Example #1
0
        private CurveFamilyF GenerateAdiabaticSaturationFamily()
        {
            double             dewPoint;
            double             ysat;
            double             wetBulb;
            double             temperature;
            double             ih;
            double             tsat;
            double             maxTemp;
            HumidGasCalculator humidGasCalculator = GetHumidGasCalculator();
            double             p           = (double)pressure.Value;
            double             cg          = humidGasCalculator.GetSpecificHeatOfDryGas();
            double             cv          = humidGasCalculator.GetSpecificHeatOfVapor();
            double             r0          = humidGasCalculator.GetEvaporationHeat(273.15);
            double             dewPoint1   = humidGasCalculator.GetDewPointFromDryBulbAndRelativeHumidity(xVar.Max, 1.0);
            double             dewPoint2   = humidGasCalculator.GetDewPointFromHumidityAndPressure(yVar.Max, p);
            double             dewPointMin = Math.Min(dewPoint1, dewPoint2);
            int numOfCurves = (int)((dewPointMin - xVar.Min) / 5.0) + 1;

            CurveF[] curves = new CurveF[numOfCurves];
            double   y;

            for (int i = 0; i < numOfCurves; i++)
            {
                tsat     = xVar.Min + i * 5.0;
                dewPoint = humidGasCalculator.GetDewPointFromDryBulbAndRelativeHumidity(tsat, 1.0);
                ysat     = humidGasCalculator.GetHumidityFromDewPointAndPressure(dewPoint, p);
                wetBulb  = humidGasCalculator.GetWetBulbFromDryBulbHumidityAndPressure(tsat, ysat, p);
                PointF[] dataPoints = new PointF[11];
                maxTemp = humidGasCalculator.GetDryBulbFromWetBulbHumidityAndPressure(wetBulb, 0.0, p);
                if (maxTemp > xVar.Max)
                {
                    maxTemp = xVar.Max;
                }
                if (ysat > yVar.Max)
                {
                    tsat = humidGasCalculator.GetDryBulbFromWetBulbHumidityAndPressure(wetBulb, yVar.Max, p);
                }
                ih = (cg + cv * ysat) * (tsat - 273.15) + r0 * ysat;
                for (int j = 0; j <= 10; j++)
                {
                    temperature = tsat + (maxTemp - tsat) / 10.0 * j;
                    //iso-enthalpy line
                    y             = (ih - cg * (temperature - 273.15)) / (r0 + cv * (temperature - 273.15));
                    dataPoints[j] = new PointF((float)temperature, (float)y);
                }
                curves[i] = new CurveF(StringConstants.GetTypeName(StringConstants.ADIABATIC_SATURATION), (float)tsat, dataPoints);
            }

            CurveFamilyF curveFamily = new CurveFamilyF(StringConstants.GetTypeName(StringConstants.ADIABATIC_SATURATION), PhysicalQuantity.Temperature, curves);

            return(curveFamily);
        }
Example #2
0
        private CurveFamilyF GenerateRelativeHumidityFamily()
        {
            double dewPoint;
            double humidity;
            double temperature;
            double maxTemp;

            CurveF[]           curves = new CurveF[16];
            double             relativeHumidity;
            HumidGasCalculator humidGasCalculator = GetHumidGasCalculator();

            for (int i = 0; i < 16; i++)
            {
                //from 0.0% to 10%--interval 2%
                if (i < 5)
                {
                    relativeHumidity = (i + 1) * 0.02;
                }
                //from 10 to 50%--interval 5%
                else if (i < 9)
                {
                    relativeHumidity = 0.1 + (i - 4) * 0.05;
                }
                //from 30 to 100%--interval 10%
                else
                {
                    relativeHumidity = 0.3 + (i - 8) * 0.1;
                }

                dewPoint = humidGasCalculator.GetDewPointFromHumidityAndPressure(yVar.Max, pressure.Value);
                maxTemp  = humidGasCalculator.GetDryBulbFromDewPointAndRelativeHumidity(dewPoint, relativeHumidity);
                if (maxTemp > xVar.Max)
                {
                    maxTemp = xVar.Max;
                }
                PointF[] dataPoints = new PointF[101];
                for (int j = 0; j <= 100; j++)
                {
                    temperature   = xVar.Min + j * (maxTemp - xVar.Min) / 100;
                    dewPoint      = humidGasCalculator.GetDewPointFromDryBulbAndRelativeHumidity(temperature, relativeHumidity);
                    humidity      = humidGasCalculator.GetHumidityFromDewPointAndPressure(dewPoint, (double)pressure.Value);
                    dataPoints[j] = new PointF((float)temperature, (float)humidity);
                }
                curves[i] = new CurveF(StringConstants.GetTypeName(StringConstants.RELATIVE_HUMIDITY), (float)relativeHumidity, dataPoints);
            }

            CurveFamilyF curveFamily = new CurveFamilyF(StringConstants.GetTypeName(StringConstants.RELATIVE_HUMIDITY), PhysicalQuantity.Fraction, curves);

            return(curveFamily);
        }
Example #3
0
        static DuklerHeatTransferCoeffCalculator()
        {
            //Perry's Chemical Engineers Handbook, Page 5-32, Fig 5-10
            //curve 1 - 0.1:  (200, 0.26), (400, 0.204), (600, 0.173),  (1000, 0.11), (2000, 0.0575), (3000, 0.036), (5000, 0.04), (10000, 0.026), (20000, 0.025), (30000, 0.026), (100000, 0.041)
            //curve 2 - 0.5:  (200, 0.265), (400, 0.205), (600, 0.175),  (1000, 0.165), (2000, 0.13), (3000, 0.12), (5000, 0.11), (10000, 0.105), (20000, 0.11), (30000, 0.12), (100000, 0.175)
            //curve 3 - 1.0:  (200, 0.27), (400, 0.206), (600, 0.20),  (1000, 0.185), (2000, 0.182), (3000, 0.175), (5000, 0.18), (10000, 0.183), (20000, 0.19), (30000, 0.2), (100000, 0.24)
            //curve 4 - 2.0:  (200, 0.28), (400, 0.23), (600, 0.22), (1000, 0.215),  (2000, 0.215), (3000, 0.22), (5000, 0.23), (10000, 0.27), (20000, 0.29), (30000, 0.31), (100000, 0.4)
            //curve 5 - 5.0:  (200, 0.3), (400, 0.295), (600, 0.29), (1000, 0.285), (2000, 0.30), (3000, 0.305), (5000, 0.335), (10000, 0.395), (20000, 0.43), (30000, 0.48), (100000, 0.52)
            //curve 6 - 10.0: (200, 0.365), (400, 0.32), (600, 0.33), (1000, 0.35), (2000, 0.38), (3000, 0.4), (5000, 0.42), (10000, 0.5), (20000, 0.6), (30000, 0.64), (100000, 0.91)

            float log200 = (float)Math.Log10(200), log400 = (float)Math.Log10(400), log600 = (float)Math.Log10(600), log1000 = (float)Math.Log10(1000), log2000 = (float)Math.Log10(2000), log3000 = (float)Math.Log10(3000), log5000 = (float)Math.Log10(5000), log10000 = (float)Math.Log10(10000), log20000 = (float)Math.Log10(20000), log30000 = (float)Math.Log10(30000), log100000 = (float)Math.Log10(100000);

            PointF[] ps0 = { new PointF(log200, (float)Math.Log10(0.26)), new PointF(log400, (float)Math.Log10(0.204)), new PointF(log600, (float)Math.Log10(0.173)), new PointF(log1000, (float)Math.Log10(0.11)), new PointF(log2000, (float)Math.Log10(0.0575)), new PointF(log3000, (float)Math.Log10(0.036)), new PointF(log5000, (float)Math.Log10(0.04)), new PointF(log10000, (float)Math.Log10(0.026)), new PointF(log20000, (float)Math.Log10(0.025)), new PointF(log30000, (float)Math.Log10(0.026)), new PointF(log100000, (float)Math.Log10(0.041)) };
            PointF[] ps1 = { new PointF(log200, (float)Math.Log10(0.265)), new PointF(log400, (float)Math.Log10(0.205)), new PointF(log600, (float)Math.Log10(0.175)), new PointF(log1000, (float)Math.Log10(0.165)), new PointF(log2000, (float)Math.Log10(0.13)), new PointF(log3000, (float)Math.Log10(0.12)), new PointF(log5000, (float)Math.Log10(0.11)), new PointF(log10000, (float)Math.Log10(0.105)), new PointF(log20000, (float)Math.Log10(0.11)), new PointF(log30000, (float)Math.Log10(0.12)), new PointF(log100000, (float)Math.Log10(0.175)) };
            PointF[] ps2 = { new PointF(log200, (float)Math.Log10(0.27)), new PointF(log400, (float)Math.Log10(0.206)), new PointF(log600, (float)Math.Log10(0.20)), new PointF(log1000, (float)Math.Log10(0.185)), new PointF(log2000, (float)Math.Log10(0.182)), new PointF(log3000, (float)Math.Log10(0.175)), new PointF(log5000, (float)Math.Log10(0.18)), new PointF(log10000, (float)Math.Log10(0.183)), new PointF(log20000, (float)Math.Log10(0.19)), new PointF(log30000, (float)Math.Log10(0.2)), new PointF(log100000, (float)Math.Log10(0.24)) };
            PointF[] ps3 = { new PointF(log200, (float)Math.Log10(0.28)), new PointF(log400, (float)Math.Log10(0.23)), new PointF(log600, (float)Math.Log10(0.22)), new PointF(log1000, (float)Math.Log10(0.215)), new PointF(log2000, (float)Math.Log10(0.215)), new PointF(log3000, (float)Math.Log10(0.22)), new PointF(log5000, (float)Math.Log10(0.23)), new PointF(log10000, (float)Math.Log10(0.27)), new PointF(log20000, (float)Math.Log10(0.29)), new PointF(log30000, (float)Math.Log10(0.31)), new PointF(log100000, (float)Math.Log10(0.4)) };
            PointF[] ps4 = { new PointF(log200, (float)Math.Log10(0.3)), new PointF(log400, (float)Math.Log10(0.295)), new PointF(log600, (float)Math.Log10(0.29)), new PointF(log1000, (float)Math.Log10(0.285)), new PointF(log2000, (float)Math.Log10(0.30)), new PointF(log3000, (float)Math.Log10(0.305)), new PointF(log5000, (float)Math.Log10(0.335)), new PointF(log10000, (float)Math.Log10(0.395)), new PointF(log20000, (float)Math.Log10(0.43)), new PointF(log30000, (float)Math.Log10(0.48)), new PointF(log100000, (float)Math.Log10(0.52)) };
            PointF[] ps5 = { new PointF(log200, (float)Math.Log10(0.365)), new PointF(log400, (float)Math.Log10(0.32)), new PointF(log600, (float)Math.Log10(0.33)), new PointF(log1000, (float)Math.Log10(0.35)), new PointF(log2000, (float)Math.Log10(0.38)), new PointF(log3000, (float)Math.Log10(0.4)), new PointF(log5000, (float)Math.Log10(0.42)), new PointF(log10000, (float)Math.Log10(0.5)), new PointF(log20000, (float)Math.Log10(0.6)), new PointF(log30000, (float)Math.Log10(0.64)), new PointF(log100000, (float)Math.Log10(0.91)) };
            duklerCurves[0] = new CurveF(0.1f, ps0);
            duklerCurves[1] = new CurveF(0.5f, ps1);
            duklerCurves[2] = new CurveF(1f, ps2);
            duklerCurves[3] = new CurveF(2f, ps3);
            duklerCurves[4] = new CurveF(5f, ps4);
            duklerCurves[5] = new CurveF(10f, ps5);

            //Handbook of Chemical Engineering Calculations--page 7-50 table (the only table on this page)
            PointF[] pt0 = { new PointF(0.0f, 1.0f), new PointF(1.0e-5f, 1.00f), new PointF(1.0e-4f, 1.03f), new PointF(2.0e-4f, 1.05f) };
            PointF[] pt1 = { new PointF(0.0f, 1.0f), new PointF(1.0e-5f, 1.03f), new PointF(1.0e-4f, 1.15f), new PointF(2.0e-4f, 1.28f) };
            PointF[] pt2 = { new PointF(0.0f, 1.0f), new PointF(1.0e-5f, 1.07f), new PointF(1.0e-4f, 1.40f), new PointF(2.0e-4f, 1.68f) };
            PointF[] pt3 = { new PointF(0.0f, 1.0f), new PointF(1.0e-5f, 1.25f), new PointF(1.0e-4f, 2.25f), new PointF(2.0e-4f, 2.80f) };
            PointF[] pt4 = { new PointF(0.0f, 1.0f), new PointF(1.0e-5f, 1.90f), new PointF(1.0e-4f, 4.35f), new PointF(2.0e-4f, 6.00f) };
            PointF[] pt5 = { new PointF(0.0f, 1.0f), new PointF(1.0e-5f, 3.30f), new PointF(1.0e-4f, 8.75f), new PointF(2.0e-4f, 13.00f) };
            duklerCorrectionCurves[0] = new CurveF(200f, pt0);
            duklerCorrectionCurves[1] = new CurveF(500f, pt1);
            duklerCorrectionCurves[2] = new CurveF(1000f, pt2);
            duklerCorrectionCurves[3] = new CurveF(3000f, pt3);
            duklerCorrectionCurves[4] = new CurveF(10000f, pt4);
            duklerCorrectionCurves[5] = new CurveF(30000f, pt5);
        }
Example #4
0
        static AirSpecificHeatRatioCalculator()
        {
            PointF[] ps0  = { new PointF(150f, 1.410f), new PointF(200f, 1.406f), new PointF(250f, 1.403f), new PointF(300f, 1.402f), new PointF(350f, 1.399f), new PointF(400f, 1.395f), new PointF(450f, 1.392f), new PointF(500f, 1.387f), new PointF(600f, 1.377f), new PointF(800f, 1.353f), new PointF(1000f, 1.336f) };
            PointF[] ps1  = { new PointF(150f, 1.510f), new PointF(200f, 1.452f), new PointF(250f, 1.429f), new PointF(300f, 1.418f), new PointF(350f, 1.411f), new PointF(400f, 1.404f), new PointF(450f, 1.397f), new PointF(500f, 1.391f), new PointF(600f, 1.378f), new PointF(800f, 1.355f), new PointF(1000f, 1.337f) };
            PointF[] ps2  = { new PointF(150f, 1.668f), new PointF(200f, 1.505f), new PointF(250f, 1.457f), new PointF(300f, 1.436f), new PointF(350f, 1.422f), new PointF(400f, 1.412f), new PointF(450f, 1.404f), new PointF(500f, 1.395f), new PointF(600f, 1.382f), new PointF(800f, 1.357f), new PointF(1000f, 1.338f) };
            PointF[] ps3  = { new PointF(150f, 2.333f), new PointF(200f, 1.630f), new PointF(250f, 1.517f), new PointF(300f, 1.470f), new PointF(350f, 1.446f), new PointF(400f, 1.429f), new PointF(450f, 1.416f), new PointF(500f, 1.406f), new PointF(600f, 1.386f), new PointF(800f, 1.359f), new PointF(1000f, 1.339f) };
            PointF[] ps4  = { new PointF(150f, 4.120f), new PointF(200f, 1.781f), new PointF(250f, 1.577f), new PointF(300f, 1.505f), new PointF(350f, 1.467f), new PointF(400f, 1.444f), new PointF(450f, 1.428f), new PointF(500f, 1.414f), new PointF(600f, 1.392f), new PointF(800f, 1.361f), new PointF(1000f, 1.342f) };
            PointF[] ps5  = { new PointF(150f, 3.973f), new PointF(200f, 1.943f), new PointF(250f, 1.640f), new PointF(300f, 1.537f), new PointF(350f, 1.488f), new PointF(400f, 1.460f), new PointF(450f, 1.438f), new PointF(500f, 1.421f), new PointF(600f, 1.398f), new PointF(800f, 1.365f), new PointF(1000f, 1.343f) };
            PointF[] ps6  = { new PointF(150f, 3.202f), new PointF(200f, 2.093f), new PointF(250f, 1.699f), new PointF(300f, 1.570f), new PointF(350f, 1.509f), new PointF(400f, 1.472f), new PointF(450f, 1.449f), new PointF(500f, 1.430f), new PointF(600f, 1.403f), new PointF(800f, 1.366f), new PointF(1000f, 1.343f) };
            PointF[] ps7  = { new PointF(150f, 2.507f), new PointF(200f, 2.274f), new PointF(250f, 1.816f), new PointF(300f, 1.640f), new PointF(350f, 1.553f), new PointF(400f, 1.505f), new PointF(450f, 1.471f), new PointF(500f, 1.448f), new PointF(600f, 1.413f), new PointF(800f, 1.372f), new PointF(1000f, 1.345f) };
            PointF[] ps8  = { new PointF(150f, 2.243f), new PointF(200f, 2.236f), new PointF(250f, 1.877f), new PointF(300f, 1.687f), new PointF(350f, 1.589f), new PointF(400f, 1.529f), new PointF(450f, 1.490f), new PointF(500f, 1.463f), new PointF(600f, 1.423f), new PointF(800f, 1.375f), new PointF(1000f, 1.348f) };
            PointF[] ps9  = { new PointF(150f, 2.091f), new PointF(200f, 2.140f), new PointF(250f, 1.896f), new PointF(300f, 1.716f), new PointF(350f, 1.612f), new PointF(400f, 1.548f), new PointF(450f, 1.505f), new PointF(500f, 1.474f), new PointF(600f, 1.432f), new PointF(800f, 1.381f), new PointF(1000f, 1.350f) };
            PointF[] ps10 = { new PointF(150f, 1.988f), new PointF(200f, 2.050f), new PointF(250f, 1.885f), new PointF(300f, 1.730f), new PointF(350f, 1.627f), new PointF(400f, 1.563f), new PointF(450f, 1.518f), new PointF(500f, 1.484f), new PointF(600f, 1.439f), new PointF(800f, 1.384f), new PointF(1000f, 1.354f) };
            PointF[] ps11 = { new PointF(150f, 1.851f), new PointF(200f, 1.920f), new PointF(250f, 1.836f), new PointF(300f, 1.727f), new PointF(350f, 1.640f), new PointF(400f, 1.579f), new PointF(450f, 1.533f), new PointF(500f, 1.499f), new PointF(600f, 1.448f), new PointF(800f, 1.392f), new PointF(1000f, 1.358f) };
            PointF[] ps12 = { new PointF(150f, 1.768f), new PointF(200f, 1.832f), new PointF(250f, 1.782f), new PointF(300f, 1.707f), new PointF(350f, 1.638f), new PointF(400f, 1.584f), new PointF(450f, 1.541f), new PointF(500f, 1.507f), new PointF(600f, 1.457f), new PointF(800f, 1.397f), new PointF(1000f, 1.361f) };
            PointF[] ps13 = { new PointF(150f, 1.712f), new PointF(200f, 1.771f), new PointF(250f, 1.743f), new PointF(300f, 1.683f), new PointF(350f, 1.629f), new PointF(400f, 1.580f), new PointF(450f, 1.542f), new PointF(500f, 1.510f), new PointF(600f, 1.461f), new PointF(800f, 1.401f), new PointF(1000f, 1.365f) };
            PointF[] ps14 = { new PointF(150f, 1.654f), new PointF(200f, 1.682f), new PointF(250f, 1.681f), new PointF(300f, 1.645f), new PointF(350f, 1.605f), new PointF(400f, 1.567f), new PointF(450f, 1.537f), new PointF(500f, 1.510f), new PointF(600f, 1.465f), new PointF(800f, 1.406f), new PointF(1000f, 1.368f) };
            PointF[] ps15 = { new PointF(150f, 1.639f), new PointF(200f, 1.619f), new PointF(250f, 1.636f), new PointF(300f, 1.619f), new PointF(350f, 1.585f), new PointF(400f, 1.555f), new PointF(450f, 1.528f), new PointF(500f, 1.504f), new PointF(600f, 1.466f), new PointF(800f, 1.409f), new PointF(1000f, 1.372f) };

            ratioCurves[0] = new CurveF(1.0e5f, ps0);
            ratioCurves[1] = new CurveF(10.0e5f, ps1);
            ratioCurves[2] = new CurveF(20.0e5f, ps2);
            ratioCurves[0] = new CurveF(40.0e5f, ps3);
            ratioCurves[0] = new CurveF(60.0e5f, ps4);
            ratioCurves[0] = new CurveF(80.0e5f, ps5);
            ratioCurves[0] = new CurveF(100.0e5f, ps6);
            ratioCurves[0] = new CurveF(150.0e5f, ps7);
            ratioCurves[0] = new CurveF(200.0e5f, ps8);
            ratioCurves[0] = new CurveF(250.0e5f, ps9);
            ratioCurves[0] = new CurveF(300e5f, ps10);
            ratioCurves[0] = new CurveF(400.0e5f, ps11);
            ratioCurves[0] = new CurveF(500.0e5f, ps12);
            ratioCurves[0] = new CurveF(600.0e5f, ps13);
            ratioCurves[0] = new CurveF(800.0e5f, ps14);
            ratioCurves[0] = new CurveF(1000.0e5f, ps15);
        }
Example #5
0
        static CycloneUtil()
        {
            //Perry's Chemical Engineers Handbook, Page 17-29, Fig 17-40
            //curve 1 - 0.35: (0.0023, 0.35), (0.005, 0.38), (0.0115, 0.425), (0.023, 0.48),  (0.063, 0.61),  (0.115, 0.765), (0.23, 0.915), (0.5, 0.988), (1.15, 0.9979), (2.1, 0.99935), (22.3, 0.99935)
            //curve 2 - 0.55: (0.0023, 0.50), (0.005, 0.59), (0.0115, 0.680), (0.023, 0.765), (0.063, 0.885), (0.115, 0.930), (0.23, 0.978), (0.5, 0.996), (1.15, 0.9989), (2.0, 0.99955), (22.3, 0.99955)
            //curve 2 - 0.65: (0.0023, 0.65), (0.005, 0.695), (0.0115, 0.77), (0.023, 0.85), (0.063, 0.928), (0.115, 0.965), (0.23, 0.99), (0.5, 0.9975), (1.15, 0.9997), (1.9, 0.99965), (22.3, 0.99965)
            //curve 4 - 0.85: (0.0023, 0.85), (0.005, 0.88), (0.0115, 0.914), (0.023, 0.93), (0.063, 0.971), (0.115, 0.985), (0.23, 0.9962), (0.5, 0.999), (1.15, 0.9997), (1.8, 0.99985), (22.3, 0.99985)
            //curve 5 - 0.94: (0.0023, 0.94), (0.005, 0.95), (0.0115, 0.96), (0.023, 0.97), (0.063, 0.988), (0.115, 0.9938), (0.23, 0.998), (0.5, 0.9995), (1.15, 0.99986), (2.2, 0.99994), (22.3, 0.99994)
            //curve 6 - 0.97: (0.0023, 0.97), (0.005, 0.972), (0.0115, 0.978), (0.023, 0.983), (0.063, 0.994), (0.115, 0.997), (0.23, 0.9991), (0.5, 0.99975), (1.15, 0.99997), (2.23, 0.99997), (22.3, 0.99997)
            //curve 7 - 0.99: (0.0023, 0.99), (0.005, 0.991), (0.0115, 0.9928), (0.023, 0.995), (0.063, 0.997), (0.115, 0.9987), (0.23, 0.99962), (0.5, 0.99992), (1.15, 0.99998), (1.66, 0.99999), (22.3, 0.99999)
            PointF[] pa1 = { new PointF((float)Math.Log10(0.0023),   0.35f), new PointF((float)Math.Log10(0.005),    0.38f), new PointF((float)Math.Log10(0.0115), 0.425f), new PointF((float)Math.Log10(0.023),  0.48f),
                             new PointF((float)Math.Log10(0.063),    0.61f), new PointF((float)Math.Log10(0.115),   0.765f), new PointF((float)Math.Log10(0.23),   0.915f), new PointF((float)Math.Log10(0.5),   0.988f),
                             new PointF((float)Math.Log10(1.15),   0.9979f), new PointF((float)Math.Log10(2.1),   0.99935f), new PointF((float)Math.Log10(22.3), 0.99935f) };
            PointF[] pa2 = { new PointF((float)Math.Log10(0.0023),    0.5f), new PointF((float)Math.Log10(0.005),    0.59f), new PointF((float)Math.Log10(0.0115),  0.68f), new PointF((float)Math.Log10(0.023), 0.765f),
                             new PointF((float)Math.Log10(0.063),   0.885f), new PointF((float)Math.Log10(0.115),   0.930f), new PointF((float)Math.Log10(0.23),   0.978f), new PointF((float)Math.Log10(0.5),   0.996f),
                             new PointF((float)Math.Log10(1.15),   0.9989f), new PointF((float)Math.Log10(2.0),   0.99955f), new PointF((float)Math.Log10(22.3), 0.99955f) };
            PointF[] pa3 = { new PointF((float)Math.Log10(0.0023),   0.65f), new PointF((float)Math.Log10(0.005),   0.695f), new PointF((float)Math.Log10(0.0115), 0.77f), new PointF((float)Math.Log10(0.023),   0.85f),
                             new PointF((float)Math.Log10(0.063),   0.928f), new PointF((float)Math.Log10(0.115),   0.965f), new PointF((float)Math.Log10(0.23),   0.99f), new PointF((float)Math.Log10(0.5),   0.9975f),
                             new PointF((float)Math.Log10(1.15),   0.9997f), new PointF((float)Math.Log10(1.9),   0.99965f), new PointF((float)Math.Log10(22.3), 0.99965f) };
            PointF[] pa4 = { new PointF((float)Math.Log10(0.0023),   0.85f), new PointF((float)Math.Log10(0.005),    0.88f), new PointF((float)Math.Log10(0.0115),  0.914f), new PointF((float)Math.Log10(0.023),  0.93f),
                             new PointF((float)Math.Log10(0.063),   0.971f), new PointF((float)Math.Log10(0.115),   0.985f), new PointF((float)Math.Log10(0.23),   0.9962f), new PointF((float)Math.Log10(0.5),   0.999f),
                             new PointF((float)Math.Log10(1.15),   0.9997f), new PointF((float)Math.Log10(1.8),   0.99985f), new PointF((float)Math.Log10(22.3), 0.99985f) };
            PointF[] pa5 = { new PointF((float)Math.Log10(0.0023),    0.94f), new PointF((float)Math.Log10(0.005),    0.95f), new PointF((float)Math.Log10(0.0115),  0.96f), new PointF((float)Math.Log10(0.023),   0.97f),
                             new PointF((float)Math.Log10(0.063),    0.988f), new PointF((float)Math.Log10(0.115),  0.9938f), new PointF((float)Math.Log10(0.23),   0.998f), new PointF((float)Math.Log10(0.5),   0.9995f),
                             new PointF((float)Math.Log10(1.15),   0.99986f), new PointF((float)Math.Log10(2.2),   0.99994f), new PointF((float)Math.Log10(22.3), 0.99994f) };
            PointF[] pa6 = { new PointF((float)Math.Log10(0.0023),    0.97f), new PointF((float)Math.Log10(0.005),   0.972f), new PointF((float)Math.Log10(0.0115),  0.978f), new PointF((float)Math.Log10(0.023),   0.983f),
                             new PointF((float)Math.Log10(0.063),    0.994f), new PointF((float)Math.Log10(0.115),   0.997f), new PointF((float)Math.Log10(0.23),   0.9991f), new PointF((float)Math.Log10(0.5),   0.99975f),
                             new PointF((float)Math.Log10(1.15),   0.99997f), new PointF((float)Math.Log10(2.2),   0.99997f), new PointF((float)Math.Log10(22.3), 0.99997f) };
            PointF[] pa7 = { new PointF((float)Math.Log10(0.0023),    0.99f), new PointF((float)Math.Log10(0.005),   0.991f), new PointF((float)Math.Log10(0.0115), 0.99928f), new PointF((float)Math.Log10(0.023),   0.995f),
                             new PointF((float)Math.Log10(0.063),    0.997f), new PointF((float)Math.Log10(0.115),  0.9987f), new PointF((float)Math.Log10(0.23),   0.99962f), new PointF((float)Math.Log10(0.5),   0.99992f),
                             new PointF((float)Math.Log10(1.15),   0.99998f), new PointF((float)Math.Log10(2.2),   0.99999f), new PointF((float)Math.Log10(22.3), 0.99999f) };
            ceLoadingCorrectionCurvesAC[0] = new CurveF(0.35f, pa1);
            ceLoadingCorrectionCurvesAC[1] = new CurveF(0.55f, pa2);
            ceLoadingCorrectionCurvesAC[2] = new CurveF(0.65f, pa3);
            ceLoadingCorrectionCurvesAC[3] = new CurveF(0.85f, pa4);
            ceLoadingCorrectionCurvesAC[4] = new CurveF(0.94f, pa5);
            ceLoadingCorrectionCurvesAC[5] = new CurveF(0.97f, pa6);
            ceLoadingCorrectionCurvesAC[6] = new CurveF(0.99f, pa7);

            //Perry's Chemical Engineers Handbook, Page 17-29, Fig 17-41
            //curve 1 - 0.10: (0.001, 0.1), (0.005, 0.118), (0.01, 0.138),  (0.02, 0.17), (0.05, 0.214), (0.1, 0.278), (0.2, 0.32), (0.5, 0.43), (1.0, 0.505), (2.1, 0.56)
            //curve 2 - 0.20: (0.001, 0.2), (0.005, 0.24), (0.01, 0.265),  (0.02, 0.302), (0.05, 0.36), (0.1, 0.458), (0.2, 0.53), (0.5, 0.65), (1.0, 0.715), (2.1, 0.76)
            //curve 3 - 0.35: (0.001, 0.35), (0.005, 0.40), (0.01, 0.45),  (0.02, 0.48), (0.05, 0.58), (0.1, 0.65), (0.2, 0.732), (0.5, 0.85), (1.0, 0.90), (2.1, 0.92)
            //curve 4 - 0.55: (0.001, 0.55), (0.005, 0.60), (0.01, 0.67),  (0.02, 0.75), (0.05, 0.87), (0.1, 0.902), (0.2, 0.94), (0.5, 0.955), (1.0, 0.966), (2.1, 0.968)
            //curve 5 - 0.65: (0.001, 0.65), (0.005, 0.70), (0.01, 0.78),  (0.02, 0.86), (0.05, 0.918), (0.1, 0.948), (0.2, 0.969), (0.5, 0.977), (1.0, 0.979), (2.1, 0.98)
            //curve 6 - 0.85: (0.001, 0.85), (0.005, 0.87), (0.01, 0.902),  (0.02, 0.93), (0.05, 0.961), (0.1, 0.973), (0.2, 0.981), (0.5, 0.984), (1.0, 0.988), (2.1, 0.99)
            //curve 7 - 0.94: (0.001, 0.94), (0.005, 0.95), (0.01, 0.96),  (0.02, 0.972), (0.05, 0.982), (0.1, 0.985), (0.2, 0.9895), (0.5, 0.9912), (1.0, 0.9916), (2.1, 0.9917)
            //curve 8 - 0.97: (0.001, 0.97), (0.005, 0.975), (0.01, 0.981),  (0.02, 0.983), (0.05, 0.988), (0.1, 0.992), (0.2, 0.9932), (0.5, 0.9935), (1.0, 0.9937), (2.1, 0.9938)
            //curve 9 - 0.99: (0.001, 0.99), (0.005, 0.992), (0.01, 0.9938),  (0.02, 0.9945), (0.05, 0.9958), (0.1, 0.9961), (0.2, 0.997), (0.5, 0.9971), (1.0, 0.9973), (2.1, 0.9973)
            PointF[] pc1 = { new PointF((float)Math.Log10(0.001),   0.1f), new PointF((float)Math.Log10(0.005), 0.118f), new PointF((float)Math.Log10(0.01), 0.138f), new PointF((float)Math.Log10(0.02), 0.17f),
                             new PointF((float)Math.Log10(0.05),  0.214f), new PointF((float)Math.Log10(0.1),   0.278f), new PointF((float)Math.Log10(0.2),   0.32f), new PointF((float)Math.Log10(0.5),  0.43f),
                             new PointF((float)Math.Log10(1.0),   0.505f), new PointF((float)Math.Log10(2.1), 0.56f) };
            PointF[] pc2 = { new PointF((float)Math.Log10(0.001),   0.2f), new PointF((float)Math.Log10(0.005),  0.24f), new PointF((float)Math.Log10(0.01), 0.265f), new PointF((float)Math.Log10(0.02), 0.302f),
                             new PointF((float)Math.Log10(0.05),   0.36f), new PointF((float)Math.Log10(0.1),   0.458f), new PointF((float)Math.Log10(0.2),   0.53f), new PointF((float)Math.Log10(0.5),   0.65f),
                             new PointF((float)Math.Log10(1.0),   0.715f), new PointF((float)Math.Log10(2.1), 0.76f) };
            PointF[] pc3 = { new PointF((float)Math.Log10(0.001), 0.35f), new PointF((float)Math.Log10(0.005),  0.4f), new PointF((float)Math.Log10(0.01),  0.45f), new PointF((float)Math.Log10(0.02), 0.48f),
                             new PointF((float)Math.Log10(0.05),  0.58f), new PointF((float)Math.Log10(0.1),   0.65f), new PointF((float)Math.Log10(0.2),  0.732f), new PointF((float)Math.Log10(0.5),  0.85f),
                             new PointF((float)Math.Log10(1.0),   0.90f), new PointF((float)Math.Log10(2.1), 0.92f) };
            PointF[] pc4 = { new PointF((float)Math.Log10(0.001),  0.55f), new PointF((float)Math.Log10(0.005),  0.60f), new PointF((float)Math.Log10(0.01), 0.67f), new PointF((float)Math.Log10(0.02),  0.75f),
                             new PointF((float)Math.Log10(0.05),   0.87f), new PointF((float)Math.Log10(0.1),   0.902f), new PointF((float)Math.Log10(0.2),  0.94f), new PointF((float)Math.Log10(0.5),  0.955f),
                             new PointF((float)Math.Log10(1.0),   0.966f), new PointF((float)Math.Log10(2.1), 0.968f) };
            PointF[] pc5 = { new PointF((float)Math.Log10(0.001),  0.65f), new PointF((float)Math.Log10(0.005),  0.70f), new PointF((float)Math.Log10(0.01),  0.78f), new PointF((float)Math.Log10(0.02),  0.86f),
                             new PointF((float)Math.Log10(0.05),  0.918f), new PointF((float)Math.Log10(0.1),   0.948f), new PointF((float)Math.Log10(0.2),  0.969f), new PointF((float)Math.Log10(0.5),  0.977f),
                             new PointF((float)Math.Log10(1.0),   0.979f), new PointF((float)Math.Log10(2.1), 0.98f) };
            PointF[] pc6 = { new PointF((float)Math.Log10(0.001),  0.85f), new PointF((float)Math.Log10(0.005),  0.87f), new PointF((float)Math.Log10(0.01), 0.902f), new PointF((float)Math.Log10(0.02),  0.93f),
                             new PointF((float)Math.Log10(0.05),  0.961f), new PointF((float)Math.Log10(0.1),   0.973f), new PointF((float)Math.Log10(0.2),  0.981f), new PointF((float)Math.Log10(0.5),  0.984f),
                             new PointF((float)Math.Log10(1.0),   0.988f), new PointF((float)Math.Log10(2.1), 0.99f) };
            PointF[] pc7 = { new PointF((float)Math.Log10(0.001),   0.94f), new PointF((float)Math.Log10(0.005),  0.95f), new PointF((float)Math.Log10(0.01),   0.96f), new PointF((float)Math.Log10(0.02),  0.972f),
                             new PointF((float)Math.Log10(0.05),   0.982f), new PointF((float)Math.Log10(0.1),   0.985f), new PointF((float)Math.Log10(0.2),  0.9895f), new PointF((float)Math.Log10(0.5),  0.9912f),
                             new PointF((float)Math.Log10(1.0),   0.9916f), new PointF((float)Math.Log10(2.1), 0.9917f) };
            PointF[] pc8 = { new PointF((float)Math.Log10(0.001),   0.97f), new PointF((float)Math.Log10(0.005), 0.975f), new PointF((float)Math.Log10(0.01),  0.981f), new PointF((float)Math.Log10(0.02),  0.983f),
                             new PointF((float)Math.Log10(0.05),   0.988f), new PointF((float)Math.Log10(0.1),   0.992f), new PointF((float)Math.Log10(0.2),  0.9932f), new PointF((float)Math.Log10(0.5),  0.9935f),
                             new PointF((float)Math.Log10(1.0),   0.9937f), new PointF((float)Math.Log10(2.1), 0.9938f) };
            PointF[] pc9 = { new PointF((float)Math.Log10(0.001),   0.99f), new PointF((float)Math.Log10(0.005),  0.992f), new PointF((float)Math.Log10(0.01), 0.9938f), new PointF((float)Math.Log10(0.02), 0.9945f),
                             new PointF((float)Math.Log10(0.05),  0.9958f), new PointF((float)Math.Log10(0.1),   0.9961f), new PointF((float)Math.Log10(0.2),  0.9970f), new PointF((float)Math.Log10(0.5),  0.9971f),
                             new PointF((float)Math.Log10(1.0),   0.9973f), new PointF((float)Math.Log10(2.1), 0.9973f) };

            ceLoadingCorrectionCurvesBD[0] = new CurveF(0.1f, pc1);
            ceLoadingCorrectionCurvesBD[1] = new CurveF(0.2f, pc2);
            ceLoadingCorrectionCurvesBD[2] = new CurveF(0.35f, pc3);
            ceLoadingCorrectionCurvesBD[3] = new CurveF(0.55f, pc4);
            ceLoadingCorrectionCurvesBD[4] = new CurveF(0.65f, pc5);
            ceLoadingCorrectionCurvesBD[5] = new CurveF(0.85f, pc6);
            ceLoadingCorrectionCurvesBD[6] = new CurveF(0.94f, pc7);
            ceLoadingCorrectionCurvesBD[7] = new CurveF(0.97f, pc8);
            ceLoadingCorrectionCurvesBD[8] = new CurveF(0.99f, pc9);
        }
Example #6
0
        public ErrorMessage FinishSpecifications()
        {
            ErrorMessage errorMsg = null;

            CurveF[]    lines = new CurveF[duhringLines.Count];
            DuhringLine line;
            double      startSolventBoilingPoint;
            double      startSolutionBoilingPoint;
            double      endSolventBoilingPoint;
            double      endSolutionBoilingPoint;

            line = (DuhringLine)duhringLines[0];
            double previousConcentration = line.Concentration.Value;

            for (int i = 0; i < duhringLines.Count; i++)
            {
                line = (DuhringLine)duhringLines[i];

                if (i > 0 && line.Concentration.Value <= previousConcentration)
                {
                    string msg = "Line " + (i + 1) + "'s mass concentration vlaue must be greater than Line " + i + "'s.\n Mass concentration values of the duhring lines must go from low to high.";
                    errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Input Value", msg);
                    break;
                }

                previousConcentration = line.Concentration.Value;

                startSolventBoilingPoint  = line.StartSolventBoilingPoint.Value;
                startSolutionBoilingPoint = line.StartSolutionBoilingPoint.Value;
                endSolventBoilingPoint    = line.EndSolventBoilingPoint.Value;
                endSolutionBoilingPoint   = line.EndSolutionBoilingPoint.Value;
                if (startSolutionBoilingPoint < startSolventBoilingPoint)
                {
                    string msg = "Line " + (i + 1) + "--the boiling point of the solution must be greater than the boiling point of the solvent.";
                    errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Input Value", msg);
                    break;
                }

                if (endSolutionBoilingPoint < endSolventBoilingPoint)
                {
                    string msg = "Line " + (i + 1) + "--the boiling point of the solution must be greater than the boiling point of the solvent.";
                    errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Input Value", msg);
                    break;
                }

                if (endSolventBoilingPoint <= startSolventBoilingPoint)
                {
                    string msg = "Line " + (i + 1) + "--the boiling point of the solvent at the end must be greater than boiling point of the solvent at the start.";
                    errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Input Value", msg);
                    break;
                }

                if (endSolutionBoilingPoint <= startSolutionBoilingPoint)
                {
                    string msg = "Line " + (i + 1) + "--the boiling point of the solution at the end must be greater than boiling point of the solution at the start.";
                    errorMsg = new ErrorMessage(ErrorType.SimpleGeneric, "Inappropriate Input Value", msg);
                    break;
                }

                PointF[] points = { new PointF((float)startSolventBoilingPoint, (float)startSolutionBoilingPoint),
                                    new PointF((float)endSolventBoilingPoint,   (float)endSolutionBoilingPoint) };
                lines[i] = new CurveF((float)line.Concentration.Value, points);
            }

            if (errorMsg == null)
            {
                owner.DuhringLines = lines;
            }

            return(errorMsg);
        }