/// <summary> /// Calculate all properties for the mixture [IP Units] /// </summary> /// <param name="p1">First PsychrometricPoint [IP Units] for mixture.</param> /// <param name="p2">Second PsychrometricPoint [IP Units] for mixture.</param> private void CalcMixture(PsychrometricPointIP p1, PsychrometricPointIP p2) { // Check for invalid values if (p1.VolumetricFlowRateInCFM <= 0 || p2.VolumetricFlowRateInCFM <= 0) { throw new VolumeCannotBeZero(); } else if (p1.MassicFlowInPoundsPerMinute <= 0 || p2.MassicFlowInPoundsPerMinute <= 0) { throw new MassCannotBeZero(); } // Add Flow Rates to get total flow rate double totalFlowRate = p1.VolumetricFlowRateInCFM + p2.VolumetricFlowRateInCFM; this._flowRate = totalFlowRate; // Assign altitude from point 1. this._alt = p1.AltitudeInFeet; // Calculate Dry-Bulb Temperature of the mix double Db = GenericMassRatio(p1.DryBulbTemperatureInDegF, p1.MassicFlowInPoundsPerMinute, p2.DryBulbTemperatureInDegF, p2.MassicFlowInPoundsPerMinute); // Calculate Wet-Bulb Temperature of the mix double Wb = GenericMassRatio(p1.WetBulbTemperatureInDegF, p1.MassicFlowInPoundsPerMinute, p2.WetBulbTemperatureInDegF, p2.MassicFlowInPoundsPerMinute); // Calculate the mix's properties this.CalcAllUsingDbWb(Db, Wb); }
private void tabPanel3_btnCalc_Click(object sender, EventArgs e) { // Collect input data double altitude = double.Parse(tabPanel3_txtAltitude.Text); double Db = double.Parse(tabPanel3_txtDb.Text); double Td = double.Parse(tabPanel3_txtTd.Text); // Decide if IP or SI if (checkBox1.Checked == false) { // IP units PsychrometricPointIP p1 = new PsychrometricPointIP(altitude); p1.CalcAllUsingDbTd(Db, Td); tabPanel3_txtWb.Text = p1.WetBulbTemperatureInDegF.ToString(); tabPanel3_txtRH.Text = p1.RelativeHumidityPercentage.ToString(); tabPanel3_txtW.Text = p1.HumidityRatioInPoundsPerPound.ToString(); tabPanel3_txtWgrains.Text = p1.HumidityRatioGrainsPerPound.ToString(); tabPanel3_txtV.Text = p1.SpecificVolumeInCubicFeetPerPound.ToString(); tabPanel3_txtH.Text = p1.EnthalpyInBtuPerPound.ToString(); tabPanel3_txtP.Text = p1.AtmosphericPressurePsia.ToString(); } else if (checkBox1.Checked == true) { // SI units PsychrometricPointSI p2 = new PsychrometricPointSI(altitude); p2.CalcAllUsingDbTd(Db, Td); tabPanel3_txtWb.Text = p2.WetBulbTemperature.ToString(); tabPanel3_txtRH.Text = p2.RelativeHumidityPercentage.ToString(); tabPanel3_txtW.Text = p2.HumidityRatio.ToString(); tabPanel3_txtWgrains.Text = p2.HumidityRatioGramsPerKilogram.ToString(); tabPanel3_txtV.Text = p2.SpecificVolume.ToString(); tabPanel3_txtH.Text = p2.Enthalpy.ToString(); tabPanel3_txtP.Text = p2.AtmosphericPressureKPa.ToString(); } }
/// <summary> /// Create an air mixture using two PsychrometricPoints [IP Units] and calculate /// the results. /// </summary> /// <param name="p1">First PsychrometricPoint [IP Units] for mixture.</param> /// <param name="p2">Second PsychrometricPoint [IP Units] for mixture.</param> public PsychrometricAirMixtureIP(PsychrometricPointIP p1, PsychrometricPointIP p2) { CalcMixture(p1, p2); }
private void button1_Click(object sender, EventArgs e) { // Collect Input Data double point1_Db = double.Parse(point1_txtDb.Text); double point1_Wb = double.Parse(point1_txtWb.Text); double point1_Flow = double.Parse(point1_txtFlowRate.Text); double altitude = double.Parse(point1_txtAltitude.Text); double point2_Db = double.Parse(point2_txtDb.Text); double point2_Wb = double.Parse(point2_txtWb.Text); double point2_Flow = double.Parse(point2_txtFlowRate.Text); // Decide if IP or SI if (checkBox1.Checked == false) { // IP Units // Create two psychrometric points PsychrometricPointIP p1 = new PsychrometricPointIP(altitude, point1_Flow); p1.CalcAllUsingDbWb(point1_Db, point1_Wb); PsychrometricPointIP p2 = new PsychrometricPointIP(altitude, point2_Flow); p2.CalcAllUsingDbWb(point2_Db, point2_Wb); // Create the psychrometric mix point PsychrometricAirMixtureIP mix = new PsychrometricAirMixtureIP(p1, p2); // Fill text boxes mix_txtDb.Text = mix.DryBulbTemperatureInDegF.ToString(); mix_txtWb.Text = mix.WetBulbTemperatureInDegF.ToString(); mix_txtRH.Text = mix.RelativeHumidityPercentage.ToString(); mix_txtTd.Text = mix.DewPointTemperatureInDegF.ToString(); mix_txtW.Text = mix.HumidityRatioInPoundsPerPound.ToString(); mix_txtWgrains.Text = mix.HumidityRatioGrainsPerPound.ToString(); mix_txtV.Text = mix.SpecificVolumeInCubicFeetPerPound.ToString(); mix_txtH.Text = mix.EnthalpyInBtuPerPound.ToString(); mix_txtP.Text = mix.AtmosphericPressurePsia.ToString(); } else if (checkBox1.Checked == true) { // SI Units // Create two psychrometric points PsychrometricPointSI p1 = new PsychrometricPointSI(altitude, point1_Flow); p1.CalcAllUsingDbWb(point1_Db, point1_Wb); PsychrometricPointSI p2 = new PsychrometricPointSI(altitude, point2_Flow); p2.CalcAllUsingDbWb(point2_Db, point2_Wb); // Create psychrometric mix point PsychrometricAirMixtureSI mix = new PsychrometricAirMixtureSI(p1, p2); // Fill text boxes mix_txtDb.Text = mix.DryBulbTemperature.ToString(); mix_txtWb.Text = mix.WetBulbTemperature.ToString(); mix_txtRH.Text = mix.RelativeHumidityPercentage.ToString(); mix_txtTd.Text = mix.DewPointTemperature.ToString(); mix_txtW.Text = mix.HumidityRatio.ToString(); mix_txtWgrains.Text = mix.HumidityRatioGramsPerKilogram.ToString(); mix_txtV.Text = mix.SpecificVolume.ToString(); mix_txtH.Text = mix.Enthalpy.ToString(); mix_txtP.Text = mix.AtmosphericPressureKPa.ToString(); } }