WFA_psychometric_chart.Form_Psychrometric_Calculator.CalculatePsymetric C# (CSharp) Method

CalculatePsymetric() public method

public CalculatePsymetric ( double temp, double hum, double pressure ) : void
temp double
hum double
pressure double
return void
        public void CalculatePsymetric(double temp, double hum,double pressure)
        {
            //Contains the formula of the converstion
            //lets grab from the textbox input.
            double temperature = Double.Parse(textBox1.Text.Trim());
            double humidity = Double.Parse(textBox2.Text.Trim());

            double Patm = pressure;

            double A = 6.116441;
            double m = 7.591386;
            double Tn = 240.7263;
            double B = 621.9907;

            //calculating 1.dew point..
            double TDewpoint = 243.04 * (Math.Log(humidity / 100) + ((17.625 * temperature) / (243.04 + temperature))) / (17.625 - Math.Log(humidity / 100) - ((17.625 * temperature) / (243.04 + temperature)));
            //setting to textbox4 its a dew point.
            // textBox4.Text = Convert.ToString(TDewpoint);
            //2.Partial pressure of saturation.

            double Pws = A * Math.Pow(10, (m * TDewpoint) / (TDewpoint + Tn));
               //textBox8.Text = Convert.ToString(Pws);

            double X = B * Pws / (Patm - Pws);
              //   textBox10.Text = Convert.ToString(X);

            double h = temperature * (1.01 + (0.00189 * X)) + 2.5 * X;
            // textBox11.Text = Convert.ToString(h);

            output_dew_point = TDewpoint;
            output_partial_pressure_of_water = Pws;
            output_mixing_ratio = X;
            output_enthalpy = h;
            output_mol_mass_of_water = B;//this value is in g/kg
        }