Collection of models that illustrate model use and test models
Information
This package contains examples for the use of models that can be found in
Buildings.Fluid.FixedResistances.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
FlowJunction
|
Test model for the three way splitter/mixer model |
HydraulicDiameter
|
Example model for flow resistance with hydraulic diameter as parameter |
Pipe
|
Test of a pipe with multiple segments |
PressureDrop
|
Example model for flow resistance with nominal pressure drop as parameter |
Test model for the three way splitter/mixer model
Information
This model demonstrates the use of the flow junction 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.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model FlowJunction
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.FixedResistances.Junction spl(
redeclare package Medium = Medium,
m_flow_nominal={1,2,3},
dp_nominal={5,10,15},
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) ;
Buildings.Fluid.Sources.Boundary_pT bou1(
redeclare package Medium = Medium,
T=273.15 + 10,
use_p_in=true,
nPorts=1)
;
Buildings.Fluid.Sources.Boundary_pT bou2(
redeclare package Medium = Medium,
T=273.15 + 20,
p(displayUnit="Pa") = 101325,
nPorts=1)
;
Buildings.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)
;
Buildings.Fluid.Sensors.TemperatureTwoPort senTem1(
redeclare package Medium = Medium,
m_flow_nominal=1)
;
Buildings.Fluid.Sensors.TemperatureTwoPort senTem2(
redeclare package Medium = Medium,
m_flow_nominal=2)
;
Buildings.Fluid.Sensors.TemperatureTwoPort senTem3(
redeclare package Medium = Medium,
m_flow_nominal=3)
;
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 FlowJunction;
Example model for flow resistance with hydraulic diameter as parameter
Information
Example model for a fixed resistance that takes as a parameter the hydraulic diameter.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model HydraulicDiameter
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Modelica.Blocks.Sources.Ramp P(
duration=1,
height=20,
offset=101325 - 10) ;
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
T=273.15 + 20,
use_p_in=true,
nPorts=1)
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=1,
p(displayUnit="Pa") = 101325)
;
Buildings.Fluid.FixedResistances.HydraulicDiameter res(
redeclare package Medium = Medium,
length=10,
m_flow_nominal=0.2,
v_nominal=1,
from_dp=true)
;
equation
connect(P.y, sou.p_in);
connect(sou.ports[1], res.port_a);
connect(res.port_b, sin.ports[1]);
end HydraulicDiameter;
Test of a pipe with multiple segments
Information
This model demonstrates the use of a pipe model.
Both pipe models have the same mass flow rates and temperatures.
Otherwise, the assert
block would terminate the simulation.
The model on the top is connected to the ambient with one heat port,
whereas the model at the bottom uses a vector of heat ports.
Since they are all connected to the same temperature, they
result in the same energy balance for the medium that flows
through the pipe.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Buildings.Media.Water | |
Connectors
Type | Name | Description |
replaceable package Medium | |
Modelica definition
model Pipe
extends Modelica.Icons.Example;
replaceable package Medium =
Buildings.Media.Water;
Modelica.Blocks.Sources.Ramp P(
duration=1,
height=2*pip.dp_nominal,
offset=101325 - pip.dp_nominal);
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium =
Medium,
use_p_in=true,
T=273.15 + 50,
nPorts=2);
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium =
Medium,
T=273.15 + 10,
nPorts=2,
use_p_in=false,
p(displayUnit="Pa") = 101325);
HeatTransfer.Sources.FixedTemperature TEnv(T=263.15);
Buildings.Fluid.FixedResistances.Pipe pip(
thicknessIns=0.01,
lambdaIns=0.01,
m_flow_nominal=10,
redeclare package Medium =
Medium,
length=10,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial);
HeatTransfer.Sources.FixedTemperature TEnv1[10](
each T=263.15);
Buildings.Fluid.FixedResistances.Pipe pip1(
thicknessIns=0.01,
lambdaIns=0.01,
m_flow_nominal=10,
redeclare package Medium =
Medium,
length=10,
useMultipleHeatPorts=true,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial);
Buildings.Fluid.Sensors.TemperatureTwoPort senTem(
redeclare package Medium =
Medium, m_flow_nominal=pip.m_flow_nominal) ;
Buildings.Fluid.Sensors.TemperatureTwoPort senTem1(
redeclare package Medium =
Medium, m_flow_nominal=pip.m_flow_nominal) ;
Buildings.Utilities.Diagnostics.AssertEquality assEqu;
equation
connect(P.y, sou.p_in);
connect(sou.ports[1], pip.port_a);
connect(TEnv.port, pip.heatPort);
connect(sou.ports[2], pip1.port_a);
connect(TEnv1.port, pip1.heatPorts);
connect(pip.port_b, senTem.port_a);
connect(senTem.port_b, sin.ports[1]);
connect(pip1.port_b, senTem1.port_a);
connect(senTem1.port_b, sin.ports[2]);
connect(assEqu.u1, senTem.T);
connect(senTem1.T, assEqu.u2);
end Pipe;
Example model for flow resistance with nominal pressure drop as parameter
Information
Example model for a fixed resistance that takes as a parameter the
pressure drop at nominal condition.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model PressureDrop
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Modelica.Blocks.Sources.Ramp P(
duration=1,
height=20,
offset=101325 - 10) ;
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
T=273.15 + 20,
use_p_in=true,
nPorts=1)
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=1,
p(displayUnit="Pa") = 101325)
;
Buildings.Fluid.FixedResistances.PressureDrop res(
redeclare package Medium = Medium,
m_flow_nominal=0.2,
from_dp=true,
dp_nominal=10)
;
equation
connect(P.y, sou.p_in);
connect(sou.ports[1], res.port_a);
connect(res.port_b, sin.ports[1]);
end PressureDrop;