This package contains example models
Information
This package contains an example illustrating the use of the model in
Buildings.DHC.Networks.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
Distribution1PipeExample
|
Example of distribution network with 1 pipe for Distribution1Pipe_R and Distribution1PipePlugFlow_v |
Distribution2PipeExample
|
Example of distribution network with 2 pipes for Distribution2Pipe_R and Distribution2PipePlugFlow_v |
Example of distribution network with 1 pipe for Distribution1Pipe_R and Distribution1PipePlugFlow_v
Information
Example model of two one-pipe distribution models that could be used i.e for building a reservoir network to connect several agents in series.
It showcases
Buildings.DHC.Networks.Distribution1Pipe_R and
Buildings.DHC.Networks.Distribution1PipePlugFlow_v. The distribution models create a vector of nLoa
connection models
Buildings.DHC.Networks.Connections that are connected to a vector
of nLoa
agents made up by time series heating loads
Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeatingValve. Each agent will draw water from the distribution pipe and release
it to the same pipe.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
String | filNam | "modelica://Buildings/Resour... | File name with thermal loads as time series |
Integer | nLoa | 5 | Number of served loads |
Nominal condition |
Temperature | T_aHeaWat_nominal | 273.15 + 40 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 5 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aLoaHea_nominal | 273.15 + 20 | Load side inlet temperature at nominal conditions in heating mode [K] |
MassFlowRate | mLoaHea_flow_nominal | 1 | Load side mass flow rate at nominal conditions in heating mode [kg/s] |
Scaling |
Real | facMul | 10 | Mulitplier factor for terminal units |
Dynamics |
Nominal condition |
Time | tau | 120 | Time constant of fluid temperature variation at nominal flow rate [s] |
Modelica definition
model Distribution1PipeExample
extends Modelica.Icons.Example;
package Medium1 =
Buildings.Media.Water
;
package Medium2 =
Buildings.Media.Air
;
parameter String filNam = "modelica://Buildings/Resources/Data/DHC/Loads/Examples/SwissResidential_20190916.mos"
;
parameter Integer nLoa=5
;
parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal = 273.15 + 40
;
parameter Modelica.Units.SI.Temperature T_bHeaWat_nominal(
min=273.15,
displayUnit="degC") = T_aHeaWat_nominal - 5
;
parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal = 273.15 + 20
;
parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal = 1
;
parameter Modelica.Units.SI.Time tau = 120
;
parameter Real facMul = 10
;
final parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nLoa] = terAutoSize.mHeaWat_flow_nominal*facMul
;
final parameter Modelica.Units.SI.MassFlowRate m_flow_nominal =
sum(mCon_flow_nominal)
;
final parameter Modelica.Units.SI.PressureDifference dp_nominal =
sum(disAutoSize.con.pipDis.dp_nominal) +
max(terAutoSize.dpSou_nominal)
;
final parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal =
Buildings.DHC.Loads.BaseClasses.getPeakLoad(string="#Peak space heating load",
filNam =
Modelica.Utilities.Files.loadResource(filNam))/facMul
;
Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeatingValve
terAutoSize[nLoa](
each final facMul=facMul,
redeclare each final package Medium1 = Medium1,
redeclare each final package Medium2 = Medium2,
each final QHea_flow_nominal=QHea_flow_nominal,
each final mLoaHea_flow_nominal=mLoaHea_flow_nominal,
each final T_aHeaWat_nominal=T_aHeaWat_nominal,
each final T_bHeaWat_nominal=T_bHeaWat_nominal,
each final T_aLoaHea_nominal=T_aLoaHea_nominal) ;
Modelica.Blocks.Sources.CombiTimeTable loa(
tableOnFile=true,
tableName="tab1",
fileName=
Modelica.Utilities.Files.loadResource(
filNam),
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
y(
each unit="W"),
offset={0,0,0},
columns={2,3,4},
smoothness=Modelica.Blocks.Types.Smoothness.MonotoneContinuousDerivative1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet(
k=293.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep(
nout=nLoa)
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep1(
nout=nLoa)
;
Buildings.Fluid.Sources.Boundary_pT supHeaWatAutoSize(
redeclare package Medium = Medium1,
use_T_in=true,
nPorts=2) ;
Buildings.DHC.Networks.Distribution1Pipe_R disAutoSize(
redeclare final package Medium = Medium1,
nCon=nLoa,
allowFlowReversal=false,
mDis_flow_nominal=m_flow_nominal,
mCon_flow_nominal=mCon_flow_nominal,
lDis=
fill(6, nLoa),
lEnd=1);
Buildings.Fluid.Movers.FlowControlled_dp pumAutoSize(
redeclare package Medium = Medium1,
per(
final motorCooledByFluid=false),
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
m_flow_nominal=m_flow_nominal,
addPowerToMedium=false,
nominalValuesDefineDefaultPressureCurve=true,
use_inputFilter=false,
dp_nominal=dp_nominal);
Buildings.Controls.OBC.CDL.Reals.Sources.Constant dpPum(
k=dp_nominal)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant THeaWatSup(k=
max(
terAutoSize.T_aHeaWat_nominal)) ;
Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeatingValve
terPlugFlow[nLoa](
each final facMul=facMul,
redeclare each final package Medium1 = Medium1,
redeclare each final package Medium2 = Medium2,
each final QHea_flow_nominal=QHea_flow_nominal,
each final mLoaHea_flow_nominal=mLoaHea_flow_nominal,
each final T_aHeaWat_nominal=T_aHeaWat_nominal,
each final T_bHeaWat_nominal=T_bHeaWat_nominal,
each final T_aLoaHea_nominal=T_aLoaHea_nominal) ;
Buildings.DHC.Networks.Distribution1PipePlugFlow_v disPlugFlow(
nCon=nLoa,
redeclare final package Medium = Medium1,
allowFlowReversal=false,
mDis_flow_nominal=m_flow_nominal,
mCon_flow_nominal=mCon_flow_nominal,
lDis=
fill(6, nLoa),
lEnd=1,
dIns=0.02,
kIns=0.2);
Buildings.Fluid.Movers.FlowControlled_dp pumPlugFlow(
redeclare package Medium = Medium1,
per(
final motorCooledByFluid=false),
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
m_flow_nominal=m_flow_nominal,
addPowerToMedium=false,
nominalValuesDefineDefaultPressureCurve=true,
use_inputFilter=false,
dp_nominal=dp_nominal);
Buildings.Fluid.Sources.Boundary_pT supHeaWatPlugFlow(
redeclare package Medium = Medium1,
use_T_in=true,
nPorts=2) ;
Fluid.FixedResistances.BuriedPipes.PipeGroundCoupling pipeGroundCouplingSup(
lPip=6,
rPip=0.04,
thiGroLay=1.1,
nSta=5,
nSeg=nLoa + 1);
Buildings.DHC.ETS.BaseClasses.Pump_m_flow pumConAutoSize[nLoa](
each dp_nominal=5000,
redeclare final package Medium = Medium1,
each m_flow_nominal=mLoaHea_flow_nominal) ;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep2(nout=nLoa)
;
Modelica.Blocks.Sources.RealExpression mFlowConAutosize(
y=terAutoSize[1].val.y_actual*mLoaHea_flow_nominal);
Buildings.DHC.ETS.BaseClasses.Pump_m_flow pumConPlugFlow[nLoa](
each dp_nominal=5000,
redeclare final package Medium = Medium1,
each m_flow_nominal=mLoaHea_flow_nominal) ;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep3(nout=nLoa)
;
Modelica.Blocks.Sources.RealExpression mFlowConPlugFlow(
y = terPlugFlow[1].val.y_actual*mLoaHea_flow_nominal);
protected
parameter Medium1.ThermodynamicState sta_default=
Medium1.setState_pTX(
T=Medium1.T_default,
p=Medium1.p_default,
X=Medium1.X_default);
parameter Modelica.Units.SI.Density rho_default=
Medium1.density(sta_default)
;
equation
connect(loa.y[2],reaRep1.u);
connect(reaRep.y, terAutoSize.TSetHea);
connect(reaRep1.y, terAutoSize.QReqHea_flow);
connect(disAutoSize.ports_bCon, terAutoSize.port_aHeaWat);
connect(pumAutoSize.port_b, disAutoSize.port_aDisSup);
connect(THeaWatSup.y, supHeaWatAutoSize.T_in);
connect(dpPum.y, pumAutoSize.dp_in);
connect(reaRep.u,minTSet.y);
connect(reaRep.y, terPlugFlow.TSetHea);
connect(reaRep1.y, terPlugFlow.QReqHea_flow);
connect(disPlugFlow.ports_bCon, terPlugFlow.port_aHeaWat);
connect(pumPlugFlow.port_b, disPlugFlow.port_aDisSup);
connect(dpPum.y, pumPlugFlow.dp_in);
connect(THeaWatSup.y, supHeaWatPlugFlow.T_in);
connect(pipeGroundCouplingSup.heatPorts, disPlugFlow.heatPorts);
connect(disAutoSize.port_bDisSup, supHeaWatAutoSize.ports[1]);
connect(disPlugFlow.port_bDisSup, supHeaWatPlugFlow.ports[1]);
connect(terAutoSize.port_bHeaWat,pumConAutoSize. port_a);
connect(pumConAutoSize.port_b, disAutoSize.ports_aCon);
connect(mFlowConAutosize.y, reaRep2.u);
connect(reaRep2.y, pumConAutoSize.m_flow_in);
connect(pumConPlugFlow.port_a, terPlugFlow.port_bHeaWat);
connect(pumConPlugFlow.port_b, disPlugFlow.ports_aCon);
connect(pumConPlugFlow.m_flow_in, reaRep3.y);
connect(reaRep3.u, mFlowConPlugFlow.y);
connect(pumAutoSize.port_a, supHeaWatAutoSize.ports[2]);
connect(pumPlugFlow.port_a, supHeaWatPlugFlow.ports[2]);
end Distribution1PipeExample;
Example of distribution network with 2 pipes for Distribution2Pipe_R and Distribution2PipePlugFlow_v
Information
Example model of two two-pipe distribution models that can be used i.e. for building a bi-directional network to connect several agents in series.
It showcases Buildings.DHC.Networks.Distribution2Pipe_R
and Buildings.DHC.Networks.Distribution2PipePlugFlow_v.
The distribution models create a vector of nLoa
connection models
Buildings.DHC.Networks.Connections that are connected to a vector of nLoa
agents made up by time series heating loads
Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeatingValve. Each agent will draw water from the supply distribution pipe
and release it in the return pipe.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
String | filNam | "modelica://Buildings/Resour... | File name with thermal loads as time series |
Integer | nLoa | 5 | Number of served loads |
Nominal condition |
Temperature | T_aHeaWat_nominal | 273.15 + 40 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 5 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aLoaHea_nominal | 273.15 + 20 | Load side inlet temperature at nominal conditions in heating mode [K] |
MassFlowRate | mLoaHea_flow_nominal | 1 | Load side mass flow rate at nominal conditions in heating mode [kg/s] |
Scaling |
Real | facMul | 10 | Mulitplier factor for terminal units |
Dynamics |
Nominal condition |
Time | tau | 120 | Time constant of fluid temperature variation at nominal flow rate [s] |
Modelica definition
model Distribution2PipeExample
extends Modelica.Icons.Example;
package Medium1 =
Buildings.Media.Water
;
package Medium2 =
Buildings.Media.Air
;
parameter String filNam = "modelica://Buildings/Resources/Data/DHC/Loads/Examples/SwissResidential_20190916.mos"
;
parameter Integer nLoa = 5
;
parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal = 273.15 + 40
;
parameter Modelica.Units.SI.Temperature T_bHeaWat_nominal(
min=273.15,
displayUnit="degC") = T_aHeaWat_nominal - 5
;
parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal = 273.15 + 20
;
parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal = 1
;
parameter Modelica.Units.SI.Time tau = 120
;
parameter Real facMul = 10
;
final parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nLoa] =
terAutoSize.mHeaWat_flow_nominal*facMul
;
final parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=
sum(
mCon_flow_nominal) ;
final parameter Modelica.Units.SI.PressureDifference dp_nominal=
sum(
disAutoSize.con.pipDisSup.dp_nominal) +
sum(disAutoSize.con.pipDisRet.dp_nominal)
+
max(terAutoSize.dpSou_nominal)
;
final parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal=
Buildings.DHC.Loads.BaseClasses.getPeakLoad(string="#Peak space heating load",
filNam =
Modelica.Utilities.Files.loadResource(filNam))/facMul
;
Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeatingValve
terAutoSize[nLoa](
each final facMul=facMul,
redeclare each final package Medium1 = Medium1,
redeclare each final package Medium2 = Medium2,
each final QHea_flow_nominal=QHea_flow_nominal,
each final mLoaHea_flow_nominal=mLoaHea_flow_nominal,
each final T_aHeaWat_nominal=T_aHeaWat_nominal,
each final T_bHeaWat_nominal=T_bHeaWat_nominal,
each final T_aLoaHea_nominal=T_aLoaHea_nominal) ;
Modelica.Blocks.Sources.CombiTimeTable loa(
tableOnFile=true,
tableName="tab1",
fileName=
Modelica.Utilities.Files.loadResource(
filNam),
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
y(
each unit="W"),
offset={0,0,0},
columns={2,3,4},
smoothness=Modelica.Blocks.Types.Smoothness.MonotoneContinuousDerivative1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet(
k=293.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep(
nout=nLoa)
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep1(
nout=nLoa)
;
Buildings.Fluid.Sources.Boundary_pT supHeaWatAutoSize(
redeclare package Medium = Medium1,
use_T_in=true,
nPorts=2) ;
Buildings.DHC.Networks.Distribution2Pipe_R disAutoSize(
redeclare final package Medium = Medium1,
nCon=nLoa,
allowFlowReversal=false,
mDis_flow_nominal=m_flow_nominal,
mCon_flow_nominal=mCon_flow_nominal,
mEnd_flow_nominal=m_flow_nominal,
lDis=
fill(6, nLoa),
lEnd=1);
Buildings.Fluid.Movers.FlowControlled_dp pumAutoSize(
redeclare package Medium = Medium1,
per(
final motorCooledByFluid=false),
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
m_flow_nominal=m_flow_nominal,
addPowerToMedium=false,
nominalValuesDefineDefaultPressureCurve=true,
use_inputFilter=false,
dp_nominal=dp_nominal);
Buildings.Controls.OBC.CDL.Reals.Sources.Constant dpPum(
k=dp_nominal)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant THeaWatSup(
k=
max(terAutoSize.T_aHeaWat_nominal)) ;
Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeatingValve
terPlugFlow[nLoa](
each final facMul=facMul,
redeclare each final package Medium1 = Medium1,
redeclare each final package Medium2 = Medium2,
each final QHea_flow_nominal=QHea_flow_nominal,
each final mLoaHea_flow_nominal=mLoaHea_flow_nominal,
each final T_aHeaWat_nominal=T_aHeaWat_nominal,
each final T_bHeaWat_nominal=T_bHeaWat_nominal,
each final T_aLoaHea_nominal=T_aLoaHea_nominal) ;
Buildings.DHC.Networks.Distribution2PipePlugFlow_v disPlugFlow(
nCon=nLoa,
redeclare final package Medium = Medium1,
allowFlowReversal=false,
mDis_flow_nominal=m_flow_nominal,
mCon_flow_nominal=mCon_flow_nominal,
mEnd_flow_nominal=m_flow_nominal,
lDis=
fill(6, nLoa),
lEnd=1);
Buildings.Fluid.Movers.FlowControlled_dp pumPlugFlow(
redeclare package Medium = Medium1,
per(
final motorCooledByFluid=false),
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
m_flow_nominal=m_flow_nominal,
addPowerToMedium=false,
nominalValuesDefineDefaultPressureCurve=true,
use_inputFilter=false,
dp_nominal=dp_nominal);
Buildings.Fluid.Sources.Boundary_pT supHeaWatPlugFlow(
redeclare package Medium = Medium1,
use_T_in=true,
nPorts=2) ;
Fluid.FixedResistances.BuriedPipes.PipeGroundCoupling pipeGroundCouplingRet(
lPip=6,
rPip=0.04,
thiGroLay=1.1,
nSta=5,
nSeg=nLoa);
Fluid.FixedResistances.BuriedPipes.PipeGroundCoupling pipeGroundCouplingSup(
lPip=6,
rPip=0.04,
thiGroLay=1.1,
nSta=5,
nSeg=nLoa + 1);
protected
parameter Medium1.ThermodynamicState sta_default=
Medium1.setState_pTX(
T=Medium1.T_default,
p=Medium1.p_default,
X=Medium1.X_default);
parameter Modelica.Units.SI.Density rho_default=
Medium1.density(sta_default)
;
equation
connect(loa.y[2],reaRep1.u);
connect(reaRep.y, terAutoSize.TSetHea);
connect(reaRep1.y, terAutoSize.QReqHea_flow);
connect(terAutoSize.port_bHeaWat, disAutoSize.ports_aCon);
connect(disAutoSize.ports_bCon, terAutoSize.port_aHeaWat);
connect(pumAutoSize.port_b, disAutoSize.port_aDisSup);
connect(THeaWatSup.y, supHeaWatAutoSize.T_in);
connect(dpPum.y, pumAutoSize.dp_in);
connect(reaRep.u,minTSet.y);
connect(reaRep.y, terPlugFlow.TSetHea);
connect(reaRep1.y, terPlugFlow.QReqHea_flow);
connect(terPlugFlow.port_bHeaWat, disPlugFlow.ports_aCon);
connect(disPlugFlow.ports_bCon, terPlugFlow.port_aHeaWat);
connect(pumPlugFlow.port_b, disPlugFlow.port_aDisSup);
connect(dpPum.y, pumPlugFlow.dp_in);
connect(THeaWatSup.y, supHeaWatPlugFlow.T_in);
connect(disAutoSize.port_bDisRet, supHeaWatAutoSize.ports[1]);
connect(disPlugFlow.port_bDisRet, supHeaWatPlugFlow.ports[1]);
connect(pipeGroundCouplingRet.heatPorts, disPlugFlow.heatPortsRet);
connect(pipeGroundCouplingSup.heatPorts, disPlugFlow.heatPortsDis);
connect(supHeaWatAutoSize.ports[2], pumAutoSize.port_a);
connect(supHeaWatPlugFlow.ports[2], pumPlugFlow.port_a);
end Distribution2PipeExample;