Buildings.Fluid.FixedResistances.Examples

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
Buildings.Fluid.FixedResistances.Examples.CheckValve CheckValve Example model for check valve
Buildings.Fluid.FixedResistances.Examples.FlowJunction FlowJunction Test model for the three way splitter/mixer model
Buildings.Fluid.FixedResistances.Examples.HydraulicDiameter HydraulicDiameter Example model for flow resistance with hydraulic diameter as parameter
Buildings.Fluid.FixedResistances.Examples.Pipe Pipe Test of a pipe with multiple segments
Buildings.Fluid.FixedResistances.Examples.PlugFlowPipe PlugFlowPipe Simple example of plug flow pipe
Buildings.Fluid.FixedResistances.Examples.PlugFlowPipeDiscretized PlugFlowPipeDiscretized Simple example of discretized plug flow pipe
Buildings.Fluid.FixedResistances.Examples.PressureDrop PressureDrop Example model for flow resistance with nominal pressure drop as parameter

Buildings.Fluid.FixedResistances.Examples.CheckValve Buildings.Fluid.FixedResistances.Examples.CheckValve

Example model for check valve

Buildings.Fluid.FixedResistances.Examples.CheckValve

Information

Example model for the use of a hydraulic check valve.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model CheckValve "Example model for check valve" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; Modelica.Blocks.Sources.Ramp P_dp( duration=1, height=4e5, offset=3e5, startTime=0) "Ramp pressure signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 20, use_p_in=true, nPorts=2) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 10, p(displayUnit="bar") = 500000, nPorts=3) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.CheckValve checkValve( redeclare package Medium = Buildings.Media.Water, m_flow_nominal=2, dpValve_nominal=3600) "Check valve"; Buildings.Fluid.FixedResistances.CheckValve checkValveDpFix( redeclare package Medium = Media.Water, m_flow_nominal=2, dpValve_nominal=3600, dpFixed_nominal=1e4) "Check valve with series resistance"; Buildings.Fluid.FixedResistances.CheckValve checkValve_m_flow( redeclare package Medium = Media.Water, m_flow_nominal=2, dpValve_nominal=3600) "Check valve where the flow rate is prescribed"; Sources.MassFlowSource_T bou( redeclare package Medium = Media.Water, use_m_flow_in=true, nPorts=1) "Mass flow source"; Modelica.Blocks.Sources.Ramp P_m_flow( duration=1, height=5, offset=0, startTime=0) "Ramp flow rate signal"; equation connect(P_dp.y, sou.p_in); connect(sou.ports[1], checkValve.port_a); connect(checkValve.port_b, sin.ports[1]); connect(sou.ports[2], checkValveDpFix.port_a); connect(checkValveDpFix.port_b, sin.ports[2]); connect(bou.ports[1], checkValve_m_flow.port_a); connect(P_m_flow.y, bou.m_flow_in); connect(checkValve_m_flow.port_b, sin.ports[3]); end CheckValve;

Buildings.Fluid.FixedResistances.Examples.FlowJunction Buildings.Fluid.FixedResistances.Examples.FlowJunction

Test model for the three way splitter/mixer model

Buildings.Fluid.FixedResistances.Examples.FlowJunction

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 "Test model for the three way splitter/mixer model" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; 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) "Splitter"; Buildings.Fluid.Sources.Boundary_pT bou1( redeclare package Medium = Medium, T=273.15 + 10, use_p_in=true, nPorts=1) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT bou2( redeclare package Medium = Medium, T=273.15 + 20, p(displayUnit="Pa") = 101325, nPorts=1) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT bou3( redeclare package Medium = Medium, T=273.15 + 30, use_p_in=true, nPorts=1) "Pressure boundary condition"; Modelica.Blocks.Sources.Ramp P1( offset=101320, height=10, duration=20, startTime=20) "Ramp pressure signal"; Modelica.Blocks.Sources.Ramp P3( offset=101320, height=10, duration=20, startTime=70) "Ramp pressure signal"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem1( redeclare package Medium = Medium, m_flow_nominal=1) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem2( redeclare package Medium = Medium, m_flow_nominal=2) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem3( redeclare package Medium = Medium, m_flow_nominal=3) "Temperature sensor"; 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;

Buildings.Fluid.FixedResistances.Examples.HydraulicDiameter Buildings.Fluid.FixedResistances.Examples.HydraulicDiameter

Example model for flow resistance with hydraulic diameter as parameter

Buildings.Fluid.FixedResistances.Examples.HydraulicDiameter

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 "Example model for flow resistance with hydraulic diameter as parameter" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; Modelica.Blocks.Sources.Ramp P( duration=1, height=4000, offset=300000 - 2000) "Ramp pressure signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 20, use_p_in=true, nPorts=2) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 10, nPorts=2, p(displayUnit="Pa") = 300000) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.HydraulicDiameter res( redeclare package Medium = Medium, m_flow_nominal=0.2, v_nominal=1, from_dp=true, length=1) "Fixed resistance with specified hydraulic diameter"; Buildings.Fluid.FixedResistances.HydraulicDiameter resLarPip( redeclare package Medium = Medium, from_dp=true, m_flow_nominal=10, length=100) "Fixed resistance with specified hydraulic diameter of a large pipe"; equation connect(P.y, sou.p_in); connect(sou.ports[1], res.port_a); connect(res.port_b, sin.ports[1]); connect(resLarPip.port_a, sou.ports[2]); connect(resLarPip.port_b, sin.ports[2]); end HydraulicDiameter;

Buildings.Fluid.FixedResistances.Examples.Pipe Buildings.Fluid.FixedResistances.Examples.Pipe

Test of a pipe with multiple segments

Buildings.Fluid.FixedResistances.Examples.Pipe

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

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.Water 

Connectors

TypeNameDescription
replaceable package Medium 

Modelica definition

model Pipe "Test of a pipe with multiple segments" 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) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem1(redeclare package Medium = Medium, m_flow_nominal=pip.m_flow_nominal) "Temperature sensor"; 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;

Buildings.Fluid.FixedResistances.Examples.PlugFlowPipe Buildings.Fluid.FixedResistances.Examples.PlugFlowPipe

Simple example of plug flow pipe

Buildings.Fluid.FixedResistances.Examples.PlugFlowPipe

Information

Basic test of model Buildings.Fluid.FixedResistances.PlugFlowPipe with and without outlet mixing volume. This test includes an inlet temperature step under a constant mass flow rate.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.WaterMedium in the pipe

Connectors

TypeNameDescription
replaceable package MediumMedium in the pipe

Modelica definition

model PlugFlowPipe "Simple example of plug flow pipe" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Medium in the pipe"; final parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=3 "Mass flow rate"; Modelica.Blocks.Sources.Ramp Tin( height=20, duration=0, offset=273.15 + 50, startTime=100) "Ramp pressure signal"; Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 10, nPorts=2, p(displayUnit="Pa") = 101325) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.PlugFlowPipe pip( redeclare package Medium = Medium, dh=0.1, length=100, dIns=0.05, kIns=0.028, m_flow_nominal=m_flow_nominal, cPip=500, thickness=0.0032, initDelay=true, m_flow_start=m_flow_nominal, rhoPip=8000, T_start_in=323.15, T_start_out=323.15) "Pipe"; Buildings.HeatTransfer.Sources.FixedTemperature bou[2](each T=283.15) "Boundary temperature"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, use_T_in=true, m_flow=m_flow_nominal, nPorts=1) "Flow source"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemOut( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0, T_start=323.15) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemIn( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0, T_start=323.15) "Temperature sensor"; Sensors.TemperatureTwoPort senTemInNoMix( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0, T_start=323.15) "Temperature sensor"; Buildings.Fluid.FixedResistances.PlugFlowPipe pipNoMix( have_pipCap=false, redeclare package Medium = Medium, dh=0.1, length=100, dIns=0.05, kIns=0.028, m_flow_nominal=m_flow_nominal, cPip=500, thickness=0.0032, initDelay=true, m_flow_start=m_flow_nominal, rhoPip=8000, T_start_in=323.15, T_start_out=323.15) "Pipe"; Sensors.TemperatureTwoPort senTemOutNoMix( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0, T_start=323.15) "Temperature sensor"; Sources.MassFlowSource_T souNoMix( redeclare package Medium = Medium, use_T_in=true, m_flow=m_flow_nominal, nPorts=1) "Flow source"; equation connect(Tin.y, sou.T_in); connect(pip.port_b, senTemOut.port_a); connect(senTemOut.port_b, sin.ports[1]); connect(senTemIn.port_b, pip.port_a); connect(senTemInNoMix.port_b, pipNoMix.port_a); connect(pipNoMix.port_b, senTemOutNoMix.port_a); connect(senTemOutNoMix.port_b, sin.ports[2]); connect(bou[1].port, pip.heatPort); connect(bou[2].port, pipNoMix.heatPort); connect(sou.ports[1], senTemIn.port_a); connect(souNoMix.ports[1], senTemInNoMix.port_a); connect(Tin.y, souNoMix.T_in); end PlugFlowPipe;

Buildings.Fluid.FixedResistances.Examples.PlugFlowPipeDiscretized Buildings.Fluid.FixedResistances.Examples.PlugFlowPipeDiscretized

Simple example of discretized plug flow pipe

Buildings.Fluid.FixedResistances.Examples.PlugFlowPipeDiscretized

Information

Basic test of model Buildings.Fluid.FixedResistances.PlugFlowPipeDiscretized. This test includes an inlet temperature step under a constant mass flow rate.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.WaterMedium in the pipe
IntegernSeg10Number of pipe segments

Connectors

TypeNameDescription
replaceable package MediumMedium in the pipe

Modelica definition

model PlugFlowPipeDiscretized "Simple example of discretized plug flow pipe" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Medium in the pipe"; parameter Integer nSeg=10 "Number of pipe segments"; Modelica.Blocks.Sources.Ramp Tin( height=20, duration=0, offset=273.15 + 50, startTime=100) "Ramp pressure signal"; Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 10, nPorts=1, p(displayUnit="Pa") = 101325) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.PlugFlowPipeDiscretized pip( redeclare package Medium = Medium, nSeg=nSeg, dh=0.1, totLen=100, dIns=0.05, kIns=0.028, m_flow_nominal=10, thickness=0.0032, initDelay=true, T_start_in=fill(323.15, nSeg)) "Pipe segments"; Buildings.HeatTransfer.Sources.FixedTemperature bou[nSeg](T={283.15 + 2 * i for i in 1:nSeg}) "Boundary temperature"; Buildings.Fluid.Sources.MassFlowSource_T sou( nPorts=1, redeclare package Medium = Medium, use_T_in=true, m_flow=10) "Flow source"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemOut( redeclare package Medium = Medium, m_flow_nominal=1, T_start=323.15) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemIn( redeclare package Medium = Medium, m_flow_nominal=1, T_start=323.15) "Temperature sensor"; equation connect(Tin.y, sou.T_in); connect(senTemOut.port_b, sin.ports[1]); connect(sou.ports[1], senTemIn.port_a); connect(senTemIn.port_b, pip.port_a); connect(bou.port, pip.heatPorts); connect(pip.port_b, senTemOut.port_a); end PlugFlowPipeDiscretized;

Buildings.Fluid.FixedResistances.Examples.PressureDrop Buildings.Fluid.FixedResistances.Examples.PressureDrop

Example model for flow resistance with nominal pressure drop as parameter

Buildings.Fluid.FixedResistances.Examples.PressureDrop

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 "Example model for flow resistance with nominal pressure drop as parameter" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp P( duration=1, height=20, offset=101325 - 10) "Ramp pressure signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 20, use_p_in=true, nPorts=1) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 10, nPorts=1, p(displayUnit="Pa") = 101325) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.PressureDrop res( redeclare package Medium = Medium, m_flow_nominal=0.2, from_dp=true, dp_nominal=10) "Fixed resistance"; equation connect(P.y, sou.p_in); connect(sou.ports[1], res.port_a); connect(res.port_b, sin.ports[1]); end PressureDrop;