modelStratifiedEnhancedInternalHex

A model of a water storage tank with a secondary loop and intenral heat exchanger

Extends from StratifiedEnhanced (Stratified tank model with enhanced discretization).

Information

This is a model of a stratified storage tank for thermal energy storage with built-in heat exchanger.

See the Buildings.Fluid.Storage.UsersGuide for more information.

Limitations

The model requires at least 4 fluid segments. Hence, set nSeg to 4 or higher.

Parameters

TypeNameDefaultDescription
Modelica.Units.SI.VolumeVTan (from PartialStratified)Tank volume
Modelica.Units.SI.LengthhTan (from PartialStratified)Height of tank (without insulation)
Modelica.Units.SI.LengthdIns (from PartialStratified)Thickness of insulation
Modelica.Units.SI.ThermalConductivitykIns (from PartialStratified)0.04Specific heat conductivity of insulation
IntegernSeg (from PartialStratified)2Number of volume segments
Modelica.Units.SI.Timetau (from PartialStratified)1Time constant for mixing
Assumptions
BooleanallowFlowReversal (from PartialTwoPortInterface)true= false to simplify equations, assuming, but not enforcing, no flow reversal
Nominal condition
Modelica.Units.SI.MassFlowRatem_flow_nominal (from PartialTwoPortInterface)Nominal mass flow rate
Advanced
Modelica.Units.SI.MassFlowRatem_flow_small (from PartialTwoPortInterface)1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow
Advanced › Diagnostics
Booleanshow_T (from PartialTwoPortInterface)false= true, if actual temperature at port is computed
Dynamics › Conservation equations
Modelica.Fluid.Types.DynamicsenergyDynamics (from PartialStratified)Modelica.Fluid.Types.Dynamics.FixedInitialFormulation of energy balance
Initialization
Medium.AbsolutePressurep_start (from PartialStratified)Medium.p_defaultStart value of pressure
Medium.TemperatureT_start (from PartialStratified)Medium.T_defaultStart value of temperature
Modelica.Units.SI.Temperature[nSeg]TFlu_start (from PartialStratified)T_start*ones(nSeg)Initial temperature of the tank segments, with TFlu_start[1] being the top segment
Medium.MassFraction[Medium.nX]X_start (from PartialStratified)Medium.X_defaultStart value of mass fractions m_i/m
Medium.ExtraProperty[Medium.nC]C_start (from PartialStratified)fill(0, Medium.nC)Start value of trace substances
General › Heat exchanger
Modelica.Units.SI.HeighthHex_aHeight of portHex_a of the heat exchanger, measured from tank bottom
Modelica.Units.SI.HeighthHex_bHeight of portHex_b of the heat exchanger, measured from tank bottom
Modelica.Units.SI.HeatFlowRateQ_flow_nominalHeat transfer at nominal conditions
Modelica.Units.SI.TemperatureTTan_nominalTemperature of fluid inside the tank at nominal heat transfer conditions
Modelica.Units.SI.TemperatureTHex_nominalTemperature of fluid inside the heat exchanger at nominal heat transfer conditions
Realr_nominal0.5Ratio between coil inside and outside convective heat transfer at nominal heat transfer conditions
Heat exchanger
IntegerhexSegMult2Number of heat exchanger segments in each tank segment
Modelica.Units.SI.DiameterdExtHex0.025Exterior diameter of the heat exchanger pipe
Modelica.Units.SI.MassFlowRatemHex_flow_nominalNominal mass flow rate through the heat exchanger
Modelica.Units.SI.PressureDifferencedpHex_nominal2500Pressure drop across the heat exchanger at nominal conditions
Flow resistance heat exchanger
BooleancomputeFlowResistancetrue=true, compute flow resistance. Set to false to assume no friction
Booleanfrom_dpfalse= true, use m_flow = f(dp) else dp = f(m_flow)
Realn2Flow exponent, n=1 for laminar, n=2 for turbulent
BooleanlinearizeFlowResistancefalse= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM0.1Fraction of nominal flow rate where flow transitions to laminar
Dynamics heat exchanger › Conservation equations
Modelica.Fluid.Types.DynamicsenergyDynamicsHexModelica.Fluid.Types.Dynamics.DynamicFreeInitialFormulation of energy balance for heat exchanger internal fluid mass
Modelica.Fluid.Types.DynamicsenergyDynamicsHexSolidenergyDynamicsHexFormulation of energy balance for heat exchanger solid mass
Modelica.Units.SI.LengthlHexrTan*abs(segHex_a - segHex_b)*Modelica.Constants.piApproximate length of the heat exchanger
Modelica.Units.SI.AreaACroHex(dExtHex^2 - (0.8*dExtHex)^2)*Modelica.Constants.pi/4Cross sectional area of the heat exchanger
Modelica.Units.SI.SpecificHeatCapacitycHex490Specific heat capacity of the heat exchanger material
Modelica.Units.SI.DensitydHex8000Density of the heat exchanger material
Modelica.Units.SI.HeatCapacityCHexACroHex*lHex*dHex*cHexCapacitance of the heat exchanger without the fluid
Assumptions › Heat exchanger
BooleanallowFlowReversalHextrue= true to allow flow reversal in heat exchanger, false restricts to design direction (portHex_a -> portHex_b)

Connectors

TypeNameDefaultDescription
Modelica.Fluid.Interfaces.FluidPort_aport_a (from PartialTwoPortInterface)Fluid connector a (positive design flow direction is from port_a to port_b)
Modelica.Fluid.Interfaces.FluidPort_bport_b (from PartialTwoPortInterface)Fluid connector b (positive design flow direction is from port_a to port_b)
Modelica.Blocks.Interfaces.RealOutputQl_flow (from PartialStratified)Heat loss of tank (positive if heat flows from tank to ambient)
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_aheaPorVol (from PartialStratified)Heat port that connects to the control volumes of the tank
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_aheaPorSid (from PartialStratified)Heat port tank side (outside insulation)
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_aheaPorTop (from PartialStratified)Heat port tank top (outside insulation)
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_aheaPorBot (from PartialStratified)Heat port tank bottom (outside insulation). Leave unconnected for adiabatic condition
Modelica.Fluid.Interfaces.FluidPort_aportHex_aHeat exchanger inlet
Modelica.Fluid.Interfaces.FluidPort_bportHex_bHeat exchanger outlet

Components

TypeNameDefaultDescription
Modelica.Units.SI.MassFlowRatem_flow (from PartialTwoPortInterface)port_a.m_flowMass flow rate from port_a to port_b (m_flow > 0 is design flow direction)
Modelica.Units.SI.PressureDifferencedp (from PartialTwoPortInterface)port_a.p - port_b.pPressure difference between port_a and port_b
Medium.ThermodynamicStatesta_a (from PartialTwoPortInterface)if allowFlowReversal then Medium.setState_phX(port_a.p, noEvent(actualStream(port_a.h_outflow)), noEvent(actualStream(port_a.Xi_outflow))) else Medium.setState_phX(port_a.p, noEvent(inStream(port_a.h_outflow)), noEvent(inStream(port_a.Xi_outflow)))Medium properties in port_a
Medium.ThermodynamicStatesta_b (from PartialTwoPortInterface)if allowFlowReversal then Medium.setState_phX(port_b.p, noEvent(actualStream(port_b.h_outflow)), noEvent(actualStream(port_b.Xi_outflow))) else Medium.setState_phX(port_b.p, noEvent(port_b.h_outflow), noEvent(port_b.Xi_outflow))Medium properties in port_b
Buildings.Fluid.MixingVolumes.MixingVolumevol (from PartialStratified)Tank segment
BaseClasses.IndirectTankHeatExchangerindTanHexHeat exchanger inside the tank
Modelica.Units.SI.HeatFlowRateQHex_flow-sum(indTanHex.port.Q_flow)Heat transferred from the heat exchanger to the tank

Contents

NameDescription
MediumHexMedium in the heat exchanger

Revisions

  • June 17, 2026, by Michael Wetter:
    Updated implementation to allow a flow coefficient n that is different from 2. This allows use of the model for not fully turbulent flow.
    This is for Buildings, #4620.
  • March 7, 2022, by Michael Wetter:
    Removed massDynamics and massDynamicsHex.
    This is for #1542.
  • June 7, 2018 by Filip Jorissen:
    Copied model from Buildings and update the model accordingly. This is for #314.
  • June 23, 2016, by Michael Wetter:
    Corrected computation of the heat exchanger location which was wrong if hHex_a < hHex_b, e.g., the port a of the heat exchanger is below the port b. This closes issue 531.
  • January 22, 2016, by Michael Wetter:
    Corrected type declaration of pressure difference. This is for #404.
  • July 2, 2015, by Michael Wetter:
    Set the default value energyDynamicsHexSolid=energyDynamicsHex rather than energyDynamicsHexSolid=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial as users are not likely to want different settings.
  • July 1, 2015, by Filip Jorissen:
    Added parameter energyDynamicsHexSolid. This is for #434.
  • March 28, 2015, by Filip Jorissen:
    Propagated allowFlowReversal and m_flow_small.
  • September 2, 2014 by Michael Wetter:
    Replaced the abs() function in the assignment of the parameter nSegHexTan as the return value of abs() is a Real which causes a type error during model check.
  • August 29, 2014 by Michael Wetter:
    Corrected issue #271 which led to a compilation error if the heat exchanger and the tank had different media.
  • April 18, 2014 by Michael Wetter:
    Added missing ceiling function in computation of botHexSeg. Without this function, this parameter can take on zero, which is wrong because the Modelica uses one-based arrays. Revised the model as the old version required the porta of the heat exchanger to be located higher than portb. This makes sense if the heat exchanger is used to heat up the tank, but not if it is used to cool down a tank, such as in a cooling plant. The following parameters were changed:
    1. Changed hexTopHeight to hHex_a.
    2. Changed hexBotHeight to hHex_b.
    3. Changed topHexSeg to segHex_a, and made it protected as this is deduced from hHex_a.
    4. Changed botHexSeg to segHex_b, and made it protected as this is deduced from hHex_b.
    The names of the following ports have been changed:
    1. Changed port_a1 to portHex_a.
    2. Changed port_b1 to portHex_b.
    The conversion script should update old instances of this model automatically in Dymola for all of the above changes.
  • May 10, 2013 by Michael Wetter:
    Removed m_flow_nominal_tank which was not used.
  • January 29, 2013 by Peter Grant:
    First implementation.