Collection of models that illustrate model use and test models
Information
This package contains examples for the use of models that can be found in
Buildings.Fluid.Storage.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
ExpansionVessel
|
Test model for expansion vessel |
Stratified
|
Test model for stratified tank |
StratifiedEnhancedInternalHex
|
Example showing the use of StratifiedEnhancedInternalHex |
Test model for expansion vessel
Information
This model tests a pressure expansion vessel. The medium model that is used in this
example changes its density as a function of temperature.
To see the effect of the expansion vessel, delete the connecting line between
the volume and the expansion vessel and check how much more the pressure increases
as the fluid is heated.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model ExpansionVessel
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Water ;
Buildings.Fluid.Storage.ExpansionVessel expVes(
redeclare package Medium = Medium,
V_start=1) ;
Buildings.Fluid.MixingVolumes.MixingVolume vol(
redeclare package Medium = Medium,
V=1,
nPorts=1,
m_flow_nominal=0.001,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) ;
Modelica.Blocks.Sources.Pulse pulse(
amplitude=20,
period=3600,
offset=293.15);
Buildings.HeatTransfer.Sources.PrescribedTemperature preTem;
Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000);
equation
connect(pulse.y, preTem.T);
connect(preTem.port, theCon.port_a);
connect(theCon.port_b, vol.heatPort);
connect(vol.ports[1], expVes.port_a);
end ExpansionVessel;
Test model for stratified tank
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).
Modelica definition
model Stratified
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Water ;
Buildings.Fluid.Storage.Stratified tanSim(
redeclare package Medium = Medium,
hTan=3,
dIns=0.3,
nSeg=10,
m_flow_nominal=0.1,
VTan=3) ;
Modelica.Blocks.Sources.TimeTable TWat(table=[0, 273.15 + 40; 3600, 273.15 + 40;
3600, 273.15 + 20; 7200, 273.15 + 20]) ;
Buildings.Fluid.Sources.Boundary_pT sou_1(
p=300000 + 5000,
T=273.15 + 50,
redeclare package Medium = Medium,
use_T_in=true,
nPorts=2);
Buildings.Fluid.Sources.Boundary_pT sin_1(
redeclare package Medium = Medium,
T=273.15 + 20,
use_p_in=true,
p=300000,
nPorts=2);
Buildings.Fluid.FixedResistances.PressureDrop res_1(
from_dp=true,
redeclare package Medium = Medium,
dp_nominal=5000,
m_flow_nominal=0.1);
Buildings.Fluid.Storage.StratifiedEnhanced tanEnh(
redeclare package Medium = Medium,
hTan=3,
dIns=0.3,
nSeg=10,
m_flow_nominal=0.1,
VTan=3) ;
Buildings.Fluid.FixedResistances.PressureDrop res_2(
from_dp=true,
redeclare package Medium = Medium,
dp_nominal=5000,
m_flow_nominal=0.1);
Buildings.Fluid.Sensors.EnthalpyFlowRate HOut_flow(
redeclare package Medium
= Medium, m_flow_nominal=0.1) ;
Buildings.Fluid.Sensors.EnthalpyFlowRate HOut_flow1(
redeclare package Medium
= Medium, m_flow_nominal=0.1) ;
Modelica.Blocks.Continuous.Integrator dH ;
Modelica.Blocks.Math.Add add(k2=-1);
Modelica.Blocks.Sources.TimeTable P(table=[0, 300000; 4200, 300000; 4200, 305000;
7200, 305000; 7200, 310000; 10800, 310000; 10800, 305000]) ;
Modelica.Blocks.Sources.Sine sine(
freqHz=1/86400,
amplitude=10,
offset=273.15 + 20);
Buildings.HeatTransfer.Sources.PrescribedTemperature TBCSid2 ;
Buildings.HeatTransfer.Sources.PrescribedTemperature TBCSid1 ;
Buildings.HeatTransfer.Sources.PrescribedTemperature TBCTop1 ;
Buildings.HeatTransfer.Sources.PrescribedTemperature TBCTop2 ;
equation
connect(TWat.y, sou_1.T_in);
connect(tanSim.port_b, HOut_flow.port_a);
connect(HOut_flow.port_b, res_1.port_a);
connect(tanEnh.port_b, HOut_flow1.port_a);
connect(HOut_flow1.port_b, res_2.port_a);
connect(add.y, dH.u);
connect(HOut_flow.H_flow, add.u1);
connect(HOut_flow1.H_flow, add.u2);
connect(P.y, sin_1.p_in);
connect(sine.y, TBCSid1.T);
connect(sine.y, TBCTop1.T);
connect(sine.y, TBCSid2.T);
connect(sine.y, TBCTop2.T);
connect(TBCSid2.port, tanEnh.heaPorSid);
connect(TBCTop2.port, tanEnh.heaPorTop);
connect(sin_1.ports[1], res_1.port_b);
connect(sin_1.ports[2], res_2.port_b);
connect(sou_1.ports[1], tanSim.port_a);
connect(sou_1.ports[2], tanEnh.port_a);
connect(TBCSid1.port, tanSim.heaPorSid);
connect(TBCTop1.port, tanSim.heaPorTop);
end Stratified;
Example showing the use of StratifiedEnhancedInternalHex
Information
This model provides an example for the
Buildings.Fluid.Storage.StratifiedEnhancedInternalHex model.
There are three tanks.
In the tank on top, the fluid in the heat exchanger and the metal of the
heat exchanger use a steady-state energy balance.
In the middle tank, both use a dynamic balance.
In the bottom tank, the fluid uses a steady-state heat balance
but the metal of the heat exchanger uses a dynamic balance.
Each tank starts at the same water temperature, and there is no
water flow through the tank.
The glycol that flows through the heat exchanger starts with zero
mass flow rate, and is set to its design flow rate at t=300 seconds.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
PressureDifference | dpHex_nominal | 2500 | Pressure drop across the heat exchanger at nominal conditions [Pa] |
MassFlowRate | mHex_flow_nominal | 0.278 | Mass flow rate of heat exchanger [kg/s] |
Modelica definition
model StratifiedEnhancedInternalHex
extends Modelica.Icons.Example;
package MediumTan =
Buildings.Media.Water ;
package MediumHex =
Buildings.Media.Water ;
parameter Modelica.SIunits.PressureDifference dpHex_nominal=2500 ;
parameter Modelica.SIunits.MassFlowRate mHex_flow_nominal=0.278 ;
Buildings.Fluid.Sources.Boundary_pT bouWat(
redeclare package Medium = MediumTan,
nPorts=3) ;
Sources.Boundary_pT solColSup(
redeclare package Medium = MediumHex,
nPorts=3,
use_p_in=true,
T=353.15) ;
Buildings.Fluid.Sources.Boundary_pT toSolCol(
redeclare package Medium = MediumHex,
nPorts=3,
p(displayUnit="Pa") = 3E5,
T=283.15) ;
Buildings.Fluid.Storage.StratifiedEnhancedInternalHex tanSte(
redeclare package Medium = MediumTan,
m_flow_nominal=0.001,
VTan=0.151416,
dIns=0.0762,
redeclare package MediumHex = MediumHex,
CHex=40,
Q_flow_nominal=0.278*4200*20,
hTan=1.746,
hHex_a=0.995,
hHex_b=0.1,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
energyDynamicsHex=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=false,
allowFlowReversalHex=false,
mHex_flow_nominal=mHex_flow_nominal,
TTan_nominal=293.15,
THex_nominal=323.15,
dpHex_nominal=dpHex_nominal) ;
Sensors.TemperatureTwoPort senTemSte(
redeclare package Medium = MediumHex,
allowFlowReversal=false,
m_flow_nominal=mHex_flow_nominal,
tau=0) ;
Modelica.Blocks.Sources.Step step(
height=dpHex_nominal,
offset=3E5,
startTime=300) ;
Sensors.TemperatureTwoPort senTemDyn(
redeclare package Medium = MediumHex,
allowFlowReversal=false,
m_flow_nominal=mHex_flow_nominal,
tau=0) ;
Buildings.Fluid.Storage.StratifiedEnhancedInternalHex tanDyn(
redeclare package Medium = MediumTan,
m_flow_nominal=0.001,
VTan=0.151416,
dIns=0.0762,
redeclare package MediumHex = MediumHex,
CHex=40,
Q_flow_nominal=0.278*4200*20,
hTan=1.746,
hHex_a=0.995,
hHex_b=0.1,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=false,
allowFlowReversalHex=false,
mHex_flow_nominal=mHex_flow_nominal,
energyDynamicsHex=Modelica.Fluid.Types.Dynamics.FixedInitial,
TTan_nominal=293.15,
THex_nominal=323.15) ;
Buildings.Fluid.Storage.StratifiedEnhancedInternalHex tanDynSol(
redeclare package Medium = MediumTan,
m_flow_nominal=0.001,
VTan=0.151416,
dIns=0.0762,
redeclare package MediumHex = MediumHex,
CHex=40,
Q_flow_nominal=0.278*4200*20,
hTan=1.746,
hHex_a=0.995,
hHex_b=0.1,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=false,
allowFlowReversalHex=false,
mHex_flow_nominal=mHex_flow_nominal,
energyDynamicsHex=Modelica.Fluid.Types.Dynamics.SteadyState,
energyDynamicsHexSolid=Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
TTan_nominal=293.15,
THex_nominal=323.15) ;
Sensors.TemperatureTwoPort senTemDynSol(
redeclare package Medium = MediumHex,
allowFlowReversal=false,
m_flow_nominal=mHex_flow_nominal,
tau=0) ;
equation
connect(solColSup.ports[1], tanSte.portHex_a);
connect(senTemSte.port_b, toSolCol.ports[1]);
connect(senTemSte.port_a, tanSte.portHex_b);
connect(senTemDyn.port_a, tanDyn.portHex_b);
connect(senTemDyn.port_b, toSolCol.ports[2]);
connect(tanDynSol.portHex_b, senTemDynSol.port_a);
connect(senTemDynSol.port_b, toSolCol.ports[3]);
connect(solColSup.ports[2], tanDyn.portHex_a);
connect(solColSup.ports[3], tanDynSol.portHex_a);
connect(bouWat.ports[1], tanSte.port_b);
connect(bouWat.ports[2], tanDyn.port_b);
connect(bouWat.ports[3], tanDynSol.port_b);
connect(step.y, solColSup.p_in);
end StratifiedEnhancedInternalHex;