Buildings.DHC.Networks.Examples

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
Buildings.DHC.Networks.Examples.Distribution1PipeExample Distribution1PipeExample Example of distribution network with 1 pipe for Distribution1Pipe_R and Distribution1PipePlugFlow_v
Buildings.DHC.Networks.Examples.Distribution2PipeExample Distribution2PipeExample Example of distribution network with 2 pipes for Distribution2Pipe_R and Distribution2PipePlugFlow_v

Buildings.DHC.Networks.Examples.Distribution1PipeExample Buildings.DHC.Networks.Examples.Distribution1PipeExample

Example of distribution network with 1 pipe for Distribution1Pipe_R and Distribution1PipePlugFlow_v

Buildings.DHC.Networks.Examples.Distribution1PipeExample

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

TypeNameDefaultDescription
StringfilNam"modelica://Buildings/Resour...File name with thermal loads as time series
IntegernLoa5Number of served loads
Nominal condition
TemperatureT_aHeaWat_nominal273.15 + 40Heating water inlet temperature at nominal conditions [K]
TemperatureT_bHeaWat_nominalT_aHeaWat_nominal - 5Heating water outlet temperature at nominal conditions [K]
TemperatureT_aLoaHea_nominal273.15 + 20Load side inlet temperature at nominal conditions in heating mode [K]
MassFlowRatemLoaHea_flow_nominal1Load side mass flow rate at nominal conditions in heating mode [kg/s]
Scaling
RealfacMul10Mulitplier factor for terminal units
Dynamics
Nominal condition
Timetau120Time constant of fluid temperature variation at nominal flow rate [s]

Modelica definition

model Distribution1PipeExample "Example of distribution network with 1 pipe for Distribution1Pipe_R and Distribution1PipePlugFlow_v" extends Modelica.Icons.Example; package Medium1 = Buildings.Media.Water "Source side medium"; package Medium2 = Buildings.Media.Air "Load side medium"; parameter String filNam = "modelica://Buildings/Resources/Data/DHC/Loads/Examples/SwissResidential_20190916.mos" "File name with thermal loads as time series"; parameter Integer nLoa=5 "Number of served loads"; parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal = 273.15 + 40 "Heating water inlet temperature at nominal conditions"; parameter Modelica.Units.SI.Temperature T_bHeaWat_nominal( min=273.15, displayUnit="degC") = T_aHeaWat_nominal - 5 "Heating water outlet temperature at nominal conditions"; parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal = 273.15 + 20 "Load side inlet temperature at nominal conditions in heating mode"; parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal = 1 "Load side mass flow rate at nominal conditions in heating mode"; parameter Modelica.Units.SI.Time tau = 120 "Time constant of fluid temperature variation at nominal flow rate"; parameter Real facMul = 10 "Mulitplier factor for terminal units"; final parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nLoa] = terAutoSize.mHeaWat_flow_nominal*facMul "Nominal mass flow rate in each connection line"; final parameter Modelica.Units.SI.MassFlowRate m_flow_nominal = sum(mCon_flow_nominal) "Nominal mass flow rate in the distribution line"; final parameter Modelica.Units.SI.PressureDifference dp_nominal = sum(disAutoSize.con.pipDis.dp_nominal) + max(terAutoSize.dpSou_nominal) "Nominal pressure drop in the distribution line"; 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 "Design heating heat flow rate (>=0)"; 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) "Heating terminal unit"; 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) "Reader for thermal loads (y[1] is cooling load, y[2] is heating load)"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet( k=293.15, y(final unit="K", displayUnit="degC")) "Minimum temperature set point"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep( nout=nLoa) "Repeat input to output an array"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep1( nout=nLoa) "Repeat input to output an array"; Buildings.Fluid.Sources.Boundary_pT supHeaWatAutoSize( redeclare package Medium = Medium1, use_T_in=true, nPorts=2) "Heating water supply"; 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) "Prescribed head"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant THeaWatSup(k=max( terAutoSize.T_aHeaWat_nominal)) "Supply temperature"; 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) "Heating terminal unit"; 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) "Heating water supply"; 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) "Distribution network pump"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep2(nout=nLoa) "Repeat input to output an array"; 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) "Distribution network pump"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep3(nout=nLoa) "Repeat input to output an array"; 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) "Density, used to compute fluid volume"; 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;

Buildings.DHC.Networks.Examples.Distribution2PipeExample Buildings.DHC.Networks.Examples.Distribution2PipeExample

Example of distribution network with 2 pipes for Distribution2Pipe_R and Distribution2PipePlugFlow_v

Buildings.DHC.Networks.Examples.Distribution2PipeExample

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

TypeNameDefaultDescription
StringfilNam"modelica://Buildings/Resour...File name with thermal loads as time series
IntegernLoa5Number of served loads
Nominal condition
TemperatureT_aHeaWat_nominal273.15 + 40Heating water inlet temperature at nominal conditions [K]
TemperatureT_bHeaWat_nominalT_aHeaWat_nominal - 5Heating water outlet temperature at nominal conditions [K]
TemperatureT_aLoaHea_nominal273.15 + 20Load side inlet temperature at nominal conditions in heating mode [K]
MassFlowRatemLoaHea_flow_nominal1Load side mass flow rate at nominal conditions in heating mode [kg/s]
Scaling
RealfacMul10Mulitplier factor for terminal units
Dynamics
Nominal condition
Timetau120Time constant of fluid temperature variation at nominal flow rate [s]

Modelica definition

model Distribution2PipeExample "Example of distribution network with 2 pipes for Distribution2Pipe_R and Distribution2PipePlugFlow_v" extends Modelica.Icons.Example; package Medium1 = Buildings.Media.Water "Source side medium"; package Medium2 = Buildings.Media.Air "Load side medium"; parameter String filNam = "modelica://Buildings/Resources/Data/DHC/Loads/Examples/SwissResidential_20190916.mos" "File name with thermal loads as time series"; parameter Integer nLoa = 5 "Number of served loads"; parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal = 273.15 + 40 "Heating water inlet temperature at nominal conditions"; parameter Modelica.Units.SI.Temperature T_bHeaWat_nominal( min=273.15, displayUnit="degC") = T_aHeaWat_nominal - 5 "Heating water outlet temperature at nominal conditions"; parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal = 273.15 + 20 "Load side inlet temperature at nominal conditions in heating mode"; parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal = 1 "Load side mass flow rate at nominal conditions in heating mode"; parameter Modelica.Units.SI.Time tau = 120 "Time constant of fluid temperature variation at nominal flow rate"; parameter Real facMul = 10 "Mulitplier factor for terminal units"; final parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal[nLoa] = terAutoSize.mHeaWat_flow_nominal*facMul "Nominal mass flow rate in each connection line"; final parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=sum( mCon_flow_nominal) "Nominal mass flow rate in the distribution line"; final parameter Modelica.Units.SI.PressureDifference dp_nominal=sum( disAutoSize.con.pipDisSup.dp_nominal) + sum(disAutoSize.con.pipDisRet.dp_nominal) + max(terAutoSize.dpSou_nominal) "Nominal pressure drop in the distribution line"; 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 "Design heating heat flow rate (>=0)"; 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) "Heating terminal unit"; 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) "Reader for thermal loads (y[1] is cooling load, y[2] is heating load)"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet( k=293.15, y(final unit="K", displayUnit="degC")) "Minimum temperature set point"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep( nout=nLoa) "Repeat input to output an array"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep1( nout=nLoa) "Repeat input to output an array"; Buildings.Fluid.Sources.Boundary_pT supHeaWatAutoSize( redeclare package Medium = Medium1, use_T_in=true, nPorts=2) "Heating water supply"; 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) "Prescribed head"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant THeaWatSup( k=max(terAutoSize.T_aHeaWat_nominal)) "Supply temperature"; 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) "Heating terminal unit"; 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) "Heating water supply"; 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) "Density, used to compute fluid volume"; 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;