Buildings.DHC.Networks.BaseClasses

Package with base classes that are used by multiple models

Information

This package contains base classes that are used to construct the classes in Buildings.DHC.Networks.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.DHC.Networks.BaseClasses.DifferenceEnthalpyFlowRate DifferenceEnthalpyFlowRate Sensor outputting the difference between two enthalpy flow rates
Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe PartialConnection1Pipe Partial model for connecting an agent to a one-pipe distribution network
Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe PartialConnection2Pipe Partial model for connecting an agent to a two-pipe distribution network
Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium PartialConnection2Pipe2Medium Partial model for connecting an agent to a two-pipe distribution network with two medium declarations
Buildings.DHC.Networks.BaseClasses.PartialDistribution PartialDistribution Partial model for distribution network
Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe PartialDistribution1Pipe Partial model for one-pipe distribution network
Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium PartialDistribution2Medium Partial model for distribution network with two medium declarations
Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe PartialDistribution2Pipe Partial model for two-pipe distribution network
Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium PartialDistribution2Pipe2Medium Partial model for a two-pipe distribution network with two medium declarations

Buildings.DHC.Networks.BaseClasses.DifferenceEnthalpyFlowRate Buildings.DHC.Networks.BaseClasses.DifferenceEnthalpyFlowRate

Sensor outputting the difference between two enthalpy flow rates

Buildings.DHC.Networks.BaseClasses.DifferenceEnthalpyFlowRate

Information

This model outputs the difference in enthalpy flow rate between two different streams: ΔḢ = ṁ1 h1 - ṁ2 h2. Optionally the time integral of this quantity can be output. The sensor is ideal, i.e., it does not influence the fluid.

By default

Extends from Fluid.Interfaces.PartialFourPortInterface (Partial model with four ports and declaration of quantities that are used by many models).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
Booleanhave_integratorfalseSet to true to output the time integral
Timetau0Time constant at nominal flow rate [s]
Nominal condition
MassFlowRatem1_flow_nominalm_flow_nominalNominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalm_flow_nominalNominal mass flow rate [kg/s]
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Initialization
InitinitTypeModelica.Blocks.Types.Init.I...Type of initialization (InitialState and InitialOutput are identical)
SpecificEnthalpyh1_out_startMedium1.specificEnthalpy_pTX...Initial or guess value of measured specific enthalpy [J/kg]
SpecificEnthalpyh2_out_startMedium2.specificEnthalpy_pTX...Initial or guess value of measured specific enthalpy [J/kg]
Assumptions
BooleanallowFlowReversal1allowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2allowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem1_flow_smallm_flow_smallSmall mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem2_flow_smallm_flow_smallSmall mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package Medium2Medium 2 in the component
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)
output RealOutputdH_flowDifference in enthalpy flow rate between stream 1 and 2 [W]
output RealOutputETime integral of enthalpy flow rate difference between stream 1 and 2 [J]

Modelica definition

model DifferenceEnthalpyFlowRate "Sensor outputting the difference between two enthalpy flow rates" extends Fluid.Interfaces.PartialFourPortInterface( redeclare replaceable package Medium2=Medium1, final m1_flow_nominal=m_flow_nominal, final m2_flow_nominal=m_flow_nominal, final allowFlowReversal1=allowFlowReversal, final allowFlowReversal2=allowFlowReversal, final m1_flow_small=m_flow_small, final m2_flow_small=m_flow_small, final show_T=false); parameter Boolean have_integrator=false "Set to true to output the time integral"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal(min=0) "Nominal mass flow rate"; parameter Modelica.Units.SI.Time tau(min=0) = 0 "Time constant at nominal flow rate"; parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.InitialState "Type of initialization (InitialState and InitialOutput are identical)"; parameter Boolean allowFlowReversal=true "= false to simplify equations, assuming, but not enforcing, no flow reversal"; parameter Modelica.Units.SI.SpecificEnthalpy h1_out_start= Medium1.specificEnthalpy_pTX( p=Medium1.p_default, T=Medium1.T_default, X=Medium1.X_default) "Initial or guess value of measured specific enthalpy"; parameter Modelica.Units.SI.SpecificEnthalpy h2_out_start= Medium2.specificEnthalpy_pTX( p=Medium2.p_default, T=Medium2.T_default, X=Medium2.X_default) "Initial or guess value of measured specific enthalpy"; parameter Medium1.MassFlowRate m_flow_small(min=0)=1E-4*abs(m_flow_nominal) "Small mass flow rate for regularization of zero flow"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput dH_flow( final unit="W") "Difference in enthalpy flow rate between stream 1 and 2"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput E( final unit="J") if have_integrator "Time integral of enthalpy flow rate difference between stream 1 and 2"; Fluid.Sensors.EnthalpyFlowRate senEntFlo1( redeclare final package Medium=Medium1, final m_flow_nominal=m_flow_nominal, final tau=tau, final initType=initType, final allowFlowReversal=allowFlowReversal, final h_out_start=h1_out_start) "Enthalpy flow rate of fluid stream 1"; Fluid.Sensors.EnthalpyFlowRate senEntFlo2( redeclare final package Medium=Medium2, final m_flow_nominal=m_flow_nominal, final tau=tau, final initType=initType, final allowFlowReversal=allowFlowReversal, final h_out_start=h2_out_start) "Enthalpy flow rate of fluid stream 2"; Buildings.Controls.OBC.CDL.Reals.Subtract dif "Compute the difference"; Modelica.Blocks.Continuous.Integrator int( y(unit="J")) if have_integrator "Time integral computation"; equation connect(port_a1,senEntFlo1.port_a); connect(senEntFlo1.port_b,port_b1); connect(port_b2,senEntFlo2.port_b); connect(senEntFlo2.port_a,port_a2); connect(dif.y,dH_flow); connect(senEntFlo1.H_flow,dif.u1); connect(senEntFlo2.H_flow,dif.u2); connect(int.y,E); connect(dif.y,int.u); end DifferenceEnthalpyFlowRate;

Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe

Partial model for connecting an agent to a one-pipe distribution network

Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe

Information


Partial model to be used for connecting an agent (e.g. energy transfer station) to a one-pipe distribution network.

Two instances of a replaceable partial model are used to represent the pipes:

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model
replaceable model Model_pipDisFluid.Interfaces.PartialTwoP... 
replaceable model Model_pipConFluid.Interfaces.PartialTwoP... 
Booleanshow_entFlofalseSet to true to output enthalpy flow rate difference
Booleanshow_TOutfalseSet to true to output temperature at connection outlet
MassFlowRatemDis_flow_nominal Nominal mass flow rate in the distribution line [kg/s]
MassFlowRatemCon_flow_nominal Nominal mass flow rate in the connection line [kg/s]
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]

Connectors

TypeNameDescription
replaceable package MediumMedium model
replaceable model Model_pipDis 
replaceable model Model_pipCon 
FluidPort_aport_aDisDistribution inlet port
FluidPort_bport_bDisDistribution outlet port
FluidPort_aport_aConConnection return port
FluidPort_bport_bConConnection supply port
output RealOutputmCon_flowConnection supply mass flow rate (measured) [kg/s]
output RealOutputdH_flowDifference in enthalpy flow rate between connection supply and return [W]
output RealOutputmByp_flowBypass mass flow rate [kg/s]
output RealOutputTOutTemperature in distribution line at connection outlet [K]

Modelica definition

partial model PartialConnection1Pipe "Partial model for connecting an agent to a one-pipe distribution network" replaceable package Medium=Modelica.Media.Interfaces.PartialMedium "Medium model"; replaceable model Model_pipDis=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final m_flow_nominal=mDis_flow_nominal, final allowFlowReversal=allowFlowReversal); replaceable model Model_pipCon=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final m_flow_nominal=mCon_flow_nominal, final allowFlowReversal=allowFlowReversal); parameter Boolean show_entFlo=false "Set to true to output enthalpy flow rate difference"; parameter Boolean show_TOut=false "Set to true to output temperature at connection outlet"; parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal "Nominal mass flow rate in the distribution line"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal "Nominal mass flow rate in the connection line"; parameter Boolean allowFlowReversal=false "= true to allow flow reversal, false restricts to design direction (port_a -> port_b)"; parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; final parameter Modelica.Fluid.Types.Dynamics massDynamics=energyDynamics "Type of mass balance: dynamic (3 initialization options) or steady state, must be steady state if energyDynamics is steady state"; parameter Modelica.Units.SI.Time tau=10 "Time constant at nominal flow for dynamic energy and momentum balance"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPort_a port_aDis( redeclare final package Medium=Medium, m_flow( min= if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow( start=Medium.h_default, nominal=Medium.h_default)) "Distribution inlet port"; Modelica.Fluid.Interfaces.FluidPort_b port_bDis( redeclare final package Medium=Medium, m_flow( max= if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow( start=Medium.h_default, nominal=Medium.h_default)) "Distribution outlet port"; Modelica.Fluid.Interfaces.FluidPort_a port_aCon( redeclare final package Medium=Medium, m_flow( min= if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow( start=Medium.h_default, nominal=Medium.h_default)) "Connection return port"; Modelica.Fluid.Interfaces.FluidPort_b port_bCon( redeclare final package Medium=Medium, m_flow( max= if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow( start=Medium.h_default, nominal=Medium.h_default)) "Connection supply port"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mCon_flow( final unit="kg/s") "Connection supply mass flow rate (measured)"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput dH_flow( final unit="W") if show_entFlo "Difference in enthalpy flow rate between connection supply and return"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mByp_flow( final unit="kg/s") "Bypass mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput TOut( final unit="K", displayUnit="degC") if show_TOut "Temperature in distribution line at connection outlet"; // COMPONENTS Fluid.FixedResistances.Junction junConSup( redeclare final package Medium=Medium, final portFlowDirection_1= if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Entering, final portFlowDirection_2= if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Leaving, final portFlowDirection_3= if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Leaving, final dp_nominal={0,0,0}, final energyDynamics=energyDynamics, final tau=tau, final m_flow_nominal={mDis_flow_nominal,-mDis_flow_nominal,-mCon_flow_nominal}) "Junction with connection supply"; Fluid.FixedResistances.Junction junConRet( redeclare final package Medium=Medium, final portFlowDirection_1= if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Entering, final portFlowDirection_2= if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Leaving, final portFlowDirection_3= if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Entering, final dp_nominal={0,0,0}, final energyDynamics=energyDynamics, final tau=tau, final m_flow_nominal={mDis_flow_nominal,-mDis_flow_nominal,mCon_flow_nominal}) "Junction with connection return"; Model_pipDis pipDis "Distribution pipe"; Model_pipCon pipCon "Connection pipe"; Buildings.Fluid.Sensors.MassFlowRate senMasFloCon( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Connection supply mass flow rate (measured)"; Buildings.Fluid.Sensors.MassFlowRate senMasFloByp( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Bypass mass flow rate (measured)"; DifferenceEnthalpyFlowRate senDifEntFlo( redeclare final package Medium1=Medium, final allowFlowReversal=allowFlowReversal, final m_flow_nominal=mCon_flow_nominal) if show_entFlo "Difference in enthalpy flow rate"; Fluid.Sensors.TemperatureTwoPort senTOut( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final m_flow_nominal=mDis_flow_nominal) if show_TOut "Temperature in distribution line at connection outlet"; protected parameter Modelica.Units.SI.SpecificHeatCapacity cp_default= Medium.specificHeatCapacityCp(Medium.setState_pTX( p=Medium.p_default, T=Medium.T_default, X=Medium.X_default)) "Specific heat capacity of medium at default medium state"; equation // Connect statements involving conditionally removed components are // removed at translation time by Modelica specification. // Only obsolete statements corresponding to the default model structure need // to be programmatically removed. if not show_entFlo then connect(port_bCon,senMasFloCon.port_b); connect(port_aCon,junConRet.port_3); end if; if not show_TOut then connect(junConRet.port_2,port_bDis); end if; connect(junConSup.port_3,pipCon.port_a); connect(senMasFloCon.m_flow,mCon_flow); connect(port_aDis,pipDis.port_a); connect(junConSup.port_2,senMasFloByp.port_a); connect(senMasFloByp.port_b,junConRet.port_1); connect(senMasFloByp.m_flow,mByp_flow); connect(senMasFloCon.port_b, senDifEntFlo.port_a1); connect(senDifEntFlo.port_b1, port_bCon); connect(senDifEntFlo.port_b2, junConRet.port_3); connect(senDifEntFlo.port_a2, port_aCon); connect(senDifEntFlo.dH_flow, dH_flow); connect(port_bDis, senTOut.port_b); connect(junConRet.port_2, senTOut.port_a); connect(senTOut.T, TOut); connect(pipCon.port_b, senMasFloCon.port_a); connect(pipDis.port_b, junConSup.port_1); end PartialConnection1Pipe;

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe

Partial model for connecting an agent to a two-pipe distribution network

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe

Information


Partial model to be used for connecting an agent (e.g. an energy transfer station) to a two-pipe distribution network.

Three instances of a replaceable partial model are used to represent the pipes:

Extends from Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium (Partial model for connecting an agent to a two-pipe distribution network with two medium declarations).

Parameters

TypeNameDefaultDescription
replaceable package MediumSupPartialMediumMedium model for supply fluid
replaceable package MediumRetPartialMediumMedium model for return fluid
replaceable model Model_pipDisSupPartialTwoPortInterfaceInterface for inlet pipe for the distribution supply
replaceable model Model_pipDisRetPartialTwoPortInterfaceInterface for outlet pipe for the distribution return
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model
replaceable model Model_pipConFluid.Interfaces.PartialTwoP... 
Booleanshow_entFlofalseSet to true to output enthalpy flow rate difference
Nominal condition
MassFlowRatemDis_flow_nominal Nominal mass flow rate in the distribution line [kg/s]
MassFlowRatemCon_flow_nominal Nominal mass flow rate in the connection line [kg/s]
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]

Connectors

TypeNameDescription
replaceable package MediumSupMedium model for supply fluid
replaceable package MediumRetMedium model for return fluid
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port
FluidPort_aport_aDisRetDistribution return inlet port
FluidPort_bport_bDisRetDistribution return outlet port
FluidPort_bport_bConConnection supply port
FluidPort_aport_aConConnection return port
replaceable package MediumMedium model
replaceable model Model_pipCon 
output RealOutputmCon_flowConnection supply mass flow rate [kg/s]
output RealOutputdpPressure drop accross the connection (measured) [Pa]
output RealOutputdH_flowDifference in enthalpy flow rate between connection supply and return [W]

Modelica definition

partial model PartialConnection2Pipe "Partial model for connecting an agent to a two-pipe distribution network" extends Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium( redeclare final package MediumSup=Medium, redeclare final package MediumRet=Medium); replaceable package Medium=Modelica.Media.Interfaces.PartialMedium "Medium model"; replaceable model Model_pipCon=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final m_flow_nominal=mCon_flow_nominal, final allowFlowReversal=allowFlowReversal); parameter Boolean show_entFlo=false "Set to true to output enthalpy flow rate difference"; // OUTPUTS Buildings.Controls.OBC.CDL.Interfaces.RealOutput mCon_flow( final quantity="MassFlowRate", final unit="kg/s") "Connection supply mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput dp( final quantity="PressureDifference", final unit="Pa", final displayUnit="Pa") "Pressure drop accross the connection (measured)"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput dH_flow( final unit="W") if show_entFlo "Difference in enthalpy flow rate between connection supply and return"; // COMPONENTS Model_pipCon pipCon "Connection pipe"; Buildings.Fluid.Sensors.MassFlowRate senMasFloCon( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Connection supply mass flow rate (measured)"; Fluid.Sensors.RelativePressure senRelPre( redeclare final package Medium=Medium) "Relative pressure sensor"; DifferenceEnthalpyFlowRate senDifEntFlo( redeclare final package Medium1 = Medium, final allowFlowReversal=allowFlowReversal, final m_flow_nominal=mCon_flow_nominal) if show_entFlo "Difference in enthalpy flow rate"; equation // Connect statements involving conditionally removed components are // removed at translation time by Modelica specification. // Only obsolete statements corresponding to the default model structure need // to be programmatically removed. if not show_entFlo then connect(port_bCon,senMasFloCon.port_b); connect(port_aCon, junConRet.port_3); end if; connect(senMasFloCon.m_flow,mCon_flow); connect(senRelPre.port_a,junConSup.port_1); connect(senRelPre.port_b,junConRet.port_2); connect(senRelPre.p_rel,dp); connect(port_bCon, senDifEntFlo.port_b1); connect(senDifEntFlo.port_a2, port_aCon); connect(senDifEntFlo.dH_flow, dH_flow); connect(senMasFloCon.port_b, senDifEntFlo.port_a1); connect(senDifEntFlo.port_b2, junConRet.port_3); connect(pipCon.port_a, junConSup.port_3); connect(senMasFloCon.port_a, pipCon.port_b); connect(pipDisSup.port_b, junConSup.port_1); connect(pipDisRet.port_a, junConRet.port_2); end PartialConnection2Pipe;

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium

Partial model for connecting an agent to a two-pipe distribution network with two medium declarations

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium

Information


Partial model to be used for connecting an agent (e.g. an energy transfer station) to a two-pipe distribution network featuring different supply and return fluids (e.g. steam and liquid water).

Six instances of a replaceable partial model are used to represent the pipes:

Parameters

TypeNameDefaultDescription
replaceable package MediumSupModelica.Media.Interfaces.Pa...Medium model for supply fluid
replaceable package MediumRetModelica.Media.Interfaces.Pa...Medium model for return fluid
replaceable model Model_pipDisSupBuildings.Fluid.Interfaces.P...Interface for inlet pipe for the distribution supply
replaceable model Model_pipDisRetBuildings.Fluid.Interfaces.P...Interface for outlet pipe for the distribution return
Nominal condition
MassFlowRatemDis_flow_nominal Nominal mass flow rate in the distribution line [kg/s]
MassFlowRatemCon_flow_nominal Nominal mass flow rate in the connection line [kg/s]
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]

Connectors

TypeNameDescription
replaceable package MediumSupMedium model for supply fluid
replaceable package MediumRetMedium model for return fluid
replaceable model Model_pipDisSupInterface for inlet pipe for the distribution supply
replaceable model Model_pipDisRetInterface for outlet pipe for the distribution return
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port
FluidPort_aport_aDisRetDistribution return inlet port
FluidPort_bport_bDisRetDistribution return outlet port
FluidPort_bport_bConConnection supply port
FluidPort_aport_aConConnection return port

Modelica definition

partial model PartialConnection2Pipe2Medium "Partial model for connecting an agent to a two-pipe distribution network with two medium declarations" replaceable package MediumSup = Modelica.Media.Interfaces.PartialMedium "Medium model for supply fluid"; replaceable package MediumRet = Modelica.Media.Interfaces.PartialMedium "Medium model for return fluid"; replaceable model Model_pipDisSup = Buildings.Fluid.Interfaces.PartialTwoPortInterface constrainedby Buildings.Fluid.Interfaces.PartialTwoPortInterface( redeclare final package Medium = MediumSup, final m_flow_nominal=mDis_flow_nominal, final allowFlowReversal=allowFlowReversal) "Interface for inlet pipe for the distribution supply"; replaceable model Model_pipDisRet = Buildings.Fluid.Interfaces.PartialTwoPortInterface constrainedby Buildings.Fluid.Interfaces.PartialTwoPortInterface( redeclare final package Medium = MediumRet, final m_flow_nominal=mDis_flow_nominal, final allowFlowReversal=allowFlowReversal) "Interface for outlet pipe for the distribution return"; parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal "Nominal mass flow rate in the distribution line"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal "Nominal mass flow rate in the connection line"; parameter Boolean allowFlowReversal = false "= true to allow flow reversal, false restricts to design direction (port_a -> port_b)"; parameter Modelica.Fluid.Types.Dynamics energyDynamics= Modelica.Fluid.Types.Dynamics.FixedInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Modelica.Units.SI.Time tau=10 "Time constant at nominal flow for dynamic energy and momentum balance"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPort_a port_aDisSup( redeclare final package Medium = MediumSup, m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow(start=MediumSup.h_default, nominal=MediumSup.h_default)) "Distribution supply inlet port"; Modelica.Fluid.Interfaces.FluidPort_b port_bDisSup( redeclare final package Medium = MediumSup, m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow(start=MediumSup.h_default, nominal=MediumSup.h_default)) "Distribution supply outlet port"; Modelica.Fluid.Interfaces.FluidPort_a port_aDisRet( redeclare final package Medium = MediumRet, m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow(start=MediumRet.h_default, nominal=MediumRet.h_default)) "Distribution return inlet port"; Modelica.Fluid.Interfaces.FluidPort_b port_bDisRet( redeclare final package Medium = MediumRet, m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow(start=MediumRet.h_default, nominal=MediumRet.h_default)) "Distribution return outlet port"; Modelica.Fluid.Interfaces.FluidPort_b port_bCon( redeclare final package Medium = MediumSup, m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow(start=MediumSup.h_default, nominal=MediumSup.h_default)) "Connection supply port"; Modelica.Fluid.Interfaces.FluidPort_a port_aCon( redeclare final package Medium = MediumRet, m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow(start=MediumRet.h_default, nominal=MediumRet.h_default)) "Connection return port"; // COMPONENTS Model_pipDisSup pipDisSup "Distribution supply pipe"; Model_pipDisRet pipDisRet "Distribution return pipe"; Buildings.Fluid.FixedResistances.Junction junConSup( redeclare final package Medium = MediumSup, final portFlowDirection_1=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Entering, final portFlowDirection_2=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Leaving, final portFlowDirection_3=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Leaving, final dp_nominal = {0, 0, 0}, final energyDynamics=energyDynamics, final tau=tau, final m_flow_nominal={mDis_flow_nominal,-mDis_flow_nominal,-mCon_flow_nominal}) "Junction with connection supply"; Buildings.Fluid.FixedResistances.Junction junConRet( redeclare final package Medium = MediumRet, final portFlowDirection_1=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Entering, final portFlowDirection_2=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Leaving, final portFlowDirection_3=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional else Modelica.Fluid.Types.PortFlowDirection.Entering, final dp_nominal = {0, 0, 0}, final energyDynamics=energyDynamics, final tau=tau, final m_flow_nominal={mDis_flow_nominal,-mDis_flow_nominal,mCon_flow_nominal}) "Junction with connection return"; protected parameter Modelica.Units.SI.SpecificHeatCapacity cp_default= MediumRet.specificHeatCapacityCp(MediumRet.setState_pTX( p = MediumRet.p_default, T = MediumRet.T_default, X = MediumRet.X_default)) "Specific heat capacity of medium at default medium state"; equation connect(port_aDisSup, pipDisSup.port_a); connect(pipDisRet.port_b, port_bDisRet); connect(junConSup.port_2, port_bDisSup); connect(junConRet.port_1, port_aDisRet); end PartialConnection2Pipe2Medium;

Buildings.DHC.Networks.BaseClasses.PartialDistribution Buildings.DHC.Networks.BaseClasses.PartialDistribution

Partial model for distribution network

Buildings.DHC.Networks.BaseClasses.PartialDistribution

Information


Partial model to be used for modeling various distribution networks e.g. one-pipe or two-pipe hydraulic distribution.

Extends from Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium (Partial model for distribution network with two medium declarations).

Parameters

TypeNameDefaultDescription
replaceable package MediumSupPartialMediumMedium model for supply fluid
replaceable package MediumRetPartialMediumMedium model for return fluid
IntegernCon Number of connections
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)

Connectors

TypeNameDescription
replaceable package MediumSupMedium model for supply fluid
replaceable package MediumRetMedium model for return fluid
FluidPorts_aports_aCon[nCon]Connection return ports
FluidPorts_bports_bCon[nCon]Connection supply ports
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port
replaceable package MediumMedium model

Modelica definition

partial model PartialDistribution "Partial model for distribution network" extends Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium( redeclare final package MediumSup=Medium, redeclare final package MediumRet=Medium); replaceable package Medium=Modelica.Media.Interfaces.PartialMedium "Medium model"; end PartialDistribution;

Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe

Partial model for one-pipe distribution network

Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe

Information


Partial model of a one-pipe distribution network.

An array of replaceable partial models is used to represent the connections along the network, including the pipe segment immediately upstream of each connection.

A replaceable partial model is used to represent the pipe segment of the return line after the last connection.

Optionally the heat flow rate transferred to each connected load can be output.

Extends from PartialDistribution (Partial model for distribution network).

Parameters

TypeNameDefaultDescription
IntegernCon Number of connections
replaceable package MediumPartialMediumMedium model
replaceable model Model_pipDisFluid.Interfaces.PartialTwoP...Model for distribution pipe
Booleanshow_entFlofalseSet to true to output enthalpy flow rate difference at each connection
Booleanshow_TOutfalseSet to true to output temperature at connection outlet
PartialConnection1Pipecon[nCon]con(redeclare each final pac...Connection to agent
Nominal condition
MassFlowRatemDis_flow_nominal Nominal mass flow rate in the distribution line [kg/s]
MassFlowRatemCon_flow_nominal[nCon] Nominal mass flow rate in each connection line [kg/s]
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]

Connectors

TypeNameDescription
FluidPorts_aports_aCon[nCon]Connection return ports
FluidPorts_bports_bCon[nCon]Connection supply ports
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port
replaceable model Model_pipDisModel for distribution pipe
output RealOutputdH_flow[nCon]Difference in enthalpy flow rate between connection supply and return [W]
output RealOutputmCon_flow[nCon]Connection supply mass flow rate (measured) [kg/s]
output RealOutputmByp_flow[nCon]Bypass mass flow rate [kg/s]
output RealOutputTOut[nCon]Temperature in distribution line at each connection outlet [K]

Modelica definition

partial model PartialDistribution1Pipe "Partial model for one-pipe distribution network" extends PartialDistribution; replaceable model Model_pipDis=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Model for distribution pipe"; parameter Boolean show_entFlo=false "Set to true to output enthalpy flow rate difference at each connection"; parameter Boolean show_TOut=false "Set to true to output temperature at connection outlet"; parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal "Nominal mass flow rate in the distribution line"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nCon] "Nominal mass flow rate in each connection line"; parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Modelica.Units.SI.Time tau=10 "Time constant at nominal flow for dynamic energy and momentum balance"; // IO CONNECTORS Buildings.Controls.OBC.CDL.Interfaces.RealOutput dH_flow[nCon]( each final unit="W") if show_entFlo "Difference in enthalpy flow rate between connection supply and return"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mCon_flow[nCon]( each final unit="kg/s") "Connection supply mass flow rate (measured)"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mByp_flow[nCon]( each final unit="kg/s") "Bypass mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput TOut[nCon]( each final unit="K", each displayUnit="degC") if show_TOut "Temperature in distribution line at each connection outlet"; // COMPONENTS replaceable PartialConnection1Pipe con[nCon]( redeclare each final package Medium=Medium, each final show_entFlo=show_entFlo, each final show_TOut=show_TOut, each final mDis_flow_nominal=mDis_flow_nominal, final mCon_flow_nominal=mCon_flow_nominal, each final allowFlowReversal=allowFlowReversal, each final energyDynamics=energyDynamics, each final tau=tau) "Connection to agent"; Model_pipDis pipEnd( final m_flow_nominal=mDis_flow_nominal) "Pipe representing the end of the distribution line (after last connection)"; equation // Connecting outlets to inlets for all instances of connection component. if nCon >= 2 then for i in 2:nCon loop connect(con[i-1].port_bDis,con[i].port_aDis); end for; end if; connect(con.port_bCon,ports_bCon); connect(ports_aCon,con.port_aCon); connect(port_aDisSup,con[1].port_aDis); connect(con[nCon].port_bDis,pipEnd.port_a); connect(pipEnd.port_b,port_bDisSup); connect(con.mByp_flow,mByp_flow); connect(con.mCon_flow,mCon_flow); connect(con.dH_flow, dH_flow); connect(con.TOut, TOut); end PartialDistribution1Pipe;

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium

Partial model for distribution network with two medium declarations

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium

Information


Partial model to be used for modeling various distribution networks e.g. one-pipe or two-pipe hydraulic distribution.

Parameters

TypeNameDefaultDescription
replaceable package MediumSupModelica.Media.Interfaces.Pa...Medium model for supply fluid
replaceable package MediumRetModelica.Media.Interfaces.Pa...Medium model for return fluid
IntegernCon Number of connections
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)

Connectors

TypeNameDescription
replaceable package MediumSupMedium model for supply fluid
replaceable package MediumRetMedium model for return fluid
FluidPorts_aports_aCon[nCon]Connection return ports
FluidPorts_bports_bCon[nCon]Connection supply ports
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port

Modelica definition

partial model PartialDistribution2Medium "Partial model for distribution network with two medium declarations" replaceable package MediumSup = Modelica.Media.Interfaces.PartialMedium "Medium model for supply fluid"; replaceable package MediumRet = Modelica.Media.Interfaces.PartialMedium "Medium model for return fluid"; parameter Integer nCon(min=1) "Number of connections"; parameter Boolean allowFlowReversal=false "= true to allow flow reversal, false restricts to design direction (port_a -> port_b)"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPorts_a ports_aCon[nCon]( redeclare each final package Medium=MediumRet, each m_flow( min= if allowFlowReversal then -Modelica.Constants.inf else 0), each h_outflow( start=MediumRet.h_default, nominal=MediumRet.h_default)) "Connection return ports"; Modelica.Fluid.Interfaces.FluidPorts_b ports_bCon[nCon]( redeclare each package Medium=MediumSup, each m_flow( max= if allowFlowReversal then +Modelica.Constants.inf else 0), each h_outflow( start=MediumSup.h_default, nominal=MediumSup.h_default)) "Connection supply ports"; Modelica.Fluid.Interfaces.FluidPort_a port_aDisSup( redeclare final package Medium=MediumSup, m_flow( min= if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow( start=MediumSup.h_default, nominal=MediumSup.h_default)) "Distribution supply inlet port"; Modelica.Fluid.Interfaces.FluidPort_b port_bDisSup( redeclare final package Medium=MediumSup, m_flow( max= if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow( start=MediumRet.h_default, nominal=MediumRet.h_default)) "Distribution supply outlet port"; end PartialDistribution2Medium;

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe

Partial model for two-pipe distribution network

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe

Information


Partial model of a two-pipe distribution network.

An array of replaceable partial models is used to represent the connections along the network, including the pipe segment immediately upstream each connection.

A replaceable partial model is used to represent the pipe segment of the supply and return line after the last connection.

The parameter iConDpSen is provided to specify the index of the connection where the pressure drop is measured. Use zero for a sensor connected to the supply pipe inlet and return pipe outlet. Use a negative value if no sensor is needed.

Optionally the heat flow rate transferred to each connected load can be output.

Extends from PartialDistribution (Partial model for distribution network).

Parameters

TypeNameDefaultDescription
IntegernCon Number of connections
replaceable package MediumPartialMediumMedium model
replaceable model Model_pipDisFluid.Interfaces.PartialTwoP...Model for distribution pipe
IntegeriConDpSennConIndex of the connection where the pressure drop is measured
Booleanshow_entFlofalseSet to true to output enthalpy flow rate difference at each connection
PartialConnection2Pipecon[nCon]con(redeclare each final pac...Connection to agent
Nominal condition
MassFlowRatemDis_flow_nominal Nominal mass flow rate in the distribution line before the first connection [kg/s]
MassFlowRatemCon_flow_nominal[nCon] Nominal mass flow rate in each connection line [kg/s]
MassFlowRatemEnd_flow_nominalmDis_flow_nominal - sum(mCon...Nominal mass flow rate in the end of the distribution line [kg/s]
MassFlowRatemDisCon_flow_nominal[nCon]cat(1, {mDis_flow_nominal}, ...Nominal mass flow rate in the distribution line before each connection [kg/s]
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]

Connectors

TypeNameDescription
FluidPorts_aports_aCon[nCon]Connection return ports
FluidPorts_bports_bCon[nCon]Connection supply ports
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port
replaceable model Model_pipDisModel for distribution pipe
FluidPort_bport_bDisRetDistribution return outlet port
FluidPort_aport_aDisRetDistribution return inlet port
output RealOutputdpPressure difference at given location (measured) [Pa]
output RealOutputdH_flow[nCon]Difference in enthalpy flow rate between connection supply and return [W]
output RealOutputmCon_flow[nCon]Connection supply mass flow rate (measured) [kg/s]

Modelica definition

partial model PartialDistribution2Pipe "Partial model for two-pipe distribution network" extends PartialDistribution; replaceable model Model_pipDis=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Model for distribution pipe"; parameter Integer iConDpSen( final max=nCon)=nCon "Index of the connection where the pressure drop is measured"; parameter Boolean show_entFlo=false "Set to true to output enthalpy flow rate difference at each connection"; parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal "Nominal mass flow rate in the distribution line before the first connection"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nCon] "Nominal mass flow rate in each connection line"; parameter Modelica.Units.SI.MassFlowRate mEnd_flow_nominal=mDis_flow_nominal - sum(mCon_flow_nominal) "Nominal mass flow rate in the end of the distribution line"; parameter Modelica.Units.SI.MassFlowRate mDisCon_flow_nominal[nCon]=cat( 1, {mDis_flow_nominal}, {mDis_flow_nominal - sum(mCon_flow_nominal[1:i]) for i in 1:(nCon - 1)}) "Nominal mass flow rate in the distribution line before each connection"; parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Modelica.Units.SI.Time tau=10 "Time constant at nominal flow for dynamic energy and momentum balance"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPort_b port_bDisRet( redeclare final package Medium=Medium, m_flow( max= if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow( start=Medium.h_default, nominal=Medium.h_default)) "Distribution return outlet port"; Modelica.Fluid.Interfaces.FluidPort_a port_aDisRet( redeclare final package Medium=Medium, m_flow( min= if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow( start=Medium.h_default, nominal=Medium.h_default)) "Distribution return inlet port"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput dp( final unit="Pa", displayUnit="Pa") if iConDpSen >= 0 "Pressure difference at given location (measured)"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput dH_flow[nCon](each final unit="W") if show_entFlo "Difference in enthalpy flow rate between connection supply and return"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mCon_flow[nCon]( each final unit="kg/s") "Connection supply mass flow rate (measured)"; // COMPONENTS replaceable Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe con[nCon]( redeclare each final package Medium=Medium, each final show_entFlo=show_entFlo, final mDis_flow_nominal=mDisCon_flow_nominal, final mCon_flow_nominal=mCon_flow_nominal, each final allowFlowReversal=allowFlowReversal, each final energyDynamics=energyDynamics, each final tau=tau) "Connection to agent"; Model_pipDis pipEnd( final m_flow_nominal=mEnd_flow_nominal) "Pipe representing the end of the distribution line (after last connection)"; Fluid.Sensors.RelativePressure senRelPre( redeclare final package Medium=Medium) if iConDpSen == 0 "Relative pressure sensor"; initial equation assert( iConDpSen <= nCon, "In "+getInstanceName()+": iConDpSen = "+String( iConDpSen)+" whereas it must be lower than "+String( nCon)+"."); equation // Connecting outlets to inlets for all instances of connection component. if nCon >= 2 then for i in 2:nCon loop connect(con[i-1].port_bDisSup,con[i].port_aDisSup); connect(con[i-1].port_aDisRet,con[i].port_bDisRet); end for; end if; // Connecting dp sensor (needs to be explicit because con[iConDpSen] is // undefined if iConDpSen <= 0). if iConDpSen > 0 then connect(con[iConDpSen].dp,dp); end if; connect(senRelPre.p_rel,dp); connect(con.port_bCon,ports_bCon); connect(ports_aCon,con.port_aCon); connect(port_aDisSup,con[1].port_aDisSup); connect(port_bDisRet,con[1].port_bDisRet); connect(con[nCon].port_aDisRet,port_aDisRet); connect(con[nCon].port_bDisSup,pipEnd.port_a); connect(pipEnd.port_b,port_bDisSup); connect(con.mCon_flow,mCon_flow); connect(port_aDisSup,senRelPre.port_a); connect(senRelPre.port_b,port_bDisRet); connect(con.dH_flow, dH_flow); end PartialDistribution2Pipe;

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium

Partial model for a two-pipe distribution network with two medium declarations

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium

Information


Partial model of a two-pipe distribution network.

An array of replaceable partial models is used to represent the connections along the network, including the pipe segment immediately upstream each connection.

A replaceable partial model is used to represent the pipe segment of the supply and return line after the last connection.

The parameter iConDpSen is provided to specify the index of the connection where the pressure drop is measured. Use zero for a sensor connected to the supply pipe inlet and return pipe outlet. Use a negative value if no sensor is needed.

Optionally the heat flow rate transferred to each connected load can be output.

Extends from Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium (Partial model for distribution network with two medium declarations).

Parameters

TypeNameDefaultDescription
replaceable package MediumSupPartialMediumMedium model for supply fluid
replaceable package MediumRetPartialMediumMedium model for return fluid
IntegernCon Number of connections
replaceable model Model_pipDisBuildings.Fluid.Interfaces.P...Model for distribution pipe
Booleanshow_heaFlofalseSet to true to output the heat flow rate transferred to each connected load
PartialConnection2Pipe2Mediumcon[nCon]redeclare Buildings.DHC.Netw...Connection to agent
Nominal condition
MassFlowRatemDis_flow_nominal Nominal mass flow rate in the distribution line before the first connection [kg/s]
MassFlowRatemCon_flow_nominal[nCon] Nominal mass flow rate in each connection line [kg/s]
MassFlowRatemEnd_flow_nominalmDis_flow_nominal - sum(mCon...Nominal mass flow rate in the end of the distribution line [kg/s]
MassFlowRatemDisCon_flow_nominal[nCon]cat(1, {mDis_flow_nominal}, ...Nominal mass flow rate in the distribution line before each connection [kg/s]
Assumptions
BooleanallowFlowReversalfalse= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]

Connectors

TypeNameDescription
FluidPorts_aports_aCon[nCon]Connection return ports
FluidPorts_bports_bCon[nCon]Connection supply ports
FluidPort_aport_aDisSupDistribution supply inlet port
FluidPort_bport_bDisSupDistribution supply outlet port
replaceable model Model_pipDisModel for distribution pipe
FluidPort_bport_bDisRetDistribution return outlet port
FluidPort_aport_aDisRetDistribution return inlet port

Modelica definition

partial model PartialDistribution2Pipe2Medium "Partial model for a two-pipe distribution network with two medium declarations" extends Buildings.DHC.Networks.BaseClasses.PartialDistribution2Medium; replaceable model Model_pipDis = Buildings.Fluid.Interfaces.PartialTwoPortInterface constrainedby Buildings.Fluid.Interfaces.PartialTwoPortInterface( redeclare final package Medium = MediumSup, final allowFlowReversal=allowFlowReversal) "Model for distribution pipe"; parameter Boolean show_heaFlo=false "Set to true to output the heat flow rate transferred to each connected load"; parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal "Nominal mass flow rate in the distribution line before the first connection"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nCon] "Nominal mass flow rate in each connection line"; parameter Modelica.Units.SI.MassFlowRate mEnd_flow_nominal=mDis_flow_nominal-sum( mCon_flow_nominal) "Nominal mass flow rate in the end of the distribution line"; parameter Modelica.Units.SI.MassFlowRate mDisCon_flow_nominal[nCon]=cat( 1, {mDis_flow_nominal}, {mDis_flow_nominal-sum(mCon_flow_nominal[1:i]) for i in 1:(nCon-1)}) "Nominal mass flow rate in the distribution line before each connection"; parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Modelica.Units.SI.Time tau=10 "Time constant at nominal flow for dynamic energy and momentum balance"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPort_b port_bDisRet( redeclare final package Medium=MediumRet, m_flow( max= if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow( start=MediumRet.h_default, nominal=MediumRet.h_default)) "Distribution return outlet port"; Modelica.Fluid.Interfaces.FluidPort_a port_aDisRet( redeclare final package Medium=MediumRet, m_flow( min= if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow( start=MediumRet.h_default, nominal=MediumRet.h_default)) "Distribution return inlet port"; // COMPONENTS replaceable Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium con[nCon] constrainedby Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium ( redeclare each final package MediumSup = MediumSup, redeclare each final package MediumRet = MediumRet, final mDis_flow_nominal=mDisCon_flow_nominal, final mCon_flow_nominal=mCon_flow_nominal, each final allowFlowReversal=allowFlowReversal, each final energyDynamics=energyDynamics, each final tau=tau) "Connection to agent"; Model_pipDis pipEnd( final m_flow_nominal=mEnd_flow_nominal) "Pipe representing the end of the distribution line (after last connection)"; initial equation assert( mDis_flow_nominal >= sum( mCon_flow_nominal), "In "+getInstanceName()+": mDis_flow_nominal = "+String( mDis_flow_nominal)+" whereas it must be higher than sum(mCon_flow_nominal) = "+String( sum( mCon_flow_nominal))+"."); equation // Connecting outlets to inlets for all instances of connection component. if nCon >= 2 then for i in 2:nCon loop connect(con[i-1].port_bDisSup,con[i].port_aDisSup); connect(con[i-1].port_aDisRet,con[i].port_bDisRet); end for; end if; connect(con.port_bCon,ports_bCon); connect(ports_aCon,con.port_aCon); connect(port_aDisSup,con[1].port_aDisSup); connect(port_bDisRet,con[1].port_bDisRet); connect(con[nCon].port_aDisRet,port_aDisRet); connect(con[nCon].port_bDisSup,pipEnd.port_a); connect(pipEnd.port_b,port_bDisSup); end PartialDistribution2Pipe2Medium;

Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe.Model_pipDis Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe.Model_pipDis


Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe.Model_pipDis

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominalmDis_flow_nominalNominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversalallowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipDis=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final m_flow_nominal=mDis_flow_nominal, final allowFlowReversal=allowFlowReversal);

Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe.Model_pipCon Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe.Model_pipCon


Buildings.DHC.Networks.BaseClasses.PartialConnection1Pipe.Model_pipCon

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominalmCon_flow_nominalNominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversalallowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipCon=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final m_flow_nominal=mCon_flow_nominal, final allowFlowReversal=allowFlowReversal);

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe.Model_pipCon Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe.Model_pipCon


Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe.Model_pipCon

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominalmCon_flow_nominalNominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversalallowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipCon=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final m_flow_nominal=mCon_flow_nominal, final allowFlowReversal=allowFlowReversal);

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium.Model_pipDisSup Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium.Model_pipDisSup

Interface for inlet pipe for the distribution supply

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium.Model_pipDisSup

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipDisSup = Buildings.Fluid.Interfaces.PartialTwoPortInterface constrainedby Buildings.Fluid.Interfaces.PartialTwoPortInterface( redeclare final package Medium = MediumSup, final m_flow_nominal=mDis_flow_nominal, final allowFlowReversal=allowFlowReversal) "Interface for inlet pipe for the distribution supply";

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium.Model_pipDisRet Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium.Model_pipDisRet

Interface for outlet pipe for the distribution return

Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe2Medium.Model_pipDisRet

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipDisRet = Buildings.Fluid.Interfaces.PartialTwoPortInterface constrainedby Buildings.Fluid.Interfaces.PartialTwoPortInterface( redeclare final package Medium = MediumRet, final m_flow_nominal=mDis_flow_nominal, final allowFlowReversal=allowFlowReversal) "Interface for outlet pipe for the distribution return";

Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe.Model_pipDis Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe.Model_pipDis

Model for distribution pipe

Buildings.DHC.Networks.BaseClasses.PartialDistribution1Pipe.Model_pipDis

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversalallowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipDis=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Model for distribution pipe";

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe.Model_pipDis Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe.Model_pipDis

Model for distribution pipe

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe.Model_pipDis

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversalallowFlowReversal= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipDis=Fluid.Interfaces.PartialTwoPortInterface ( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal) "Model for distribution pipe";

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium.Model_pipDis Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium.Model_pipDis

Model for distribution pipe

Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe2Medium.Model_pipDis

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

replaceable model Model_pipDis = Buildings.Fluid.Interfaces.PartialTwoPortInterface constrainedby Buildings.Fluid.Interfaces.PartialTwoPortInterface( redeclare final package Medium = MediumSup, final allowFlowReversal=allowFlowReversal) "Model for distribution pipe";