コード例 #1
0
        public static double CalculateWaterSaturationPressure(double temperature)
        {
            double pSaturation = 1.0;

            //if (temperature >= 253.15 && temperature <= 283.15) {
            //   pSaturation = 8.8365E-10 * Math.Pow((temperature -193.03), 6.2145);
            //}
            //else if (temperature <= 453.15) {
            //   pSaturation = Math.Exp(23.197 - 3816.44/(temperature - 46.13));
            //}
            if (temperature <= 273.33) //temperature belown which steam table can not deal
            //double t = temperature - 273.15;
            //pSaturation = 100.0 * 6.1121 * Math.Exp(17.502 * t/(240.97 + t));
            //To Do: When system is not air-water, need to change!!!
            {
                pSaturation = ThermalPropCalculator.CalculateWaterSaturationPressureBelowFreezingPoint(temperature);
            }
            else
            {
                //formulation coming from Perry's Chemical Engineer's Handbook
                //pSaturation = Math.Exp(73.649 - 7258.2/temperature - 7.3037 * Math.Log(temperature)
                //   + 4.1653e-6 * temperature * temperature);
                //pSaturation = ThermalPropCalculator.CalculateVaporPressure(temperature, vapPressureCoeffs);
                SteamTable steamTable = SteamTable.GetInstance();
                pSaturation = steamTable.GetSaturationPressure(temperature);
            }

            return(pSaturation);
        }
コード例 #2
0
        //cp unit is J/kg.k
        private static double CalculateCp(ArrayList materialComponents, double temperature, SubstanceState state)
        {
            double heatCapacity = 0.0;
            double cp           = 0;
            double molarWeight;
            double massFrac;

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance s = mc.Substance;
                molarWeight = s.MolarWeight;
                ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs;
                massFrac = mc.GetMassFractionValue();
                if (state == SubstanceState.Gas)
                {
                    cp = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, tpc.GasCpCoeffs) / molarWeight;
                }
                else if (state == SubstanceState.Liquid)
                {
                    cp = ThermalPropCalculator.CalculateLiquidHeatCapacity1(temperature, tpc.LiqCpCoeffs) / molarWeight;
                }
                heatCapacity += cp * massFrac;
            }

            return(heatCapacity);
        }
コード例 #3
0
        public double GetSpecificHeatOfVapor(double temperature)
        {
            //return 1880.0;
            double cp = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, gasCpCoeffs);

            return(cp / molarWeight);
        }
コード例 #4
0
        public double GetMeanSpecificHeatOfLiquid(double t1, double t2)
        {
            //this correlation comes from Perry's Chemical Engineers Handbook
            //double cp = 2.7637e5 - 2.0901e3 * temperature + 8.125 * temperature * temperature
            //            -1.4116e-2 * Math.Pow(temperature, 3) + 9.3701e-6 * Math.Pow(temperature, 4);
            double cp = ThermalPropCalculator.CalculateMeanLiquidHeatCapacity1(t1, t2, liqCpCoeffs);

            return(cp / molarWeight);
        }
コード例 #5
0
        public double GetEnthalpy(double p, double t)
        {
            double h = 0.0;

            if (moisture.Name.Equals("Water"))
            {
                h = ThermalPropCalculator.CalculateWaterEnthalpy(p, t);
            }
            return(h);
        }
コード例 #6
0
        private static double CalculateViscosity(ArrayList materialComponents, double temperature, SubstanceState state)
        {
            double viscosity = 0.0;
            double visc;
            double molarWt;
            double moleFrac;
            double massFrac;
            double numerator   = 0.0;
            double denominator = 0.0;

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance             s   = mc.Substance;
                ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs;
                molarWt  = s.MolarWeight;
                moleFrac = mc.GetMoleFractionValue();
                massFrac = mc.GetMassFractionValue();
                if (moleFrac == Constants.NO_VALUE)
                {
                    moleFrac = massFrac;
                }
                if (state == SubstanceState.Gas)
                {
                    if (s.Name == "Air")
                    {
                        visc = ThermalPropCalculator.CalculateAirGasViscosity(temperature);
                    }
                    else
                    {
                        visc = ThermalPropCalculator.CalculateGasViscosity(temperature, tpc.GasViscCoeffs);
                    }
                    numerator   += visc * moleFrac * Math.Sqrt(molarWt);
                    denominator += moleFrac * Math.Sqrt(molarWt);
                }
                else if (state == SubstanceState.Liquid)
                {
                    visc       = ThermalPropCalculator.CalculateLiquidViscosity(temperature, tpc.LiqViscCoeffs);
                    numerator += moleFrac * Math.Log10(visc);
                }
            }

            if (state == SubstanceState.Gas)
            {
                if (denominator > 1.0e-8)
                {
                    viscosity = numerator / denominator;
                }
            }
            else if (state == SubstanceState.Liquid)
            {
                viscosity = Math.Pow(10, numerator);
            }

            return(viscosity);
        }
コード例 #7
0
        public double GetSaturationTemperature(double pressure)
        {
            double temperature = 1.0e-10;

            if (moisture.Name.Equals("Water"))
            {
                temperature = ThermalPropCalculator.CalculateWaterSaturationTemperature(pressure);
            }
            else
            {
                temperature = ThermalPropCalculator.CalculateSaturationTemperature(pressure, vapPressureCoeffs);
            }
            return(temperature);
        }
コード例 #8
0
        public double GetMeanSpecificHeatOfDryGas(double t1, double t2)
        {
            double cp;

            if (Math.Abs(t1 - t2) > 1.0e-4)
            {
                cp = ThermalPropCalculator.CalculateMeanGasHeatCapacity1(t1, t2, gasCpCoeffs);
            }
            else
            {
                cp = ThermalPropCalculator.CalculateGasHeatCapacity1(t1, gasCpCoeffs);
            }
            return(cp / molarWeight);
        }
コード例 #9
0
        public static double GetLiquidDensity(ArrayList materialComponents, double temperature)
        {
            double density = 0.0;
            double den     = 0;
            double massFrac;

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance             s   = mc.Substance;
                ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs;
                massFrac = mc.GetMassFractionValue();
                den      = ThermalPropCalculator.CalculateLiquidDensity(temperature, tpc.LiqDensityCoeffs);
                density += den * massFrac;
            }

            return(density);
        }
コード例 #10
0
        public double GetSaturationPressure(double temperature)
        {
            if (temperature < minimumTemperature || temperature > criticalTemperature)
            {
                throw new IllegalVarValueException("Temperature out of range");
            }

            double pSaturation = 1.0;

            if (moisture.Name.Equals("Water"))
            {
                pSaturation = ThermalPropCalculator.CalculateWaterSaturationPressure(temperature);
            }
            else
            {
                pSaturation = ThermalPropCalculator.CalculateSaturationPressure(temperature, vapPressureCoeffs);
            }

            return(pSaturation);
        }
コード例 #11
0
        public double GetEvaporationHeat(double temperature)
        {
            if (temperature < minimumTemperature || temperature > criticalTemperature)
            {
                throw new IllegalVarValueException("Temperature out of range.");
            }
            //double n = n1;
            //if (temperature > 563.15 && temperature <= tc) {
            //   n = n2;
            //}
            //double c = Math.Pow((tc-temperature)/(tc-t0), n);
            //return r0 * Math.Pow((tc-temperature)/(tc-t0), n);
            //this correlation comes from Perry's Chemical Engineers Handbook, 6th edition
            //double tr = temperature/PropConstants.Tc;
            //double tempValue = 0.3199 - 0.212 * tr + 0.25795 * tr * tr;
            //double r = 5.2053e7/18.015 * Math.Pow((1-tr), tempValue);
            //return r;
            double r = ThermalPropCalculator.CalculateEvaporationHeat(temperature, criticalTemperature, evapHeatCoeffs);

            return(r / molarWeight);
        }
コード例 #12
0
        public double GetMeanSpecificHeatOfVapor(double p, double t1, double t2)
        {
            double cp;

            if (moisture.Name.Equals("Water"))
            {
                if (Math.Abs(t1 - t2) > 1.0e-4)
                {
                    cp = ThermalPropCalculator.CalculateWaterMeanHeatCapacity(p, t1, t2);
                }
                else
                {
                    cp = ThermalPropCalculator.CalculateWaterMeanHeatCapacity(p, t1, t1 + 1);
                }
            }
            else
            {
                cp = ThermalPropCalculator.CalculateMeanGasHeatCapacity1(t1, t2, gasCpCoeffs);
                cp = cp / molarWeight;
            }
            return(cp);
        }
コード例 #13
0
        public static double GetSpecificHeatRatio(ArrayList materialComponents, double temperature)
        {
            double heatCapacity = 0.0;
            double cp           = 0;
            //double molarWeight = 0.0;
            double w;
            double molarFrac;
            double totalMole = 0.0;

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance s = mc.Substance;
                if (s.Name == "Generic Dry Material" || s is CompositeSubstance)
                {
                    continue;
                }
                w          = s.MolarWeight;
                molarFrac  = mc.GetMassFractionValue() / w;
                totalMole += molarFrac;
            }

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance s = mc.Substance;
                if (s.Name == "Generic Dry Material" || s is CompositeSubstance)
                {
                    continue;
                }
                w = s.MolarWeight;
                ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs;
                molarFrac = mc.GetMassFractionValue() / w / totalMole;
                //since heat capacity from ThermalPropCalculator is in J/kmol.K, it is necessary to
                //convert into kJ/kmol.K to be aligned with the unit of universal gas constant R
                heatCapacity = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, tpc.GasCpCoeffs) / 1000;
                cp          += heatCapacity * molarFrac;
            }

            return(cp / (cp - Constants.R));
        }
コード例 #14
0
        private static double CalculateThermalConductivity(ArrayList materialComponents, double temperature, SubstanceState state)
        {
            double thermalCond = 0.0;
            double k           = 0;
            double massFrac;

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance             s   = mc.Substance;
                ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs;
                massFrac = mc.GetMassFractionValue();
                if (state == SubstanceState.Gas)
                {
                    if (s.Name == "Air")
                    {
                        k = ThermalPropCalculator.CalculateAirGasThermalConductivity(temperature);
                    }
                    else
                    {
                        k = ThermalPropCalculator.CalculateGasThermalConductivity(temperature, tpc.GasKCoeffs);
                    }
                }
                else if (state == SubstanceState.Liquid)
                {
                    if (s.SubstanceType == SubstanceType.Inorganic)
                    {
                        k = ThermalPropCalculator.CalculateLiquidInorganicThermalConductivity(temperature, tpc.LiqKCoeffs);
                    }
                    else if (s.SubstanceType == SubstanceType.Organic)
                    {
                        k = ThermalPropCalculator.CalculateLiquidOrganicThermalConductivity(temperature, tpc.LiqKCoeffs);
                    }
                }
                thermalCond += k * massFrac;
            }

            return(thermalCond);
        }
コード例 #15
0
        /// <summary>
        /// THE PROPERTIES OF GASES AND LIQUIDS, Section 10.6
        /// </summary>
        /// <param name="temperature"></param>
        /// <param name="humidity"></param>
        /// <returns></returns>
        private double CalculateHumidGasConductivity(double temperature, double humidity)
        {
            ThermalPropCalculator propCalculator = ThermalPropCalculator.Instance;
            double gasK      = propCalculator.CalculateGasThermalConductivity(temperature, gas);
            double moistureK = propCalculator.CalculateGasThermalConductivity(temperature, moisture);

            double gasMole      = 1 / gasMolarMass;
            double moistureMole = humidity / moistureMolarMass;

            double totalMole = gasMole + moistureMole;

            double gasMoleFraction      = gasMole / totalMole;
            double moistureMoleFraction = moistureMole / totalMole;

            double gasPc = gas.CriticalPropsAndAcentricFactor.CriticalPressure / 1.0e5;
            double gasTc = gas.CriticalPropsAndAcentricFactor.CriticalTemperature;

            double gasTr = temperature / gasTc;
            double gasReducedInverseK   = 210 * Math.Pow(gasTc * Math.Pow(gasMolarMass, 3) / Math.Pow(gasPc, 4), 1.0 / 6.0);
            double monatomicValueOfGasK = gasReducedInverseK * (Math.Exp(0.0464 * gasTr) - Math.Exp(-0.2412 * gasTr));

            double moisturePc = moisture.CriticalPropsAndAcentricFactor.CriticalPressure / 1.0e5;
            double moistureTc = moisture.CriticalPropsAndAcentricFactor.CriticalTemperature;
            double moistureTr = temperature / moistureTc;
            double moistureReducedInverseK   = 210 * Math.Pow(moistureTc * Math.Pow(moistureMolarMass, 3) / Math.Pow(moisturePc, 4), 1.0 / 6.0);
            double monatomicValueOfMoistureK = moistureReducedInverseK * (Math.Exp(0.0464 * moistureTr) - Math.Exp(-0.2412 * moistureTr));

            double gasMoistureMolarMassRatio = 1 / moistureGasMolarMassRatio;
            double temp         = 1 + Math.Sqrt(monatomicValueOfGasK / monatomicValueOfMoistureK) * Math.Pow(gasMoistureMolarMassRatio, 0.25);
            double aGasMoisture = temp * temp / Math.Sqrt(8.0 * (1.0 + gasMoistureMolarMassRatio));

            temp = 1 + Math.Sqrt(monatomicValueOfMoistureK / monatomicValueOfGasK) * Math.Pow(moistureGasMolarMassRatio, 0.25);
            double aMoistureGas = temp * temp / Math.Sqrt(8.0 * (1.0 + moistureGasMolarMassRatio));
            double mixtureK     = gasMoleFraction * gasK / (gasMoleFraction + aGasMoisture * moistureMoleFraction) +
                                  moistureMoleFraction * moistureK / (aMoistureGas * gasMoleFraction + moistureMoleFraction);

            return(mixtureK);
        }
コード例 #16
0
        public double GetDensity(double pressure, double temperature)
        {
            double density = 1;

            if (moisture.Name.Equals("Water"))
            {
                density = ThermalPropCalculator.CalculateWaterDensity(pressure, temperature);
            }
            else
            {
                double satTemperature = GetSaturationTemperature(pressure);
                if (temperature < satTemperature)
                {
                    density = ThermalPropCalculator.CalculateLiquidDensity(temperature, liqDensityCoeffs);
                }
                else if (temperature > satTemperature)
                {
                    //density = ThermalPropCalculator.CalculateLiquidDensity(temperature);
                    //need to use state equation to calculate state
                }
            }
            return(density);
        }
コード例 #17
0
        public static double GetSpecificHeatRatio(ArrayList materialComponents, double temperature)
        {
            double heatCapacity = 0.0;
            double cp           = 0;
            //double molarWeight = 0.0;
            double w;
            double molarFrac;
            double totalMole = 1.0;

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance s = mc.Substance;
                if (s.Name == "Generic Dry Material" || s is CompositeSubstance)
                {
                    continue;
                }
                w          = s.MolarWeight;
                molarFrac  = mc.GetMassFractionValue() / w;
                totalMole += molarFrac;
            }

            foreach (MaterialComponent mc in materialComponents)
            {
                Substance s = mc.Substance;
                if (s.Name == "Generic Dry Material" || s is CompositeSubstance)
                {
                    continue;
                }
                w = s.MolarWeight;
                ThermalPropsAndCoeffs tpc = s.ThermalPropsAndCoeffs;
                molarFrac    = mc.GetMassFractionValue() / w / totalMole;
                heatCapacity = ThermalPropCalculator.CalculateGasHeatCapacity1(temperature, tpc.GasCpCoeffs);
                cp          += heatCapacity * molarFrac;
            }

            return(cp / (cp - Constants.R));
        }
コード例 #18
0
        public static double CalculateBoilingPointElevation(DryingMaterial dryingMaterial, double concentrationValue, double pressureValue)
        {
            SolutionType solutionType       = dryingMaterial.SolutionType;
            double       deltaT             = 0;
            Substance    s                  = dryingMaterial.Moisture;
            double       solventMolarWeight = s.MolarWeight;

            s = dryingMaterial.AbsoluteDryMaterial;
            double soluteMolarWeight = s.MolarWeight;
            double tEvap             = 0.0;

            /*if (solutionType == SolutionType.Raoult) {
             * //Unit Operations in Food Engieering Eq. 18.13
             * double soluteMassRatio = 1.0/owner.MoistureContentDryBase.Value;
             * double boilingConstant = 1.0;
             * deltaT = 1000 * boilingConstant * soluteMassRatio/soluteMolarWeight;
             * }
             * else if (solutionType == SolutionType.Aqueous) {
             * //Unit Operations in Food Engieering Eq. 18.14
             * double molarConcentration = concentrationValue/soluteMolarWeight/(concentrationValue/soluteMolarWeight+(1-concentrationValue)/solventMolarWeight);
             * deltaT = 0.52 * molarConcentration;
             * }
             * else if (solutionType == SolutionType.InorganicSalts) {
             * //Unit Operations in Food Engieering Eq. 18.17
             * double molarConcentration = concentrationValue/soluteMolarWeight/(concentrationValue/soluteMolarWeight+(1-concentrationValue)/solventMolarWeight);
             * deltaT = 104.9 * Math.Pow(molarConcentration, 1.14);
             * }
             * else if (solutionType == SolutionType.Ideal) {
             * //Unit Operations in Food Engieering Eq. 18.15
             * double tEvap = ThermalPropCalculator.CalculateTemperatureFromWaterVaporPressure(pressureValue);
             * double evapHeat = owner.GetEvaporationHeat(tEvap);
             * double solventMassFraction = 1.0/owner.MoistureContentWetBase.Value;
             * deltaT = -tEvap/(1.0 + (evapHeat/(8.314*tEvap*Math.Log(solventMassFraction))));
             * }*/
            if (solutionType == SolutionType.Sucrose)
            {
                //Unit Operations in Food Engieering Eq. 18.17
                pressureValue = pressureValue / 100; //note: pressure unit is mbar
                deltaT        = 3.061 * Math.Pow(concentrationValue, 0.094) * Math.Pow(pressureValue, 0.136) * Math.Exp(5.328 * concentrationValue);
            }
            else if (solutionType == SolutionType.ReducingSugars)
            {
                //Unit Operations in Food Engieering Eq. 18.17
                pressureValue = pressureValue / 100; //note: pressure unit is mbar
                deltaT        = 2.227 * Math.Pow(concentrationValue, 0.588) * Math.Pow(pressureValue, 0.119) * Math.Exp(3.593 * concentrationValue);
            }
            else if (solutionType == SolutionType.Juices)
            {
                //Unit Operations in Food Engieering Eq. 18.17
                pressureValue = pressureValue / 100; //note: pressure unit is mbar
                //deltaT = 0.04904 * Math.Pow(concentration, 0.029)*Math.Pow(pressureValue, 0.113)*Math.Exp(-0.03899*concentration + 6.52e-4*concentration*concentration);
                deltaT = 1.36 * Math.Pow(concentrationValue, 0.749) * Math.Pow(pressureValue, 0.106) * Math.Exp(3.39 * concentrationValue);
            }
            else if (solutionType == SolutionType.Unknown)
            {
                //Duhring rules
                tEvap = ThermalPropCalculator.CalculateWaterSaturationTemperature(pressureValue);
                CurveF[] duhringLines = dryingMaterial.DuhringLines;
                if (duhringLines != null)
                {
                    double tEvapReal = ChartUtil.GetInterpolatedValue(duhringLines, concentrationValue, tEvap);
                    deltaT = tEvapReal - tEvap;
                }

                /*double correctionCoeff = 1.0;
                 * if (duhringLines.VarValue == Constants.NO_VALUE && Math.Abs(pressureValue-1.0132685e5) < 1.0e-3) {
                 * double evapHeat = GetEvaporationHeat(tEvap);
                 * correctionCoeff = 0.0162*tEvap*tEvap/evapHeat;  //Chemical Engineering Eq. 7-15 at p.310
                 * deltaT *= correctionCoeff;
                 * }*/
            }
            return(deltaT);
        }