Exemplo n.º 1
0
 private void GenerateHumidityChartData()
 {
     CurveFamilyF[] curveFamilies = new CurveFamilyF[2];
     curveFamilies[0]  = GenerateRelativeHumidityFamily();
     curveFamilies[1]  = GenerateAdiabaticSaturationFamily();
     humidityChartData = new HumidityChartData("Humidity Chart Data", curveFamilies);
 }
Exemplo n.º 2
0
        private void UpdateProcess()
        {
            if (this.process != null)
            {
                CurveFamilyF curves = this.psychrometricChartModel.GetProcessStates();
                if (curves != null)
                {
                    // display the process curve(s) on the plot
                    this.plotCtrl.Graph.ShowOtherData = true;
                    PlotData otherData = this.ConvertToPlotData(curves);
                    this.plotCtrl.Graph.OtherData = otherData;
                }

                PointF siPoint        = this.psychrometricChartModel.GetProcessInputState();
                PointF currentInPoint = this.ConvertFromSI(siPoint);
                this.process.Input.Variables = currentInPoint;
                siPoint = this.psychrometricChartModel.GetProcessOutputState();
                PointF currentOutPoint = this.ConvertFromSI(siPoint);
                this.process.Output.Variables = currentOutPoint;
                this.plotCtrl.Graph.ShowCurrentCoordinate(this.process.ToString());

                //
                PointF pageCurrentInPoint = this.plotCtrl.Graph.ConvertFromDomainToPage(currentInPoint);
                this.inStateCtrl.Location = new Point((int)(pageCurrentInPoint.X - StateControl.RADIUS + 1), (int)(pageCurrentInPoint.Y - StateControl.RADIUS));
                PointF pageCurrentOutPoint = this.plotCtrl.Graph.ConvertFromDomainToPage(currentOutPoint);
                this.outStateCtrl.Location = new Point((int)(pageCurrentOutPoint.X - StateControl.RADIUS + 1), (int)(pageCurrentOutPoint.Y - StateControl.RADIUS));

                PointF[] points = new PointF[] { currentInPoint, currentOutPoint };
                this.plotCtrl.Graph.Points     = points;
                this.plotCtrl.Graph.ShowPoints = true;
                this.plotCtrl.RefreshPlot();
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        private PlotData ConvertToPlotData(CurveFamilyF curves)
        {
            PlotData plotData = new PlotData();

            plotData.Name = "Process";

            CurveFamilyF[] oldFamilies = new CurveFamilyF[1];
            oldFamilies[0] = curves;
            CurveFamily[] newFamilies = UI.ConvertCurveFamilies(oldFamilies, this.xPlotVariable.Variable.Type, this.yPlotVariable.Variable.Type);

            // add the new families to the PlotData
            plotData.CurveFamilies = newFamilies;
            return(plotData);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public CurveFamilyF GetCurveFamily(string name)
        {
            CurveFamilyF curveFamily = null;

            for (int i = 0; i < curveFamilies.Length; i++)
            {
                curveFamily = curveFamilies[i];
                if (curveFamily.Name.Equals(name))
                {
                    break;
                }
            }
            return(curveFamily);
        }
Exemplo n.º 7
0
        private void GenerateProcessCurves()
        {
            double enthalpy = inputStream.SpecificEnthalpy.Value;

            PointF[] dataPoints = { new PointF((float)inputStream.Temperature.Value,  (float)inputStream.Humidity.Value),
                                    new PointF((float)outputStream.Temperature.Value, (float)outputStream.Humidity.Value) };
            enthalpy = inputStream.SpecificEnthalpy.Value;
            CurveF[] curves = { new CurveF("Iso-Enthalpy", (float)enthalpy, dataPoints) };
            if (curveFamily == null)
            {
                curveFamily = new CurveFamilyF("Adiabatic Saturation", PhysicalQuantity.Temperature, curves);
            }
            else
            {
                curveFamily.Curves = curves;
            }
        }
Exemplo n.º 8
0
        private PlotData ConvertToPlotData(Plot2D p2d)
        {
            PhysicalQuantity xPhysicalQuantity = p2d.PlotVariableX.Variable.Type;
            PhysicalQuantity yPhysicalQuantity = p2d.PlotVariableY.Variable.Type;

            if (p2d.CurveFamily.Name == null)
            {
                p2d.CurveFamily.Name = p2d.Name;
            }

            PlotData plotData = new PlotData();

            plotData.Name = p2d.Name;
            CurveFamilyF[] oldFamilies = new CurveFamilyF[1];
            oldFamilies[0] = p2d.CurveFamily;
            CurveFamily[] newFamilies = UI.ConvertCurveFamilies(oldFamilies, xPhysicalQuantity, yPhysicalQuantity);
            plotData.CurveFamilies = newFamilies;
            return(plotData);
        }