Buildings.Fluid.FixedResistances.Validation

Collection of validation models

Information

This package contains validation models for the classes in Buildings.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
Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyState FlowJunctionSteadyState Test model for the three way splitter/mixer model configured as steady-state
Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyStateNoPressureDrop FlowJunctionSteadyStateNoPressureDrop Test model for the three way splitter/mixer model configured as steady-state
Buildings.Fluid.FixedResistances.Validation.LosslessPipe LosslessPipe Validation model for lossless pipe
Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicit PressureDropsExplicit Test of multiple resistances in series
Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicitLinearized PressureDropsExplicitLinearized Test of multiple linearized resistances in series
Buildings.Fluid.FixedResistances.Validation.PressureDropsParallel PressureDropsParallel Test with multiple resistances in parallel
Buildings.Fluid.FixedResistances.Validation.PressureDropsSeries PressureDropsSeries Test of multiple resistances in series

Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyState Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyState

Test model for the three way splitter/mixer model configured as steady-state

Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyState

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 "Test model for the three way splitter/mixer model configured as steady-state" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.FixedResistances.Junction spl( redeclare package Medium = Medium, m_flow_nominal={2,2,2}, dp_nominal={5,10,15}, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "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 FlowJunctionSteadyState;

Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyStateNoPressureDrop Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyStateNoPressureDrop

Test model for the three way splitter/mixer model configured as steady-state

Buildings.Fluid.FixedResistances.Validation.FlowJunctionSteadyStateNoPressureDrop

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 "Test model for the three way splitter/mixer model configured as steady-state" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.FixedResistances.Junction spl( redeclare package Medium = Medium, m_flow_nominal={2,2,2}, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, dp_nominal={0,0,0}) "Splitter"; Buildings.Fluid.Sources.MassFlowSource_T bou1( redeclare package Medium = Medium, T=273.15 + 10, nPorts=1, use_m_flow_in=true) "Mass flow 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.MassFlowSource_T bou3( redeclare package Medium = Medium, T=273.15 + 30, nPorts=1, use_m_flow_in=true) "Mass flow boundary condition"; Modelica.Blocks.Sources.Ramp m1_flow( duration=20, startTime=20, height=1, offset=-1) "Ramp mass flow signal"; Modelica.Blocks.Sources.Ramp m3_flow( height=1, duration=20, startTime=70, offset=1) "Ramp mass flow 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(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;

Buildings.Fluid.FixedResistances.Validation.LosslessPipe Buildings.Fluid.FixedResistances.Validation.LosslessPipe

Validation model for lossless pipe

Buildings.Fluid.FixedResistances.Validation.LosslessPipe

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 "Validation model for lossless pipe" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp m_flow( duration=1, offset=-1, height=2) "Mass flow source"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true, T=273.15 + 20) "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.LosslessPipe res( redeclare package Medium = Medium, show_T=true, m_flow_nominal=1) "Fixed resistance"; 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;

Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicit Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicit

Test of multiple resistances in series

Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicit

Information

This model tests multiple flow resistances in series.

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

Modelica definition

model PressureDropsExplicit "Test of multiple resistances in series" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.Boundary_ph sou( redeclare package Medium = Medium, nPorts=1, p(displayUnit="Pa") = 101335, use_p_in=true) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_ph sin( redeclare package Medium = Medium, nPorts=1, use_p_in=false, p=101325) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.PressureDrop res11( redeclare package Medium = Medium, from_dp=false, m_flow_nominal=2, dp_nominal=5) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res12( redeclare package Medium = Medium, from_dp=false, m_flow_nominal=2, dp_nominal=5) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res22( redeclare package Medium = Medium, m_flow_nominal=2, dp_nominal=5, from_dp=true) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res21( redeclare package Medium = Medium, m_flow_nominal=2, dp_nominal=5, from_dp=true) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res31( redeclare package Medium = Medium, from_dp=false, m_flow_nominal=2, dp_nominal=5) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res32( redeclare package Medium = Medium, from_dp=false, m_flow_nominal=2, dp_nominal=5) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res42( redeclare package Medium = Medium, m_flow_nominal=2, dp_nominal=5, from_dp=true) "Flow resistance"; Buildings.Fluid.FixedResistances.PressureDrop res41( redeclare package Medium = Medium, m_flow_nominal=2, dp_nominal=5, from_dp=true) "Flow resistance"; Buildings.Fluid.Sources.MassFlowSource_h bou( redeclare package Medium = Medium, m_flow=1, nPorts=1) "Mass flow boundary condition"; Buildings.Fluid.Sources.MassFlowSource_h bou1( redeclare package Medium = Medium, m_flow=1, nPorts=1) "Mass flow boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin1( redeclare package Medium = Medium, T=273.15 + 10, nPorts=2, use_p_in=false, p=101325) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_ph sin2( redeclare package Medium = Medium, nPorts=1, use_p_in=false, p=101325) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_ph sou1( redeclare package Medium = Medium, nPorts=1, p(displayUnit="Pa") = 101335, use_p_in=true) "Pressure boundary condition"; Modelica.Blocks.Sources.Ramp P( duration=1, height=20, offset=101315) "Signal source"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo1( redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo2( redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo3( redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo4( redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Utilities.Diagnostics.AssertEquality assertEquality(threShold=1E-1) "Assert equality of the two mass flow rates"; Buildings.Utilities.Diagnostics.AssertEquality assertEquality1(threShold=1E-1) "Assert equality of the two mass flow rates"; 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;

Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicitLinearized Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicitLinearized

Test of multiple linearized resistances in series

Buildings.Fluid.FixedResistances.Validation.PressureDropsExplicitLinearized

Information

This model tests multiple linearized flow resistances in series.

Extends from PressureDropsExplicit (Test of multiple resistances in series).

Modelica definition

model PressureDropsExplicitLinearized "Test of multiple linearized resistances in series" 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;

Buildings.Fluid.FixedResistances.Validation.PressureDropsParallel Buildings.Fluid.FixedResistances.Validation.PressureDropsParallel

Test with multiple resistances in parallel

Buildings.Fluid.FixedResistances.Validation.PressureDropsParallel

Information

This model tests two resistances in parallel.

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

Modelica definition

model PressureDropsParallel "Test with multiple resistances in parallel" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; Modelica.Blocks.Sources.Ramp P( duration=1, height=20, offset=101315) "Signal source"; Buildings.Fluid.FixedResistances.PressureDrop res1( redeclare package Medium = Medium, m_flow_nominal=5, dp_nominal=10, deltaM=0.3, linearized=false, from_dp=true) "Flow resistance"; Buildings.Fluid.Sources.Boundary_pT sou1( redeclare package Medium = Medium, nPorts=2, use_p_in=true, T=293.15) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin1( redeclare package Medium = Medium, nPorts=2, p(displayUnit="Pa") = 101325, T=283.15) "Pressure boundary condition"; Buildings.Fluid.FixedResistances.PressureDrop res2( redeclare package Medium = Medium, m_flow_nominal=5, dp_nominal=10, deltaM=0.3, linearized=false, from_dp=true) "Flow resistance"; Buildings.Fluid.Sensors.MassFlowRate masFlo2(redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Utilities.Diagnostics.AssertEquality assEqu( message="Inputs differ, check that lossless pipe is correctly implemented.", threShold=1E-4) "Assert equality of the two mass flow rates"; Buildings.Fluid.Sensors.MassFlowRate masFlo1(redeclare package Medium = Medium) "Mass flow rate sensor"; 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;

Buildings.Fluid.FixedResistances.Validation.PressureDropsSeries Buildings.Fluid.FixedResistances.Validation.PressureDropsSeries

Test of multiple resistances in series

Buildings.Fluid.FixedResistances.Validation.PressureDropsSeries

Information

This model tests multiple resistances in series.

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

Parameters

TypeNameDefaultDescription
IntegernRes10Number of resistances
PressureDifferencedp_nominal5Nominal pressure drop for each resistance [Pa]

Modelica definition

model PressureDropsSeries "Test of multiple resistances in series" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; parameter Integer nRes(min=2) = 10 "Number of resistances"; parameter Modelica.SIunits.PressureDifference dp_nominal = 5 "Nominal pressure drop for each resistance"; Modelica.Blocks.Sources.Ramp P( duration=1, height=2*dp_nominal*nRes, offset=101325 - dp_nominal*nRes) "Signal source"; 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[nRes] res( redeclare each package Medium = Medium, each dp_nominal=dp_nominal, each from_dp=false, each m_flow_nominal=2) "Flow resistance"; 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;