Buildings.Utilities.Psychrometrics.Functions.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 Buildings.Utilities.Psychrometrics.Functions.

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

Package Content

Name Description
Buildings.Utilities.Psychrometrics.Functions.Examples.Density_pTX Density_pTX Model to test density_pTX
Buildings.Utilities.Psychrometrics.Functions.Examples.SaturationPressure SaturationPressure Model to test the saturationPressure function
Buildings.Utilities.Psychrometrics.Functions.Examples.X_pSatpphi X_pSatpphi Model to test X_pSatpphi function
Buildings.Utilities.Psychrometrics.Functions.Examples.pW_TDewPoi pW_TDewPoi Model to test pW_TDewPoi and its inverse function
Buildings.Utilities.Psychrometrics.Functions.Examples.pW_TDewPoi_comparison pW_TDewPoi_comparison Model to test the approximation for pW_TDewPoi and its inverse function
Buildings.Utilities.Psychrometrics.Functions.Examples.pW_X pW_X Model to test pW_X and its inverse function
Buildings.Utilities.Psychrometrics.Functions.Examples.phi_pTX phi_pTX Model to test phi_pTX

Buildings.Utilities.Psychrometrics.Functions.Examples.Density_pTX Buildings.Utilities.Psychrometrics.Functions.Examples.Density_pTX

Model to test density_pTX

Information

Model that tests the implementation of Buildings.Utilities.Psychrometrics.Functions.density_pTX.

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

Parameters

TypeNameDefaultDescription
Pressurep101325Pressure of the medium [Pa]

Modelica definition

model Density_pTX "Model to test density_pTX" extends Modelica.Icons.Example; parameter Modelica.SIunits.Pressure p = 101325 "Pressure of the medium"; Modelica.SIunits.Temperature T "Temperature"; Modelica.SIunits.MassFraction X_w "Mass fraction"; Modelica.SIunits.Density d "Mass density"; constant Real convT(unit="1/s") = 0.999 "Conversion factor"; constant Real convX(unit="1/s") = 0.02 "Conversion factor"; equation if time < 0.5 then X_w = convX*time; T = 293.15; else X_w = 0.5*convX; T = 293.15+convT*(time-0.5)*10; end if; d = Buildings.Utilities.Psychrometrics.Functions.density_pTX(p=p, T=T, X_w=X_w); end Density_pTX;

Buildings.Utilities.Psychrometrics.Functions.Examples.SaturationPressure Buildings.Utilities.Psychrometrics.Functions.Examples.SaturationPressure

Model to test the saturationPressure function

Information

This example computes the saturation pressure of water.

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

Parameters

TypeNameDefaultDescription
TemperatureTMin190Temperature [K]
TemperatureTMax373.16Temperature [K]

Modelica definition

model SaturationPressure "Model to test the saturationPressure function" extends Modelica.Icons.Example; parameter Modelica.SIunits.Temperature TMin = 190 "Temperature"; parameter Modelica.SIunits.Temperature TMax = 373.16 "Temperature"; Modelica.SIunits.Temperature T "Temperature"; Modelica.SIunits.AbsolutePressure pSat "Saturation pressure"; constant Real conv(unit="1/s") = 1 "Conversion factor"; equation T = TMin + conv*time * (TMax-TMin); pSat = Buildings.Utilities.Psychrometrics.Functions.saturationPressure(T); end SaturationPressure;

Buildings.Utilities.Psychrometrics.Functions.Examples.X_pSatpphi Buildings.Utilities.Psychrometrics.Functions.Examples.X_pSatpphi

Model to test X_pSatpphi function

Information

This example computes the water content of air for a relative humidity between 0 and 100%, a temperature of 20ˆC and atmospheric pressure.

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

Parameters

TypeNameDefaultDescription
TemperatureT293.15Temperature [K]
Pressurep101325Pressure of the fluid [Pa]

Modelica definition

model X_pSatpphi "Model to test X_pSatpphi function" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; parameter Modelica.SIunits.Temperature T = 293.15 "Temperature"; parameter Modelica.SIunits.Pressure p = 101325 "Pressure of the fluid"; Modelica.SIunits.AbsolutePressure pSat "Saturation pressure"; Real phi(min=0, max=1) "Relative humidity"; Modelica.SIunits.MassFraction X_w( min=0, max=1, nominal=0.01) "Water vapor concentration per total mass of air"; constant Real conv(unit="1/s") = 1 "Conversion factor"; equation phi = time*conv; pSat = Medium.saturationPressure(T); X_w = Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi(pSat=pSat, p=p, phi=phi); end X_pSatpphi;

Buildings.Utilities.Psychrometrics.Functions.Examples.pW_TDewPoi Buildings.Utilities.Psychrometrics.Functions.Examples.pW_TDewPoi

Model to test pW_TDewPoi and its inverse function

Information

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

Modelica definition

model pW_TDewPoi "Model to test pW_TDewPoi and its inverse function" extends Modelica.Icons.Example; Modelica.SIunits.Temperature T "Dew point temperature"; Modelica.SIunits.Temperature TInv "Dew point temperature"; Modelica.SIunits.TemperatureDifference dT "Difference between temperatures"; Modelica.SIunits.Pressure p_w "Water vapor partial pressure"; constant Real conv(unit="K/s") = 100 "Conversion factor"; equation T = conv*time + 273.15; p_w = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi(T); TInv = Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW(p_w); dT = T - TInv; assert(abs(dT) < 10E-12, "Error in function implementation."); end pW_TDewPoi;

Buildings.Utilities.Psychrometrics.Functions.Examples.pW_TDewPoi_comparison Buildings.Utilities.Psychrometrics.Functions.Examples.pW_TDewPoi_comparison

Model to test the approximation for pW_TDewPoi and its inverse function

Information

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

Modelica definition

model pW_TDewPoi_comparison "Model to test the approximation for pW_TDewPoi and its inverse function" extends Modelica.Icons.Example; Modelica.SIunits.Temperature T "Dew point temperature"; Modelica.SIunits.Temperature TInv "Dew point temperature"; Modelica.SIunits.TemperatureDifference dT "Difference between temperatures"; Modelica.SIunits.Pressure p_w_ashrae "Water vapor partial pressure according to the ASHRAE handbook"; Modelica.SIunits.Pressure p_w "Water vapor partial pressure"; constant Real conv(unit="K/s") = 30 "Conversion factor"; Real r_p "Ratio of the two approximations"; equation T = conv*time + 273.15; p_w_ashrae = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi(T); p_w = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb(T); r_p = p_w_ashrae/p_w; p_w = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb(TInv); dT = T - TInv; assert(abs(dT) < 10E-12, "Error in function implementation."); end pW_TDewPoi_comparison;

Buildings.Utilities.Psychrometrics.Functions.Examples.pW_X Buildings.Utilities.Psychrometrics.Functions.Examples.pW_X

Model to test pW_X and its inverse function

Information

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

Modelica definition

model pW_X "Model to test pW_X and its inverse function" extends Modelica.Icons.Example; Modelica.SIunits.MassFraction X "Mass fraction"; Modelica.SIunits.MassFraction XInv "Mass fraction"; Modelica.SIunits.MassFraction dX "Difference between mass fraction"; Modelica.SIunits.Pressure p_w "Water vapor partial pressure"; constant Real conv(unit="1/s") = 0.999 "Conversion factor"; equation X = conv*time; p_w = Buildings.Utilities.Psychrometrics.Functions.pW_X(X); XInv = Buildings.Utilities.Psychrometrics.Functions.X_pW(p_w); dX = X - XInv; assert(abs(dX) < 10E-12, "Error in function implementation."); end pW_X;

Buildings.Utilities.Psychrometrics.Functions.Examples.phi_pTX Buildings.Utilities.Psychrometrics.Functions.Examples.phi_pTX

Model to test phi_pTX

Information

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

Parameters

TypeNameDefaultDescription
Pressurep101325Pressure of the medium [Pa]

Modelica definition

model phi_pTX "Model to test phi_pTX" extends Modelica.Icons.Example; parameter Modelica.SIunits.Pressure p = 101325 "Pressure of the medium"; Modelica.SIunits.Temperature T "Temperature"; Modelica.SIunits.MassFraction X_w "Mass fraction"; Real phi "Relative humidity"; constant Real convT(unit="1/s") = 0.999 "Conversion factor"; constant Real convX(unit="1/s") = 0.02 "Conversion factor"; equation if time < 0.5 then X_w = convX*time; T = 293.15; else X_w = 0.5*convX; T = 293.15+convT*(time-0.5)*10; end if; phi = Buildings.Utilities.Psychrometrics.Functions.phi_pTX(p=p, T=T, X_w=X_w); end phi_pTX;