Buildings.Fluid.Storage.Examples

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 Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).

Package Content

NameDescription
ExpansionVessel Test model for expansion vessel
Stratified Test model for stratified tank
StratifiedLoadingUnloading Test model for stratified tank


Buildings.Fluid.Storage.Examples.ExpansionVessel

Test model for expansion vessel

Buildings.Fluid.Storage.Examples.ExpansionVessel

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.

Modelica definition

model ExpansionVessel "Test model for expansion vessel"
  import Buildings;

 package Medium = Modelica.Media.Water.WaterIF97OnePhase_ph "Medium model";
// package Medium = Buildings.Media.ConstantPropertyLiquidWaterCompressible "Medium model";

  inner Modelica.Fluid.System system(p_ambient=400000, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial);
  Buildings.Fluid.Storage.ExpansionVessel expVes(
    redeclare package Medium = Medium, VTot=0.1) "Expansion vessel";
  Buildings.Fluid.MixingVolumes.MixingVolume vol(
    redeclare package Medium = Medium,
    use_HeatTransfer=true,
    V=1,
    nPorts=1) "Volume of water";
  Modelica.Blocks.Sources.Pulse pulse(
    amplitude=20,
    period=3600,
    offset=293.15);
  Modelica.Thermal.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;

Buildings.Fluid.Storage.Examples.Stratified

Test model for stratified tank

Buildings.Fluid.Storage.Examples.Stratified

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.

Modelica definition

model Stratified "Test model for stratified tank"

 package Medium = Buildings.Media.ConstantPropertyLiquidWater "Medium model";

  Buildings.Fluid.Storage.Stratified tanSim(
    redeclare package Medium = Medium,
    hTan=3,
    dIns=0.3,
    VTan=5,
    m_flow_nominal=10,
    nSeg=10) "Tank";
    Modelica.Blocks.Sources.TimeTable TWat(table=[0,273.15 + 40; 3600,273.15 +
        40; 3600,273.15 + 20; 7200,273.15 + 20]) "Water temperature";
  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);
    FixedResistances.FixedResistanceDpM res_1(
    from_dp=true,
    redeclare package Medium = Medium,
    dp_nominal=5000,
    m_flow_nominal=10);
  Buildings.Fluid.Storage.StratifiedEnhanced tanEnh(
    redeclare package Medium = Medium,
    hTan=3,
    dIns=0.3,
    VTan=5,
    m_flow_nominal=10,
    nSeg=10) "Tank";
    FixedResistances.FixedResistanceDpM res_2(
    from_dp=true,
    redeclare package Medium = Medium,
    dp_nominal=5000,
    m_flow_nominal=10);
  Buildings.Fluid.Sensors.EnthalpyFlowRate HOut_flow(redeclare package Medium
      = Medium) "Enthalpy flow rate";
  Buildings.Fluid.Sensors.EnthalpyFlowRate HOut_flow1(redeclare package Medium
      = Medium) "Enthalpy flow rate";
  Modelica.Blocks.Continuous.Integrator dH 
    "Differenz in enthalpy (should be zero at steady-state)";
  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]) 
    "Pressure boundary condition";
  Modelica.Blocks.Sources.Sine sine(
    freqHz=1/86400,
    amplitude=10,
    offset=273.15 + 20);
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TBCSid2 
    "Boundary condition for tank";
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TBCSid1 
    "Boundary condition for tank";
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TBCTop1 
    "Boundary condition for tank";
  Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TBCTop2 
    "Boundary condition for tank";
  inner Modelica.Fluid.System system;
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;

Buildings.Fluid.Storage.Examples.StratifiedLoadingUnloading

Test model for stratified tank

Buildings.Fluid.Storage.Examples.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.

Modelica definition

model StratifiedLoadingUnloading "Test model for stratified tank"
  import Buildings;

 package Medium = Buildings.Media.ConstantPropertyLiquidWater "Medium model";
 constant Integer nSeg = 7 "Number of segments in tank";
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    p=300000 + 5000,
    T=273.15 + 40,
    redeclare package Medium = Medium,
    use_T_in=false,
    nPorts=2);
  Sources.MassFlowSource_T sin_1(
    redeclare package Medium = Medium,
    T=273.15 + 20,
    nPorts=1,
    m_flow=-0.028,
    use_m_flow_in=true);
  Buildings.Fluid.Storage.StratifiedEnhanced tanEnh(
    redeclare package Medium = Medium,
    hTan=3,
    dIns=0.3,
    m_flow_nominal=1*1000/3600/4,
    VTan=0.1,
    nSeg=nSeg,
    vol(medium(T(start=ones(nSeg)*273.15 + {50,26.8425,26.6594,26.65958,26.6596,26.6596,26.6596}))),
    show_T=true) "Tank";

  inner Modelica.Fluid.System system;
  Sources.MassFlowSource_T sin_2(
    redeclare package Medium = Medium,
    T=273.15 + 20,
    nPorts=1,
    m_flow=-0.028,
    use_m_flow_in=true);
  Buildings.Fluid.Storage.Stratified tan(
    redeclare package Medium = Medium,
    hTan=3,
    dIns=0.3,
    m_flow_nominal=1*1000/3600/4,
    VTan=0.1,
    nSeg=nSeg,
    vol(medium(T(start=ones(nSeg)*273.15 + {50,26.8425,26.6594,26.65958,26.6596,26.6596,26.6596}))),
    show_T=true) "Tank";

  Modelica.Blocks.Sources.Pulse pulse(
    amplitude=10*0.028,
    offset=-5*0.028,
    period=7200);
equation 
  connect(sou_1.ports[1], tanEnh.port_a);
  connect(tanEnh.port_b, sin_1.ports[1]);
  connect(tan.port_b, sin_2.ports[1]);
  connect(tan.port_a, sou_1.ports[2]);

  connect(pulse.y, sin_1.m_flow_in);
  connect(pulse.y, sin_2.m_flow_in);
end StratifiedLoadingUnloading;

HTML-documentation generated by Dymola Fri Jul 30 18:06:55 2010.