Buildings.Fluid.Storage.Validation

Collection of models that validate the storage models

Information

This package contains models that validate the storage models. These model outputs are stored as reference data to allow continuous validation whenever models in the library change.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Buildings.Fluid.Storage.Validation.HeatExchangerDynamics HeatExchangerDynamics Test model for stratified tank with steady-state and dynamic heat exchanger balance
Buildings.Fluid.Storage.Validation.HeatExchangerLocation HeatExchangerLocation Test model for heat exchanger with hHex_a and hHex_b interchanged
Buildings.Fluid.Storage.Validation.StratifiedLoadingUnloading StratifiedLoadingUnloading Test model for stratified tank
Buildings.Fluid.Storage.Validation.StratifiedNonUniformInitial StratifiedNonUniformInitial Test model for stratified tank with non-uniform initial temperature

Buildings.Fluid.Storage.Validation.HeatExchangerDynamics Buildings.Fluid.Storage.Validation.HeatExchangerDynamics

Test model for stratified tank with steady-state and dynamic heat exchanger balance

Buildings.Fluid.Storage.Validation.HeatExchangerDynamics

Information

This validation model compares two tank models. The only difference between the two tank models is that one uses a dynamic energy balance, whereas the other uses a steady-state energy balance for the heat exchanger. The mass flow rate through the heat exchanger is varied from zero to the design flow rate and back to zero to test the model under conditions in which no water flows through the heat exchanger.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
HeatFlowRateQHex_flow_nominal2000Design heat flow rate of heat exchanger [W]
MassFlowRatem_flow_nominalQHex_flow_nominal/4200/4[kg/s]

Modelica definition

model HeatExchangerDynamics "Test model for stratified tank with steady-state and dynamic heat exchanger balance" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; constant Integer nSeg = 7 "Number of segments in tank"; parameter Modelica.Units.SI.HeatFlowRate QHex_flow_nominal=2000 "Design heat flow rate of heat exchanger"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=QHex_flow_nominal/ 4200/4; Buildings.Fluid.Sources.Boundary_pT watInTan( redeclare package Medium = Medium, use_T_in=false, nPorts=2, T=273.15 + 30, p(displayUnit="Pa")) "Boundary condition for water in the tank"; Buildings.Fluid.Sources.MassFlowSource_T mHex_flow1( redeclare package Medium = Medium, use_m_flow_in=true, T=273.15 + 60, nPorts=1) "Mass flow rate through the heat exchanger"; model Tank = StratifiedEnhancedInternalHex ( redeclare package Medium = Medium, redeclare package MediumHex = Medium, hTan=2, dIns=0.3, VTan=0.3, nSeg=nSeg, hHex_a=1, hHex_b=0.2, Q_flow_nominal=QHex_flow_nominal, TTan_nominal=313.15, THex_nominal=333.15, mHex_flow_nominal=m_flow_nominal, show_T=true, m_flow_nominal=m_flow_nominal, energyDynamicsHex=Modelica.Fluid.Types.Dynamics.FixedInitial) "Tank with dynamic heat exchanger balance"; Tank tanDyn "Tank with dynamic heat exchanger balance"; Tank tanSte(energyDynamicsHex=Modelica.Fluid.Types.Dynamics.SteadyState) "Tank with steady-state heat exchanger balance"; Modelica.Blocks.Sources.Trapezoid mHex_flow_in( period=7200, amplitude=m_flow_nominal, offset=0, rising=1800, width=1800, falling=1800, startTime=900) "Control signal for mass flow rate in heat exchanger"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 30, p(displayUnit="Pa"), nPorts=2) "Sink boundary condition"; Buildings.Fluid.Sources.MassFlowSource_T mHex_flow2( redeclare package Medium = Medium, use_m_flow_in=true, T=273.15 + 60, nPorts=1) "Mass flow rate through the heat exchanger"; Buildings.Fluid.Sensors.TemperatureTwoPort senTanDyn( redeclare package Medium = Medium, allowFlowReversal=false, m_flow_nominal=m_flow_nominal, tau=0) "Temperature sensor at tank outlet"; Buildings.Fluid.Sensors.TemperatureTwoPort senTanSte( redeclare package Medium = Medium, allowFlowReversal=false, m_flow_nominal=m_flow_nominal, tau=0) "Temperature sensor at tank outlet"; Buildings.Fluid.Sources.MassFlowSource_T mWatTanDyn_flow( redeclare package Medium = Medium, nPorts=1) "Mass flow rate through the tank"; Buildings.Fluid.Sources.MassFlowSource_T mWatTanSte_flow( redeclare package Medium = Medium, nPorts=1) "Mass flow rate through the tank"; equation connect(mHex_flow_in.y, mHex_flow1.m_flow_in); connect(mHex_flow2.m_flow_in, mHex_flow_in.y); connect(mHex_flow2.ports[1], tanSte.portHex_a); connect(watInTan.ports[1], tanSte.port_a); connect(mHex_flow1.ports[1], tanDyn.portHex_a); connect(watInTan.ports[2], tanDyn.port_a); connect(senTanDyn.port_a, tanDyn.portHex_b); connect(senTanSte.port_a, tanSte.portHex_b); connect(senTanDyn.port_b, sin.ports[1]); connect(senTanSte.port_b, sin.ports[2]); connect(mWatTanDyn_flow.ports[1], tanDyn.port_b); connect(mWatTanSte_flow.ports[1], tanSte.port_b); end HeatExchangerDynamics;

Buildings.Fluid.Storage.Validation.HeatExchangerLocation Buildings.Fluid.Storage.Validation.HeatExchangerLocation

Test model for heat exchanger with hHex_a and hHex_b interchanged

Buildings.Fluid.Storage.Validation.HeatExchangerLocation

Information

This validation model compares two tank models. The only difference between the two tank models is that tan_aTop has the hot water inlet for the heat exchanger above its outlet, whereas tan_bTop has the hot water inlet below its outlet. In both models, the heat exchanger extends from element 9 to element 11.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
HeatFlowRateQHex_flow_nominal6000Design heat flow rate of heat exchanger [W]
MassFlowRatem_flow_nominalQHex_flow_nominal/4200/4[kg/s]

Modelica definition

model HeatExchangerLocation "Test model for heat exchanger with hHex_a and hHex_b interchanged" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; parameter Modelica.Units.SI.HeatFlowRate QHex_flow_nominal=6000 "Design heat flow rate of heat exchanger"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=QHex_flow_nominal/ 4200/4; Buildings.Fluid.Sources.Boundary_pT watInTan( redeclare package Medium = Medium, use_T_in=false, nPorts=2, T=273.15 + 30, p(displayUnit="Pa")) "Boundary condition for water in the tank"; Buildings.Fluid.Sources.MassFlowSource_T mHex_flow1( redeclare package Medium = Medium, nPorts=2, m_flow=m_flow_nominal/100, T=273.15 + 60) "Mass flow rate through the heat exchanger"; model Tank = StratifiedEnhancedInternalHex ( redeclare final package Medium = Medium, redeclare final package MediumHex = Medium, final VTan=0.3, final kIns=0.034, final dIns=0.04, final hTan=1.2, final m_flow_nominal=m_flow_nominal, final mHex_flow_nominal=m_flow_nominal, final nSeg=12, final hexSegMult=2, final Q_flow_nominal=QHex_flow_nominal, final TTan_nominal=293.15, final THex_nominal=273.15+60, final computeFlowResistance=false, final energyDynamicsHex=Modelica.Fluid.Types.Dynamics.FixedInitial) "Tank"; Tank tan_aTop( hHex_a=0.3, hHex_b=0.1) "Tank with heat exchanger inlet above its outlet"; Tank tan_bTop( hHex_a=0.1, hHex_b=0.3) "Tank with heat exchanger outlet above its inlet"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=273.15 + 30, p(displayUnit="Pa"), nPorts=2) "Sink boundary condition"; Buildings.Fluid.Sensors.TemperatureTwoPort senTan_aTop( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0) "Temperature sensor at tank outlet"; Buildings.Fluid.Sensors.TemperatureTwoPort senTan_bTop( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0) "Temperature sensor at tank outlet"; Buildings.Fluid.Sources.MassFlowSource_T mWatTanSte_flow( redeclare package Medium = Medium, nPorts=1) "Mass flow rate through the tank"; Buildings.Fluid.Sources.MassFlowSource_T mWatTanDyn_flow( redeclare package Medium = Medium, nPorts=1) "Mass flow rate through the tank"; equation connect(mHex_flow1.ports[1], tan_aTop.portHex_a); connect(senTan_aTop.port_a, tan_aTop.portHex_b); connect(senTan_aTop.port_b, sin.ports[1]); connect(senTan_bTop.port_b, sin.ports[2]); connect(senTan_bTop.port_a, tan_bTop.portHex_b); connect(tan_bTop.portHex_a, mHex_flow1.ports[2]); connect(tan_aTop.port_a, watInTan.ports[1]); connect(tan_bTop.port_a, watInTan.ports[2]); connect(mWatTanDyn_flow.ports[1], tan_aTop.port_b); connect(tan_bTop.port_b, mWatTanSte_flow.ports[1]); end HeatExchangerLocation;

Buildings.Fluid.Storage.Validation.StratifiedLoadingUnloading Buildings.Fluid.Storage.Validation.StratifiedLoadingUnloading

Test model for stratified tank

Buildings.Fluid.Storage.Validation.StratifiedLoadingUnloading

Information

This test model compares two tank models. The only difference between the two tank models is that one uses the third order upwind discretization scheme that reduces numerical diffusion that is induced when connecting volumes in series.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal1*1000/3600/4[kg/s]

Modelica definition

model StratifiedLoadingUnloading "Test model for stratified tank" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; constant Integer nSeg = 7 "Number of segments in tank"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1*1000/3600/4; Buildings.Fluid.Sources.Boundary_pT sou_1( p=300000 + 5000, T=273.15 + 40, redeclare package Medium = Medium, use_T_in=false, nPorts=2); Buildings.Fluid.Sources.MassFlowSource_T sin_1( redeclare package Medium = Medium, T=273.15 + 20, m_flow=-0.028, use_m_flow_in=true, nPorts=1); Buildings.Fluid.Storage.StratifiedEnhanced tanEnh( redeclare package Medium = Medium, hTan=3, dIns=0.3, VTan=0.1, nSeg=nSeg, show_T=true, m_flow_nominal=m_flow_nominal) "Tank"; Buildings.Fluid.Sources.MassFlowSource_T sin_2( redeclare package Medium = Medium, T=273.15 + 20, m_flow=-0.028, use_m_flow_in=true, nPorts=1); Buildings.Fluid.Storage.Stratified tan( redeclare package Medium = Medium, hTan=3, dIns=0.3, VTan=0.1, nSeg=nSeg, show_T=true, m_flow_nominal=m_flow_nominal) "Tank"; Modelica.Blocks.Sources.Pulse pulse( amplitude=2*m_flow_nominal, offset=-m_flow_nominal, period=7200); Buildings.Fluid.Sensors.EnthalpyFlowRate HIn_flow(redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate HOut_flow(redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate HInEnh_flow(redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate HOutEnh_flow(redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Modelica.Blocks.Math.Add add(k2=-1); Modelica.Blocks.Continuous.Integrator dHTanEnh "Difference in enthalpy (should be zero at steady-state)"; Modelica.Blocks.Math.Add add1( k2=-1); Modelica.Blocks.Continuous.Integrator dHTan "Difference in enthalpy (should be zero at steady-state)"; equation connect(sou_1.ports[1], HIn_flow.port_a); connect(HIn_flow.port_b, tan.port_a); connect(tan.port_b, HOut_flow.port_a); connect(HOut_flow.port_b, sin_2.ports[1]); connect(sou_1.ports[2], HInEnh_flow.port_a); connect(HInEnh_flow.port_b, tanEnh.port_a); connect(tanEnh.port_b, HOutEnh_flow.port_a); connect(HOutEnh_flow.port_b, sin_1.ports[1]); connect(HInEnh_flow.H_flow, add.u1); connect(HOutEnh_flow.H_flow, add.u2); connect(add.y, dHTanEnh.u); connect(HIn_flow.H_flow, add1.u1); connect(HOut_flow.H_flow, add1.u2); connect(add1.y, dHTan.u); connect(pulse.y, sin_1.m_flow_in); connect(pulse.y, sin_2.m_flow_in); end StratifiedLoadingUnloading;

Buildings.Fluid.Storage.Validation.StratifiedNonUniformInitial Buildings.Fluid.Storage.Validation.StratifiedNonUniformInitial

Test model for stratified tank with non-uniform initial temperature

Buildings.Fluid.Storage.Validation.StratifiedNonUniformInitial

Information

This test model validates Buildings.Fluid.Storage.Stratified by specifying a non-uniform initial temperature.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal1*1000/3600/4[kg/s]

Modelica definition

model StratifiedNonUniformInitial "Test model for stratified tank with non-uniform initial temperature" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; constant Integer nSeg = 7 "Number of segments in tank"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1*1000/3600/4; Buildings.Fluid.Sources.Boundary_pT sou_1( p=300000 + 5000, T=273.15 + 40, redeclare package Medium = Medium, use_T_in=false, nPorts=2); Buildings.Fluid.Sources.MassFlowSource_T sin_1( redeclare package Medium = Medium, T=273.15 + 20, m_flow=-m_flow_nominal, nPorts=1) "Mass flow source"; Buildings.Fluid.Storage.Stratified heaTan( redeclare package Medium = Medium, hTan=3, dIns=0.3, VTan=0.1, nSeg=nSeg, show_T=true, m_flow_nominal=m_flow_nominal, TFlu_start={313.15,312.15,311.15,310.15,309.15,308.15,307.15}) "Tank that will be heated up"; Buildings.Fluid.Sources.MassFlowSource_T sin_2( redeclare package Medium = Medium, T=273.15 + 20, m_flow=m_flow_nominal, nPorts=1) "Mass flow source"; Buildings.Fluid.Storage.Stratified cooTan( redeclare package Medium = Medium, hTan=3, dIns=0.3, VTan=0.1, nSeg=nSeg, show_T=true, m_flow_nominal=m_flow_nominal, TFlu_start={313.15,312.15,311.15,310.15,309.15,308.15,307.15}) "Tank that will be cooled down"; Buildings.Fluid.Sensors.EnthalpyFlowRate HIn_flow( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate HOut_flow( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate HInEnh_flow( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Buildings.Fluid.Sensors.EnthalpyFlowRate HOutEnh_flow( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Enthalpy flow rate"; Modelica.Blocks.Math.Add add(k2=-1) "Adder for enthalpy difference"; Modelica.Blocks.Continuous.Integrator dHTanEnh "Difference in enthalpy (should be zero at steady-state)"; Modelica.Blocks.Math.Add add1(k2=-1) "Adder for enthalpy difference"; Modelica.Blocks.Continuous.Integrator dHTan "Difference in enthalpy (should be zero at steady-state)"; equation connect(HIn_flow.port_b, cooTan.port_a); connect(cooTan.port_b, HOut_flow.port_a); connect(HOut_flow.port_b, sin_2.ports[1]); connect(HOutEnh_flow.port_b, sin_1.ports[1]); connect(HInEnh_flow.H_flow, add.u1); connect(HOutEnh_flow.H_flow, add.u2); connect(add.y, dHTanEnh.u); connect(HIn_flow.H_flow, add1.u1); connect(HOut_flow.H_flow, add1.u2); connect(add1.y, dHTan.u); connect(HInEnh_flow.port_b, heaTan.port_a); connect(heaTan.port_b, HOutEnh_flow.port_a); connect(sou_1.ports[1], HInEnh_flow.port_a); connect(sou_1.ports[2], HIn_flow.port_a); end StratifiedNonUniformInitial;

Buildings.Fluid.Storage.Validation.HeatExchangerDynamics.Tank Buildings.Fluid.Storage.Validation.HeatExchangerDynamics.Tank

Tank with dynamic heat exchanger balance

Buildings.Fluid.Storage.Validation.HeatExchangerDynamics.Tank

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VolumeVTan0.3Tank volume [m3]
LengthhTan2Height of tank (without insulation) [m]
LengthdIns0.3Thickness of insulation [m]
ThermalConductivitykIns0.04Specific heat conductivity of insulation [W/(m.K)]
IntegernSegnSegNumber of volume segments
Timetau1Time constant for mixing [s]
Nominal condition
MassFlowRatem_flow_nominalm_flow_nominalNominal mass flow rate [kg/s]
Heat exchanger
replaceable package MediumHexPartialMediumMedium in the heat exchanger
HeighthHex_a1Height of portHex_a of the heat exchanger, measured from tank bottom [m]
HeighthHex_b0.2Height of portHex_b of the heat exchanger, measured from tank bottom [m]
IntegerhexSegMult2Number of heat exchanger segments in each tank segment
DiameterdExtHex0.025Exterior diameter of the heat exchanger pipe [m]
HeatFlowRateQ_flow_nominalQHex_flow_nominalHeat transfer at nominal conditions [W]
TemperatureTTan_nominal313.15Temperature of fluid inside the tank at nominal heat transfer conditions [K]
TemperatureTHex_nominal333.15Temperature of fluid inside the heat exchanger at nominal heat transfer conditions [K]
Realr_nominal0.5Ratio between coil inside and outside convective heat transfer at nominal heat transfer conditions
MassFlowRatemHex_flow_nominalm_flow_nominalNominal mass flow rate through the heat exchanger [kg/s]
PressureDifferencedpHex_nominal2500Pressure drop across the heat exchanger at nominal conditions [Pa]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Heat exchanger
BooleanallowFlowReversalHextrue= true to allow flow reversal in heat exchanger, false restricts to design direction (portHex_a -> portHex_b)
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Ttrue= true, if actual temperature at port is computed
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Formulation of energy balance
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
TemperatureTFlu_start[nSeg]T_start*ones(nSeg)Initial temperature of the tank segments, with TFlu_start[1] being the top segment [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
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)
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
DynamicsenergyDynamicsHexModelica.Fluid.Types.Dynamic...Formulation of energy balance for heat exchanger internal fluid mass
DynamicsenergyDynamicsHexSolidenergyDynamicsHexFormulation of energy balance for heat exchanger solid mass
LengthlHexrTan*abs(segHex_a - segHex_b...Approximate length of the heat exchanger [m]
AreaACroHex(dExtHex^2 - (0.8*dExtHex)^2...Cross sectional area of the heat exchanger [m2]
SpecificHeatCapacitycHex490Specific heat capacity of the heat exchanger material [J/(kg.K)]
DensitydHex8000Density of the heat exchanger material [kg/m3]
HeatCapacityCHexACroHex*lHex*dHex*cHexCapacitance of the heat exchanger without the fluid [J/K]

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
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)
output RealOutputQl_flowHeat loss of tank (positive if heat flows from tank to ambient)
HeatPort_aheaPorVol[nSeg]Heat port that connects to the control volumes of the tank
HeatPort_aheaPorSidHeat port tank side (outside insulation)
HeatPort_aheaPorTopHeat port tank top (outside insulation)
HeatPort_aheaPorBotHeat port tank bottom (outside insulation). Leave unconnected for adiabatic condition
FluidPort_aportHex_aHeat exchanger inlet
FluidPort_bportHex_bHeat exchanger outlet
Heat exchanger
replaceable package MediumHexMedium in the heat exchanger

Modelica definition

model Tank = StratifiedEnhancedInternalHex ( redeclare package Medium = Medium, redeclare package MediumHex = Medium, hTan=2, dIns=0.3, VTan=0.3, nSeg=nSeg, hHex_a=1, hHex_b=0.2, Q_flow_nominal=QHex_flow_nominal, TTan_nominal=313.15, THex_nominal=333.15, mHex_flow_nominal=m_flow_nominal, show_T=true, m_flow_nominal=m_flow_nominal, energyDynamicsHex=Modelica.Fluid.Types.Dynamics.FixedInitial) "Tank with dynamic heat exchanger balance";

Buildings.Fluid.Storage.Validation.HeatExchangerLocation.Tank Buildings.Fluid.Storage.Validation.HeatExchangerLocation.Tank

Tank

Buildings.Fluid.Storage.Validation.HeatExchangerLocation.Tank

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VolumeVTan0.3Tank volume [m3]
LengthhTan1.2Height of tank (without insulation) [m]
LengthdIns0.04Thickness of insulation [m]
ThermalConductivitykIns0.034Specific heat conductivity of insulation [W/(m.K)]
IntegernSeg12Number of volume segments
Timetau1Time constant for mixing [s]
Nominal condition
MassFlowRatem_flow_nominalm_flow_nominalNominal mass flow rate [kg/s]
Heat exchanger
replaceable package MediumHexPartialMediumMedium in the heat exchanger
HeighthHex_a Height of portHex_a of the heat exchanger, measured from tank bottom [m]
HeighthHex_b Height of portHex_b of the heat exchanger, measured from tank bottom [m]
IntegerhexSegMult2Number of heat exchanger segments in each tank segment
DiameterdExtHex0.025Exterior diameter of the heat exchanger pipe [m]
HeatFlowRateQ_flow_nominalQHex_flow_nominalHeat transfer at nominal conditions [W]
TemperatureTTan_nominal293.15Temperature of fluid inside the tank at nominal heat transfer conditions [K]
TemperatureTHex_nominal273.15 + 60Temperature of fluid inside the heat exchanger at nominal heat transfer conditions [K]
Realr_nominal0.5Ratio between coil inside and outside convective heat transfer at nominal heat transfer conditions
MassFlowRatemHex_flow_nominalm_flow_nominalNominal mass flow rate through the heat exchanger [kg/s]
PressureDifferencedpHex_nominal2500Pressure drop across the heat exchanger at nominal conditions [Pa]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Heat exchanger
BooleanallowFlowReversalHextrue= true to allow flow reversal in heat exchanger, false restricts to design direction (portHex_a -> portHex_b)
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Formulation of energy balance
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
TemperatureTFlu_start[nSeg]T_start*ones(nSeg)Initial temperature of the tank segments, with TFlu_start[1] being the top segment [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
Flow resistance heat exchanger
BooleancomputeFlowResistancefalse=true, compute flow resistance. Set to false to assume no friction
Booleanfrom_dpfalse= true, use m_flow = f(dp) else dp = f(m_flow)
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
DynamicsenergyDynamicsHexModelica.Fluid.Types.Dynamic...Formulation of energy balance for heat exchanger internal fluid mass
DynamicsenergyDynamicsHexSolidenergyDynamicsHexFormulation of energy balance for heat exchanger solid mass
LengthlHexrTan*abs(segHex_a - segHex_b...Approximate length of the heat exchanger [m]
AreaACroHex(dExtHex^2 - (0.8*dExtHex)^2...Cross sectional area of the heat exchanger [m2]
SpecificHeatCapacitycHex490Specific heat capacity of the heat exchanger material [J/(kg.K)]
DensitydHex8000Density of the heat exchanger material [kg/m3]
HeatCapacityCHexACroHex*lHex*dHex*cHexCapacitance of the heat exchanger without the fluid [J/K]

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
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)
output RealOutputQl_flowHeat loss of tank (positive if heat flows from tank to ambient)
HeatPort_aheaPorVol[nSeg]Heat port that connects to the control volumes of the tank
HeatPort_aheaPorSidHeat port tank side (outside insulation)
HeatPort_aheaPorTopHeat port tank top (outside insulation)
HeatPort_aheaPorBotHeat port tank bottom (outside insulation). Leave unconnected for adiabatic condition
FluidPort_aportHex_aHeat exchanger inlet
FluidPort_bportHex_bHeat exchanger outlet
Heat exchanger
replaceable package MediumHexMedium in the heat exchanger

Modelica definition

model Tank = StratifiedEnhancedInternalHex ( redeclare final package Medium = Medium, redeclare final package MediumHex = Medium, final VTan=0.3, final kIns=0.034, final dIns=0.04, final hTan=1.2, final m_flow_nominal=m_flow_nominal, final mHex_flow_nominal=m_flow_nominal, final nSeg=12, final hexSegMult=2, final Q_flow_nominal=QHex_flow_nominal, final TTan_nominal=293.15, final THex_nominal=273.15+60, final computeFlowResistance=false, final energyDynamicsHex=Modelica.Fluid.Types.Dynamics.FixedInitial) "Tank";