Name | Description |
---|---|
BaseClasses | Package with base classes for tank models |
Examples | Collection of models that illustrate model use and test models |
Stratified | Model of a stratified tank for thermal energy storage |
StratifiedEnhanced | Stratified tank model with enhanced discretization |
This is a model of a stratified storage tank. The tank uses several volumes to model the stratification. Heat conduction is modeled between the volumes through the fluid, and between the volumes and the ambient. The port heaPorVol may be used to connect a temperature sensor that measures the fluid temperature of an individual volume. It may also be used to add heat to individual volumes.
The heat ports outside the tank insulation can be used to specify an ambient temperature. Leave these ports unconnected to force adiabatic boundary conditions. Note, however, that all heat conduction elements through the tank wall (but not the top and bottom) are connected to the heat port heaPorSid. Thus, not connecting heaPorSid means an adiabatic boundary condition in the sense that heaPorSid.Q_flow = 0. This, however, still allows heat to flow through the tank walls, modelled by conWal, between one fluid to another.
For a model with enhanced stratification, use Buildings.Fluids.Storage.StratifiedEnhanced.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | VTan | Tank volume [m3] | |
Length | hTan | Height of tank (without insulation) [m] | |
Length | dIns | Thickness of insulation [m] | |
ThermalConductivity | kIns | 0.04 | Specific heat conductivity of insulation [W/(m.K)] |
Integer | nSeg | 2 | Number of volume segments |
Time | tau | 1 | Time constant for mixing due to temperature inversion [s] |
Initialization | |||
MassFlowRate | m_flow | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s] | |
Pressure | dp | Pressure difference between port_a and port_b [Pa] | |
Advanced | |||
Temp | flowDirection | Modelica_Fluid.Types.FlowDir... | Unidirectional (port_a -> port_b) or bidirectional flow component |
Initialization | |||
Temp | initType | Types.Init.NoInit | Initialization option |
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Boolean | use_T_start | true | = true, use T_start, otherwise h_start |
Temperature | T_start | if use_T_start then Medium.T... | Start value of temperature [K] |
SpecificEnthalpy | h_start | if use_T_start then Medium.s... | Start value of specific enthalpy [J/kg] |
MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
Type | Name | Description |
---|---|---|
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
HeatPort_a | heaPorVol[nSeg] | Heat port of fluid volumes |
HeatPort_a | heaPorSid | Heat port tank side (outside insulation) |
HeatPort_a | heaPorTop | Heat port tank top (outside insulation) |
HeatPort_a | heaPorBot | Heat port tank bottom (outside insulation). Leave unconnected for adiabatic condition |
output RealOutput | Ql_flow | Heat loss of tank (positve if heat flows from to ambient) |
model Stratified "Model of a stratified tank for thermal energy storage" extends Buildings.Fluids.Interfaces.PartialStaticTwoPortInterface; extends Modelica_Fluid.Interfaces.PartialInitializationParameters; extends Buildings.BaseClasses.BaseIcon; parameter Modelica.SIunits.Volume VTan "Tank volume"; parameter Modelica.SIunits.Length hTan "Height of tank (without insulation)"; parameter Modelica.SIunits.Length dIns "Thickness of insulation"; parameter Modelica.SIunits.ThermalConductivity kIns = 0.04 "Specific heat conductivity of insulation"; parameter Integer nSeg(min=2) = 2 "Number of volume segments"; MixingVolumes.MixingVolume[nSeg] vol( redeclare each package Medium = Medium, each V=VTan/nSeg, each nP=nP, each initType=initType, each p_start=p_start, each use_T_start=use_T_start, each T_start=T_start, each h_start=h_start, each X_start=X_start) "Tank segment"; Sensors.EnthalpyFlowRate hA(redeclare package Medium = Medium); Sensors.EnthalpyFlowRate[nSeg-1] hVol_flow(redeclare package Medium = Medium); Sensors.EnthalpyFlowRate hB(redeclare package Medium = Medium); public BaseClasses.Buoyancy buo( redeclare package Medium = Medium, V=VTan, nSeg=nSeg, tau=tau) "Model to prevent unstable tank stratification"; parameter Modelica.SIunits.Time tau=1 "Time constant for mixing due to temperature inversion"; Modelica.Thermal.HeatTransfer.ThermalConductor[nSeg - 1] conFlu( each G=conFluSeg) "Thermal conductance in fluid between the segments"; Modelica.Thermal.HeatTransfer.ThermalConductor[nSeg] conWal( each G=2*Modelica.Constants.pi*kIns*hSeg/ln((rTan+dIns)/rTan)) "Thermal conductance through tank wall"; Modelica.Thermal.HeatTransfer.ThermalConductor conTop( G=conTopSeg) "Thermal conductance through tank top"; Modelica.Thermal.HeatTransfer.ThermalConductor conBot( G=conTopSeg) "Thermal conductance through tank bottom"; protected constant Integer nP = 2 "Number of ports of volume"; parameter Modelica.SIunits.Length hSeg = hTan / nSeg "Height of a tank segment"; parameter Modelica.SIunits.Area ATan = VTan/hTan "Tank cross-sectional area (without insulation)"; parameter Modelica.SIunits.Length rTan = sqrt(ATan/Modelica.Constants.pi) "Tank diameter (without insulation)"; parameter Modelica.SIunits.ThermalConductance conFluSeg = ATan*Medium.lambda_const/hSeg "Thermal conductance between fluid volumes"; parameter Modelica.SIunits.ThermalConductance conTopSeg = 1/(1/conFluSeg+1/(ATan*kIns/dIns)) "Thermal conductance from center of top (or bottom) volume through tank insulation at top (or bottom)"; public Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a[nSeg] heaPorVol "Heat port of fluid volumes"; public Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorSid "Heat port tank side (outside insulation)"; Modelica.Thermal.HeatTransfer.HeatFlowSensor heaFloSid[nSeg] "Heat flow at wall of tank (outside insulation)"; protected Modelica.Blocks.Math.Sum sum1(nin=nSeg + 2); public Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorTop "Heat port tank top (outside insulation)"; Modelica.Thermal.HeatTransfer.HeatFlowSensor heaFloTop "Heat flow at top of tank (outside insulation)"; public Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorBot "Heat port tank bottom (outside insulation). Leave unconnected for adiabatic condition"; Modelica.Thermal.HeatTransfer.HeatFlowSensor heaFloBot "Heat flow at bottom of tank (outside insulation)"; protected Modelica.Blocks.Routing.Multiplex3 mul( n1=1, n2=nSeg, n3=1); public Modelica.Blocks.Interfaces.RealOutput Ql_flow(redeclare type SignalType = Modelica.SIunits.HeatFlowRate) "Heat loss of tank (positve if heat flows from to ambient)"; equation connect(hA.port_b, vol[1].port[1]); connect(vol[nSeg].port[2], hB.port_a); connect(hB.port_b, port_b); for i in 1:(nSeg-1) loop connect(vol[i].port[2], hVol_flow[i].port_a); connect(hVol_flow[i].port_b, vol[i+1].port[1]); end for; connect(port_a, hA.port_a); connect(buo.heatPort, vol.thermalPort); for i in 1:nSeg-1 loop // heat conduction between fluid nodes connect(vol[i].thermalPort, conFlu[i].port_a); connect(vol[i+1].thermalPort, conFlu[i].port_b); end for; connect(vol[1].thermalPort, conTop.port_a); connect(vol.thermalPort, conWal.port_a); connect(conBot.port_a, vol[nSeg].thermalPort); connect(vol.thermalPort, heaPorVol); connect(conWal.port_b, heaFloSid.port_a); for i in 1:nSeg loop connect(heaFloSid[i].port_b, heaPorSid); end for; connect(conTop.port_b, heaFloTop.port_a); connect(conBot.port_b, heaFloBot.port_a); connect(heaFloTop.port_b, heaPorTop); connect(heaFloBot.port_b, heaPorBot); connect(heaFloTop.Q_flow, mul.u1[1]); connect(heaFloSid.Q_flow, mul.u2); connect(heaFloBot.Q_flow, mul.u3[1]); connect(mul.y, sum1.u); connect(sum1.y, Ql_flow); end Stratified;
This is a model of a stratified storage tank for thermal energy storage. The model is identical to Buildings.Fluids.Storage.Stratified, except that it adds a correction that reduces the numerical dissipation. The correction is identical to the one described by Wischhusen (2006).
Wischhusen Stefan, An Enhanced Discretization Method for Storage Tank Models within Energy Systems, Modelica Conference, Vienna, Austria, September 2006.
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Volume | VTan | Tank volume [m3] | |
Length | hTan | Height of tank (without insulation) [m] | |
Length | dIns | Thickness of insulation [m] | |
ThermalConductivity | kIns | 0.04 | Specific heat conductivity of insulation [W/(m.K)] |
Integer | nSeg | 2 | Number of volume segments |
Time | tau | 1 | Time constant for mixing due to temperature inversion [s] |
Real | a | 1E-4 | Tuning factor. a=0 is equivalent to not using this model |
Initialization | |||
MassFlowRate | m_flow | Mass flow rate from port_a to port_b (m_flow > 0 is design flow direction) [kg/s] | |
Pressure | dp | Pressure difference between port_a and port_b [Pa] | |
Advanced | |||
Temp | flowDirection | Modelica_Fluid.Types.FlowDir... | Unidirectional (port_a -> port_b) or bidirectional flow component |
Initialization | |||
Temp | initType | Types.Init.NoInit | Initialization option |
AbsolutePressure | p_start | Medium.p_default | Start value of pressure [Pa] |
Boolean | use_T_start | true | = true, use T_start, otherwise h_start |
Temperature | T_start | if use_T_start then Medium.T... | Start value of temperature [K] |
SpecificEnthalpy | h_start | if use_T_start then Medium.s... | Start value of specific enthalpy [J/kg] |
MassFraction | X_start[Medium.nX] | Medium.X_default | Start value of mass fractions m_i/m [kg/kg] |
Type | Name | Description |
---|---|---|
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
HeatPort_a | heaPorVol[nSeg] | Heat port of fluid volumes |
HeatPort_a | heaPorSid | Heat port tank side (outside insulation) |
HeatPort_a | heaPorTop | Heat port tank top (outside insulation) |
HeatPort_a | heaPorBot | Heat port tank bottom (outside insulation). Leave unconnected for adiabatic condition |
output RealOutput | Ql_flow | Heat loss of tank (positve if heat flows from to ambient) |
model StratifiedEnhanced "Stratified tank model with enhanced discretization" extends Stratified(nP=3); BaseClasses.Stratifier str( redeclare package Medium = Medium, nSeg=nSeg, a=a) "Model to reduce numerical dissipation"; parameter Real a=1E-4 "Tuning factor. a=0 is equivalent to not using this model"; Modelica.Blocks.Sources.RealExpression mTan_flow(y=port_a.m_flow) "Mass flow rate at port a"; equation connect(vol[1:nSeg].port[3], str.fluidPort[2:nSeg+1]); connect(hA.H_flow, str.H_flow[1]); connect(hVol_flow[1:nSeg-1].H_flow, str.H_flow[2:nSeg]); connect(hB.H_flow, str.H_flow[nSeg + 1]); connect(str.heatPort, vol.thermalPort); connect(port_a, str.fluidPort[1]); connect(port_b, str.fluidPort[nSeg + 2]); connect(mTan_flow.y, str.m_flow); end StratifiedEnhanced;