Buildings.DHC.ETS.BaseClasses

Package with base classes

Information

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

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

Package Content

Name Description
Buildings.DHC.ETS.BaseClasses.CollectorDistributor CollectorDistributor Model of a collector/distributor with zero pressure drop between connections
Buildings.DHC.ETS.BaseClasses.Connection2PipeLossless Connection2PipeLossless Model of a lossless connection to a collector/distributor
Buildings.DHC.ETS.BaseClasses.Junction Junction Fluid junction with zero pressure drop
Buildings.DHC.ETS.BaseClasses.PartialDirect PartialDirect Partial direct ETS model for district energy systems with in-building pumping and deltaT control
Buildings.DHC.ETS.BaseClasses.PartialETS PartialETS Partial class for modeling an energy transfer station
Buildings.DHC.ETS.BaseClasses.PartialIndirect PartialIndirect Partial indirect energy transfer station for district energy systems
Buildings.DHC.ETS.BaseClasses.Pump_m_flow Pump_m_flow Pump with prescribed mass flow rate
Buildings.DHC.ETS.BaseClasses.StratifiedTank StratifiedTank Stratified buffer tank model
Buildings.DHC.ETS.BaseClasses.computeCoordinates computeCoordinates Coordinates of evenly distributed boreholes given the number of boreholes
Buildings.DHC.ETS.BaseClasses.Validation Validation Collection of validation models

Buildings.DHC.ETS.BaseClasses.CollectorDistributor Buildings.DHC.ETS.BaseClasses.CollectorDistributor

Model of a collector/distributor with zero pressure drop between connections

Buildings.DHC.ETS.BaseClasses.CollectorDistributor

Information

This model represents a collector/distributor which connects nCon hydronic circuits in parallel. The pressure drop between each connection is assumed negligible compared to the pressure drop in each circuit, and is set to zero in the model. By default,

Extends from Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe (Partial model for two-pipe distribution network).

Parameters

TypeNameDefaultDescription
IntegernCon Number of connections
replaceable package MediumPartialMediumMedium model
replaceable model Model_pipDisFluid.FixedResistances.Lossl...Model for distribution pipe
IntegeriConDpSen-1Index of the connection where the pressure drop is measured
Booleanshow_entFlofalseSet to true to output enthalpy flow rate difference at each connection
Nominal condition
MassFlowRatemDis_flow_nominalsum(mCon_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_nominalNominal mass flow rate in the end of the distribution line [kg/s]
MassFlowRatemDisCon_flow_nominal[nCon]fill(mDis_flow_nominal, nCon)Nominal mass flow rate in the distribution line before each connection [kg/s]
Assumptions
BooleanallowFlowReversaltrue= 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

model CollectorDistributor "Model of a collector/distributor with zero pressure drop between connections" extends Buildings.DHC.Networks.BaseClasses.PartialDistribution2Pipe( mDis_flow_nominal=sum( mCon_flow_nominal), final mDisCon_flow_nominal=fill( mDis_flow_nominal, nCon), final mEnd_flow_nominal=mDis_flow_nominal, final allowFlowReversal=true, final iConDpSen=-1, redeclare Connection2PipeLossless con[nCon], redeclare model Model_pipDis=Fluid.FixedResistances.LosslessPipe); end CollectorDistributor;

Buildings.DHC.ETS.BaseClasses.Connection2PipeLossless Buildings.DHC.ETS.BaseClasses.Connection2PipeLossless

Model of a lossless connection to a collector/distributor

Buildings.DHC.ETS.BaseClasses.Connection2PipeLossless

Information

This is a model of a connection for a two-pipe system using a pipe model with no flow resistance, no heat loss and no transport delay.

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

Parameters

TypeNameDefaultDescription
replaceable model Model_pipDisSupPartialTwoPortInterfaceInterface for inlet pipe for the distribution supply
replaceable model Model_pipDisRetPartialTwoPortInterfaceInterface for outlet pipe for the distribution return
replaceable package MediumPartialMediumMedium model
replaceable model Model_pipConBuildings.Fluid.FixedResista... 
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 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
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

model Connection2PipeLossless "Model of a lossless connection to a collector/distributor" extends Buildings.DHC.Networks.BaseClasses.PartialConnection2Pipe( redeclare model Model_pipDisSup = Buildings.Fluid.FixedResistances.LosslessPipe, redeclare model Model_pipDisRet = Buildings.Fluid.FixedResistances.LosslessPipe, redeclare model Model_pipCon=Buildings.Fluid.FixedResistances.LosslessPipe); end Connection2PipeLossless;

Buildings.DHC.ETS.BaseClasses.Junction Buildings.DHC.ETS.BaseClasses.Junction

Fluid junction with zero pressure drop

Buildings.DHC.ETS.BaseClasses.Junction

Information

This is a model of a fluid junction with zero pressure drop. By default the model is configured in steady-state.

Extends from Fluid.FixedResistances.Junction (Flow splitter with fixed resistance at each port).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal[3] Mass flow rate. Set negative at outflowing ports. [kg/s]
Pressuredp_nominal[3]fill(0, 3)Pressure drop at nominal mass flow rate, set to zero or negative number at outflowing ports. [Pa]
Transition to laminar
RealdeltaM0.3Fraction of nominal mass flow rate where transition to turbulent occurs
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
MassFlowRatemDyn_flow_nominalsum(abs(m_flow_nominal[:])/3)Nominal mass flow rate for dynamic momentum and energy balance [kg/s]
Nominal condition
Timetau10Time constant at nominal flow for dynamic energy and momentum balance [s]
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
ExtraPropertyC_nominal[Medium.nC]fill(1E-2, Medium.nC)Nominal value of trace substances. (Set to typical order of magnitude.)
Advanced
Booleanfrom_dpfalse= true, use m_flow = f(dp) else dp = f(m_flow)
PortFlowDirectionportFlowDirection_1Modelica.Fluid.Types.PortFlo...Flow direction for port_1
PortFlowDirectionportFlowDirection_2Modelica.Fluid.Types.PortFlo...Flow direction for port_2
PortFlowDirectionportFlowDirection_3Modelica.Fluid.Types.PortFlo...Flow direction for port_3
BooleanverifyFlowReversalfalse=true, to assert that the flow does not reverse when portFlowDirection_* does not equal Bidirectional
MassFlowRatem_flow_smallmDyn_flow_nominal*1e-4Small mass flow rate for checking flow reversal [kg/s]
Booleanlinearizedfalse= true, use linear relation between m_flow and dp for any flow rate

Connectors

TypeNameDescription
FluidPort_aport_1First port, typically inlet
FluidPort_bport_2Second port, typically outlet
FluidPort_aport_3Third port, can be either inlet or outlet

Modelica definition

model Junction "Fluid junction with zero pressure drop" extends Fluid.FixedResistances.Junction( energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, final dp_nominal=fill( 0, 3), final from_dp=false); end Junction;

Buildings.DHC.ETS.BaseClasses.PartialDirect Buildings.DHC.ETS.BaseClasses.PartialDirect

Partial direct ETS model for district energy systems with in-building pumping and deltaT control

Buildings.DHC.ETS.BaseClasses.PartialDirect

Information

Direct cooling energy transfer station (ETS) model with in-building pumping and deltaT control. The design is based on a typical district cooling ETS described in ASHRAE's District Cooling Guide. As shown in the figure below, the district and building piping are hydronically coupled. The control valve ensures that the return temperature to the district cooling network is at or above the minimum specified value. This configuration naturally results in a fluctuating building supply tempearture.

DC ETS Direct

Reference

American Society of Heating, Refrigeration and Air-Conditioning Engineers. (2019). Chapter 5: End User Interface. In District Cooling Guide, Second Edition and Owner's Guide for Buildings Served by District Cooling.

Extends from Buildings.DHC.ETS.BaseClasses.PartialETS (Partial class for modeling an energy transfer station).

Parameters

TypeNameDefaultDescription
replaceable package MediumSerWaterService side medium
replaceable package MediumSerHea_aWaterService side medium at heating inlet
replaceable package MediumBuiWaterBuilding side medium
Genericfue[nFue] Fuel type
Configuration
DistrictSystemTypetypBuildings.DHC.Types.District...Type of district system
Booleanhave_heaWatfalseSet to true if the ETS supplies heating water
Booleanhave_hotWatfalseSet to true if the ETS supplies hot water
Booleanhave_chiWatfalseSet to true if the ETS supplies chilled water
Booleanhave_fanfalseSet to true if fan power is computed
Booleanhave_pumfalseSet to true if pump power is computed
Booleanhave_eleHeafalseSet to true if the ETS has electric heating system
IntegernFue0Number of fuel types (0 means no combustion system)
Booleanhave_eleCoofalseSet to true if the ETS has electric cooling system
Booleanhave_weaBusfalseSet to true to use a weather bus
Nominal condition
HeatFlowRateQHeaWat_flow_nominal0Nominal capacity of heating system (>=0) [W]
HeatFlowRateQHotWat_flow_nominal0Nominal capacity of hot water production system (>=0) [W]
HeatFlowRateQChiWat_flow_nominal0Nominal capacity of cooling system (<=0) [W]
MassFlowRatemBui_flow_nominal Nominal mass flow rate of building side [kg/s]
PressureDifferencedpConVal_nominal50Nominal pressure drop in the control valve [Pa]
PressureDifferencedpCheVal_nominal6000Nominal pressure drop in the check valve [Pa]
PID controller
SimpleControllercontrollerTypeModelica.Blocks.Types.Simple...Type of controller
Realk0.1Gain of controller [1]
TimeTi60Time constant of integrator block [s]
TimeTd0.1Time constant of derivative block [s]
RealyMax1Upper limit of output
RealyMin0Lower limit of output
Assumptions
BooleanallowFlowReversalSerfalseSet to true to allow flow reversal on service side
BooleanallowFlowReversalBuifalseSet to true to allow flow reversal on building side
Advanced
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Realbandwidth0.2Bandwidth around reference signal for on/off controller

Connectors

TypeNameDescription
FluidPorts_aports_aHeaWat[nPorts_aHeaWat]Fluid connectors for heating water return (from building)
FluidPorts_bports_bHeaWat[nPorts_bHeaWat]Fluid connectors for heating water supply (to building)
FluidPorts_aports_aChiWat[nPorts_aChiWat]Fluid connectors for chilled water return (from building)
FluidPorts_bports_bChiWat[nPorts_bChiWat]Fluid connectors for chilled water supply (to building)
FluidPort_aport_aSerAmbFluid connector for ambient water service supply line
FluidPort_bport_bSerAmbFluid connector for ambient water service return line
FluidPort_aport_aSerHeaFluid connector for heating service supply line
FluidPort_bport_bSerHeaFluid connector for heating service return line
FluidPort_aport_aSerCooFluid connector for cooling service supply line
FluidPort_bport_bSerCooFluid connector for cooling service return line
output RealOutputPHeaPower drawn by heating system [W]
output RealOutputPCooPower drawn by cooling system [W]
output RealOutputPFanPower drawn by fan motors [W]
output RealOutputPPumPower drawn by pump motors [W]
output RealOutputQFue_flow[nFue]Fuel energy input rate [W]
BusweaBusWeather data bus
input RealInputTDisRetSetSetpoint for the district return temperature (min for cooling, max for heating) [K]
output RealOutputQ_flowMeasured heating demand at the ETS [W]
output RealOutputQMeasured energy consumption at the ETS [J]

Modelica definition

model PartialDirect "Partial direct ETS model for district energy systems with in-building pumping and deltaT control" extends Buildings.DHC.ETS.BaseClasses.PartialETS( final have_weaBus=false, final have_hotWat=false, final have_eleHea=false, final nFue=0, final have_eleCoo=false, final have_pum=false, final have_fan=false); // Mass flow rate parameter Modelica.Units.SI.MassFlowRate mBui_flow_nominal( final min=0) "Nominal mass flow rate of building side"; // Pressure drops parameter Modelica.Units.SI.PressureDifference dpConVal_nominal( final min=0, displayUnit="Pa")=50 "Nominal pressure drop in the control valve"; parameter Modelica.Units.SI.PressureDifference dpCheVal_nominal( final min=0, displayUnit="Pa")=6000 "Nominal pressure drop in the check valve"; // Controller parameters parameter Modelica.Blocks.Types.SimpleController controllerType=Modelica.Blocks.Types.SimpleController.PI "Type of controller"; parameter Real k( final min=0, final unit="1")=0.1 "Gain of controller"; parameter Modelica.Units.SI.Time Ti( final min=Modelica.Constants.small)=60 "Time constant of integrator block"; parameter Modelica.Units.SI.Time Td( final min=0)=0.1 "Time constant of derivative block"; parameter Real yMax=1 "Upper limit of output"; parameter Real yMin=0 "Lower limit of output"; // Advanced parameters parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Real bandwidth=0.2 "Bandwidth around reference signal for on/off controller"; Modelica.Blocks.Interfaces.RealInput TDisRetSet( final unit="K", displayUnit="degC") "Setpoint for the district return temperature (min for cooling, max for heating)"; Modelica.Blocks.Interfaces.RealOutput Q_flow( final quantity="HeatFlowRate", final unit="W", displayUnit="kW") "Measured heating demand at the ETS"; Modelica.Blocks.Interfaces.RealOutput Q( final quantity="Energy", final unit="J", displayUnit="kW.h") "Measured energy consumption at the ETS"; Buildings.Fluid.Sensors.TemperatureTwoPort senTDisSup( redeclare final package Medium=MediumSer, final m_flow_nominal=mBui_flow_nominal) "District supply temperature sensor"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo( redeclare final package Medium=MediumSer) "District supply mass flow rate sensor"; Buildings.Fluid.FixedResistances.Junction jun( redeclare final package Medium=MediumSer, final energyDynamics=energyDynamics, final m_flow_nominal=mBui_flow_nominal*{1,-1,1}, final dp_nominal={0,0,0}) "Bypass junction"; Buildings.Fluid.Sensors.TemperatureTwoPort senTDisRet( redeclare final package Medium=MediumSer, final m_flow_nominal=mBui_flow_nominal) "District return temperature sensor"; Buildings.Fluid.FixedResistances.Junction spl( redeclare final package Medium=MediumSer, final energyDynamics=energyDynamics, final m_flow_nominal=mBui_flow_nominal*{1,-1,-1}, final dp_nominal={0,0,0}) "Bypass junction, splitter"; Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage conVal( redeclare final package Medium=MediumSer, final m_flow_nominal=mBui_flow_nominal, final dpValve_nominal=dpConVal_nominal, use_inputFilter=true, riseTime(displayUnit="s") = 60) "Control valve"; Buildings.Fluid.Sensors.TemperatureTwoPort senTBuiRet( redeclare final package Medium = MediumSer, final m_flow_nominal=mBui_flow_nominal) "Building return temperature sensor"; Fluid.FixedResistances.CheckValve cheVal( redeclare final package Medium=MediumSer, final m_flow_nominal=mBui_flow_nominal, final dpValve_nominal=dpCheVal_nominal) "Check valve (backflow preventer)"; Modelica.Blocks.Math.Add dTDis( final k1=-1) "Temperature difference on the district side"; Modelica.Blocks.Math.Product pro "Product"; Modelica.Blocks.Math.Gain cp( final k=cp_default) "Specific heat multiplier to calculate heat flow rate"; Modelica.Blocks.Continuous.Integrator int( final k=1) "Integration"; Controls.OBC.CDL.Reals.PID con( final controllerType=controllerType, final k=k, final Ti=Ti, final Td=Td, final yMax=yMax, final yMin=yMin) "District return temperature controller"; Buildings.Fluid.Sensors.TemperatureTwoPort senTBuiSup( redeclare final package Medium = MediumSer, final m_flow_nominal=mBui_flow_nominal) "Building supply temperature sensor"; protected final parameter MediumSer.ThermodynamicState sta_default=MediumSer.setState_pTX( T=MediumSer.T_default, p=MediumSer.p_default, X=MediumSer.X_default) "Medium state at default properties"; final parameter Modelica.Units.SI.SpecificHeatCapacity cp_default=MediumSer.specificHeatCapacityCp( sta_default) "Specific heat capacity of the fluid"; equation connect(senTDisSup.port_b, senMasFlo.port_a); connect(senMasFlo.port_b, jun.port_1); connect(senTBuiRet.port_b, spl.port_1); connect(spl.port_2, conVal.port_a); connect(senMasFlo.m_flow, pro.u2); connect(pro.y, cp.u); connect(cp.y, Q_flow); connect(cp.y, int.u); connect(int.y, Q); connect(dTDis.y, pro.u1); connect(conVal.port_b, senTDisRet.port_a); connect(senTDisRet.T,dTDis. u1); connect(senTDisSup.T,dTDis. u2); connect(TDisRetSet, con.u_s); connect(senTBuiRet.T, con.u_m); connect(jun.port_2, senTBuiSup.port_a); connect(spl.port_3, cheVal.port_a); connect(cheVal.port_b, jun.port_3); connect(con.y, conVal.y); end PartialDirect;

Buildings.DHC.ETS.BaseClasses.PartialETS Buildings.DHC.ETS.BaseClasses.PartialETS

Partial class for modeling an energy transfer station

Buildings.DHC.ETS.BaseClasses.PartialETS

Information

Partial class to be used for modeling an energy transfer station and optional in-building primary systems.

The connectors to the service lines are configured based on an enumeration defining the type of district system (CombinedGeneration2to4 by default), see Buildings.DHC.Types.DistrictSystemType. In case of a heating service line, the model allows for using two different media at the inlet port port_aSerHea and at the oulet port port_bSerHea to represent a steam supply and condensate return.

The connectors to the building distribution systems are configured based on the Boolean parameters have_heaWat and have_chiWat.

Parameters

TypeNameDefaultDescription
replaceable package MediumSerBuildings.Media.WaterService side medium
replaceable package MediumSerHea_aBuildings.Media.WaterService side medium at heating inlet
replaceable package MediumBuiBuildings.Media.WaterBuilding side medium
Genericfue[nFue] Fuel type
Configuration
DistrictSystemTypetypBuildings.DHC.Types.District...Type of district system
Booleanhave_heaWatfalseSet to true if the ETS supplies heating water
Booleanhave_hotWatfalseSet to true if the ETS supplies hot water
Booleanhave_chiWatfalseSet to true if the ETS supplies chilled water
Booleanhave_fanfalseSet to true if fan power is computed
Booleanhave_pumfalseSet to true if pump power is computed
Booleanhave_eleHeafalseSet to true if the ETS has electric heating system
IntegernFue0Number of fuel types (0 means no combustion system)
Booleanhave_eleCoofalseSet to true if the ETS has electric cooling system
Booleanhave_weaBusfalseSet to true to use a weather bus
Nominal condition
HeatFlowRateQHeaWat_flow_nominal0Nominal capacity of heating system (>=0) [W]
HeatFlowRateQHotWat_flow_nominal0Nominal capacity of hot water production system (>=0) [W]
HeatFlowRateQChiWat_flow_nominal0Nominal capacity of cooling system (<=0) [W]
Assumptions
BooleanallowFlowReversalSerfalseSet to true to allow flow reversal on service side
BooleanallowFlowReversalBuifalseSet to true to allow flow reversal on building side

Connectors

TypeNameDescription
replaceable package MediumSerService side medium
replaceable package MediumSerHea_aService side medium at heating inlet
replaceable package MediumBuiBuilding side medium
FluidPorts_aports_aHeaWat[nPorts_aHeaWat]Fluid connectors for heating water return (from building)
FluidPorts_bports_bHeaWat[nPorts_bHeaWat]Fluid connectors for heating water supply (to building)
FluidPorts_aports_aChiWat[nPorts_aChiWat]Fluid connectors for chilled water return (from building)
FluidPorts_bports_bChiWat[nPorts_bChiWat]Fluid connectors for chilled water supply (to building)
FluidPort_aport_aSerAmbFluid connector for ambient water service supply line
FluidPort_bport_bSerAmbFluid connector for ambient water service return line
FluidPort_aport_aSerHeaFluid connector for heating service supply line
FluidPort_bport_bSerHeaFluid connector for heating service return line
FluidPort_aport_aSerCooFluid connector for cooling service supply line
FluidPort_bport_bSerCooFluid connector for cooling service return line
output RealOutputPHeaPower drawn by heating system [W]
output RealOutputPCooPower drawn by cooling system [W]
output RealOutputPFanPower drawn by fan motors [W]
output RealOutputPPumPower drawn by pump motors [W]
output RealOutputQFue_flow[nFue]Fuel energy input rate [W]
BusweaBusWeather data bus

Modelica definition

partial model PartialETS "Partial class for modeling an energy transfer station" import TypDisSys=Buildings.DHC.Types.DistrictSystemType "District system type enumeration"; replaceable package MediumSer=Buildings.Media.Water constrainedby Modelica.Media.Interfaces.PartialMedium "Service side medium"; replaceable package MediumSerHea_a=Buildings.Media.Water constrainedby Modelica.Media.Interfaces.PartialMedium "Service side medium at heating inlet"; replaceable package MediumBui=Buildings.Media.Water constrainedby Modelica.Media.Interfaces.PartialMedium "Building side medium"; parameter TypDisSys typ = Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4 "Type of district system"; parameter Integer nPorts_aHeaWat=0 "Number of heating water return ports"; parameter Integer nPorts_bHeaWat=0 "Number of heating water supply ports"; parameter Integer nPorts_aChiWat=0 "Number of chilled water return ports"; parameter Integer nPorts_bChiWat=0 "Number of chilled water supply ports"; parameter Boolean have_heaWat=false "Set to true if the ETS supplies heating water"; parameter Boolean have_hotWat=false "Set to true if the ETS supplies hot water"; parameter Boolean have_chiWat=false "Set to true if the ETS supplies chilled water"; parameter Boolean have_fan=false "Set to true if fan power is computed"; parameter Boolean have_pum=false "Set to true if pump power is computed"; parameter Boolean have_eleHea=false "Set to true if the ETS has electric heating system"; parameter Integer nFue=0 "Number of fuel types (0 means no combustion system)"; parameter Boolean have_eleCoo=false "Set to true if the ETS has electric cooling system"; parameter Boolean have_weaBus=false "Set to true to use a weather bus"; parameter Boolean allowFlowReversalSer=false "Set to true to allow flow reversal on service side"; parameter Boolean allowFlowReversalBui=false "Set to true to allow flow reversal on building side"; parameter Modelica.Units.SI.HeatFlowRate QHeaWat_flow_nominal(min=0) = 0 "Nominal capacity of heating system (>=0)"; parameter Modelica.Units.SI.HeatFlowRate QHotWat_flow_nominal(min=0) = 0 "Nominal capacity of hot water production system (>=0)"; parameter Modelica.Units.SI.HeatFlowRate QChiWat_flow_nominal(max=0) = 0 "Nominal capacity of cooling system (<=0)"; parameter Buildings.Fluid.Data.Fuels.Generic fue[nFue] "Fuel type"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPorts_a ports_aHeaWat[nPorts_aHeaWat]( redeclare each package Medium=MediumBui, each m_flow( min= if allowFlowReversalBui then -Modelica.Constants.inf else 0), each h_outflow( start=MediumBui.h_default, nominal=MediumBui.h_default)) if have_heaWat "Fluid connectors for heating water return (from building)"; Modelica.Fluid.Interfaces.FluidPorts_b ports_bHeaWat[nPorts_bHeaWat]( redeclare each package Medium=MediumBui, each m_flow( max= if allowFlowReversalBui then +Modelica.Constants.inf else 0), each h_outflow( start=MediumBui.h_default, nominal=MediumBui.h_default)) if have_heaWat "Fluid connectors for heating water supply (to building)"; Modelica.Fluid.Interfaces.FluidPorts_a ports_aChiWat[nPorts_aChiWat]( redeclare each package Medium=MediumBui, each m_flow( min= if allowFlowReversalBui then -Modelica.Constants.inf else 0), each h_outflow( start=MediumBui.h_default, nominal=MediumBui.h_default)) if have_chiWat "Fluid connectors for chilled water return (from building)"; Modelica.Fluid.Interfaces.FluidPorts_b ports_bChiWat[nPorts_bChiWat]( redeclare each package Medium=MediumBui, each m_flow( max= if allowFlowReversalBui then +Modelica.Constants.inf else 0), each h_outflow( start=MediumBui.h_default, nominal=MediumBui.h_default)) if have_chiWat "Fluid connectors for chilled water supply (to building)"; Modelica.Fluid.Interfaces.FluidPort_a port_aSerAmb( redeclare package Medium = MediumSer, m_flow(min=if allowFlowReversalSer then -Modelica.Constants.inf else 0), h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default)) if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 "Fluid connector for ambient water service supply line"; Modelica.Fluid.Interfaces.FluidPort_b port_bSerAmb( redeclare package Medium = MediumSer, m_flow(max=if allowFlowReversalSer then +Modelica.Constants.inf else 0), h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default)) if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 "Fluid connector for ambient water service return line"; Modelica.Fluid.Interfaces.FluidPort_a port_aSerHea( redeclare package Medium = MediumSerHea_a, m_flow(min=if allowFlowReversalSer then -Modelica.Constants.inf else 0), h_outflow(start=MediumSerHea_a.h_default, nominal=MediumSerHea_a.h_default)) if typ <> Buildings.DHC.Types.DistrictSystemType.Cooling and typ <> Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 "Fluid connector for heating service supply line"; Modelica.Fluid.Interfaces.FluidPort_b port_bSerHea( redeclare package Medium = MediumSer, m_flow(max=if allowFlowReversalSer then +Modelica.Constants.inf else 0), h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default)) if typ <> Buildings.DHC.Types.DistrictSystemType.Cooling and typ <> Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 "Fluid connector for heating service return line"; Modelica.Fluid.Interfaces.FluidPort_a port_aSerCoo( redeclare package Medium = MediumSer, m_flow(min=if allowFlowReversalSer then -Modelica.Constants.inf else 0), h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default)) if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration1 or typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4 or typ == Buildings.DHC.Types.DistrictSystemType.Cooling "Fluid connector for cooling service supply line"; Modelica.Fluid.Interfaces.FluidPort_b port_bSerCoo( redeclare package Medium = MediumSer, m_flow(max=if allowFlowReversalSer then +Modelica.Constants.inf else 0), h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default)) if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration1 or typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4 or typ == Buildings.DHC.Types.DistrictSystemType.Cooling "Fluid connector for cooling service return line"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput PHea( final unit="W") if have_eleHea "Power drawn by heating system"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput PCoo( final unit="W") if have_eleCoo "Power drawn by cooling system"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput PFan( final unit="W") if have_fan "Power drawn by fan motors"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput PPum( final unit="W") if have_pum "Power drawn by pump motors"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput QFue_flow[nFue]( each final unit="W") if nFue>0 "Fuel energy input rate"; BoundaryConditions.WeatherData.Bus weaBus if have_weaBus "Weather data bus"; initial equation assert( nPorts_aHeaWat == nPorts_bHeaWat, "In "+getInstanceName()+": The numbers of heating water supply ports ("+String( nPorts_bHeaWat)+") and return ports ("+String( nPorts_aHeaWat)+") must be equal."); assert( nPorts_aChiWat == nPorts_bChiWat, "In "+getInstanceName()+": The numbers of chilled water supply ports ("+String( nPorts_bChiWat)+") and return ports ("+String( nPorts_aChiWat)+") must be equal."); if have_chiWat then assert( QChiWat_flow_nominal <-Modelica.Constants.eps, "In "+getInstanceName()+": Design heat flow rate for chilled water production must be strictly negative. Obtained QChiWat_flow_nominal = "+String( QChiWat_flow_nominal)); end if; if have_heaWat then assert( QHeaWat_flow_nominal > Modelica.Constants.eps, "In "+getInstanceName()+": Design heat flow rate for heating water production must be strictly positive. Obtained QHeaWat_flow_nominal = "+String( QHeaWat_flow_nominal)); end if; if have_hotWat then assert( QHotWat_flow_nominal > Modelica.Constants.eps, "In "+getInstanceName()+": Design heat flow rate for heating water production must be strictly positive. Obtained QHotWat_flow_nominal = "+String( QHotWat_flow_nominal)); end if; end PartialETS;

Buildings.DHC.ETS.BaseClasses.PartialIndirect Buildings.DHC.ETS.BaseClasses.PartialIndirect

Partial indirect energy transfer station for district energy systems

Buildings.DHC.ETS.BaseClasses.PartialIndirect

Information

Indirect cooling energy transfer station (ETS) model that controls the building chilled water supply temperature by modulating a primary control valve on the district supply side. The design is based on a typical district cooling ETS described in ASHRAE's District Cooling Guide. As shown in the figure below, the building pumping design (constant/variable) is specified on the building side and not within the ETS.

DHC.ETS.Indirect

Reference

American Society of Heating, Refrigeration and Air-Conditioning Engineers. (2019). Chapter 5: End User Interface. In District Cooling Guide, Second Edition and Owner's Guide for Buildings Served by District Cooling.

Extends from Buildings.DHC.ETS.BaseClasses.PartialETS (Partial class for modeling an energy transfer station).

Parameters

TypeNameDefaultDescription
replaceable package MediumSerWaterService side medium
replaceable package MediumSerHea_aWaterService side medium at heating inlet
replaceable package MediumBuiWaterBuilding side medium
Genericfue[nFue] Fuel type
Configuration
DistrictSystemTypetypBuildings.DHC.Types.District...Type of district system
Booleanhave_heaWatfalseSet to true if the ETS supplies heating water
Booleanhave_hotWatfalseSet to true if the ETS supplies hot water
Booleanhave_chiWatfalseSet to true if the ETS supplies chilled water
Booleanhave_fanfalseSet to true if fan power is computed
Booleanhave_pumfalseSet to true if pump power is computed
Booleanhave_eleHeafalseSet to true if the ETS has electric heating system
IntegernFue0Number of fuel types (0 means no combustion system)
Booleanhave_eleCoofalseSet to true if the ETS has electric cooling system
Booleanhave_weaBusfalseSet to true to use a weather bus
Nominal condition
HeatFlowRateQHeaWat_flow_nominal0Nominal capacity of heating system (>=0) [W]
HeatFlowRateQHotWat_flow_nominal0Nominal capacity of hot water production system (>=0) [W]
HeatFlowRateQChiWat_flow_nominal0Nominal capacity of cooling system (<=0) [W]
MassFlowRatemDis_flow_nominal Nominal mass flow rate of district side [kg/s]
MassFlowRatemBui_flow_nominal Nominal mass flow rate of building side [kg/s]
PressureDifferencedpConVal_nominal6000Nominal pressure drop of fully open control valve [Pa]
Heat exchanger
PressureDifferencedp1_nominal Nominal pressure difference on primary side [Pa]
PressureDifferencedp2_nominal Nominal pressure difference on secondary side [Pa]
Booleanuse_Q_flow_nominaltrueSet to true to specify Q_flow_nominal and temeratures, or to false to specify effectiveness
HeatFlowRateQ_flow_nominal Nominal heat transfer (positive for heat transfer from district to building) [W]
TemperatureT_a1_nominal Nominal temperature at port a1 (district supply) [K]
TemperatureT_a2_nominal Nominal temperature at port a2 (building return) [K]
Efficiencyeta0.8Constant effectiveness [1]
PID controller
SimpleControllercontrollerTypeModelica.Blocks.Types.Simple...Type of controller
Realk1Gain of controller [1]
TimeTi120Time constant of integrator block [s]
TimeTd0.1Time constant of derivative block [s]
RealyMax1Upper limit of output
RealyMin0.01Lower limit of output
Assumptions
BooleanallowFlowReversalSerfalseSet to true to allow flow reversal on service side
BooleanallowFlowReversalBuifalseSet to true to allow flow reversal on building side

Connectors

TypeNameDescription
FluidPorts_aports_aHeaWat[nPorts_aHeaWat]Fluid connectors for heating water return (from building)
FluidPorts_bports_bHeaWat[nPorts_bHeaWat]Fluid connectors for heating water supply (to building)
FluidPorts_aports_aChiWat[nPorts_aChiWat]Fluid connectors for chilled water return (from building)
FluidPorts_bports_bChiWat[nPorts_bChiWat]Fluid connectors for chilled water supply (to building)
FluidPort_aport_aSerAmbFluid connector for ambient water service supply line
FluidPort_bport_bSerAmbFluid connector for ambient water service return line
FluidPort_aport_aSerHeaFluid connector for heating service supply line
FluidPort_bport_bSerHeaFluid connector for heating service return line
FluidPort_aport_aSerCooFluid connector for cooling service supply line
FluidPort_bport_bSerCooFluid connector for cooling service return line
output RealOutputPHeaPower drawn by heating system [W]
output RealOutputPCooPower drawn by cooling system [W]
output RealOutputPFanPower drawn by fan motors [W]
output RealOutputPPumPower drawn by pump motors [W]
output RealOutputQFue_flow[nFue]Fuel energy input rate [W]
BusweaBusWeather data bus
input RealInputTBuiSupSetSetpoint temperature for building supply
output RealOutputQ_flowMeasured heating demand at the ETS [W]
output RealOutputQMeasured energy consumption at the ETS [J]

Modelica definition

model PartialIndirect "Partial indirect energy transfer station for district energy systems" extends Buildings.DHC.ETS.BaseClasses.PartialETS( final have_weaBus=false, final have_hotWat=false, final have_eleHea=false, final nFue=0, final have_eleCoo=false, final have_pum=false, final have_fan=false); // mass flow rates parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal( final min=0) "Nominal mass flow rate of district side"; parameter Modelica.Units.SI.MassFlowRate mBui_flow_nominal( final min=0) "Nominal mass flow rate of building side"; // Primary supply control valve parameter Modelica.Units.SI.PressureDifference dpConVal_nominal( final min=0, displayUnit="Pa")=6000 "Nominal pressure drop of fully open control valve"; // Heat exchanger parameter Modelica.Units.SI.PressureDifference dp1_nominal( final min=0, displayUnit="Pa") "Nominal pressure difference on primary side"; parameter Modelica.Units.SI.PressureDifference dp2_nominal( final min=0, displayUnit="Pa") "Nominal pressure difference on secondary side"; parameter Boolean use_Q_flow_nominal=true "Set to true to specify Q_flow_nominal and temeratures, or to false to specify effectiveness"; parameter Modelica.Units.SI.HeatFlowRate Q_flow_nominal "Nominal heat transfer (positive for heat transfer from district to building)"; parameter Modelica.Units.SI.Temperature T_a1_nominal( final min=273.15, final max=373.15) "Nominal temperature at port a1 (district supply)"; parameter Modelica.Units.SI.Temperature T_a2_nominal( final min=273.15, final max=373.15) "Nominal temperature at port a2 (building return)"; parameter Modelica.Units.SI.Efficiency eta( final min=0, final max=1)=0.8 "Constant effectiveness"; //Controller parameters parameter Modelica.Blocks.Types.SimpleController controllerType=Modelica.Blocks.Types.SimpleController.PI "Type of controller"; parameter Real k( final min=0, final unit="1")=1 "Gain of controller"; parameter Modelica.Units.SI.Time Ti( final min=Modelica.Constants.small)=120 "Time constant of integrator block"; parameter Modelica.Units.SI.Time Td( final min=0)=0.1 "Time constant of derivative block"; parameter Real yMax=1 "Upper limit of output"; parameter Real yMin=0.01 "Lower limit of output"; Modelica.Blocks.Interfaces.RealInput TBuiSupSet "Setpoint temperature for building supply"; Modelica.Blocks.Interfaces.RealOutput Q_flow( final quantity="HeatFlowRate", final unit="W", displayUnit="kW") "Measured heating demand at the ETS"; Modelica.Blocks.Interfaces.RealOutput Q( final quantity="Energy", final unit="J", displayUnit="kW.h") "Measured energy consumption at the ETS"; Buildings.Fluid.Sensors.TemperatureTwoPort senTDisSup( redeclare final package Medium=MediumSer, final m_flow_nominal=mDis_flow_nominal) "District supply temperature sensor"; Buildings.Fluid.Sensors.MassFlowRate senMasFlo( redeclare final package Medium=MediumSer) "District supply mass flow rate sensor"; Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage conVal( redeclare final package Medium=MediumSer, final m_flow_nominal=mDis_flow_nominal, final dpValve_nominal=dpConVal_nominal, riseTime(displayUnit="s") = 10, y_start=0) "Control valve"; Buildings.Fluid.HeatExchangers.PlateHeatExchangerEffectivenessNTU hex( redeclare package Medium1 = MediumSer, redeclare package Medium2 = MediumBui, final m1_flow_nominal=mDis_flow_nominal, final m2_flow_nominal=mBui_flow_nominal, final dp1_nominal=dp1_nominal, final dp2_nominal=dp2_nominal, final configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CounterFlow, final Q_flow_nominal=Q_flow_nominal, final T_a1_nominal=T_a1_nominal, final T_a2_nominal=T_a2_nominal) "Heat exchanger"; Buildings.Fluid.Sensors.TemperatureTwoPort senTDisRet( redeclare final package Medium=MediumSer, final m_flow_nominal=mDis_flow_nominal) "District return temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTBuiRet( redeclare final package Medium=MediumBui, final m_flow_nominal=mBui_flow_nominal) "Building return temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTBuiSup( redeclare final package Medium=MediumBui, final m_flow_nominal=mBui_flow_nominal) "Building supply temperature sensor"; Controls.OBC.CDL.Reals.PID con( final controllerType=controllerType, final k=k, final Ti=Ti, final Td=Td, final yMax=yMax, final yMin=yMin) "Building supply temperature controller"; Modelica.Blocks.Math.Add dTDis( final k1=-1) "Temperature difference on the district side"; Modelica.Blocks.Math.Product pro "product"; Modelica.Blocks.Math.Gain cp( final k=cp_default) "Specific heat multiplier to calculate heat flow rate"; Modelica.Blocks.Continuous.Integrator int( final k=1) "Integration"; protected final parameter MediumSer.ThermodynamicState sta_default=MediumSer.setState_pTX( T=MediumSer.T_default, p=MediumSer.p_default, X=MediumSer.X_default) "Medium state at default properties"; final parameter Modelica.Units.SI.SpecificHeatCapacity cp_default=MediumSer.specificHeatCapacityCp( sta_default) "Specific heat capacity of the fluid"; equation connect(senTDisSup.port_b, senMasFlo.port_a); connect(senMasFlo.port_b, conVal.port_a); connect(conVal.port_b, hex.port_a1); connect(hex.port_b1, senTDisRet.port_a); connect(senTBuiRet.port_b, hex.port_a2); connect(hex.port_b2, senTBuiSup.port_a); connect(senTBuiSup.T, con.u_m); connect(TBuiSupSet, con.u_s); connect(con.y, conVal.y); connect(senTDisSup.T,dTDis. u2); connect(senTBuiRet.T,dTDis. u1); connect(senMasFlo.m_flow, pro.u2); connect(dTDis.y, pro.u1); connect(pro.y, cp.u); connect(cp.y, Q_flow); connect(cp.y, int.u); connect(int.y, Q); end PartialIndirect;

Buildings.DHC.ETS.BaseClasses.Pump_m_flow Buildings.DHC.ETS.BaseClasses.Pump_m_flow

Pump with prescribed mass flow rate

Buildings.DHC.ETS.BaseClasses.Pump_m_flow

Information

This is a steady-state model of a pump with ideally controlled mass flow rate as input signal, and no heat added to the medium.

Extends from Buildings.Fluid.Movers.Preconfigured.FlowControlled_m_flow (Fan or pump with ideally controlled mass flow rate as input signal and pre-configured parameters).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
BooleanaddPowerToMediumfalseSet to false to avoid any power (=heat and flow work) being added to medium (may give simpler equations)
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
PressureDifferencedp_nominalif rho_default < 500 then 50...Nominal pressure raise, used for default pressure curve if not specified in record per [Pa]
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Nominal condition
Timetau1Time constant of fluid volume for nominal flow, used if energy or mass balance is dynamic [s]
Filtered speed
Booleanuse_inputFilterfalse= true, if speed is filtered with a 2nd order CriticalDamping filter
TimeriseTime30Rise time of the filter (time to reach 99.6 % of the speed) [s]
MassFlowRatem_flow_start0Initial value of mass flow rate [kg/s]
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances
ExtraPropertyC_nominal[Medium.nC]fill(1E-2, Medium.nC)Nominal value of trace substances. (Set to typical order of magnitude.)
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]
PressuredpMax2*max(eff.per.pressure.dp)Maximum pressure allowed to operate the model, if exceeded, the simulation stops with an error [Pa]
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)
input IntegerInputstageStage input signal for the pressure head
output RealOutputy_actualActual normalised fan or pump speed that is used for computations [1]
output RealOutputPElectrical power consumed [W]
HeatPort_aheatPortHeat dissipation to environment
input RealInputm_flow_inPrescribed mass flow rate [kg/s]
output RealOutputm_flow_actualActual mass flow rate [kg/s]

Modelica definition

model Pump_m_flow "Pump with prescribed mass flow rate" extends Buildings.Fluid.Movers.Preconfigured.FlowControlled_m_flow( addPowerToMedium=false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, use_inputFilter=false); end Pump_m_flow;

Buildings.DHC.ETS.BaseClasses.StratifiedTank Buildings.DHC.ETS.BaseClasses.StratifiedTank

Stratified buffer tank model

Buildings.DHC.ETS.BaseClasses.StratifiedTank

Information

This is a four-port tank model based on Buildings.Fluid.Storage.Stratified which includes the following features.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model
VolumeVTan Tank volume [m3]
LengthhTan Height of tank (without insulation) [m]
LengthdIns Thickness of insulation [m]
ThermalConductivitykIns0.04Specific heat conductivity of insulation [W/(m.K)]
IntegernSeg3Number of volume segments
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]

Connectors

TypeNameDescription
replaceable package MediumMedium model
FluidPort_aport_aTopInlet fluid port at tank top
FluidPort_bport_bBotOutlet fluid port at tank bottom
FluidPort_aport_aBotInlet fluid port at tank bottom
FluidPort_bport_bTopOutlet fluid port at tank top
output RealOutputQl_flowHeat loss of tank (positive if heat flows from tank to ambient) [W]
output RealOutputTTopFluid temperature at tank top [K]
output RealOutputTBotFluid temperature at tank bottom [K]
HeatPort_aheaPorAmbHeat port at interface with ambient (outside insulation)

Modelica definition

model StratifiedTank "Stratified buffer tank model" replaceable package Medium=Modelica.Media.Interfaces.PartialMedium "Medium model"; final parameter Boolean allowFlowReversal=true "= true to allow flow reversal, false restricts to design direction (port_a -> port_b)"; parameter Modelica.Units.SI.Volume VTan "Tank volume"; parameter Modelica.Units.SI.Length hTan "Height of tank (without insulation)"; parameter Modelica.Units.SI.Length dIns "Thickness of insulation"; parameter Modelica.Units.SI.ThermalConductivity kIns=0.04 "Specific heat conductivity of insulation"; parameter Integer nSeg( min=2)=3 "Number of volume segments"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal "Nominal mass flow rate"; // IO CONNECTORS Modelica.Fluid.Interfaces.FluidPort_a port_aTop( 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)) "Inlet fluid port at tank top"; Modelica.Fluid.Interfaces.FluidPort_b port_bBot( 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)) "Outlet fluid port at tank bottom"; Modelica.Fluid.Interfaces.FluidPort_a port_aBot( 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)) "Inlet fluid port at tank bottom"; Modelica.Fluid.Interfaces.FluidPort_b port_bTop( 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)) "Outlet fluid port at tank top"; Modelica.Blocks.Interfaces.RealOutput Ql_flow( final unit="W") "Heat loss of tank (positive if heat flows from tank to ambient)"; Modelica.Blocks.Interfaces.RealOutput TTop( final unit="K", displayUnit="degC") "Fluid temperature at tank top"; Modelica.Blocks.Interfaces.RealOutput TBot( final unit="K", displayUnit="degC") "Fluid temperature at tank bottom"; Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorAmb "Heat port at interface with ambient (outside insulation)"; // COMPONENTS Fluid.Storage.Stratified tan( redeclare final package Medium=Medium, final m_flow_nominal=m_flow_nominal, final VTan=VTan, final hTan=hTan, final dIns=dIns, final kIns=kIns, final nSeg=nSeg) "Stratified tank"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTBot "Tank bottom temperature"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTTop "Tank top temperature"; protected Modelica.Thermal.HeatTransfer.Components.ThermalCollector theCol( m=3) "Connector to assign multiple heat ports to one heat port"; equation connect(port_aTop,tan.port_a); connect(port_bTop,tan.fluPorVol[1]); connect(tan.port_b,port_bBot); connect(port_aBot,tan.fluPorVol[nSeg]); connect(tan.Ql_flow,Ql_flow); connect(tan.heaPorVol[nSeg],senTBot.port); connect(tan.heaPorVol[1],senTTop.port); connect(senTTop.T,TTop); connect(senTBot.T,TBot); connect(heaPorAmb,theCol.port_b); connect(theCol.port_a[1],tan.heaPorTop); connect(theCol.port_a[2],tan.heaPorSid); connect(theCol.port_a[3],tan.heaPorBot); end StratifiedTank;

Buildings.DHC.ETS.BaseClasses.computeCoordinates Buildings.DHC.ETS.BaseClasses.computeCoordinates

Coordinates of evenly distributed boreholes given the number of boreholes

Information

This function computes the coordinates of boreholes evenly distributed along the x and y axis, given the number of boreholes (which must be the square of an integer).

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
IntegernBorHol Number of boreholes
Distancedxy6Distance in x-axis (and y-axis) between borehole axes [m]

Outputs

TypeNameDescription
DistancecooBor[nBorHol, 2]Coordinates of boreholes [m]

Modelica definition

function computeCoordinates "Coordinates of evenly distributed boreholes given the number of boreholes" extends Modelica.Icons.Function; input Integer nBorHol "Number of boreholes"; input Modelica.Units.SI.Distance dxy=6 "Distance in x-axis (and y-axis) between borehole axes"; output Modelica.Units.SI.Distance cooBor[nBorHol,2] "Coordinates of boreholes"; protected Integer k=1 "Iteration index"; algorithm for i in 0:sqrt( nBorHol)-1 loop for j in 0:sqrt( nBorHol)-1 loop cooBor[k,1] := i*dxy; cooBor[k,2] := j*dxy; k := k+1; end for; end for; end computeCoordinates;