예제 #1
0
        public static double GetDensity(ArrayList materialComponents, double t)
        {
            t = t - 273.15;
            double             total = 0.0;
            double             den   = 0;
            double             massFrac;
            MaterialComponent  dryMatComponent  = materialComponents[0] as MaterialComponent;
            CompositeSubstance drySubstance     = dryMatComponent.Substance as CompositeSubstance;
            double             dryTotalFraction = dryMatComponent.GetMassFractionValue();

            ArrayList components = drySubstance.Components;

            foreach (MaterialComponent mc in components)
            {
                Substance s = mc.Substance;
                massFrac = mc.GetMassFractionValue();
                if (s.Name == "Carbohydrate")
                {
                    den = GetCarbohydrateDensity(t);
                }
                else if (s.Name == "Ash")
                {
                    den = GetAshDensity(t);
                }
                else if (s.Name == "Fiber")
                {
                    den = GetFiberDensity(t);
                }
                else if (s.Name == "Fat")
                {
                    den = GetFatDensity(t);
                }
                else if (s.Name == "Protein")
                {
                    den = GetProteinDensity(t);
                }

                total += dryTotalFraction * massFrac / den;
            }

            MaterialComponent moistureComponent = materialComponents[1] as MaterialComponent;
            double            moistureFraction  = moistureComponent.GetMassFractionValue();
            double            moistureDensity   = GetWaterDensity(t);

            total += moistureFraction / moistureDensity;

            double density = 1.0 / total;

            return(density);
        }
예제 #2
0
        public static double GetCp(ArrayList materialComponents, double t)
        {
            t = t - 273.15;
            double heatCapacity = 0.0;
            double cp           = 0;
            double massFrac;

            MaterialComponent  dryMatComponent  = materialComponents[0] as MaterialComponent;
            CompositeSubstance drySubstance     = dryMatComponent.Substance as CompositeSubstance;
            double             dryTotalFraction = dryMatComponent.GetMassFractionValue();

            ArrayList components = drySubstance.Components;

            foreach (MaterialComponent mc in components)
            {
                Substance s = mc.Substance;
                massFrac = mc.GetMassFractionValue();
                if (s.Name == "Carbohydrate")
                {
                    cp = GetCarbohydrateCp(t);
                }
                else if (s.Name == "Ash")
                {
                    cp = GetAshCp(t);
                }
                else if (s.Name == "Fiber")
                {
                    cp = GetFiberCp(t);
                }
                else if (s.Name == "Fat")
                {
                    cp = GetFatCp(t);
                }
                else if (s.Name == "Protein")
                {
                    cp = GetProteinCp(t);
                }

                heatCapacity += cp * massFrac * dryTotalFraction;
            }

            MaterialComponent moistureComponent = materialComponents[1] as MaterialComponent;
            double            moistureFraction  = moistureComponent.GetMassFractionValue();

            cp = GetWaterCp(t);

            heatCapacity += cp * moistureFraction;

            return(1000 * heatCapacity);
        }
예제 #3
0
        public static double GetCp(ArrayList materialComponents, double t)
        {
            //t = t - 273.15;
            double heatCapacity = 0.0;
            //double cp = 0;
            //double massFrac;

            MaterialComponent  dryMatComponent  = materialComponents[0] as MaterialComponent;
            CompositeSubstance drySubstance     = dryMatComponent.Substance as CompositeSubstance;
            double             dryTotalFraction = dryMatComponent.GetMassFractionValue();
            double             boneDryCp        = GetAbsoluteDryCp(drySubstance, t); //Cp unit is J/kg.k

            //ArrayList components = drySubstance.Components;
            //foreach (MaterialComponent mc in components) {
            //   Substance s = mc.Substance;
            //   massFrac = mc.GetMassFractionValue();
            //   if (s.Name == "Carbohydrate") {
            //      cp = GetCarbohydrateCp(t);
            //   }
            //   else if (s.Name == "Ash") {
            //      cp = GetAshCp(t);
            //   }
            //   else if (s.Name == "Fiber") {
            //      cp = GetFiberCp(t);
            //   }
            //   else if (s.Name == "Fat") {
            //      cp = GetFatCp(t);
            //   }
            //   else if (s.Name == "Protein") {
            //      cp = GetProteinCp(t);
            //   }

            //   heatCapacity += cp * massFrac * dryTotalFraction;
            //}

            MaterialComponent moistureComponent = materialComponents[1] as MaterialComponent;
            double            moistureFraction  = moistureComponent.GetMassFractionValue();
            double            moistureCp        = 1000 * GetWaterCp(t - 273.15);//convert from kJ/kg.k to J/kg.k, we have to multiply 1000

            heatCapacity = boneDryCp * dryTotalFraction + moistureCp * moistureFraction;

            return(heatCapacity);
        }
예제 #4
0
        private void Solve()
        {
            //Mass Transfer--gas moisture and material particles transfer from gas stream to liquid stream
            DryingMaterialStream dmsOutlet = liquidOutlet as DryingMaterialStream;

            DryingGasStream dgsInlet  = gasInlet as DryingGasStream;
            DryingGasStream dgsOutlet = gasOutlet as DryingGasStream;

            //if (dgsInlet.DewPoint.HasValue && dgsOutlet.Temperature.HasValue && dgsOutlet.Temperature.Value > dgsInlet.DewPoint.Value) {
            //   throw new InappropriateSpecifiedValueException("Gas outlet temperature is not low enough to reach satuation");
            //}

            Calculate(dgsOutlet.RelativeHumidity, 0.9999999);

            //have to recalculate the streams so that the following balance calcualtion
            //can have all the latest balance calculated values taken into account
            if (dgsOutlet.Temperature.HasValue || dgsOutlet.WetBulbTemperature.HasValue)
            {
                UpdateStreamsIfNecessary();
            }

            balanceModel.DoBalanceCalculation();

            double inletDustMassFlowRate      = Constants.NO_VALUE;
            double outletDustMassFlowRate     = Constants.NO_VALUE;
            double inletDustMoistureFraction  = 0.0;
            double outletDustMoistureFraction = 0.0;

            DryingGasComponents dgc;

            if (InletParticleLoading.HasValue && gasInlet.VolumeFlowRate.HasValue)
            {
                inletDustMassFlowRate = InletParticleLoading.Value * gasInlet.VolumeFlowRate.Value;
                dgc = dgsInlet.GasComponents;
                if (dgc.SolidPhase != null)
                {
                    SolidPhase        sp = dgc.SolidPhase;
                    MaterialComponent mc = sp[1];
                    inletDustMoistureFraction = mc.GetMassFractionValue();
                }
            }

            if (OutletParticleLoading.HasValue && gasOutlet.VolumeFlowRate.HasValue)
            {
                outletDustMassFlowRate = OutletParticleLoading.Value * gasOutlet.VolumeFlowRate.Value;
                dgc = dgsOutlet.GasComponents;
                if (dgc.SolidPhase != null)
                {
                    SolidPhase        sp = dgc.SolidPhase;
                    MaterialComponent mc = sp[1];
                    inletDustMoistureFraction = mc.GetMassFractionValue();
                }
            }

            double materialFromGas = ParticleCollectionRate.Value;

            if (inletDustMassFlowRate != Constants.NO_VALUE && materialFromGas != Constants.NO_VALUE && outletDustMassFlowRate == Constants.NO_VALUE)
            {
                outletDustMassFlowRate = inletDustMassFlowRate - materialFromGas;
            }

            MoistureProperties moistureProperties = (this.unitOpSystem as EvaporationAndDryingSystem).GetMoistureProperties(((DryingGasStream)gasInlet).GasComponents.Moisture.Substance);
            double             materialEnthalpyLoss;
            double             gasEnthalpyLoss;
            double             gatTempValue;
            double             matTempValue;
            double             liquidCp;
            double             specificHeatOfSolidPhase;
            double             totalEnthapyLoss;

            if (waterInlet != null && waterOutlet != null)
            {
                if (waterInlet.MassFlowRate.HasValue)
                {
                    Calculate(waterOutlet.MassFlowRate, waterInlet.MassFlowRate.Value);
                }
                else if (waterOutlet.MassFlowRate.HasValue)
                {
                    Calculate(waterInlet.MassFlowRate, waterOutlet.MassFlowRate.Value);
                }

                if (waterInlet.SpecificEnthalpy.HasValue && waterInlet.MassFlowRate.HasValue &&
                    waterOutlet.SpecificEnthalpy.HasValue)
                {
                    double waterEnthalpyGain = waterInlet.MassFlowRate.Value * (waterOutlet.SpecificEnthalpy.Value - waterInlet.SpecificEnthalpy.Value);
                    Calculate(coolingDuty, waterEnthalpyGain);
                }
            }

            if (dmsOutlet.Temperature.HasValue && dgsInlet.SpecificEnthalpyDryBase.HasValue && coolingDuty.HasValue &&
                dgsInlet.MassFlowRateDryBase.HasValue && inletDustMoistureFraction != Constants.NO_VALUE &&
                materialFromGas != Constants.NO_VALUE)
            {
                gatTempValue = gasInlet.Temperature.Value;
                matTempValue = dmsOutlet.Temperature.Value;

                liquidCp = moistureProperties.GetSpecificHeatOfLiquid(MathUtility.Average(gatTempValue, matTempValue));
                specificHeatOfSolidPhase = (1.0 - inletDustMoistureFraction) * dmsOutlet.GetCpOfAbsoluteDryMaterial() + inletDustMoistureFraction * liquidCp;
                materialEnthalpyLoss     = materialFromGas * specificHeatOfSolidPhase * (matTempValue - gatTempValue);
                gasEnthalpyLoss          = coolingDuty.Value - materialEnthalpyLoss;
                //double outletEnthalpy = gasInlet.SpecificEnthalpy.Value - gasEnthalpyLoss;
                //Calculate(gasOutlet.SpecificEnthalpy, outletEnthalpy);
                double outletEnthalpy = dgsInlet.SpecificEnthalpyDryBase.Value - gasEnthalpyLoss / dgsInlet.MassFlowRateDryBase.Value;
                Calculate(dgsOutlet.SpecificEnthalpyDryBase, outletEnthalpy);
                UpdateStreamsIfNecessary();
                if (dgsOutlet.VolumeFlowRate.HasValue)
                {
                    double outletLoading = outletDustMassFlowRate / dgsOutlet.VolumeFlowRate.Value;
                    Calculate(OutletParticleLoading, outletLoading);
                }
            }
            else if (dmsOutlet.Temperature.HasValue && dgsInlet.SpecificEnthalpyDryBase.HasValue && dgsOutlet.Temperature.HasValue &&
                     dgsInlet.MassFlowRateDryBase.HasValue && dgsOutlet.SpecificEnthalpyDryBase.HasValue && inletDustMoistureFraction != Constants.NO_VALUE)
            {
                gatTempValue = dgsInlet.Temperature.Value;
                matTempValue = dmsOutlet.Temperature.Value;

                liquidCp = moistureProperties.GetSpecificHeatOfLiquid(MathUtility.Average(gatTempValue, matTempValue));
                specificHeatOfSolidPhase = (1.0 - inletDustMoistureFraction) * dmsOutlet.GetCpOfAbsoluteDryMaterial() + inletDustMoistureFraction * liquidCp;
                materialEnthalpyLoss     = materialFromGas * specificHeatOfSolidPhase * (matTempValue - gatTempValue);
                gasEnthalpyLoss          = dgsInlet.MassFlowRateDryBase.Value * (dgsInlet.SpecificEnthalpyDryBase.Value - dgsOutlet.SpecificEnthalpyDryBase.Value);
                totalEnthapyLoss         = materialEnthalpyLoss + gasEnthalpyLoss;
                Calculate(coolingDuty, totalEnthapyLoss);
                if (waterInlet != null && waterOutlet != null)
                {
                    if (waterInlet.SpecificEnthalpy.HasValue && waterInlet.MassFlowRate.HasValue)
                    {
                        double waterOutletSpecificEnthanlpy = totalEnthapyLoss / waterInlet.MassFlowRate.Value + waterInlet.SpecificEnthalpy.Value;
                        Calculate(waterOutlet.SpecificEnthalpy, waterOutletSpecificEnthanlpy);
                    }
                    else if (waterOutlet.SpecificEnthalpy.HasValue && waterInlet.MassFlowRate.HasValue)
                    {
                        double waterInletSpecificEnthanlpy = waterOutlet.SpecificEnthalpy.Value - totalEnthapyLoss / waterInlet.MassFlowRate.Value;
                        Calculate(waterOutlet.SpecificEnthalpy, waterInletSpecificEnthanlpy);
                    }
                }
            }
            //else if (gasInlet.SpecificEnthalpy.HasValue && gasOutlet.SpecificEnthalpy.HasValue && coolingDuty.HasValue
            //   && gasInlet.MassFlowRate.HasValue && inletDustMoistureFraction != Constants.NO_VALUE) {

            //   gasEnthalpyLoss = gasInlet.SpecificEnthalpy.Value * gasInlet.MassFlowRate.Value - gasOutlet.SpecificEnthalpy.Value * gasOutlet.MassFlowRate.Value;
            //   materialEnthalpyLoss = coolingDuty.Value - gasEnthalpyLoss;
            //   gatTempValue = gasInlet.Temperature.Value;
            //   //double matTempValue = dmsOutlet.Temperature.Value;

            //   liquidCp = moistureProperties.GetSpecificHeatOfLiquid(gatTempValue);
            //   specificHeatOfSolidPhase = (1.0 - inletDustMoistureFraction) * dmsOutlet.GetCpOfAbsoluteDryMaterial() + inletDustMoistureFraction * liquidCp;
            //   matTempValue = gatTempValue + materialEnthalpyLoss / (materialFromGas * specificHeatOfSolidPhase);

            //   Calculate(liquidOutlet.Temperature, matTempValue);
            //}

            double inletMoistureFlowRate  = Constants.NO_VALUE;
            double outletMoistureFlowRate = Constants.NO_VALUE;

            if (dgsInlet.MassFlowRateDryBase.HasValue && dgsInlet.MoistureContentDryBase.HasValue)
            {
                inletMoistureFlowRate = dgsInlet.MassFlowRateDryBase.Value * dgsInlet.MoistureContentDryBase.Value;
            }

            if (dgsOutlet.MassFlowRateDryBase.HasValue && dgsOutlet.MoistureContentDryBase.HasValue)
            {
                outletMoistureFlowRate = dgsOutlet.MassFlowRateDryBase.Value * dgsOutlet.MoistureContentDryBase.Value;
            }

            if (materialFromGas != Constants.NO_VALUE &&
                inletMoistureFlowRate != Constants.NO_VALUE && outletMoistureFlowRate != Constants.NO_VALUE)
            {
                double moistureFromGas = inletMoistureFlowRate - outletMoistureFlowRate;
                // materialFromGas = inletDustMassFlowRate - outletDustMassFlowRate;
                double moistureOfMaterialFromGas = inletDustMassFlowRate * inletDustMoistureFraction - outletDustMassFlowRate * outletDustMoistureFraction;

                double outletMassFlowRate = materialFromGas + moistureFromGas;
                Calculate(dmsOutlet.MassFlowRate, outletMassFlowRate);

                double outletMaterialMoistureFlowRate = moistureFromGas + moistureOfMaterialFromGas;
                double outletMoistureContentWetBase   = outletMaterialMoistureFlowRate / outletMassFlowRate;
                Calculate(dmsOutlet.MoistureContentWetBase, outletMoistureContentWetBase);
                //solveState = SolveState.Solved;
            }

            if (liquidToGasVolumeRatio.HasValue && gasInlet.VolumeFlowRate.HasValue)
            {
                double recirculationVolumeFlow = liquidToGasVolumeRatio.Value * gasInlet.VolumeFlowRate.Value;
                Calculate(liquidRecirculationVolumeFlowRate, recirculationVolumeFlow);
                if (liquidOutlet.Density.HasValue)
                {
                    double recirculationMassFlow = recirculationVolumeFlow / liquidOutlet.Density.Value;
                    Calculate(liquidRecirculationMassFlowRate, recirculationMassFlow);
                }
            }

            if (dgsInlet.DewPoint.HasValue && dgsOutlet.Temperature.HasValue && dgsOutlet.Temperature.Value > dgsInlet.DewPoint.Value)
            {
                solveState = SolveState.SolvedWithWarning;
            }
            //else if (gasInlet.Pressure.HasValue && gasOutlet.Pressure.HasValue
            //   && gasInlet.Temperature.HasValue && gasOutlet.Temperature.HasValue
            //   && gasInlet.SpecificEnthalpy.HasValue && gasOutlet.SpecificEnthalpy.HasValue
            //   && waterInlet.Pressure.HasValue && waterOutlet.Pressure.HasValue
            //   && waterInlet.Temperature.HasValue && waterOutlet.Temperature.HasValue
            //   && waterInlet.SpecificEnthalpy.HasValue && waterOutlet.SpecificEnthalpy.HasValue
            //   && liquidOutlet.Pressure.HasValue && liquidOutlet.Temperature.HasValue
            //   && dmsOutlet.MoistureContentWetBase.HasValue) {
            else if (gasInlet.SolveState == SolveState.Solved && gasOutlet.SolveState == SolveState.Solved &&
                     coolingDuty.HasValue &&
                     ((waterInlet == null || waterOutlet == null) ||
                      (waterInlet != null && waterOutlet != null) &&
                      (waterInlet.SolveState == SolveState.Solved && waterOutlet.SpecificEnthalpy.HasValue ||
                       waterOutlet.SolveState == SolveState.Solved && waterInlet.SpecificEnthalpy.HasValue)))
            {
                solveState = SolveState.Solved;
            }
        }
예제 #5
0
        private void Solve()
        {
            //Mass Transfer--material particles transfer from gas stream to liquid stream
            //Mass Transfer--moisture transfers from liquid stream to gas stream
            //by an adiabaitc saturation process if ScrubberType is General.
            DryingMaterialStream dmsInlet  = liquidInlet as DryingMaterialStream;
            DryingMaterialStream dmsOutlet = liquidOutlet as DryingMaterialStream;

            DryingGasStream dgsInlet  = gasInlet as DryingGasStream;
            DryingGasStream dgsOutlet = gasOutlet as DryingGasStream;

            //gas stream goes through an adiabatic saturation process
            double tg1 = dgsInlet.Temperature.Value;
            double y1  = dgsInlet.Humidity.Value;
            double tw1 = dgsInlet.WetBulbTemperature.Value;
            double td1 = dgsInlet.DewPoint.Value;
            double fy1 = dgsInlet.RelativeHumidity.Value;

            double tg2 = dgsOutlet.Temperature.Value;
            double y2  = dgsOutlet.Humidity.Value;
            double tw2 = dgsOutlet.WetBulbTemperature.Value;
            double td2 = dgsOutlet.DewPoint.Value;
            double fy2 = dgsOutlet.RelativeHumidity.Value;

            double ih = 0;
            double p1 = dgsInlet.Pressure.Value;
            double p2 = dgsOutlet.Pressure.Value;

            if (p1 == Constants.NO_VALUE || p2 == Constants.NO_VALUE)
            {
                return;
            }
            HumidGasCalculator humidGasCalculator = GetHumidGasCalculator();

            if (tg1 != Constants.NO_VALUE && y1 != Constants.NO_VALUE)
            {
                ih = humidGasCalculator.GetHumidEnthalpyFromDryBulbHumidityAndPressure(tg1, y1, p1);
                if (tg2 != Constants.NO_VALUE)
                {
                    y2 = humidGasCalculator.GetHumidityFromHumidEnthalpyTemperatureAndPressure(ih, tg2, p2);
                    if (y2 <= 0.0)
                    {
                        y2 = 1.0e-6;
                    }
                    Calculate(dgsOutlet.MoistureContentDryBase, y2);
                    solveState = SolveState.Solved;
                }
                else if (y2 != Constants.NO_VALUE)
                {
                    tg2 = humidGasCalculator.GetDryBulbFromHumidEnthalpyHumidityAndPressure(ih, y2, p2);
                    Calculate(dgsOutlet.Temperature, tg2);
                    solveState = SolveState.Solved;
                }
                else if (td2 != Constants.NO_VALUE)
                {
                    y2  = humidGasCalculator.GetHumidityFromDewPointAndPressure(td2, p2);
                    tg2 = humidGasCalculator.GetDryBulbFromHumidEnthalpyHumidityAndPressure(ih, y2, p2);
                    Calculate(dgsOutlet.Temperature, tg2);
                    solveState = SolveState.Solved;
                }
                else if (fy2 != Constants.NO_VALUE)
                {
                    double fy_temp    = 0;
                    double delta      = 10.0;
                    double totalDelta = delta;
                    tg2 = tg1 - delta;
                    bool negativeLastTime = false;

                    int counter = 0;
                    do
                    {
                        counter++;
                        y2      = humidGasCalculator.GetHumidityFromHumidEnthalpyTemperatureAndPressure(ih, tg2, p2);
                        fy_temp = humidGasCalculator.GetRelativeHumidityFromDryBulbHumidityAndPressure(tg2, y2, p2);
                        if (fy2 > fy_temp)
                        {
                            if (negativeLastTime)
                            {
                                delta /= 2.0; //testing finds delta/2.0 is almost optimal
                            }
                            totalDelta      += delta;
                            negativeLastTime = false;
                        }
                        else if (fy2 < fy_temp)
                        {
                            delta           /= 2.0; //testing finds delta/2.0 is almost optimal
                            totalDelta      -= delta;
                            negativeLastTime = true;
                        }
                        tg2 = tg1 - totalDelta;
                    } while (Math.Abs(fy2 - fy_temp) > 1.0e-6 && counter <= 200);

                    if (counter < 200)
                    {
                        Calculate(dgsOutlet.Temperature, tg2);
                        solveState = SolveState.Solved;
                    }
                }

                if (solveState == SolveState.Solved)
                {
                    double fy = humidGasCalculator.GetRelativeHumidityFromDryBulbHumidityAndPressure(tg2, y2, p2);
                    if (fy > 1.0)
                    {
                        solveState = SolveState.NotSolved;
                        string msg = "Specified gas inlet state makes the relative humidity of the outlet greater than 1.0.";
                        throw new InappropriateSpecifiedValueException(msg);
                    }
                }
            }
            else if (tg2 != Constants.NO_VALUE && y2 != Constants.NO_VALUE)
            {
                ih = humidGasCalculator.GetHumidEnthalpyFromDryBulbHumidityAndPressure(tg2, y2, p2);
                if (tg1 != Constants.NO_VALUE)
                {
                    y1 = humidGasCalculator.GetHumidityFromHumidEnthalpyTemperatureAndPressure(ih, tg1, p1);
                    Calculate(dgsInlet.MoistureContentDryBase, y1);
                    solveState = SolveState.Solved;
                }
                else if (y1 != Constants.NO_VALUE)
                {
                    tg1 = humidGasCalculator.GetDryBulbFromHumidEnthalpyHumidityAndPressure(ih, y1, p1);
                    Calculate(dgsInlet.Temperature, tg1);
                    solveState = SolveState.Solved;
                }
                else if (td1 != Constants.NO_VALUE)
                {
                    y1  = humidGasCalculator.GetHumidityFromDewPointAndPressure(td1, p1);
                    tg1 = humidGasCalculator.GetDryBulbFromHumidEnthalpyHumidityAndPressure(ih, y1, p1);
                    Calculate(dgsInlet.Temperature, tg1);
                    solveState = SolveState.Solved;
                }
                else if (fy1 != Constants.NO_VALUE)
                {
                    double fy_temp    = 0;
                    double delta      = 10.0;
                    double totalDelta = delta;
                    tg1 = tg2 + delta;
                    bool negativeLastTime = false;

                    int counter = 0;
                    do
                    {
                        counter++;
                        y1      = humidGasCalculator.GetHumidityFromHumidEnthalpyTemperatureAndPressure(ih, tg1, p1);
                        fy_temp = humidGasCalculator.GetRelativeHumidityFromDryBulbHumidityAndPressure(tg1, y1, p1);
                        if (fy1 < fy_temp)
                        {
                            if (negativeLastTime)
                            {
                                delta /= 2.0; //testing finds delta/2.0 is almost optimal
                            }
                            totalDelta      += delta;
                            negativeLastTime = false;
                        }
                        else if (fy1 > fy_temp)
                        {
                            delta           /= 2.0; //testing finds delta/2.0 is almost optimal
                            totalDelta      -= delta;
                            negativeLastTime = true;
                        }
                        tg1 = tg2 + totalDelta;
                    } while (Math.Abs(fy1 - fy_temp) > 1.0e-6 && counter <= 200);

                    if (counter < 200)
                    {
                        Calculate(dgsInlet.Temperature, tg1);
                        solveState = SolveState.Solved;
                    }
                }
            }
            //end of adiabatic saturation process calculatioin


            //have to recalculate the streams so that the following balance calcualtion
            //can have all the latest balance calculated values taken into account
            //PostSolve(false);
            UpdateStreamsIfNecessary();

            balanceModel.DoBalanceCalculation();

            double inletDustMassFlowRate      = Constants.NO_VALUE;
            double outletDustMassFlowRate     = Constants.NO_VALUE;
            double inletDustMoistureFraction  = 0.0;
            double outletDustMoistureFraction = 0.0;

            DryingGasComponents dgc;

            if (InletParticleLoading.HasValue && gasInlet.VolumeFlowRate.HasValue)
            {
                inletDustMassFlowRate = InletParticleLoading.Value * gasInlet.VolumeFlowRate.Value;
                dgc = dgsInlet.GasComponents;
                if (dgc.SolidPhase != null)
                {
                    SolidPhase        sp = dgc.SolidPhase;
                    MaterialComponent mc = sp[1];
                    inletDustMoistureFraction = mc.GetMassFractionValue();
                }
            }

            if (OutletParticleLoading.HasValue && gasOutlet.VolumeFlowRate.HasValue)
            {
                outletDustMassFlowRate = OutletParticleLoading.Value * gasOutlet.VolumeFlowRate.Value;
                dgc = dgsOutlet.GasComponents;
                if (dgc.SolidPhase != null)
                {
                    SolidPhase        sp = dgc.SolidPhase;
                    MaterialComponent mc = sp[1];
                    inletDustMoistureFraction = mc.GetMassFractionValue();
                }
            }

            double inletMoistureFlowRate  = Constants.NO_VALUE;
            double outletMoistureFlowRate = Constants.NO_VALUE;

            if (dgsInlet.MassFlowRateDryBase.HasValue && dgsInlet.MoistureContentDryBase.HasValue)
            {
                inletMoistureFlowRate = dgsInlet.MassFlowRateDryBase.Value * dgsInlet.MoistureContentDryBase.Value;
            }

            if (dgsOutlet.MassFlowRateDryBase.HasValue && dgsOutlet.MoistureContentDryBase.HasValue)
            {
                outletMoistureFlowRate = dgsOutlet.MassFlowRateDryBase.Value * dgsOutlet.MoistureContentDryBase.Value;
            }

            double materialFromGas = 0.0;

            if (inletDustMassFlowRate != Constants.NO_VALUE && outletDustMassFlowRate != Constants.NO_VALUE &&
                inletMoistureFlowRate != Constants.NO_VALUE && outletMoistureFlowRate != Constants.NO_VALUE)
            {
                double moistureToGas = outletMoistureFlowRate - inletMoistureFlowRate;
                materialFromGas = inletDustMassFlowRate - outletDustMassFlowRate;
                double moistureOfMaterialFromGas = inletDustMassFlowRate * inletDustMoistureFraction - outletDustMassFlowRate * outletDustMoistureFraction;

                if (dmsInlet.MassFlowRate.HasValue)
                {
                    double outletMassFlowRate = dmsInlet.MassFlowRate.Value + materialFromGas - moistureToGas;
                    Calculate(dmsOutlet.MassFlowRate, outletMassFlowRate);

                    if (dmsInlet.MoistureContentWetBase.HasValue)
                    {
                        double inletMaterialMoistureFlowRate  = dmsInlet.MassFlowRate.Value * dmsInlet.MoistureContentWetBase.Value;
                        double outletMaterialMoistureFlowRate = inletMaterialMoistureFlowRate - moistureToGas + moistureOfMaterialFromGas;
                        double outletMoistureContentWetBase   = outletMaterialMoistureFlowRate / outletMassFlowRate;
                        Calculate(dmsOutlet.MoistureContentWetBase, outletMoistureContentWetBase);
                        solveState = SolveState.Solved;
                    }
                    else if (dmsOutlet.MoistureContentWetBase.HasValue)
                    {
                        double outletMaterialMoistureFlowRate = dmsOutlet.MassFlowRate.Value * dmsInlet.MoistureContentWetBase.Value;
                        double inletMaterialMoistureFlowRate  = outletMaterialMoistureFlowRate + moistureToGas - moistureOfMaterialFromGas;
                        double inletMoistureContentWetBase    = inletMaterialMoistureFlowRate / dmsInlet.MassFlowRate.Value;
                        Calculate(dmsInlet.MoistureContentWetBase, inletMoistureContentWetBase);
                        solveState = SolveState.Solved;
                    }
                }
                else if (dmsOutlet.MassFlowRate.HasValue)
                {
                    double inletMassFlowRate = dmsOutlet.MassFlowRate.Value - materialFromGas + moistureToGas;
                    Calculate(dmsInlet.MassFlowRate, inletMassFlowRate);

                    if (dmsInlet.MoistureContentWetBase.HasValue)
                    {
                        double inletMaterialMoistureFlowRate  = dmsInlet.MassFlowRate.Value * dmsInlet.MoistureContentWetBase.Value;
                        double outletMaterialMoistureFlowRate = inletMaterialMoistureFlowRate - moistureToGas + moistureOfMaterialFromGas;
                        double outletMoistureContentWetBase   = outletMaterialMoistureFlowRate / dmsOutlet.MassFlowRate.Value;
                        Calculate(dmsOutlet.MoistureContentWetBase, outletMoistureContentWetBase);
                        solveState = SolveState.Solved;
                    }
                    else if (dmsOutlet.MoistureContentWetBase.HasValue)
                    {
                        double outletMaterialMoistureFlowRate = dmsOutlet.MassFlowRate.Value * dmsInlet.MoistureContentWetBase.Value;
                        double inletMaterialMoistureFlowRate  = outletMaterialMoistureFlowRate + moistureToGas - moistureOfMaterialFromGas;
                        double inletMoistureContentWetBase    = inletMaterialMoistureFlowRate / inletMassFlowRate;
                        Calculate(dmsInlet.MoistureContentWetBase, inletMoistureContentWetBase);
                        solveState = SolveState.Solved;
                    }
                }
                else if (dmsOutlet.MassConcentration.HasValue)
                {
                    double cValue            = dmsOutlet.MassConcentration.Value;
                    double inletMassFlowRate = (materialFromGas * (1 - cValue) + moistureToGas * cValue) / cValue;
                    Calculate(dmsInlet.MassFlowRate, inletMassFlowRate);
                    double outletMassFlowRate = inletMassFlowRate + materialFromGas - moistureToGas;
                    Calculate(dmsOutlet.MassFlowRate, outletMassFlowRate);
                    solveState = SolveState.Solved;
                }
            }

            MoistureProperties moistureProperties        = (this.unitOpSystem as EvaporationAndDryingSystem).GetMoistureProperties(((DryingMaterialStream)liquidInlet).MaterialComponents.Moisture.Substance);
            double             enthalpyOfMaterialFromGas = 0.0;

            if (dmsOutlet.GetCpOfAbsoluteDryMaterial() != Constants.NO_VALUE && inletDustMoistureFraction != Constants.NO_VALUE && gasInlet.Temperature.HasValue)
            {
                double tempValue = gasInlet.Temperature.Value;
                double liquidCp  = moistureProperties.GetSpecificHeatOfLiquid(tempValue);
                double specificHeatOfSolidPhase = (1.0 - inletDustMoistureFraction) * dmsOutlet.GetCpOfAbsoluteDryMaterial() + inletDustMoistureFraction * liquidCp;
                enthalpyOfMaterialFromGas = materialFromGas * specificHeatOfSolidPhase * (tempValue - 273.15);
            }

            if (gasInlet.SpecificEnthalpy.HasValue && gasInlet.MassFlowRate.HasValue &&
                gasOutlet.SpecificEnthalpy.HasValue && gasOutlet.MassFlowRate.HasValue)
            {
                double gasEnthalpyLoss = gasInlet.SpecificEnthalpy.Value * gasInlet.MassFlowRate.Value -
                                         gasOutlet.SpecificEnthalpy.Value * gasOutlet.MassFlowRate.Value;

                if (liquidInlet.SpecificEnthalpy.HasValue && liquidInlet.MassFlowRate.HasValue &&
                    liquidOutlet.MassFlowRate.HasValue)
                {
                    double totalLiquidOutletEnthalpy    = gasEnthalpyLoss + enthalpyOfMaterialFromGas + liquidInlet.SpecificEnthalpy.Value * liquidInlet.MassFlowRate.Value;
                    double specificLiquidOutletEnthalpy = totalLiquidOutletEnthalpy / liquidOutlet.MassFlowRate.Value;
                    Calculate(liquidOutlet.SpecificEnthalpy, specificLiquidOutletEnthalpy);
                }
                //else if (gasInlet.SpecificEnthalpy.HasValue && gasInlet.MassFlowRate.HasValue &&
                //               gasOutlet.SpecificEnthalpy.HasValue && gasOutlet.MassFlowRate.HasValue &&
                //               liquidOutlet.SpecificEnthalpy.HasValue && liquidOutlet.MassFlowRate.HasValue &&
                //               liquidInlet.MassFlowRate.HasValue) {
                //   double totalLiquidInletEnthalpy = liquidOutlet.SpecificEnthalpy.Value * liquidOutlet.MassFlowRate.Value - gasEnthalpyLoss - enthalpyOfMaterialFromGas;
                //   double specificLiquidInletEnthalpy = totalLiquidInletEnthalpy / liquidInlet.MassFlowRate.Value;
                //   Calculate(liquidInlet.SpecificEnthalpy, specificLiquidInletEnthalpy);
                //}
            }
            else if (liquidInlet.SpecificEnthalpy.HasValue && liquidInlet.MassFlowRate.HasValue &&
                     liquidOutlet.SpecificEnthalpy.HasValue && liquidOutlet.MassFlowRate.HasValue)
            {
                double liquidEnthalpyLoss = liquidInlet.SpecificEnthalpy.Value * liquidInlet.MassFlowRate.Value -
                                            liquidOutlet.SpecificEnthalpy.Value * liquidOutlet.MassFlowRate.Value;

                if (gasInlet.SpecificEnthalpy.HasValue && gasInlet.MassFlowRate.HasValue &&
                    gasOutlet.MassFlowRate.HasValue)
                {
                    double totalGasOutletEnthalpy    = liquidEnthalpyLoss + gasInlet.SpecificEnthalpy.Value * gasInlet.MassFlowRate.Value + enthalpyOfMaterialFromGas;
                    double specificGasOutletEnthalpy = totalGasOutletEnthalpy / gasOutlet.MassFlowRate.Value;
                    Calculate(gasOutlet.SpecificEnthalpy, specificGasOutletEnthalpy);
                }
                //else if (gasOutlet.SpecificEnthalpy.HasValue && gasOutlet.MassFlowRate.HasValue &&
                //               gasInlet.MassFlowRate.HasValue) {
                //   double totalGasInletEnthalpy = gasOutlet.SpecificEnthalpy.Value * gasOutlet.MassFlowRate.Value - liquidEnthalpyLoss;
                //   double specificGasInletEnthalpy = totalGasInletEnthalpy / gasInlet.MassFlowRate.Value;
                //   Calculate(gasInlet.SpecificEnthalpy, specificGasInletEnthalpy);
                //}
            }

            if (liquidToGasVolumeRatio.HasValue && gasInlet.VolumeFlowRate.HasValue)
            {
                //double recirculationVolumeFlow = liquidToGasVolumeRatio.Value * gasInlet.VolumeFlowRate.Value;
                //Calculate(liquidRecirculationVolumeFlowRate, recirculationVolumeFlow);
                //if (liquidOutlet.Density.HasValue) {
                //   double recirculationMassFlow = recirculationVolumeFlow / liquidOutlet.Density.Value;
                //   Calculate(liquidRecirculationMassFlowRate, recirculationMassFlow);
                //}
            }
        }
예제 #6
0
        public static double GetThermalConductivity(ArrayList materialComponents, double t)
        {
            t = t - 273.15;
            double thermalCond = 0.0;
            double k           = 0;
            double den         = 0;
            double massFrac;

            double total = 0.0;

            MaterialComponent  dryMatComponent  = materialComponents[0] as MaterialComponent;
            CompositeSubstance drySubstance     = dryMatComponent.Substance as CompositeSubstance;
            double             dryTotalFraction = dryMatComponent.GetMassFractionValue();

            ArrayList components = drySubstance.Components;

            foreach (MaterialComponent mc in components)
            {
                Substance s = mc.Substance;
                massFrac = mc.GetMassFractionValue();
                if (s.Name == "Carbohydrate")
                {
                    den = GetCarbohydrateDensity(t);
                }
                else if (s.Name == "Ash")
                {
                    den = GetAshDensity(t);
                }
                else if (s.Name == "Fiber")
                {
                    den = GetFiberDensity(t);
                }
                else if (s.Name == "Fat")
                {
                    den = GetFatDensity(t);
                }
                else if (s.Name == "Protein")
                {
                    den = GetProteinDensity(t);
                }

                total += dryTotalFraction * massFrac / den;
            }

            double            volumeFraction;
            double            moistureDensity;
            MaterialComponent moistureComponent = materialComponents[1] as MaterialComponent;
            double            moistureFraction  = moistureComponent.GetMassFractionValue();

            moistureDensity = GetWaterDensity(t);

            total += moistureFraction / moistureDensity;

            foreach (MaterialComponent mc in components)
            {
                Substance s = mc.Substance;
                massFrac = mc.GetMassFractionValue();
                if (s.Name == "")
                {
                    k   = GetCarbohydrateThermalConductivity(t);
                    den = GetCarbohydrateDensity(t);
                }
                else if (s.Name == "Ash")
                {
                    k   = GetAshThermalConductivity(t);
                    den = GetAshDensity(t);
                }
                else if (s.Name == "Fiber")
                {
                    k   = GetFiberThermalConductivity(t);
                    den = GetFiberDensity(t);
                }
                else if (s.Name == "Fat")
                {
                    k   = GetFatThermalConductivity(t);
                    den = GetFatDensity(t);
                }
                else if (s.Name == "Protein")
                {
                    k   = GetProteinThermalConductivity(t);
                    den = GetProteinDensity(t);
                }

                volumeFraction = dryTotalFraction * massFrac / den / total;
                thermalCond   += k * volumeFraction;
            }

            //water conductivity
            k = GetWaterThermalConductivity(t);

            volumeFraction = dryTotalFraction * moistureFraction / moistureDensity / total;
            thermalCond   += k * volumeFraction;

            return(thermalCond);
        }