Collection of validation models
Information
This package contains validation models for the classes in
Annex60.Fluid.FMI.
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 |
FlowSplitter_u
|
Flow splitter |
HeaterFan
|
Heater and fan in series, model configured to allow flow reversal |
HeaterFanPressureDriven
|
Heater and fan in series, model configured to allow flow reversal and pressure driven flow rate |
HeaterFan_noReverseFlow
|
Heater and fan in series, model configured to not allow flow reversal |
Flow splitter
Information
This example demonstrates how to configure a model with a flow splitter.
For this example, the model is not exported as an FMU. However, the
thermofluid flow models are wrapped using input/output blocks.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
MassFlowRate | m_flow_nominal | 0.1 | Nominal mass flow rate [kg/s] |
Boolean | use_p_in | false | = true to use a pressure from connector, false to output Medium.p_default |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (inlet -> outlet) |
Modelica definition
model FlowSplitter_u
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal=0.1
;
parameter Boolean use_p_in = false
;
parameter Boolean allowFlowReversal = false
;
Modelica.Blocks.Sources.Constant uSpl(k=1.0) ;
Source_T sou(
redeclare package Medium = Medium,
use_p_in=use_p_in,
allowFlowReversal = allowFlowReversal)
;
Modelica.Blocks.Sources.Constant m_flow(k=m_flow_nominal*3) ;
Modelica.Blocks.Sources.Constant pIn(k=100000) ;
Modelica.Blocks.Sources.Constant TIn(k=293.15) ;
Modelica.Blocks.Sources.Constant X_w_in(k=0.01) ;
Modelica.Blocks.Sources.Constant C[Medium.nC](
each k=0.01)
if
Medium.nC > 0 ;
ExportContainers.Examples.FMUs.FlowSplitter_u floSpl(
redeclare package Medium = Medium,
use_p_in=use_p_in,
allowFlowReversal=allowFlowReversal);
equation
connect(m_flow.y, sou.m_flow_in);
connect(sou.p_in, pIn.y);
connect(TIn.y, sou.T_in);
connect(C.y, sou.C_in);
connect(X_w_in.y, sou.X_w_in);
connect(floSpl.inlet, sou.outlet);
connect(floSpl.u[1], uSpl.y);
connect(floSpl.u[2], uSpl.y);
end FlowSplitter_u;
Heater and fan in series, model configured to allow flow reversal
Information
This example demonstrates how to configure a model with a heater
and a fan that causes a pressure rise in the air stream.
Note that the mass flow rate and the absolute pressure are
set by the component sou
.
Therefore, the fan simply increases the pressure of the medium,
and it also computes how much power is needed for this pressure rise,
which is an input to the fan model.
For a model with that computes the mass flow rate based on the pressure drop, see
Annex60.Fluid.FMI.Validation.HeaterFanPressureDriven.
For this example, the models are not exported as FMUs. However, the
thermofluid flow models are wrapped using input/output blocks.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
MassFlowRate | m_flow_nominal | Q_flow_nominal/1000/10 | Nominal mass flow rate [kg/s] |
PressureDifference | dp_nominal | 2000 | Pressure [Pa] |
HeatFlowRate | Q_flow_nominal | 1000 | Heat flow rate at u=1, positive for heating [W] |
Boolean | use_p_in | true | = true to use a pressure from connector, false to output Medium.p_default |
Modelica definition
model HeaterFan
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal=Q_flow_nominal/1000/10
;
parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=2000
;
parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal = 1000
;
parameter Boolean use_p_in = true
;
ExportContainers.Examples.FMUs.Fan floMac(
redeclare final package Medium = Medium,
m_flow_nominal=m_flow_nominal,
dp_nominal=dp_nominal,
use_p_in=use_p_in) ;
ExportContainers.Examples.FMUs.HeaterCooler_u hea(
redeclare final package Medium = Medium,
m_flow_nominal=m_flow_nominal,
dp_nominal=dp_nominal,
Q_flow_nominal=Q_flow_nominal,
use_p_in=use_p_in) ;
Modelica.Blocks.Sources.Constant dp(k=dp_nominal) ;
Modelica.Blocks.Sources.Constant uHea(k=0.2) ;
Source_T sou(
redeclare package Medium = Medium, use_p_in=use_p_in)
;
Sink_T sin(
redeclare package Medium = Medium, use_p_in=use_p_in)
;
Modelica.Blocks.Sources.Constant m_flow(k=m_flow_nominal) ;
Modelica.Blocks.Sources.Constant pIn(k=100000) ;
Modelica.Blocks.Sources.Constant TIn(k=293.15) ;
Modelica.Blocks.Sources.Constant X_w_in(k=0.01) ;
Modelica.Blocks.Sources.Constant TBac(k=303.15)
;
Modelica.Blocks.Sources.Constant X_w_bac(k=0.015)
;
Modelica.Blocks.Sources.Constant CBac[Medium.nC](
each k=0.01)
if
Medium.nC > 0 ;
Modelica.Blocks.Sources.Constant C[Medium.nC](
each k=0.01)
if
Medium.nC > 0 ;
equation
connect(uHea.y, hea.u);
connect(dp.y, floMac.dp_in);
connect(sou.outlet, hea.inlet);
connect(hea.outlet, floMac.inlet);
connect(sin.inlet, floMac.outlet);
connect(sin.T_in, TBac.y);
connect(CBac.y, sin.C_in);
connect(m_flow.y, sou.m_flow_in);
connect(sou.p_in, pIn.y);
connect(TIn.y, sou.T_in);
connect(C.y, sou.C_in);
connect(X_w_in.y, sou.X_w_in);
connect(sin.X_w_in, X_w_bac.y);
end HeaterFan;
Heater and fan in series, model configured to allow flow reversal and pressure driven flow rate
Information
This example demonstrates how to configure a model with a heater
and a fan that causes a pressure rise in the air stream.
The fan increases the pressure of the medium,
and it also computes how much power is needed for this pressure rise,
which is an input to the fan model.
The component invBloCon
at the bottom of the model sets up
an equality constraint on the pressure between the sink and the source.
It also outputs a signal for the mass flow rate. Hence, this component is
used to declare how to break the algebraic loop in this signal flow diagram.
For a model with prescribed mass flow rate, see
Annex60.Fluid.FMI.Validation.HeaterFan.
For this example, the models are not exported as FMUs. However, the
thermofluid flow models are wrapped using input/output blocks.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
MassFlowRate | m_flow_nominal | Q_flow_nominal/1000/10 | Nominal mass flow rate [kg/s] |
PressureDifference | dp_nominal | 2000 | Pressure [Pa] |
HeatFlowRate | Q_flow_nominal | 1000 | Heat flow rate at u=1, positive for heating [W] |
Modelica definition
model HeaterFanPressureDriven
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal=Q_flow_nominal/1000/10
;
parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=2000
;
parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal = 1000
;
constant Boolean use_p_in = true
;
ExportContainers.Examples.FMUs.Fan floMac(
m_flow_nominal=m_flow_nominal,
dp_nominal=dp_nominal,
use_p_in=use_p_in) ;
ExportContainers.Examples.FMUs.HeaterCooler_u hea(
m_flow_nominal=m_flow_nominal,
dp_nominal=dp_nominal,
Q_flow_nominal=Q_flow_nominal,
use_p_in=use_p_in) ;
Modelica.Blocks.Sources.Constant dp(k=dp_nominal) ;
Modelica.Blocks.Sources.Constant uHea(k=0.2) ;
Source_T sou(
redeclare package Medium = Medium, use_p_in=use_p_in)
;
Sink_T sin(
redeclare package Medium = Medium, use_p_in=use_p_in)
;
Modelica.Blocks.Sources.Constant m_flow(k=m_flow_nominal) ;
Modelica.Blocks.Sources.Constant pIn(k=100000) ;
Modelica.Blocks.Sources.Constant TIn(k=293.15) ;
Modelica.Blocks.Sources.Constant X_w_in(k=0.01) ;
Modelica.Blocks.Sources.Constant TBac(k=303.15)
;
Modelica.Blocks.Sources.Constant X_w_bac(k=0.015)
;
Modelica.Blocks.Sources.Constant CBac[Medium.nC](
each k=0.01)
if
Medium.nC > 0 ;
Modelica.Blocks.Sources.Constant C[Medium.nC](
each k=0.01)
if
Medium.nC > 0 ;
Modelica.Blocks.Math.InverseBlockConstraints invBloCon
;
equation
connect(uHea.y, hea.u);
connect(dp.y, floMac.dp_in);
connect(sou.outlet, hea.inlet);
connect(hea.outlet, floMac.inlet);
connect(sin.inlet, floMac.outlet);
connect(sin.T_in, TBac.y);
connect(CBac.y, sin.C_in);
connect(sou.p_in, pIn.y);
connect(TIn.y, sou.T_in);
connect(C.y, sou.C_in);
connect(pIn.y, invBloCon.u1);
connect(sin.p, invBloCon.u2);
connect(invBloCon.y1, sou.m_flow_in);
connect(X_w_in.y, sou.X_w_in);
connect(X_w_bac.y, sin.X_w_in);
end HeaterFanPressureDriven;
Heater and fan in series, model configured to not allow flow reversal
Information
This example demonstrates how to configure a model with a heater
and a fan that causes a pressure rise in the air stream.
The model is identical with
Annex60.Fluid.FMI.Validation.HeaterFan
except that reverse flow is not allowed due to the parameter
allowFlowReversal=false
.
Consequently, the connectors for the fluid properties for the reverse flow
are removed, and the blocks on the right hand side of the model
Annex60.Fluid.FMI.Validation.HeaterFan
have been deleted.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Boolean | use_p_in | false | = true to use a pressure from connector, false to output Medium.p_default |
MassFlowRate | m_flow_nominal | Q_flow_nominal/1000/10 | Nominal mass flow rate [kg/s] |
PressureDifference | dp_nominal | 2000 | Pressure [Pa] |
HeatFlowRate | Q_flow_nominal | 1000 | Heat flow rate at u=1, positive for heating [W] |
Modelica definition
model HeaterFan_noReverseFlow
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
final parameter Boolean allowFlowReversal = false
;
parameter Boolean use_p_in = false
;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal=Q_flow_nominal/1000/10
;
parameter Modelica.SIunits.PressureDifference dp_nominal(displayUnit="Pa")=2000
;
parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal = 1000
;
ExportContainers.Examples.FMUs.Fan floMac(
redeclare final package Medium = Medium,
m_flow_nominal=m_flow_nominal,
dp_nominal=dp_nominal,
final allowFlowReversal=allowFlowReversal,
use_p_in=use_p_in) ;
ExportContainers.Examples.FMUs.HeaterCooler_u hea(
redeclare final package Medium = Medium,
m_flow_nominal=m_flow_nominal,
dp_nominal=dp_nominal,
Q_flow_nominal=Q_flow_nominal,
final allowFlowReversal=allowFlowReversal,
use_p_in=use_p_in) ;
Modelica.Blocks.Sources.Constant dp(k=1000) ;
Modelica.Blocks.Sources.Constant uHea(k=0.2) ;
Source_T sou(
redeclare package Medium = Medium,
final allowFlowReversal=allowFlowReversal,
use_p_in=use_p_in) ;
Modelica.Blocks.Sources.Constant m_flow(k=m_flow_nominal) ;
Modelica.Blocks.Sources.Constant pIn(k=100000) ;
Modelica.Blocks.Sources.Constant TIn(k=293.15) ;
Modelica.Blocks.Sources.Constant X_w_in(k=0.01) ;
Modelica.Blocks.Sources.Constant C[Medium.nC](
each k=0.01)
if
Medium.nC > 0 ;
equation
connect(uHea.y, hea.u);
connect(dp.y, floMac.dp_in);
connect(sou.outlet, hea.inlet);
connect(hea.outlet, floMac.inlet);
connect(m_flow.y, sou.m_flow_in);
connect(sou.p_in, pIn.y);
connect(TIn.y, sou.T_in);
connect(C.y, sou.C_in);
connect(X_w_in.y, sou.X_w_in);
end HeaterFan_noReverseFlow;
http://iea-annex60.org