Exemplo n.º 1
0
        private void InitializePerrysThermalPropCorrelations()
        {
            //from Perry's
            string substanceName = "Air";
            PerrysGasCpCorrelation gasCpCorrelation = new PerrysGasCpCorrelation(substanceName, 0.2896e5, 0.0939e5, 3.012e3, 0.0758e5, 1484.0, 50, 1500);

            gasCpTablePerrys.Add(substanceName, gasCpCorrelation);
            PerrysLiquidCpCorrelation liquidCpCorrelation = new PerrysLiquidCpCorrelation(substanceName, -2.1446e5, 9.1851e3, -1.0612e2, 4.1616e-1, 0, 132.45, 75, 115);

            liquidCpTablePerrys.Add(substanceName, liquidCpCorrelation);
            PerrysEvaporationHeatCorrelation evapHeatCorrelation = new PerrysEvaporationHeatCorrelation(substanceName, 0.8474e7, 0.3822, 0.0, 0.0, 59.15, 132.45);

            evapHeatTablePerrys.Add(substanceName, evapHeatCorrelation);
            PerrysVaporPressureCorrelation vapPressureCorrelation = new PerrysVaporPressureCorrelation(substanceName, 21.662, -692.39, -0.39208, 4.7574e-3, 1.0, 59.15, 132.45);

            vapPressureTablePerrys.Add(substanceName, vapPressureCorrelation);
            PerrysLiquidDensityCorrelation liquidDensityCorrelation = new PerrysLiquidDensityCorrelation(substanceName, 2.8963, 0.26733, 132.45, 0.27341, 59.15, 132.45);

            liquidDensityTablePerrys.Add(substanceName, liquidDensityCorrelation);

            substanceName    = "water";
            gasCpCorrelation = new PerrysGasCpCorrelation(substanceName, 0.3336e5, 0.2679e5, 2.6105e3, 0.089e5, 1169, 100, 2273.15);
            gasCpTablePerrys.Add(substanceName, gasCpCorrelation);
            liquidCpCorrelation = new PerrysLiquidCpCorrelation(substanceName, 2.7637e5, -2.0901e3, 8.125, -1.4116e-2, 9.3701e-6, 647.13, 273.16, 533.15);
            liquidCpTablePerrys.Add(substanceName, liquidCpCorrelation);
            evapHeatCorrelation = new PerrysEvaporationHeatCorrelation(substanceName, 5.2053e7, 0.3199, -0.212, 0.25795, 273.16, 647.13);
            evapHeatTablePerrys.Add(substanceName, evapHeatCorrelation);
            vapPressureCorrelation = new PerrysVaporPressureCorrelation(substanceName, 73.649, -7258.2, -7.3037, 4.1653e-6, 2.0, 273.16, 647.13);
            vapPressureTablePerrys.Add(substanceName, vapPressureCorrelation);
            liquidDensityCorrelation = new PerrysLiquidDensityCorrelation(substanceName, 5.459, 0.30542, 647.13, 0.081, 273.16, 333.15);
            liquidDensityTablePerrys.Add(substanceName, liquidDensityCorrelation);

            substanceName    = "carbon tetrachloride";
            gasCpCorrelation = new PerrysGasCpCorrelation(substanceName, 0.3758e5, 0.7054e5, 0.5121e3, 0.4850e5, 236.1, 100, 1500);
            gasCpTablePerrys.Add(substanceName, gasCpCorrelation);
            liquidCpCorrelation = new PerrysLiquidCpCorrelation(substanceName, -7.5270e5, 8.9661e3, -3.0394e1, 3.4455e-2, 0.0, 556.35, 250.33, 388.71);
            liquidCpTablePerrys.Add(substanceName, liquidCpCorrelation);
            evapHeatCorrelation = new PerrysEvaporationHeatCorrelation(substanceName, 4.3252e7, 0.37688, 0.0, 0.0, 250.33, 556.35);
            evapHeatTablePerrys.Add(substanceName, evapHeatCorrelation);
            vapPressureCorrelation = new PerrysVaporPressureCorrelation(substanceName, 78.441, -6128.1, -8.5766, 6.8465e-6, 2.0, 250.33, 556.35);
            vapPressureTablePerrys.Add(substanceName, vapPressureCorrelation);
            liquidDensityCorrelation = new PerrysLiquidDensityCorrelation(substanceName, 0.99835, 0.274, 556.35, 0.287, 250.33, 556.35);
            liquidDensityTablePerrys.Add(substanceName, liquidDensityCorrelation);

            substanceName    = "benzene";
            gasCpCorrelation = new PerrysGasCpCorrelation(substanceName, 0.4442e5, 2.3205e5, 1.4946e3, 1.7213e5, -678.15, 200, 1500);
            gasCpTablePerrys.Add(substanceName, gasCpCorrelation);
            liquidCpCorrelation = new PerrysLiquidCpCorrelation(substanceName, 1.2944e5, -1.6950e2, 6.4781e-1, 0.0, 0.0, 562.16, 278.68, 353.24);
            liquidCpTablePerrys.Add(substanceName, liquidCpCorrelation);
            evapHeatCorrelation = new PerrysEvaporationHeatCorrelation(substanceName, 4.7500e7, 0.45238, 0.0534, -0.1181, 278.68, 562.16);
            evapHeatTablePerrys.Add(substanceName, evapHeatCorrelation);
            vapPressureCorrelation = new PerrysVaporPressureCorrelation(substanceName, 83.918, -6517.7, -9.3453, 7.1182e-6, 2.0, 278.68, 562.16);
            vapPressureTablePerrys.Add(substanceName, vapPressureCorrelation);
            liquidDensityCorrelation = new PerrysLiquidDensityCorrelation(substanceName, 0.99835, 0.274, 556.35, 0.287, 278.68, 562.16);
            liquidDensityTablePerrys.Add(substanceName, liquidDensityCorrelation);

            substanceName    = "toluene";
            gasCpCorrelation = new PerrysGasCpCorrelation(substanceName, 0.5814e5, 2.8630e5, 1.4406e3, 1.8980e5, -650.43, 200, 1500);
            gasCpTablePerrys.Add(substanceName, gasCpCorrelation);
            liquidCpCorrelation = new PerrysLiquidCpCorrelation(substanceName, 1.4014e5, -1.5230e2, 6.9500e-1, 0.0, 0.0, 591.8, 178.18, 500);
            liquidCpTablePerrys.Add(substanceName, liquidCpCorrelation);
            evapHeatCorrelation = new PerrysEvaporationHeatCorrelation(substanceName, 5.0144e7, 0.3859, 0.0, 0.0, 178.18, 591.8);
            evapHeatTablePerrys.Add(substanceName, evapHeatCorrelation);
            vapPressureCorrelation = new PerrysVaporPressureCorrelation(substanceName, 80.877, -6902.4, -8.7761, 5.8034e-6, 2.0, 178.18, 591.8);
            vapPressureTablePerrys.Add(substanceName, vapPressureCorrelation);
            liquidDensityCorrelation = new PerrysLiquidDensityCorrelation(substanceName, 0.99835, 0.274, 556.35, 0.287, 178.18, 591.8);
            liquidDensityTablePerrys.Add(substanceName, liquidDensityCorrelation);
        }
Exemplo n.º 2
0
        override internal void ExtractCoeffs(ListBox listBox, SubstanceType substanceType, ThermPropType thermProp)
        {
            propList.Clear();

            string[] separatorsStr1 = { "</td>" };
            string[] separatorsStr2 = { "<i>", "</i>" };
            string   name;
            string   casRegestryNo;
            double   a, b, c, d = 1, e = 1;
            double   tc = 1;
            double   minTemp = 1, maxTemp = 1;

            string       line1, line2, lineTemp;
            int          correlationType;
            int          counter;
            FileStream   fsRead = null;
            StreamReader reader;

            ThermalPropCorrelationBase thermalPropCorrelation;

            try {
                foreach (object fullFileName in listBox.Items)
                {
                    counter = 0;
                    fsRead  = new FileStream((string)fullFileName, FileMode.Open, FileAccess.Read);
                    reader  = new StreamReader(fsRead);
                    line1   = reader.ReadLine();
                    while (!reader.EndOfStream && counter < 50)
                    {
                        line2 = reader.ReadLine();
                        if (line1.Contains("&nbsp") || line1.Contains("<a border"))
                        {
                            counter++;

                            correlationType = 1;
                            name            = ExtractName(line2, separatorsStr1, separatorsStr2);

                            lineTemp = reader.ReadLine(); //formula

                            lineTemp      = reader.ReadLine().Trim();
                            casRegestryNo = ExtractCasNo(lineTemp, separatorsStr1);

                            if (thermProp != ThermPropType.VapPressure) //molar weight is not listed in vapor pressure table
                            {
                                lineTemp = reader.ReadLine();
                            }

                            lineTemp = reader.ReadLine();
                            if (lineTemp == null)
                            {
                                continue;
                            }
                            a = ExtractValue(lineTemp, separatorsStr1);

                            lineTemp = reader.ReadLine();
                            b        = ExtractValue(lineTemp, separatorsStr1);

                            lineTemp = reader.ReadLine();
                            c        = ExtractValue(lineTemp, separatorsStr1);

                            lineTemp = reader.ReadLine();
                            d        = ExtractValue(lineTemp, separatorsStr1);

                            if (thermProp == ThermPropType.GasCp || thermProp == ThermPropType.LiquidCp ||
                                thermProp == ThermPropType.VapPressure)
                            {
                                lineTemp = reader.ReadLine();
                                e        = ExtractValue(lineTemp, separatorsStr1);
                            }

                            lineTemp = reader.ReadLine();
                            minTemp  = ExtractValue(lineTemp, separatorsStr1);

                            lineTemp = reader.ReadLine();

                            lineTemp = reader.ReadLine();
                            maxTemp  = ExtractValue(lineTemp, separatorsStr1);

                            if (thermProp == ThermPropType.LiquidCp || thermProp == ThermPropType.EvapHeat)
                            {
                                lineTemp = reader.ReadLine();

                                lineTemp = reader.ReadLine();
                                tc       = ExtractValue(lineTemp, separatorsStr1);
                            }

                            if (thermProp == ThermPropType.GasCp)
                            {
                                correlationType = 1;
                                if (name == "helium-4" || name == "nitric oxide")
                                {
                                    correlationType = 2;
                                }
                                else if (name == "propylbenzene")
                                {
                                    correlationType = 3;
                                }
                                thermalPropCorrelation = new PerrysGasCpCorrelation(name, casRegestryNo, a * 1e5, b * 1e5, c * 1e3, d * 1e5, e, minTemp, maxTemp, correlationType);
                                propList.Add(thermalPropCorrelation);
                            }
                            else if (thermProp == ThermPropType.LiquidCp)
                            {
                                correlationType = 1;
                                if (name == "methane" || name == "ethane" || name == "propane" || name == "n-butane" ||
                                    name == "n-heptane" || name == "hydrogen" || name == "ammonia" || name == "carbon monoxide" ||
                                    name == "hydrogen sulfide")
                                {
                                    correlationType = 2;
                                }
                                thermalPropCorrelation = new PerrysLiquidCpCorrelation(name, casRegestryNo, a, b, c, d, e, tc, minTemp, maxTemp, correlationType);
                                propList.Add(thermalPropCorrelation);
                            }
                            else if (thermProp == ThermPropType.EvapHeat)
                            {
                                thermalPropCorrelation = new PerrysEvaporationHeatCorrelation(name, casRegestryNo, a * 1.0e7, b, c, d, tc, minTemp, maxTemp);
                                propList.Add(thermalPropCorrelation);
                            }
                            else if (thermProp == ThermPropType.VapPressure)
                            {
                                thermalPropCorrelation = new PerrysVaporPressureCorrelation(name, casRegestryNo, a, b, c, d, e, minTemp, maxTemp);
                                propList.Add(thermalPropCorrelation);
                            }
                            else if (thermProp == ThermPropType.LiquidDensity)
                            {
                                thermalPropCorrelation = new PerrysLiquidDensityCorrelation(name, casRegestryNo, a, b, c, d, minTemp, maxTemp);
                                propList.Add(thermalPropCorrelation);
                            }
                        }

                        line1 = line2;
                    }
                    reader.Close();
                    fsRead.Close();
                }
            }
            catch (Exception ex) {
                Console.WriteLine("The process failed: {0}", ex.ToString());
            }
            finally {
                if (fsRead != null)
                {
                    fsRead.Close();
                }
            }

            PersistProp(GetFileName(thermProp), propList);
            UnpersistProp(GetFileName(thermProp));
        }