IEA EBC Annex 60 EBC logo

Annex60.Utilities.Psychrometrics.Examples

Collection of models that illustrate model use and test models

Information

This package contains examples for the use of models that can be found in Annex60.Utilities.Psychrometrics.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Annex60.Utilities.Psychrometrics.Examples.Density_pTX Density_pTX Model to test the density computation
Annex60.Utilities.Psychrometrics.Examples.DewPointTemperature DewPointTemperature Unit test for dew point temperature calculation
Annex60.Utilities.Psychrometrics.Examples.HumidityRatioPressure HumidityRatioPressure Unit test for humidity ratio model
Annex60.Utilities.Psychrometrics.Examples.MassFraction_pTphi MassFraction_pTphi Unit test for dew point temperature calculation
Annex60.Utilities.Psychrometrics.Examples.Phi_pTX Phi_pTX Model to test the relative humidity computation
Annex60.Utilities.Psychrometrics.Examples.SaturationPressure SaturationPressure Model to test the wet bulb temperature computation
Annex60.Utilities.Psychrometrics.Examples.SaturationPressureLiquid SaturationPressureLiquid Model to test the wet bulb temperature computation
Annex60.Utilities.Psychrometrics.Examples.SublimationPressureIce SublimationPressureIce Model to test the wet bulb temperature computation
Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi TWetBul_TDryBulPhi Model to test the wet bulb temperature computation
Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulXi TWetBul_TDryBulXi  
Annex60.Utilities.Psychrometrics.Examples.TotalAirDryAir TotalAirDryAir Unit test for conversion of humidity per total air and dry air mass

Annex60.Utilities.Psychrometrics.Examples.Density_pTX Annex60.Utilities.Psychrometrics.Examples.Density_pTX

Model to test the density computation

Annex60.Utilities.Psychrometrics.Examples.Density_pTX

Information

This examples is a unit test for the density computation.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model Density_pTX "Model to test the density computation" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Modelica.Blocks.Sources.Constant p(k=101325) "Pressure"; Modelica.Blocks.Sources.Ramp XDryBul( height=0.014, offset=0, duration=0.5) "Dry bulb water vapor mass fraction"; Annex60.Utilities.Psychrometrics.Density_pTX den "Density"; Modelica.Blocks.Sources.Ramp TDryBul( duration=0.5, startTime=0.5, height=-10, offset=303.15) "Dry bulb temperature"; equation connect(XDryBul.y, den.X_w); connect(den.p, p.y); connect(TDryBul.y, den.T); end Density_pTX;

Annex60.Utilities.Psychrometrics.Examples.DewPointTemperature Annex60.Utilities.Psychrometrics.Examples.DewPointTemperature

Unit test for dew point temperature calculation

Annex60.Utilities.Psychrometrics.Examples.DewPointTemperature

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model DewPointTemperature "Unit test for dew point temperature calculation" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Annex60.Utilities.Psychrometrics.pW_TDewPoi watVapPre; Modelica.Blocks.Sources.Ramp XHum( duration=1, height=(0.01 - 0.1), offset=0.1) "Humidity concentration"; Annex60.Utilities.Psychrometrics.pW_X humRat( use_p_in=false); Annex60.Utilities.Psychrometrics.TDewPoi_pW TDewPoi; equation connect(XHum.y, humRat.X_w); connect(humRat.p_w, TDewPoi.p_w); connect(TDewPoi.T, watVapPre.T); end DewPointTemperature;

Annex60.Utilities.Psychrometrics.Examples.HumidityRatioPressure Annex60.Utilities.Psychrometrics.Examples.HumidityRatioPressure

Unit test for humidity ratio model

Annex60.Utilities.Psychrometrics.Examples.HumidityRatioPressure

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model HumidityRatioPressure "Unit test for humidity ratio model" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Annex60.Utilities.Psychrometrics.pW_X vapPre( use_p_in=true) "Model for humidity ratio"; Modelica.Blocks.Sources.Ramp XHumDryAir( duration=1, height=(0.0133 - 0.2), offset=0.2) "Humidity concentration in [kg/kg dry air]"; Modelica.Blocks.Sources.Constant p(k=101325) "Pressure"; Annex60.Utilities.Psychrometrics.X_pW humRat( use_p_in=true); Diagnostics.AssertEquality assertEquality(threShold=1E-5) "Checks that model and its inverse implementation are correct"; ToTotalAir toTotalAir; equation connect(vapPre.p_w, humRat.p_w); connect(humRat.X_w, assertEquality.u1); connect(p.y, humRat.p_in); connect(p.y, vapPre.p_in); connect(XHumDryAir.y, toTotalAir.XiDry); connect(toTotalAir.XiTotalAir, vapPre.X_w); connect(toTotalAir.XiTotalAir, assertEquality.u2); end HumidityRatioPressure;

Annex60.Utilities.Psychrometrics.Examples.MassFraction_pTphi Annex60.Utilities.Psychrometrics.Examples.MassFraction_pTphi

Unit test for dew point temperature calculation

Annex60.Utilities.Psychrometrics.Examples.MassFraction_pTphi

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MassFraction_pTphi "Unit test for dew point temperature calculation" extends Modelica.Icons.Example; package Medium1 = Annex60.Media.Air "Medium model"; package Medium2 = Annex60.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp Phi( offset=0, duration=0.5, height=1) "Relative humidity"; Annex60.Utilities.Psychrometrics.X_pTphi masFra1 "Mass fraction computation"; Modelica.Blocks.Sources.Ramp T( height=10, offset=283.15, duration=0.5, startTime=0.5) "Temperature"; Modelica.Blocks.Sources.Constant P(k=101325) "Pressure"; Annex60.Utilities.Psychrometrics.X_pTphi masFra2(use_p_in=false) "Mass fraction computation"; equation connect(T.y, masFra1.T); connect(Phi.y, masFra1.phi); connect(T.y, masFra2.T); connect(Phi.y, masFra2.phi); connect(P.y, masFra1.p_in); end MassFraction_pTphi;

Annex60.Utilities.Psychrometrics.Examples.Phi_pTX Annex60.Utilities.Psychrometrics.Examples.Phi_pTX

Model to test the relative humidity computation

Annex60.Utilities.Psychrometrics.Examples.Phi_pTX

Information

This examples is a unit test for the relative humidity computation.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model Phi_pTX "Model to test the relative humidity computation" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Modelica.Blocks.Sources.Constant p(k=101325) "Pressure"; Modelica.Blocks.Sources.Ramp XDryBul( height=0.014, offset=0, duration=0.5) "Dry bulb water vapor mass fraction"; Annex60.Utilities.Psychrometrics.Phi_pTX phi "Relative humidity"; Modelica.Blocks.Sources.Ramp TDryBul( duration=0.5, startTime=0.5, height=-10, offset=303.15) "Dry bulb temperature"; equation connect(XDryBul.y, phi.X_w); connect(phi.p, p.y); connect(TDryBul.y, phi.T); end Phi_pTX;

Annex60.Utilities.Psychrometrics.Examples.SaturationPressure Annex60.Utilities.Psychrometrics.Examples.SaturationPressure

Model to test the wet bulb temperature computation

Annex60.Utilities.Psychrometrics.Examples.SaturationPressure

Information

This examples is a unit test for the saturation pressure computation.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SaturationPressure "Model to test the wet bulb temperature computation" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Annex60.Utilities.Psychrometrics.SaturationPressure pSat "Saturation pressure"; Modelica.Blocks.Sources.Ramp T( height=373.15 - 190, duration=1, offset=190) "Temperature"; equation connect(T.y, pSat.TSat); end SaturationPressure;

Annex60.Utilities.Psychrometrics.Examples.SaturationPressureLiquid Annex60.Utilities.Psychrometrics.Examples.SaturationPressureLiquid

Model to test the wet bulb temperature computation

Annex60.Utilities.Psychrometrics.Examples.SaturationPressureLiquid

Information

This examples is a unit test for the saturation pressure computation of liquid water.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SaturationPressureLiquid "Model to test the wet bulb temperature computation" extends Modelica.Icons.Example; Annex60.Utilities.Psychrometrics.SaturationPressureLiquid pSat "Saturation pressure"; Modelica.Blocks.Sources.Ramp T( height=100, duration=1, offset=273.15) "Temperature"; equation connect(T.y, pSat.TSat); end SaturationPressureLiquid;

Annex60.Utilities.Psychrometrics.Examples.SublimationPressureIce Annex60.Utilities.Psychrometrics.Examples.SublimationPressureIce

Model to test the wet bulb temperature computation

Annex60.Utilities.Psychrometrics.Examples.SublimationPressureIce

Information

This examples is a unit test for the sublimation pressure computation of ice.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SublimationPressureIce "Model to test the wet bulb temperature computation" extends Modelica.Icons.Example; Annex60.Utilities.Psychrometrics.SublimationPressureIce pSat "Saturation pressure"; Modelica.Blocks.Sources.Ramp T( height=273.15 - 190, duration=1, offset=190) "Temperature"; equation connect(T.y, pSat.TSat); end SublimationPressureIce;

Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi

Model to test the wet bulb temperature computation

Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi

Information

This examples is a unit test for the wet bulb computation. The model on the top uses the accurate computation of the wet bulb temperature, whereas the model below uses the approximate computation of the wet bulb temperature.

The model contains an assert that validates the model based on a single operating point from Example 17.1 in Ananthanarayanan (2013).

References

Ananthanarayanan, P. N. Basic refrigeration and air conditioning. Tata McGraw-Hill Education, 2013.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model TWetBul_TDryBulPhi "Model to test the wet bulb temperature computation" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Annex60.Utilities.Psychrometrics.TWetBul_TDryBulPhi wetBulPhi( redeclare package Medium = Medium) "Model for wet bulb temperature"; Modelica.Blocks.Sources.Constant p(k=101325) "Pressure"; Modelica.Blocks.Sources.Ramp phi( duration=1, height=1, offset=0) "Relative humidity"; Modelica.Blocks.Sources.Constant TDryBul(k=273.15 + 29.4) "Dry bulb temperature"; Annex60.Utilities.Psychrometrics.TWetBul_TDryBulPhi wetBulPhiApp( redeclare package Medium = Medium, approximateWetBulb=true) "Model for wet bulb temperature"; Annex60.Utilities.Psychrometrics.TWetBul_TDryBulXi wetBulXi( redeclare package Medium = Medium) "Model for wet bulb temperature using Xi as an input, used to verify consistency with wetBulPhi"; Annex60.Utilities.Psychrometrics.X_pTphi x_pTphi "Computes mass fraction"; protected block Assertions extends Modelica.Blocks.Icons.Block; constant Modelica.SIunits.Temperature dT_max=0.1 "Maximum allowed deviation with reference result"; Modelica.Blocks.Interfaces.RealInput phi "Relative humidity"; Modelica.Blocks.Interfaces.RealInput wetBulPhi_TWetBul "Wet bulb temperature from wetBulPhi_phi"; Modelica.Blocks.Interfaces.RealInput wetBulXi_TWetBul "Wet bulb temperature from wetBulXi_phi"; equation // Validation of one data point based on example 17.1 in // Ananthanarayanan, P. N. Basic refrigeration and air conditioning. Tata McGraw-Hill Education, 2013. if abs(phi-0.48)<0.001 then assert(abs(wetBulPhi_TWetBul - 21.1-273.15) < dT_max, "Error in computation of wet bulb temperature, deviation with reference result is larger than " + String(dT_max) + " K since the wet bulb temperature equals " +String(wetBulPhi_TWetBul)); end if; assert(abs(wetBulPhi_TWetBul-wetBulXi_TWetBul)<1e-2, "Inconsistent implementation of wetBulPhi and wetBulXi."); end Assertions; Assertions assertions "Verifies that the results are correct"; equation connect(p.y, wetBulPhi.p); connect(TDryBul.y, wetBulPhi.TDryBul); connect(phi.y, wetBulPhi.phi); connect(p.y, wetBulPhiApp.p); connect(TDryBul.y, wetBulPhiApp.TDryBul); connect(phi.y, wetBulPhiApp.phi); connect(wetBulXi.TDryBul, TDryBul.y); connect(wetBulXi.p, p.y); connect(x_pTphi.p_in, p.y); connect(x_pTphi.T, TDryBul.y); connect(x_pTphi.phi, phi.y); connect(x_pTphi.X[1], wetBulXi.Xi[1]); connect(wetBulPhi.TWetBul, assertions.wetBulPhi_TWetBul); connect(wetBulXi.TWetBul, assertions.wetBulXi_TWetBul); connect(assertions.phi, phi.y); end TWetBul_TDryBulPhi;

Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulXi Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulXi


Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulXi

Information

This examples is a unit test for the wet bulb computation. The model on the top uses the accurate computation of the wet bulb temperature, whereas the model below uses the approximate computation of the wet bulb temperature.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model TWetBul_TDryBulXi extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp TDryBul( height=10, duration=1, offset=273.15 + 30) "Dry bulb temperature"; Annex60.Utilities.Psychrometrics.TWetBul_TDryBulXi wetBul( redeclare package Medium = Medium) "Model for wet bulb temperature"; Modelica.Blocks.Sources.Constant p(k=101325) "Pressure"; Modelica.Blocks.Sources.Ramp XHum( duration=1, height=(0.0133 - 0.0175), offset=0.0175) "Humidity concentration"; Annex60.Utilities.Psychrometrics.TWetBul_TDryBulXi wetBulApp(redeclare package Medium = Medium, approximateWetBulb=true) "Model for wet bulb temperature"; equation connect(p.y, wetBul.p); connect(XHum.y, wetBul.Xi[1]); connect(TDryBul.y, wetBul.TDryBul); connect(p.y, wetBulApp.p); connect(XHum.y, wetBulApp.Xi[1]); connect(TDryBul.y, wetBulApp.TDryBul); end TWetBul_TDryBulXi;

Annex60.Utilities.Psychrometrics.Examples.TotalAirDryAir Annex60.Utilities.Psychrometrics.Examples.TotalAirDryAir

Unit test for conversion of humidity per total air and dry air mass

Annex60.Utilities.Psychrometrics.Examples.TotalAirDryAir

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model TotalAirDryAir "Unit test for conversion of humidity per total air and dry air mass" extends Modelica.Icons.Example; package Medium = Annex60.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp XHum( duration=1, height=(0.01 - 0.1), offset=0.1) "Humidity concentration"; ToTotalAir toTotalAir; ToDryAir toDryAir; Diagnostics.AssertEquality assertEquality(threShold=1E-5) "Checks that model and its inverse implementation are correct"; equation connect(toTotalAir.XiDry, XHum.y); connect(toTotalAir.XiTotalAir, toDryAir.XiTotalAir); connect(toDryAir.XiDry, assertEquality.u1); connect(assertEquality.u2, XHum.y); end TotalAirDryAir;

Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi.Assertions Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi.Assertions


Annex60.Utilities.Psychrometrics.Examples.TWetBul_TDryBulPhi.Assertions

Information

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputphiRelative humidity
input RealInputwetBulPhi_TWetBulWet bulb temperature from wetBulPhi_phi
input RealInputwetBulXi_TWetBulWet bulb temperature from wetBulXi_phi

Modelica definition

block Assertions extends Modelica.Blocks.Icons.Block; constant Modelica.SIunits.Temperature dT_max=0.1 "Maximum allowed deviation with reference result"; Modelica.Blocks.Interfaces.RealInput phi "Relative humidity"; Modelica.Blocks.Interfaces.RealInput wetBulPhi_TWetBul "Wet bulb temperature from wetBulPhi_phi"; Modelica.Blocks.Interfaces.RealInput wetBulXi_TWetBul "Wet bulb temperature from wetBulXi_phi"; equation // Validation of one data point based on example 17.1 in // Ananthanarayanan, P. N. Basic refrigeration and air conditioning. Tata McGraw-Hill Education, 2013. if abs(phi-0.48)<0.001 then assert(abs(wetBulPhi_TWetBul - 21.1-273.15) < dT_max, "Error in computation of wet bulb temperature, deviation with reference result is larger than " + String(dT_max) + " K since the wet bulb temperature equals " +String(wetBulPhi_TWetBul)); end if; assert(abs(wetBulPhi_TWetBul-wetBulXi_TWetBul)<1e-2, "Inconsistent implementation of wetBulPhi and wetBulXi."); end Assertions;

http://iea-annex60.org