modelPowerLaw_m_flow_DerivativeCheck2
Model that checks the correct implementation of the 2nd order derivative of the power law function
Extends from Modelica.Icons.Example (Icon for runnable examples).
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.
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 |
| Modelica.Units.SI.MassFlowRate | m_flow_turbulent | 0.1 | Mass flow rate where transition to turbulent flow occurs |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.MassFlowRate | m_flow | Mass flow rate | |
| Modelica.Units.SI.PressureDifference | dp | Pressure drop | |
| Modelica.Units.SI.PressureDifference | dp_comp | Comparison value for dp | |
| Real | der_dp | 1st order derivative of pressure drop | |
| Real | der_dp_comp | 1st order derivative of comparison value for pressure drop | |
| Modelica.Units.SI.PressureDifference | err_dp | Integration error for dp | |
| Real | err_der_dp | Integration error for der_dp |
Revisions
-
May 30, 2026, by Michael Wetter:
First implementation.
This is for Buildings, #4620.