This package contains examples for the use of models that can be found in Buildings.Utilities.Psychrometrics.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Name | Description |
---|---|
DewPointTemperature | Unit test for dew point temperature calculation |
HumidityRatioPressure | Unit test for humidity ratio model |
MassFraction_pTphi | Unit test for dew point temperature calculation |
TotalAirDryAir | Unit test for conversion of humidity per total air and dry air mass |
TWetBul_TDryBulXi |
model DewPointTemperature "Unit test for dew point temperature calculation" extends Modelica.Icons.Example; package Medium = Buildings.Media.PerfectGases.MoistAir "Medium model";Buildings.Utilities.Psychrometrics.pW_TDewPoi watVapPre; Modelica.Blocks.Sources.Ramp XHum( duration=1, height=(0.01 - 0.1), offset=0.1) "Humidity concentration"; Buildings.Utilities.Psychrometrics.pW_X humRat( use_p_in=false); Buildings.Utilities.Psychrometrics.TDewPoi_pW TDewPoi; equationconnect(XHum.y, humRat.X_w); connect(humRat.p_w, TDewPoi.p_w); connect(TDewPoi.T, watVapPre.T); end DewPointTemperature;
model HumidityRatioPressure "Unit test for humidity ratio model" extends Modelica.Icons.Example; package Medium = Buildings.Media.PerfectGases.MoistAir "Medium model";Buildings.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"; Buildings.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; equationconnect(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;
model MassFraction_pTphi "Unit test for dew point temperature calculation" extends Modelica.Icons.Example; package Medium1 = Buildings.Media.PerfectGases.MoistAir "Medium model"; package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAir "Medium model";Modelica.Blocks.Sources.Ramp Phi( offset=0, duration=0.5, height=1) "Relative humidity"; Buildings.Utilities.Psychrometrics.X_pTphi masFra1( redeclare package Medium = Medium1) "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"; Buildings.Utilities.Psychrometrics.X_pTphi masFra2( redeclare package Medium = Medium2, use_p_in=false) "Mass fraction computation"; equationconnect(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;
model TotalAirDryAir "Unit test for conversion of humidity per total air and dry air mass" extends Modelica.Icons.Example; package Medium = Buildings.Media.PerfectGases.MoistAir "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"; equationconnect(toTotalAir.XiDry, XHum.y); connect(toTotalAir.XiTotalAir, toDryAir.XiTotalAir); connect(toDryAir.XiDry, assertEquality.u1); connect(assertEquality.u2, XHum.y); end TotalAirDryAir;
Extends from Modelica.Icons.Example (Icon for runnable examples).
model TWetBul_TDryBulXi extends Modelica.Icons.Example; package Medium = Buildings.Media.PerfectGases.MoistAir "Medium model";Modelica.Blocks.Sources.Ramp TDryBul( height=10, duration=1, offset=273.15 + 30) "Dry bulb temperature"; Buildings.Utilities.Diagnostics.AssertEquality assertEquality(startTime=0, threShold=0.05); Modelica.Blocks.Sources.Constant TWetBulExp(k=273.15 + 25) "Expected wet bulb temperature"; Buildings.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"; equationconnect(TWetBulExp.y, assertEquality.u2); connect(p.y, wetBul.p); connect(XHum.y, wetBul.Xi[1]); connect(TDryBul.y, wetBul.TDryBul); connect(wetBul.TWetBul, assertEquality.u1); end TWetBul_TDryBulXi;