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
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.Volume | VTan (from PartialStratified) | Tank volume | |
| Modelica.Units.SI.Length | hTan (from PartialStratified) | Height of tank (without insulation) | |
| Modelica.Units.SI.Length | dIns (from PartialStratified) | Thickness of insulation | |
| Modelica.Units.SI.ThermalConductivity | kIns (from PartialStratified) | 0.04 | Specific heat conductivity of insulation |
| Integer | nSeg (from PartialStratified) | 2 | Number of volume segments |
| Modelica.Units.SI.Time | tau (from PartialStratified) | 1 | Time constant for mixing |
| Assumptions | |||
| Boolean | allowFlowReversal (from PartialTwoPortInterface) | true | = false to simplify equations, assuming, but not enforcing, no flow reversal |
| Nominal condition | |||
| Modelica.Units.SI.MassFlowRate | m_flow_nominal (from PartialTwoPortInterface) | Nominal mass flow rate | |
| Advanced | |||
| Modelica.Units.SI.MassFlowRate | m_flow_small (from PartialTwoPortInterface) | 1E-4*abs(m_flow_nominal) | Small mass flow rate for regularization of zero flow |
| Advanced › Diagnostics | |||
| Boolean | show_T (from PartialTwoPortInterface) | false | = true, if actual temperature at port is computed |
| Dynamics › Conservation equations | |||
| Modelica.Fluid.Types.Dynamics | energyDynamics (from PartialStratified) | Modelica.Fluid.Types.Dynamics.FixedInitial | Formulation of energy balance |
| Initialization | |||
| Medium.AbsolutePressure | p_start (from PartialStratified) | Medium.p_default | Start value of pressure |
| Medium.Temperature | T_start (from PartialStratified) | Medium.T_default | Start 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_default | Start 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.Height | hHex_a | Height of portHex_a of the heat exchanger, measured from tank bottom | |
| Modelica.Units.SI.Height | hHex_b | Height of portHex_b of the heat exchanger, measured from tank bottom | |
| Modelica.Units.SI.HeatFlowRate | Q_flow_nominal | Heat transfer at nominal conditions | |
| Modelica.Units.SI.Temperature | TTan_nominal | Temperature of fluid inside the tank at nominal heat transfer conditions | |
| Modelica.Units.SI.Temperature | THex_nominal | Temperature of fluid inside the heat exchanger at nominal heat transfer conditions | |
| Real | r_nominal | 0.5 | Ratio between coil inside and outside convective heat transfer at nominal heat transfer conditions |
| Heat exchanger | |||
| Integer | hexSegMult | 2 | Number of heat exchanger segments in each tank segment |
| Modelica.Units.SI.Diameter | dExtHex | 0.025 | Exterior diameter of the heat exchanger pipe |
| Modelica.Units.SI.MassFlowRate | mHex_flow_nominal | Nominal mass flow rate through the heat exchanger | |
| Modelica.Units.SI.PressureDifference | dpHex_nominal | 2500 | Pressure drop across the heat exchanger at nominal conditions |
| Flow resistance heat exchanger | |||
| Boolean | computeFlowResistance | true | =true, compute flow resistance. Set to false to assume no friction |
| Boolean | from_dp | false | = true, use m_flow = f(dp) else dp = f(m_flow) |
| Real | n | 2 | Flow exponent, n=1 for laminar, n=2 for turbulent |
| Boolean | linearizeFlowResistance | false | = true, use linear relation between m_flow and dp for any flow rate |
| Real | deltaM | 0.1 | Fraction of nominal flow rate where flow transitions to laminar |
| Dynamics heat exchanger › Conservation equations | |||
| Modelica.Fluid.Types.Dynamics | energyDynamicsHex | Modelica.Fluid.Types.Dynamics.DynamicFreeInitial | Formulation of energy balance for heat exchanger internal fluid mass |
| Modelica.Fluid.Types.Dynamics | energyDynamicsHexSolid | energyDynamicsHex | Formulation of energy balance for heat exchanger solid mass |
| Modelica.Units.SI.Length | lHex | rTan*abs(segHex_a - segHex_b)*Modelica.Constants.pi | Approximate length of the heat exchanger |
| Modelica.Units.SI.Area | ACroHex | (dExtHex^2 - (0.8*dExtHex)^2)*Modelica.Constants.pi/4 | Cross sectional area of the heat exchanger |
| Modelica.Units.SI.SpecificHeatCapacity | cHex | 490 | Specific heat capacity of the heat exchanger material |
| Modelica.Units.SI.Density | dHex | 8000 | Density of the heat exchanger material |
| Modelica.Units.SI.HeatCapacity | CHex | ACroHex*lHex*dHex*cHex | Capacitance of the heat exchanger without the fluid |
| Assumptions › Heat exchanger | |||
| Boolean | allowFlowReversalHex | true | = true to allow flow reversal in heat exchanger, false restricts to design direction (portHex_a -> portHex_b) |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Fluid.Interfaces.FluidPort_a | port_a (from PartialTwoPortInterface) | Fluid connector a (positive design flow direction is from port_a to port_b) | |
| Modelica.Fluid.Interfaces.FluidPort_b | port_b (from PartialTwoPortInterface) | Fluid connector b (positive design flow direction is from port_a to port_b) | |
| Modelica.Blocks.Interfaces.RealOutput | Ql_flow (from PartialStratified) | Heat loss of tank (positive if heat flows from tank to ambient) | |
| Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a | heaPorVol (from PartialStratified) | Heat port that connects to the control volumes of the tank | |
| Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a | heaPorSid (from PartialStratified) | Heat port tank side (outside insulation) | |
| Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a | heaPorTop (from PartialStratified) | Heat port tank top (outside insulation) | |
| Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a | heaPorBot (from PartialStratified) | Heat port tank bottom (outside insulation). Leave unconnected for adiabatic condition | |
| Modelica.Fluid.Interfaces.FluidPort_a | portHex_a | Heat exchanger inlet | |
| Modelica.Fluid.Interfaces.FluidPort_b | portHex_b | Heat exchanger outlet |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.MassFlowRate | m_flow (from PartialTwoPortInterface) | port_a.m_flow | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) |
| Modelica.Units.SI.PressureDifference | dp (from PartialTwoPortInterface) | port_a.p - port_b.p | Pressure difference between port_a and port_b |
| Medium.ThermodynamicState | sta_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.ThermodynamicState | sta_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.MixingVolume | vol (from PartialStratified) | Tank segment | |
| BaseClasses.IndirectTankHeatExchanger | indTanHex | Heat exchanger inside the tank | |
| Modelica.Units.SI.HeatFlowRate | QHex_flow | -sum(indTanHex.port.Q_flow) | Heat transferred from the heat exchanger to the tank |
Contents
| Name | Description |
|---|---|
| Medium in the heat exchanger |
Revisions
-
June 17, 2026, by Michael Wetter:
Updated implementation to allow a flow coefficientnthat is different from2. This allows use of the model for not fully turbulent flow.
This is for Buildings, #4620. -
March 7, 2022, by Michael Wetter:
RemovedmassDynamicsandmassDynamicsHex.
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 ifhHex_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 valueenergyDynamicsHexSolid=energyDynamicsHexrather thanenergyDynamicsHexSolid=Modelica.Fluid.Types.Dynamics.DynamicFreeInitialas users are not likely to want different settings. -
July 1, 2015, by Filip Jorissen:
Added parameterenergyDynamicsHexSolid. This is for #434. -
March 28, 2015, by Filip Jorissen:
PropagatedallowFlowReversalandm_flow_small. -
September 2, 2014 by Michael Wetter:
Replaced theabs()function in the assignment of the parameternSegHexTanas the return value ofabs()is aRealwhich 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 ofbotHexSeg. 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:- Changed
hexTopHeighttohHex_a. - Changed
hexBotHeighttohHex_b. - Changed
topHexSegtosegHex_a, and made it protected as this is deduced fromhHex_a. - Changed
botHexSegtosegHex_b, and made it protected as this is deduced fromhHex_b.
- Changed
port_a1toportHex_a. - Changed
port_b1toportHex_b.
- Changed
-
May 10, 2013 by Michael Wetter:
Removedm_flow_nominal_tankwhich was not used. -
January 29, 2013 by Peter Grant:
First implementation.