Buildings.Fluid.BaseClasses.FlowModels.Validation
Collection of validation models
Information
This package contains validation models for the classes in Buildings.Fluid.BaseClasses.FlowModels.
Note that most validation models contain simple input data which may not be realistic, but for which the correct output can be obtained through an analytic solution. The examples plot various outputs, which have been verified against these solutions. These model outputs are stored as reference data and used for continuous validation whenever models in the library change.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
| Name | Description |
|---|---|
| Model that checks the correct implementation of the 1st order derivative of the flow function | |
| Model that checks the correct implementation of the 2nd order derivative of the flow function | |
| Model that checks the correct implementation of the 1st order derivative of the flow function | |
| Model that checks the correct implementation of the 2nd order derivative of the flow function | |
| Test model for flow function and its inverse | |
| Test model for power law flow function and its inverse | |
| Test model that inverts basicFlowFunction_dp | |
| Test model that inverts basicFlowFunction_m_flow | |
| Test model that inverts powerLaw_dp | |
| Test model that inverts powerLaw_m_flow | |
| Test model for power law function | |
| Model that checks the correct implementation of the 1st order derivative of the power law function | |
| Model that checks the correct implementation of the 2nd order derivative of the power law function | |
| Model that checks the correct implementation of the 1st order derivative of the power law function | |
| Model that checks the correct implementation of the 2nd order derivative of the power law function |
Buildings.Fluid.BaseClasses.FlowModels.Validation.BasicFlowFunction_dp_DerivativeCheck
Model that checks the correct implementation of the 1st order derivative of the flow function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp and its first order derivative Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der. If the derivative implementation is wrong, the simulation will stop with an error.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.35 | Flow coefficient |
| MassFlowRate | m_flow_turbulent | 0.36 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.BasicFlowFunction_dp_DerivativeCheck2
Model that checks the correct implementation of the 2nd order derivative of the flow function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp and its second order derivative Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2. If the derivative implementation is wrong, the simulation will stop with an error.
Implementation
The pressure drop dp is increased non-linearly in order
for the first and second derivatives in
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2
to be non-zero during part of the simulation. This will ensure
full code coverage of this function.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.35 | Flow coefficient |
| MassFlowRate | m_flow_turbulent | 0.36 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.BasicFlowFunction_m_flow_DerivativeCheck
Model that checks the correct implementation of the 1st order derivative of the flow function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow and its first order derivative Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der. If the derivative implementation is wrong, the simulation will stop with an error.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.35 | Flow coefficient |
| MassFlowRate | m_flow_turbulent | 0.36 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.BasicFlowFunction_m_flow_DerivativeCheck2
Model that checks the correct implementation of the 2nd order derivative of the flow function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow and its second order derivative Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2. If the derivative implementation is wrong, the simulation will stop with an error.
Implementation
The mass flow rate m_flow is increased non-linearly in order
for the first and second derivatives in
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2
to be non-zero during part of the simulation. This will ensure
full code coverage of this function.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.35 | Flow coefficient |
| MassFlowRate | m_flow_turbulent | 0.36 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.InverseFlowFunctions
Test model for flow function and its inverse
Information
This model tests the inverse formulation of the flow functions.
The pressure difference dp and dpCalc need to
be equal up to the solver tolerance, except for a small neighborhood
around the origin. In this neighborhood around the origin, the functions
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp
and
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow
do not have an analytic expression for their inverse function and hence
the implementation of the inverse function slightly differs.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | |
| MassFlowRate | m_flow_nominal | 1 | Nominal flow rate [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.InversePowerLaws
Test model for power law flow function and its inverse
Information
This model tests the inverse formulation of the power law flow functions for three values of the flow exponent: n=1 (laminar flow), n=1.25, and n=2 (turbulent flow).
The pressure difference dp and dpCalc need to
be equal up to the solver tolerance, except for a small neighborhood
around the origin. In this neighborhood around the origin, the functions
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp
and
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow
do not have an analytic expression for their inverse function and hence
the implementation of the inverse function slightly differs.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | |
| Real | n[3] | {1,1/0.8,2} | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_nominal | 1 | Nominal flow rate [kg/s] |
| MassFlowRate | m_flow_turbulent | m_flow_nominal*0.3 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.InvertingBasicFlowFunction_dp
Test model that inverts basicFlowFunction_dp
Information
This model tests whether the Modelica translator substitutes the
inverse function for
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp.
Specifically, this function declares in its annotation section
that its inverse is provided by
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow.
Translating this model should therefore give no nonlinear equations
after the symbolic manipulation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient |
| MassFlowRate | m_flow_nominal | 1.5 | Nominal mass flow rate [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.InvertingBasicFlowFunction_m_flow
Test model that inverts basicFlowFunction_m_flow
Information
This model tests whether the Modelica translator substitutes the
inverse function for
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow.
Specifically, this function declares in its annotation section
that its inverse is provided by
Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp.
Translating this model should therefore give no nonlinear equations
after the symbolic manipulation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient |
| MassFlowRate | m_flow_nominal | 0.5 | Nominal mass flow rate [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.InvertingPowerLaw_dp
Test model that inverts powerLaw_dp
Information
This model tests whether the Modelica translator substitutes the
inverse function for
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp.
Specifically, this function declares in its annotation section
that its inverse is provided by
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow.
Translating this model should therefore give no nonlinear equations
after the symbolic manipulation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient |
| Real | n | 1.5 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_nominal | 1.5 | Nominal mass flow rate [kg/s] |
| MassFlowRate | m_flow_turbulent | m_flow_nominal*0.3 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.InvertingPowerLaw_m_flow
Test model that inverts powerLaw_m_flow
Information
This model tests whether the Modelica translator substitutes the
inverse function for
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow.
Specifically, this function declares in its annotation section
that its inverse is provided by
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp.
Translating this model should therefore give no nonlinear equations
after the symbolic manipulation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient |
| Real | n | 1.5 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_nominal | 0.5 | Nominal mass flow rate [kg/s] |
| MassFlowRate | m_flow_turbulent | m_flow_nominal*0.3 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.PowerLaw_dp
Test model for power law function
Information
This example compares the mass flow rate of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp by comparing it with the mass flow rate from Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM. Outside the turbulent region, the two models give the same result. However, inside the turbulent region, the results differ slightly because Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp uses a 5th order polynomial to ensure C2 continuity, while Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM uses a 7th order polynomial.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | gamma | 1.5 | Normalized flow rate where dphi(0)/dpi intersects phi(1) |
| Real | a | gamma | Polynomial coefficient for regularized implementation of flow resistance |
| Real | b | 1/8*m^2 - 3*gamma - 3/2*m + ... | Polynomial coefficient for regularized implementation of flow resistance |
| Real | c | -1/4*m^2 + 3*gamma + 5/2*m -... | Polynomial coefficient for regularized implementation of flow resistance |
| Real | d | 1/8*m^2 - gamma - m + 15.0/8 | Polynomial coefficient for regularized implementation of flow resistance |
| Density | rho | 1.2 | Fluid density [kg/m3] |
| MassFlowRate | m_flow_nominal | 5 | Nominal mass flow rate used to compute the flow coefficient k and C for the power law model [kg/s] |
| PressureDifference | dp_nominal | 10 | Nominal pressure difference used to compute the flow coefficient k and C for the power law model [Pa] |
| Real | n | 1/0.8 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| Real | k | m_flow_nominal/dp_nominal^(1... | Flow coefficient, k = m_flow/ dp^(1/n) |
| MassFlowRate | m_flow_turbulent | m_flow_nominal | Mass flow rate where regularization starts, here set to the same value as m_flow_nominal [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.PowerLaw_dp_DerivativeCheck
Model that checks the correct implementation of the 1st order derivative of the power law function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp and its first order derivative Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der. If the derivative implementation is wrong, the simulation will stop with an error.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient, k = m_flow/ dp^(1/n) |
| Real | n | 1.5 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_turbulent | 0.1 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.PowerLaw_dp_DerivativeCheck2
Model that checks the correct implementation of the 2nd order derivative of the power law function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp and its second order derivative Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der2. If the derivative implementation is wrong, the simulation will stop with an error.
Implementation
The pressure drop dp is increased non-linearly in order
for the first and second derivatives in
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_dp_der2
to be non-zero during part of the simulation. This will ensure
full code coverage of this function.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient, k = m_flow/ dp^(1/n) |
| Real | n | 1.5 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_turbulent | 0.1 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.PowerLaw_m_flow_DerivativeCheck
Model that checks the correct implementation of the 1st order derivative of the power law function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow and its first order derivative Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der. If the derivative implementation is wrong, the simulation will stop with an error.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient, k = m_flow/ dp^(1/n) |
| Real | n | 1.5 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_turbulent | 0.1 | Mass flow rate where transition to turbulent flow occurs [kg/s] |
Modelica definition
Buildings.Fluid.BaseClasses.FlowModels.Validation.PowerLaw_m_flow_DerivativeCheck2
Model that checks the correct implementation of the 2nd order derivative of the power law function
Information
This model validates the implementation of Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow and its second order derivative Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der2. If the derivative implementation is wrong, the simulation will stop with an error.
Implementation
The mass flow rate m_flow is increased non-linearly in order
for the first and second derivatives in
Buildings.Fluid.BaseClasses.FlowModels.powerLaw_m_flow_der2
to be non-zero during part of the simulation. This will ensure
full code coverage of this function.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | k | 0.5 | Flow coefficient, k = m_flow/ dp^(1/n) |
| Real | n | 1.5 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| MassFlowRate | m_flow_turbulent | 0.1 | Mass flow rate where transition to turbulent flow occurs [kg/s] |