LBL logo

Buildings.Media.Specialized.Water.Examples

Collection of models that test the water models

Information

This package contains examples that test the media packages in Buildings.Media.Water.

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

Package Content

Name Description
Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityDerivativeCheck TemperatureDependentDensityDerivativeCheck Model that tests the derivative implementation
Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityProperties TemperatureDependentDensityProperties Model that tests the implementation of the fluid properties
Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTemperatureEnthalpyInversion TemperatureDependentDensityTemperatureEnthalpyInversion Model to check computation of h(T) and its inverse
Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTestImplementation TemperatureDependentDensityTestImplementation Model that tests the medium implementation

Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityDerivativeCheck Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityDerivativeCheck

Model that tests the derivative implementation

Information

This example checks whether the function derivative is implemented correctly. If the derivative implementation is not correct, the model will stop with an assert statement.

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

Modelica definition

model TemperatureDependentDensityDerivativeCheck "Model that tests the derivative implementation" extends Modelica.Icons.Example; package Medium = Buildings.Media.Specialized.Water.TemperatureDependentDensity "Medium model"; Modelica.SIunits.SpecificEnthalpy hLiqSym "Liquid phase enthalpy"; Modelica.SIunits.SpecificEnthalpy hLiqCod "Liquid phase enthalpy"; Modelica.SIunits.SpecificHeatCapacity cpSym "Specific heat capacity"; Modelica.SIunits.SpecificHeatCapacity cpCod "Specific heat capacity"; Modelica.SIunits.SpecificHeatCapacity cvSym "Specific heat capacity"; Modelica.SIunits.SpecificHeatCapacity cvCod "Specific heat capacity"; constant Real conv(unit="K/s") = 1 "Conversion factor to satisfy unit check"; initial equation hLiqSym = hLiqCod; cpSym = cpCod; cvSym = cvCod; equation hLiqCod=Medium.enthalpyOfLiquid(conv*time); der(hLiqCod)=der(hLiqSym); assert(abs(hLiqCod-hLiqSym) < 1E-2, "Model has an error"); cpCod=Medium.specificHeatCapacityCp( Medium.setState_pTX( p=1e5, T=conv*time, X={0.1})); der(cpCod)=der(cpSym); assert(abs(cpCod-cpSym) < 1E-2, "Model has an error"); cvCod=Medium.specificHeatCapacityCv( Medium.setState_pTX( p=1e5, T=conv*time, X={0.1})); der(cvCod)=der(cvSym); assert(abs(cvCod-cvSym) < 1E-2, "Model has an error"); end TemperatureDependentDensityDerivativeCheck;

Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityProperties Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityProperties

Model that tests the implementation of the fluid properties

Information

This example checks thermophysical properties of the medium.

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Media.Examples.BaseClasses.FluidProperties (Model that tests the implementation of the fluid properties).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMedium 
TemperatureTMin273.15Minimum temperature for the simulation [K]
TemperatureTMax373.15Maximum temperature for the simulation [K]
PressurepMedium.p_defaultPressure [Pa]
MassFractionX[Medium.nX]Medium.X_defaultMass fraction [1]

Connectors

TypeNameDescription
replaceable package Medium 

Modelica definition

model TemperatureDependentDensityProperties "Model that tests the implementation of the fluid properties" extends Modelica.Icons.Example; extends Buildings.Media.Examples.BaseClasses.FluidProperties( redeclare package Medium = Buildings.Media.Specialized.Water.TemperatureDependentDensity, TMin=273.15, TMax=373.15); equation // Check the implementation of the base properties basPro.state.p=p; basPro.state.T=T; end TemperatureDependentDensityProperties;

Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTemperatureEnthalpyInversion Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTemperatureEnthalpyInversion

Model to check computation of h(T) and its inverse

Information

This model tests whether the inversion of temperature and enthalpy is implemented correctly. If T ≠ T(h(T)), the model stops with an error.

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Media.Examples.BaseClasses.TestTemperatureEnthalpyInversion (Model to check computation of h(T) and its inverse).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialCondensingGases 
TemperatureT0273.15 + 20Temperature [K]

Connectors

TypeNameDescription
replaceable package Medium 

Modelica definition

model TemperatureDependentDensityTemperatureEnthalpyInversion "Model to check computation of h(T) and its inverse" extends Modelica.Icons.Example; extends Buildings.Media.Examples.BaseClasses.TestTemperatureEnthalpyInversion ( redeclare package Medium = Buildings.Media.Specialized.Water.TemperatureDependentDensity); end TemperatureDependentDensityTemperatureEnthalpyInversion;

Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTestImplementation Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTestImplementation

Model that tests the medium implementation

Buildings.Media.Specialized.Water.Examples.TemperatureDependentDensityTestImplementation

Information

This is a simple test for the medium model. It uses the test model described in Modelica.Media.UsersGuide.MediumDefinition.TestOfMedium.

Extends from Modelica.Icons.Example (Icon for runnable examples), Modelica.Media.Examples.Tests.Components.PartialTestModel (Basic test model to test a medium).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium model
AbsolutePressurep_startMedium.p_defaultInitial value of pressure [Pa]
TemperatureT_startMedium.T_defaultInitial value of temperature [K]
SpecificEnthalpyh_startMedium.h_defaultInitial value of specific enthalpy [J/kg]
RealX_start[Medium.nX]Medium.X_defaultInitial value of mass fractions

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model TemperatureDependentDensityTestImplementation "Model that tests the medium implementation" extends Modelica.Icons.Example; extends Modelica.Media.Examples.Tests.Components.PartialTestModel( redeclare package Medium = Buildings.Media.Specialized.Water.TemperatureDependentDensity); end TemperatureDependentDensityTestImplementation;

Automatically generated Mon May 4 10:23:24 2015.