Collection of validation models
Information
This package contains validation models for the classes in
Annex60.Fluid.FixedResistances.
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 |
FlowJunctionSteadyState
|
Test model for the three way splitter/mixer model configured as steady-state |
FlowJunctionSteadyStateNoPressureDrop
|
Test model for the three way splitter/mixer model configured as steady-state |
LosslessPipe
|
Validation model for lossless pipe |
PressureDropsExplicit
|
Test of multiple resistances in series |
PressureDropsExplicitLinearized
|
Test of multiple linearized resistances in series |
PressureDropsParallel
|
Test with multiple resistances in parallel |
PressureDropsSeries
|
Test of multiple resistances in series |
Test model for the three way splitter/mixer model configured as steady-state
Information
This model validates the use of the splitter and mixer model
for different flow directions.
The example is configured such that the flow changes its direction in
each flow leg between t = 0 seconds to t = 100 seconds.
The splitter model has been configured as a steady-state model.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model FlowJunctionSteadyState
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
Annex60.Fluid.FixedResistances.Junction spl(
redeclare package Medium = Medium,
m_flow_nominal={1,2,3},
dp_nominal={5,10,15},
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) ;
Annex60.Fluid.Sources.Boundary_pT bou1(
redeclare package Medium = Medium,
T=273.15 + 10,
use_p_in=true,
nPorts=1)
;
Annex60.Fluid.Sources.Boundary_pT bou2(
redeclare package Medium = Medium,
T=273.15 + 20,
p(displayUnit="Pa") = 101325,
nPorts=1)
;
Annex60.Fluid.Sources.Boundary_pT bou3(
redeclare package Medium = Medium,
T=273.15 + 30,
use_p_in=true,
nPorts=1)
;
Modelica.Blocks.Sources.Ramp P1(
offset=101320,
height=10,
duration=20,
startTime=20) ;
Modelica.Blocks.Sources.Ramp P3(
offset=101320,
height=10,
duration=20,
startTime=70) ;
Annex60.Fluid.Sensors.TemperatureTwoPort senTem1(
redeclare package Medium = Medium,
m_flow_nominal=1,
tau=0)
;
Annex60.Fluid.Sensors.TemperatureTwoPort senTem2(
redeclare package Medium = Medium,
m_flow_nominal=2,
tau=0)
;
Annex60.Fluid.Sensors.TemperatureTwoPort senTem3(
redeclare package Medium = Medium,
m_flow_nominal=3,
tau=0)
;
equation
connect(P1.y, bou1.p_in);
connect(bou3.p_in, P3.y);
connect(bou3.ports[1], senTem3.port_a);
connect(senTem3.port_b, spl.port_3);
connect(bou1.ports[1], senTem1.port_a);
connect(senTem1.port_b, spl.port_1);
connect(spl.port_2, senTem2.port_a);
connect(senTem2.port_b, bou2.ports[1]);
end FlowJunctionSteadyState;
Test model for the three way splitter/mixer model configured as steady-state
Information
This model validates the use of the splitter and mixer model
for different flow directions.
The example is configured such that the flow changes its direction in
each flow leg between t = 0 seconds to t = 100 seconds.
The splitter model has been configured as a steady-state model,
with no flow resistance.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model FlowJunctionSteadyStateNoPressureDrop
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
Annex60.Fluid.FixedResistances.Junction spl(
redeclare package Medium = Medium,
m_flow_nominal={1,2,3},
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
dp_nominal={0,0,0}) ;
Annex60.Fluid.Sources.MassFlowSource_T bou1(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=1,
use_m_flow_in=true) ;
Annex60.Fluid.Sources.Boundary_pT bou2(
redeclare package Medium = Medium,
T=273.15 + 20,
p(displayUnit="Pa") = 101325,
nPorts=1)
;
Annex60.Fluid.Sources.MassFlowSource_T bou3(
redeclare package Medium = Medium,
T=273.15 + 30,
nPorts=1,
use_m_flow_in=true) ;
Modelica.Blocks.Sources.Ramp m1_flow(
duration=20,
startTime=20,
height=1,
offset=-1) ;
Modelica.Blocks.Sources.Ramp m3_flow(
height=1,
offset=-1,
duration=20,
startTime=70) ;
Annex60.Fluid.Sensors.TemperatureTwoPort senTem1(
redeclare package Medium = Medium,
m_flow_nominal=1,
tau=0)
;
Annex60.Fluid.Sensors.TemperatureTwoPort senTem2(
redeclare package Medium = Medium,
m_flow_nominal=2,
tau=0)
;
Annex60.Fluid.Sensors.TemperatureTwoPort senTem3(
redeclare package Medium = Medium,
m_flow_nominal=3,
tau=0)
;
equation
connect(bou3.ports[1], senTem3.port_a);
connect(senTem3.port_b, spl.port_3);
connect(bou1.ports[1], senTem1.port_a);
connect(senTem1.port_b, spl.port_1);
connect(spl.port_2, senTem2.port_a);
connect(senTem2.port_b, bou2.ports[1]);
connect(m1_flow.y, bou1.m_flow_in);
connect(m3_flow.y, bou3.m_flow_in);
end FlowJunctionSteadyStateNoPressureDrop;
Validation model for lossless pipe
Information
Validation model for a the pipe model with no friction and no heat loss.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model LosslessPipe
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
Modelica.Blocks.Sources.Ramp m_flow(
duration=1,
offset=-1,
height=2) ;
Annex60.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
nPorts=1,
use_m_flow_in=true,
T=273.15 + 20)
;
Annex60.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=1,
p(displayUnit="Pa") = 101325)
;
Annex60.Fluid.FixedResistances.LosslessPipe res(
redeclare package Medium = Medium,
show_T=true,
m_flow_nominal=1)
;
equation
connect(sou.ports[1], res.port_a);
connect(res.port_b, sin.ports[1]);
connect(m_flow.y, sou.m_flow_in);
end LosslessPipe;
Test of multiple resistances in series
Information
This model tests multiple flow resistances in series.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model PressureDropsExplicit
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
Annex60.Fluid.Sources.Boundary_ph sou(
redeclare package Medium = Medium,
nPorts=1,
p(displayUnit="Pa") = 101335,
use_p_in=true) ;
Annex60.Fluid.Sources.Boundary_ph sin(
redeclare package Medium = Medium,
nPorts=1,
use_p_in=false,
p=101325)
;
Annex60.Fluid.FixedResistances.PressureDrop res11(
redeclare package Medium = Medium,
from_dp=false,
m_flow_nominal=2,
dp_nominal=5) ;
Annex60.Fluid.FixedResistances.PressureDrop res12(
redeclare package Medium = Medium,
from_dp=false,
m_flow_nominal=2,
dp_nominal=5) ;
Annex60.Fluid.FixedResistances.PressureDrop res22(
redeclare package Medium = Medium,
m_flow_nominal=2,
dp_nominal=5,
from_dp=true) ;
Annex60.Fluid.FixedResistances.PressureDrop res21(
redeclare package Medium = Medium,
m_flow_nominal=2,
dp_nominal=5,
from_dp=true) ;
Annex60.Fluid.FixedResistances.PressureDrop res31(
redeclare package Medium = Medium,
from_dp=false,
m_flow_nominal=2,
dp_nominal=5) ;
Annex60.Fluid.FixedResistances.PressureDrop res32(
redeclare package Medium = Medium,
from_dp=false,
m_flow_nominal=2,
dp_nominal=5) ;
Annex60.Fluid.FixedResistances.PressureDrop res42(
redeclare package Medium = Medium,
m_flow_nominal=2,
dp_nominal=5,
from_dp=true) ;
Annex60.Fluid.FixedResistances.PressureDrop res41(
redeclare package Medium = Medium,
m_flow_nominal=2,
dp_nominal=5,
from_dp=true) ;
Annex60.Fluid.Sources.MassFlowSource_h bou(
redeclare package Medium = Medium,
m_flow=1,
nPorts=1) ;
Annex60.Fluid.Sources.MassFlowSource_h bou1(
redeclare package Medium = Medium,
m_flow=1,
nPorts=1) ;
Annex60.Fluid.Sources.Boundary_pT sin1(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=2,
use_p_in=false,
p=101325) ;
Annex60.Fluid.Sources.Boundary_ph sin2(
redeclare package Medium = Medium,
nPorts=1,
use_p_in=false,
p=101325) ;
Annex60.Fluid.Sources.Boundary_ph sou1(
redeclare package Medium = Medium,
nPorts=1,
p(displayUnit="Pa") = 101335,
use_p_in=true) ;
Modelica.Blocks.Sources.Ramp P(
duration=1,
height=20,
offset=101315) ;
Annex60.Fluid.Sensors.MassFlowRate senMasFlo1(
redeclare package Medium = Medium) ;
Annex60.Fluid.Sensors.MassFlowRate senMasFlo2(
redeclare package Medium = Medium) ;
Annex60.Fluid.Sensors.MassFlowRate senMasFlo3(
redeclare package Medium = Medium) ;
Annex60.Fluid.Sensors.MassFlowRate senMasFlo4(
redeclare package Medium = Medium) ;
Annex60.Utilities.Diagnostics.AssertEquality assertEquality(threShold=1E-1)
;
Annex60.Utilities.Diagnostics.AssertEquality assertEquality1(threShold=1E-1)
;
equation
connect(res11.port_b, res12.port_a);
connect(res21.port_b, res22.port_a);
connect(res31.port_b, res32.port_a);
connect(res41.port_b, res42.port_a);
connect(sou.ports[1], res11.port_a);
connect(bou.ports[1], res31.port_a);
connect(bou1.ports[1], res41.port_a);
connect(sou1.ports[1], res21.port_a);
connect(P.y, sou.p_in);
connect(P.y, sou1.p_in);
connect(res12.port_b, senMasFlo1.port_a);
connect(res22.port_b, senMasFlo2.port_a);
connect(res32.port_b, senMasFlo3.port_a);
connect(res42.port_b, senMasFlo4.port_a);
connect(senMasFlo3.port_b, sin1.ports[1]);
connect(senMasFlo4.port_b, sin1.ports[2]);
connect(senMasFlo1.port_b, sin.ports[1]);
connect(senMasFlo2.port_b, sin2.ports[1]);
connect(senMasFlo3.m_flow, assertEquality1.u1);
connect(senMasFlo4.m_flow, assertEquality1.u2);
connect(senMasFlo1.m_flow, assertEquality.u1);
connect(senMasFlo2.m_flow, assertEquality.u2);
end PressureDropsExplicit;
Test of multiple linearized resistances in series
Information
This model tests multiple linearized flow resistances in series.
Extends from PressureDropsExplicit (Test of multiple resistances in series).
Modelica definition
model PressureDropsExplicitLinearized
extends PressureDropsExplicit(
res11(linearized=true),
res12(linearized=true),
res21(linearized=true),
res22(linearized=true),
res31(linearized=true),
res32(linearized=true),
res41(linearized=true),
res42(linearized=true));
end PressureDropsExplicitLinearized;
Test with multiple resistances in parallel
Information
This model tests two resistances in parallel.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model PressureDropsParallel
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Water ;
Modelica.Blocks.Sources.Ramp P(
duration=1,
height=20,
offset=101315) ;
Annex60.Fluid.FixedResistances.PressureDrop res1(
redeclare package Medium = Medium,
m_flow_nominal=5,
dp_nominal=10,
deltaM=0.3,
linearized=false,
from_dp=true) ;
Annex60.Fluid.Sources.Boundary_pT sou1(
redeclare package Medium = Medium,
nPorts=2,
use_p_in=true,
T=293.15) ;
Annex60.Fluid.Sources.Boundary_pT sin1(
redeclare package Medium = Medium,
nPorts=2,
p(displayUnit="Pa") = 101325,
T=283.15) ;
Annex60.Fluid.FixedResistances.PressureDrop res2(
redeclare package Medium = Medium,
m_flow_nominal=5,
dp_nominal=10,
deltaM=0.3,
linearized=false,
from_dp=true) ;
Annex60.Fluid.Sensors.MassFlowRate masFlo2(
redeclare package Medium = Medium)
;
Annex60.Utilities.Diagnostics.AssertEquality assEqu(
message="Inputs differ, check that lossless pipe is correctly implemented.",
threShold=1E-4)
;
Annex60.Fluid.Sensors.MassFlowRate masFlo1(
redeclare package Medium = Medium)
;
equation
connect(P.y, sou1.p_in);
connect(res2.port_b, masFlo2.port_a);
connect(res1.port_b, masFlo1.port_a);
connect(sou1.ports[1], res1.port_a);
connect(sou1.ports[2], res2.port_a);
connect(sin1.ports[1], masFlo1.port_b);
connect(sin1.ports[2], masFlo2.port_b);
connect(masFlo2.m_flow, assEqu.u1);
connect(masFlo1.m_flow, assEqu.u2);
end PressureDropsParallel;
Test of multiple resistances in series
Information
This model tests multiple resistances in series.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Integer | nRes | 10 | Number of resistances |
PressureDifference | dp_nominal | 5 | Nominal pressure drop for each resistance [Pa] |
Modelica definition
model PressureDropsSeries
extends Modelica.Icons.Example;
package Medium =
Annex60.Media.Air ;
parameter Integer nRes(min=2) = 10 ;
parameter Modelica.SIunits.PressureDifference dp_nominal = 5
;
Modelica.Blocks.Sources.Ramp P(
duration=1,
height=2*dp_nominal*nRes,
offset=101325 - dp_nominal*nRes) ;
Annex60.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
T=273.15 + 20,
use_p_in=true,
nPorts=1) ;
Annex60.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=1,
p(displayUnit="Pa") = 101325) ;
Annex60.Fluid.FixedResistances.PressureDrop[nRes] res(
redeclare each package Medium = Medium,
each dp_nominal=dp_nominal,
each from_dp=false,
each m_flow_nominal=2) ;
equation
for i
in 1:nRes-1
loop
connect(res[i].port_b, res[i+1].port_a);
end for;
connect(P.y, sou.p_in);
connect(sin.ports[1], res[nRes].port_b);
connect(sou.ports[1], res[1].port_a);
end PressureDropsSeries;
http://iea-annex60.org