Example models
Information
This package contains examples for the use of models that can be found in
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
DualMixing
|
Model illustrating the operation of a dual mixing circuit |
SingleMixing
|
Model illustrating the operation of single mixing circuits |
SingleMixingOpenLoop
|
Model illustrating the operation of single mixing circuits with primary back pressure |
BaseClasses
|
Package with base classes |
Model illustrating the operation of a dual mixing circuit
Information
This model represents a heating system where the configuration
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.DualMixing
serves as the interface between a variable flow primary circuit
and a constant flow secondary circuit.
The secondary supply temperature is constant and lower
than the primary circuit.
The fixed bypass of the dual mixing circuit is balanced at design conditions
if kSizBal=1
.
Selecting a lower value such as kSizBal=0.6
illustrates
the operation with an oversized balancing valve, yielding
a lower pressure drop.
One can observe that the secondary supply temperature set point cannot
be met despite the control valve being fully open.
The secondary distribution pump operates with sufficient head
as the design flow rate is met in the consumer circuit.
This is the low pressure differential at the boundaries
of the control valve due to the oversized balancing valve
that creates the primary flow shortage and prevents from
serving the load properly.
Extends from BaseClasses.PartialPassivePrimary (Partial model of passive primary network).
Parameters
Type | Name | Default | Description |
Control | typ | Buildings.Fluid.HydronicConf... | Load type |
Integer | nTer | 2 | Number of terminal units |
Pressure | p_min | 200000 | Circuit minimum pressure [Pa] |
Temperature | TLiqEnt_nominal | 35 + 273.15 | Liquid entering temperature at design conditions [K] |
Temperature | TLiqLvg_nominal | 25 + 273.15 | Liquid leaving temperature at design conditions [K] |
Temperature | TLiqEntChg_nominal | 60 + 273.15 | Liquid entering temperature in change-over mode [K] |
Temperature | TLiqSup_nominal | 60 + 273.15 | Liquid primary supply temperature at design conditions [K] |
Temperature | TLiqSupChg_nominal | TLiqEntChg_nominal | Liquid primary supply temperature in change-over mode [K] |
MassFlowRate | mAir_flow_nominal | abs(loa.loa.Q_flow_nominal)/... | Air mass flow rate at design conditions [kg/s] |
Temperature | TAirEnt_nominal | 24 + 273.15 | Air entering temperature at design conditions [K] |
MassFraction | phiAirEnt_nominal | 0.5 | Air entering relative humidity at design conditions [1] |
Nominal condition |
MassFlowRate | mTer_flow_nominal | 1 | Terminal unit mass flow rate at design conditions [kg/s] |
MassFlowRate | m1_flow_nominal | if abs(TLiqSup_nominal - TLi... | Mass flow rate in primary circuit at design conditions [kg/s] |
PressureDifference | dpTer_nominal | 3E4 | Terminal unit pressure drop at design conditions [Pa] |
PressureDifference | dpPip_nominal | 0.5E4 | Pipe section pressure drop at design conditions [Pa] |
MassFlowRate | m2_flow_nominal | nTer*mTer_flow_nominal | Mass flow rate in consumer circuit at design conditions [kg/s] |
Configuration |
Real | kSizBal | 1.0 | Sizing factor for bypass balancing valve (1 means balanced) |
Dynamics |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Modelica definition
model DualMixing
extends BaseClasses.PartialPassivePrimary(
typ=Buildings.Fluid.HydronicConfigurations.Types.Control.Heating,
m1_flow_nominal=
if abs(TLiqSup_nominal - TLiqEnt_nominal) > Modelica.Constants.eps
then m2_flow_nominal*(TLiqEnt_nominal - TLiqLvg_nominal)/(TLiqSup_nominal - TLiqLvg_nominal)
else 0.95*m2_flow_nominal,
TLiqEnt_nominal=35 + 273.15,
TLiqLvg_nominal=25 + 273.15,
TLiqSup_nominal=60 + 273.15,
del1(nPorts=2),
ref(use_T_in=true));
parameter Real kSizBal(
final min=0) = 1.0
;
parameter Modelica.Units.SI.MassFlowRate m2_flow_nominal(
final min=0)=
nTer * mTer_flow_nominal
;
parameter Modelica.Units.SI.MassFlowRate mAir_flow_nominal=
abs(loa.loa.Q_flow_nominal) / 3 / 1015
;
parameter Modelica.Units.SI.Temperature TAirEnt_nominal=
24 + 273.15
;
parameter Modelica.Units.SI.MassFraction phiAirEnt_nominal = 0.5
;
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.DualMixing con(
typPum=Buildings.Fluid.HydronicConfigurations.Types.Pump.NoVariableInput,
final typCtl=typ,
redeclare final package Medium=MediumLiq,
final energyDynamics=energyDynamics,
final m2_flow_nominal=m2_flow_nominal,
final m1_flow_nominal=m1_flow_nominal,
dp1_nominal=res1.dp_nominal,
final dp2_nominal=dpPip_nominal + loa1.dpTer_nominal + loa1.dpValve_nominal,
final dpBal3_nominal=kSizBal * (con.dpValve_nominal + res1.dp_nominal))
;
ActiveNetworks.Examples.BaseClasses.LoadThreeWayValveControl loa(
redeclare final package MediumLiq = MediumLiq,
final typ=typ,
final energyDynamics=energyDynamics,
final mLiq_flow_nominal=mTer_flow_nominal,
final mAir_flow_nominal=mAir_flow_nominal,
final TAirEnt_nominal=TAirEnt_nominal,
final phiAirEnt_nominal=phiAirEnt_nominal,
final TLiqEnt_nominal=TLiqEnt_nominal,
final TLiqLvg_nominal=TLiqLvg_nominal,
final TLiqEntChg_nominal=TLiqEntChg_nominal)
;
Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable mode(
table=[0,0; 6,0; 6,1; 15,1; 15,1; 22,1; 22,0; 24,0],
timeScale=3600,
period=86400) ;
Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable fraLoa(table=[0,0,0; 6,
0,0; 6.1,1,1; 8,1,1; 9,1,0; 14,0.5,0; 14.5,0,0; 16,0,0; 17,0,1; 21,0,1;
22,0,0; 24,0,0], timeScale=3600) ;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant T2Set(
y(
final unit="K", displayUnit="degC"),
final k=TLiqEnt_nominal) ;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant T1Set(
y(
final unit="K", displayUnit="degC"),
final k=TLiqSup_nominal) ;
ActiveNetworks.Examples.BaseClasses.LoadThreeWayValveControl loa1(
redeclare final package MediumLiq = MediumLiq,
final typ=typ,
final energyDynamics=energyDynamics,
final mLiq_flow_nominal=mTer_flow_nominal,
final mAir_flow_nominal=mAir_flow_nominal,
final TAirEnt_nominal=TAirEnt_nominal,
final phiAirEnt_nominal=phiAirEnt_nominal,
final TLiqEnt_nominal=TLiqEnt_nominal,
final TLiqLvg_nominal=TLiqLvg_nominal,
final TLiqEntChg_nominal=TLiqEntChg_nominal)
;
FixedResistances.PressureDrop res2(
redeclare final package Medium = MediumLiq,
final m_flow_nominal=con.pum.m_flow_nominal - loa.mLiq_flow_nominal,
final dp_nominal=dpPip_nominal)
;
Delays.DelayFirstOrder del2(
redeclare final package Medium = MediumLiq,
final energyDynamics=energyDynamics,
final m_flow_nominal=m2_flow_nominal,
nPorts=3) ;
equation
connect(con.port_b2, loa.port_a);
connect(con.port_b1, del1.ports[2]);
connect(mode.y[1], loa.mode);
connect(mode.y[1], con.mode);
connect(fraLoa.y[1], loa.u);
connect(res1.port_b, con.port_a1);
connect(con.port_b2, res2.port_a);
connect(res2.port_b, loa1.port_a);
connect(del2.ports[1], con.port_a2);
connect(loa.port_b, del2.ports[2]);
connect(loa1.port_b, del2.ports[3]);
connect(mode.y[1], loa1.mode);
connect(fraLoa.y[2], loa1.u);
connect(T1Set.y, ref.T_in);
connect(T2Set.y, con.set);
end DualMixing;
Model illustrating the operation of single mixing circuits
Information
This model represents a change-over system where the configuration
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.SingleMixing
serves as the interface between a variable flow primary circuit
at constant supply temperature and two consumer circuits:
the first one is a constant flow circuit,
the second one is a variable flow circuit.
For each circuit, the secondary supply temperature is reset with an open loop,
representing for instance a reset logic based on the outdoor air temperature.
The pump model for the second circuit is an ideal
Δp-controlled model, its input being computed to
mimic the tracking of a pressure differential at the boundaries
of the terminal unit.
Extends from BaseClasses.PartialPassivePrimary (Partial model of passive primary network).
Parameters
Type | Name | Default | Description |
Control | typ | Buildings.Fluid.HydronicConf... | Load type |
Integer | nTer | 2 | Number of terminal units |
Pressure | p_min | 200000 | Circuit minimum pressure [Pa] |
Temperature | TLiqEnt_nominal | if typ == Buildings.Fluid.Hy... | Liquid entering temperature at design conditions [K] |
Temperature | TLiqLvg_nominal | TLiqEnt_nominal + (if typ ==... | Liquid leaving temperature at design conditions [K] |
Temperature | TLiqEntChg_nominal | 60 + 273.15 | Liquid entering temperature in change-over mode [K] |
Temperature | TLiqSup_nominal | TLiqEnt_nominal | Liquid primary supply temperature at design conditions [K] |
Temperature | TLiqSupChg_nominal | TLiqEntChg_nominal | Liquid primary supply temperature in change-over mode [K] |
Nominal condition |
MassFlowRate | mTer_flow_nominal | 1 | Terminal unit mass flow rate at design conditions [kg/s] |
MassFlowRate | m1_flow_nominal | nTer*mTer_flow_nominal | Mass flow rate in primary circuit at design conditions [kg/s] |
PressureDifference | dpTer_nominal | 3E4 | Terminal unit pressure drop at design conditions [Pa] |
PressureDifference | dpPip_nominal | 0.5E4 | Pipe section pressure drop at design conditions [Pa] |
Controls |
PressureDifference | dp2Set | loa1.dpTer_nominal + loa1.dp... | Secondary pressure differential set point [Pa] |
Dynamics |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Modelica definition
model SingleMixing
extends BaseClasses.PartialPassivePrimary(
typ=Buildings.Fluid.HydronicConfigurations.Types.Control.ChangeOver,
del1(nPorts=3),
ref(use_T_in=true));
parameter Modelica.Units.SI.PressureDifference dp2Set(
final min=0,
displayUnit="Pa") = loa1.dpTer_nominal + loa1.dpValve_nominal
;
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.SingleMixing con(
typPum=Buildings.Fluid.HydronicConfigurations.Types.Pump.NoVariableInput,
final typCtl=typ,
redeclare final package Medium=MediumLiq,
final energyDynamics=energyDynamics,
final m2_flow_nominal=loa.m_flow_nominal,
dp1_nominal=0,
final dp2_nominal=loa.dpTer_nominal + loa.dpValve_nominal)
;
ActiveNetworks.Examples.BaseClasses.LoadThreeWayValveControl loa(
redeclare final package MediumLiq = MediumLiq,
final typ=typ,
final energyDynamics=energyDynamics,
final mLiq_flow_nominal=mTer_flow_nominal,
final TLiqEnt_nominal=TLiqEnt_nominal,
final TLiqLvg_nominal=TLiqLvg_nominal,
final TLiqEntChg_nominal=TLiqEntChg_nominal)
;
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.SingleMixing con1(
typPumMod=Buildings.Fluid.HydronicConfigurations.Types.PumpModel.Head,
typPum=Buildings.Fluid.HydronicConfigurations.Types.Pump.VariableInput,
final typCtl=typ,
redeclare final package Medium = MediumLiq,
final energyDynamics=energyDynamics,
final m2_flow_nominal=loa1.m_flow_nominal / 0.9,
dp1_nominal=0,
final dp2_nominal=dp2Set)
;
ActiveNetworks.Examples.BaseClasses.LoadTwoWayValveControl loa1(
redeclare final package MediumLiq = MediumLiq,
final typ=typ,
final energyDynamics=energyDynamics,
final mLiq_flow_nominal=mTer_flow_nominal,
final TLiqEnt_nominal=TLiqEnt_nominal,
final TLiqLvg_nominal=TLiqLvg_nominal,
final TLiqEntChg_nominal=TLiqEntChg_nominal)
;
Sensors.RelativePressure dp2(
redeclare final package Medium = MediumLiq)
;
FixedResistances.PressureDrop resEnd2(
redeclare final package Medium = MediumLiq,
final m_flow_nominal=0.1*con1.pum.m_flow_nominal,
final dp_nominal=dp2Set)
;
Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable mode(
table=[0,0; 6,0; 6,2; 15,2; 15,1; 22,1; 22,0; 24,0],
timeScale=3600,
period=86400) ;
Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable fraLoa(table=[0,0,0; 6,
0,0; 6.1,1,1; 8,1,1; 9,1,0; 14,0.5,0; 14.5,0,0; 16,0,0; 17,0,1; 21,0,1;
22,0,0; 24,0,0], timeScale=3600) ;
Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable setOff(table=[0,0; 10,
0; 13,-8; 13,0; 18,0; 22,+5; 22,0; 24,0], timeScale=3600)
;
Buildings.Controls.OBC.CDL.Reals.Add T2Set(y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor T2SetMod(nin=3,
y(
final unit="K", displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant T2SetVal[3](
final k={
MediumLiq.T_default,TLiqEnt_nominal,TLiqEntChg_nominal})
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant T1SetVal[3](
final k={
MediumLiq.T_default,TLiqSup_nominal,TLiqSupChg_nominal})
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor T1Set(nin=3,
y(
final unit="K", displayUnit="degC"))
;
Modelica.Blocks.Sources.RealExpression uPum(y=(dp2Set + con1.val.dp3)/con1.pum.dp_nominal)
;
Buildings.Controls.OBC.CDL.Integers.AddParameter addPar(
final p=1)
;
equation
connect(con.port_b2, loa.port_a);
connect(loa.port_b, con.port_a2);
connect(con.port_b1, del1.ports[2]);
connect(con1.port_b1, del1.ports[3]);
connect(loa1.port_a, dp2.port_a);
connect(loa1.port_b, dp2.port_b);
connect(dp2.port_a, con1.port_b2);
connect(dp2.port_b, con1.port_a2);
connect(resEnd2.port_b, loa1.port_b);
connect(resEnd2.port_a, loa1.port_a);
connect(mode.y[1], loa.mode);
connect(mode.y[1], loa1.mode);
connect(mode.y[1], con.mode);
connect(fraLoa.y[1], loa.u);
connect(fraLoa.y[2], loa1.u);
connect(mode.y[1], con1.mode);
connect(T2SetVal.y, T2SetMod.u);
connect(T2SetMod.y, T2Set.u1);
connect(setOff.y[1], T2Set.u2);
connect(T2Set.y, con.set);
connect(T2Set.y, con1.set);
connect(T1SetVal.y, T1Set.u);
connect(T1Set.y, ref.T_in);
connect(res1.port_b, con.port_a1);
connect(res1.port_b, con1.port_a1);
connect(uPum.y, con1.yPum);
connect(mode.y[1], addPar.u);
connect(addPar.y, T1Set.index);
connect(addPar.y, T2SetMod.index);
end SingleMixing;
Model illustrating the operation of single mixing circuits with primary back pressure
Information
This model illustrates the disturbance caused on the three-way valve
operation by an induced negative pressure differential at the
circuit boundaries.
Two consumer circuits are connected to a primary loop by means of
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.SingleMixing.
The primary loop is configured with a flow resistance that
generates a negative pressure differential at the boundaries of the
consumer circuits
(representing for instance a boiler with a high pressure drop
and no minimum flow requirement).
Each consumer circuit is equipped with a circulation pump
that is sized to cover the primary pressure differential.
When the parameter is_bal
is false
no bypass balancing valve is considered.
When this parameter is true
a bypass balancing
valve is considered with the same design pressure drop
as the one in the primary loop.
The pump design head remains unchanged whatever the value
of the parameter is_bal
.
The model is configured in steady-state with open loop control.
The load on each consumer circuit is constant.
The control valve of the first circuit is modulated
from fully open to fully closed position while the
control valve of the remote circuit is kept fully open.
When the bypass is not balanced, the flow reverses in the primary
branch when the valve opening is below 20% which means
that the load cannot be served any more.
When the bypass is balanced, no flow reversal occurs and the
mixing function of the three-way valve is preserved
over its whole opening range.
Note that the setting of this model represents an oversized control
valve with a low authority β = 0.14.
Setting a higher valve design pressure drop to reach an authority
close to 0.5 alleviates the risk of primary flow reversal
and reduces the need for a bypass balancing valve.
Extends from BaseClasses.PartialPassivePrimary (Partial model of passive primary network).
Parameters
Type | Name | Default | Description |
Control | typ | Buildings.Fluid.HydronicConf... | Load type |
Integer | nTer | 2 | Number of terminal units |
Pressure | p_min | 200000 | Circuit minimum pressure [Pa] |
Temperature | TLiqEnt_nominal | 60 + 273.15 | Liquid entering temperature at design conditions [K] |
Temperature | TLiqLvg_nominal | TLiqEnt_nominal - 10 | Liquid leaving temperature at design conditions [K] |
Temperature | TLiqEntChg_nominal | 60 + 273.15 | Liquid entering temperature in change-over mode [K] |
Temperature | TLiqSup_nominal | TLiqEnt_nominal | Liquid primary supply temperature at design conditions [K] |
Temperature | TLiqSupChg_nominal | TLiqEntChg_nominal | Liquid primary supply temperature in change-over mode [K] |
PressureDifference | dpValve_nominal | 5e3 | Control valve pressure drop at design conditions [Pa] |
Nominal condition |
MassFlowRate | mTer_flow_nominal | 1 | Terminal unit mass flow rate at design conditions [kg/s] |
MassFlowRate | m1_flow_nominal | nTer*mTer_flow_nominal | Mass flow rate in primary circuit at design conditions [kg/s] |
PressureDifference | dpTer_nominal | 3E4 | Terminal unit pressure drop at design conditions [Pa] |
PressureDifference | dpPip_nominal | 0.5E4 | Pipe section pressure drop at design conditions [Pa] |
Configuration |
Boolean | is_bal | false | Set to true for balanced bypass branch |
Dynamics |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance: dynamic (3 initialization options) or steady state |
Modelica definition
model SingleMixingOpenLoop
extends BaseClasses.PartialPassivePrimary(
typ=Buildings.Fluid.HydronicConfigurations.Types.Control.Heating,
TLiqEnt_nominal=60 + 273.15,
TLiqLvg_nominal=TLiqEnt_nominal - 10,
TLiqSup_nominal=TLiqEnt_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
del1(nPorts=3),
res1(dp_nominal=3e4));
parameter Boolean is_bal=false
;
parameter Modelica.Units.SI.PressureDifference dpValve_nominal(
displayUnit="Pa") = 5e3
;
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.SingleMixing con(
typPum=Buildings.Fluid.HydronicConfigurations.Types.Pump.NoVariableInput,
redeclare final package Medium=MediumLiq,
val(fraK=1.0),
final typCtl=Buildings.Fluid.HydronicConfigurations.Types.Control.None,
final energyDynamics=energyDynamics,
final m2_flow_nominal=loa.m_flow_nominal,
dp1_nominal=res1.dp_nominal,
final dp2_nominal=loa.dpLiq_nominal,
final dpValve_nominal=dpValve_nominal,
final dpBal3_nominal=
if is_bal
then res1.dp_nominal
else 0)
;
Buildings.Fluid.HydronicConfigurations.ActiveNetworks.Examples.BaseClasses.Load
loa(
redeclare final package MediumLiq = MediumLiq,
final typ=typ,
final energyDynamics=energyDynamics,
final mLiq_flow_nominal=mTer_flow_nominal,
final dpLiq_nominal=dpTer_nominal,
final TLiqEnt_nominal=TLiqEnt_nominal,
final TLiqLvg_nominal=TLiqLvg_nominal) ;
Buildings.Fluid.HydronicConfigurations.PassiveNetworks.SingleMixing con1(
typPum=Buildings.Fluid.HydronicConfigurations.Types.Pump.NoVariableInput,
redeclare final package Medium = MediumLiq,
val(fraK=1.0),
final typCtl=Buildings.Fluid.HydronicConfigurations.Types.Control.None,
final energyDynamics=energyDynamics,
final m2_flow_nominal=loa1.m_flow_nominal,
dp1_nominal=res1.dp_nominal,
final dp2_nominal=loa1.dpLiq_nominal,
final dpValve_nominal=dpValve_nominal,
final dpBal3_nominal=
if is_bal
then res1.dp_nominal
else 0)
;
Buildings.Fluid.HydronicConfigurations.ActiveNetworks.Examples.BaseClasses.Load
loa1(
redeclare final package MediumLiq = MediumLiq,
final typ=typ,
final energyDynamics=energyDynamics,
final mLiq_flow_nominal=mTer_flow_nominal,
final dpLiq_nominal=dpTer_nominal,
final TLiqEnt_nominal=TLiqEnt_nominal,
final TLiqLvg_nominal=TLiqLvg_nominal) ;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant mode(k=1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant fraLoa(k=1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.TimeTable ope(
table=[0,1,1; 1,0,1],
extrapolation=Buildings.Controls.OBC.CDL.Types.Extrapolation.HoldLastPoint,
timeScale=100) ;
equation
connect(con.port_b2, loa.port_a);
connect(loa.port_b, con.port_a2);
connect(con.port_b1, del1.ports[2]);
connect(con1.port_b1, del1.ports[3]);
connect(mode.y, loa.mode);
connect(mode.y, loa1.mode);
connect(mode.y, con.mode);
connect(fraLoa.y, loa.u);
connect(fraLoa.y, loa1.u);
connect(mode.y, con1.mode);
connect(res1.port_b, con.port_a1);
connect(res1.port_b, con1.port_a1);
connect(con1.port_b2, loa1.port_a);
connect(loa1.port_b, con1.port_a2);
connect(ope.y[1], con.yVal);
connect(ope.y[2], con1.yVal);
end SingleMixingOpenLoop;