Buildings.Experimental.DHC.BaseClasses.Steam

Package for steam systems using the split-medium approach.

Information

This package contains base class models for steam systems. These models use the split-medium approach to allow various water/steam models to be coupled with a numerically-efficient liquid water model. This can greatly improve the computing performance by decoupling the energy and mass balance equations.

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Buildings.Experimental.DHC.BaseClasses.Steam.PartialSaturatedControlVolume PartialSaturatedControlVolume Partial control volume for evaporation/condensation processes
Buildings.Experimental.DHC.BaseClasses.Steam.PartialTwoPortTwoMedium PartialTwoPortTwoMedium Partial model with two ports with two separate medium models without storing mass or energy

Buildings.Experimental.DHC.BaseClasses.Steam.PartialSaturatedControlVolume Buildings.Experimental.DHC.BaseClasses.Steam.PartialSaturatedControlVolume

Partial control volume for evaporation/condensation processes

Buildings.Experimental.DHC.BaseClasses.Steam.PartialSaturatedControlVolume

Information

This model represents a partial control volume for either condensation or evaporation processes of water with liquid and vapor phases in equilibrium and at a saturated state. Models that extend this base class need to assign the mass flow rate at each port and the enthlapy at each port, as exemplifed in the evaporation and condensation models listed below. The volume can exchange heat through its heatPort when configured with dynamic mass and energy balances. In steady state, the heat port is conditionally removed in order to maintain a consistent set of equations.

This model is similar to Modelica.Fluid.Examples.DrumBoiler.BaseClasses.EquilibriumDrumBoiler with the following exceptions:

Implementation

This model is configured to allow both steady state and dynamic mass and energy balances. The heat transfer through the heatPort is disabled in steady state balance. This is required because the fluid is restricted to a saturated state; thus, the heat transfer rate is a function of mass flow rate only if the volume is steady. The fluid mass m in the volume is calculated as

m = ρsVs + ρwVw

where ρ is density,V is volume, and subscripts represent the steam and liquid water components, respectively. The total internal energy U is

U = ρsVshs + ρwVw − pV

where h is specific enthalpy, p is pressure, and the total volume of fluid V=Vs+Vw.

The steady state mass balance is given as

s + ṁw = 0,

while no additional equation is given for the steady state energy balance, since the heat flow rate into the water must be removed from the system in which the control volume is used.

The dynamic mass and energy balances are given as

dm/dt = ṁs + ṁw
dU/dt = Q̇ + ṁs hs + ṁ w hw

where ̇s and w are the mass flow rates of steam and liquid water respectively; is the heat flow rate into the control volume; hs and hw are the specific enthalpies of steam and liquid water, respectively. Note that with an evaporation process, the liquid phase (water) is always assigned at the port_a (inlet), while the vapor phase (steam) is always at the port_b (outlet). The opposite holds for a condensation process.

Assumptions

Three principal assumptions are made with this model:

Models that extend this base class include Buildings.Experimental.DHC.Plants.Steam.BaseClasses.ControlVolumeEvaporation and Buildings.Experimental.DHC.Loads.Steam.BaseClasses.ControlVolumeCondensation.

Reference

Hinkelman, Kathryn, Saranya Anbarasu, Michael Wetter, Antoine Gautier, and Wangda Zuo. 2022. “A Fast and Accurate Modeling Approach for Water and Steam Thermodynamics with Practical Applications in District Heating System Simulation.” Preprint. February 24. doi:10.13140/RG.2.2.20710.29762.

Extends from Buildings.BaseClasses.BaseIcon (Base icon), Buildings.Experimental.DHC.BaseClasses.Steam.PartialTwoPortTwoMedium (Partial model with two ports with two separate medium models without storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package Medium_aPartialMediumMedium model for port_a (inlet)
replaceable package Medium_bPartialMediumMedium model for port_b (outlet)
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
replaceable package MediumWatBuildings.Media.Specialized....Liquid water medium
replaceable package MediumSteBuildings.Media.SteamSteam medium
VolumeV Total volume [m3]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Advanced
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal. Used only if model has two ports.
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
DynamicsmassDynamicsenergyDynamicsType of mass balance: dynamic (3 initialization options) or steady state
Initialization
AbsolutePressurep_startMediumSte.p_defaultStart value of pressure [Pa]
TemperatureT_startMediumSte.saturationTemperat...Start value of temperature [K]
VolumeVWat_startV/2Start value of liquid volume [m3]

Connectors

TypeNameDescription
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)
replaceable package MediumWatLiquid water medium
replaceable package MediumSteSteam medium
HeatPort_aheatPortHeat port
output RealOutputVLiqLiquid volume [m3]

Modelica definition

partial model PartialSaturatedControlVolume "Partial control volume for evaporation/condensation processes" extends Buildings.BaseClasses.BaseIcon; extends Buildings.Experimental.DHC.BaseClasses.Steam.PartialTwoPortTwoMedium( p_start=MediumSte.p_default, final T_start=MediumSte.saturationTemperature(p_start)); // Medium declarations replaceable package MediumWat = Buildings.Media.Specialized.Water.TemperatureDependentDensity "Liquid water medium"; replaceable package MediumSte = Buildings.Media.Steam "Steam medium"; // Parameters parameter Modelica.Units.SI.Volume V "Total volume"; // Initialization parameter Modelica.Units.SI.Volume VWat_start=V/2 "Start value of liquid volume"; // Variables MediumWat.ThermodynamicState stateWat(p=p, T=T) "Saturated state, liquid water"; MediumSte.ThermodynamicState stateSte(p=p, T=T) "Saturated state, steam"; MediumSte.AbsolutePressure p( final start=p_start, stateSelect=if massDynamics == Modelica.Fluid.Types.Dynamics.SteadyState then StateSelect.default else StateSelect.prefer) "Pressure inside volume"; MediumSte.Temperature T(final start=T_start) "Temperature inside volume"; Modelica.Units.SI.Volume VSte "Volume of steam vapor"; Modelica.Units.SI.Volume VWat( final start=VWat_start, fixed=true, stateSelect=if massDynamics == Modelica.Fluid.Types.Dynamics.SteadyState then StateSelect.default else StateSelect.prefer) "Volume of liquid water phase"; Modelica.Units.SI.VolumeFlowRate VWat_flow(start=0) "Volumetric flow rate of liquid water"; MediumSte.SpecificEnthalpy hSte "Specific enthalpy of steam vapor"; MediumWat.SpecificEnthalpy hWat "Specific enthalpy of liquid water"; MediumSte.Density rhoSte "Density of steam vapor"; MediumWat.Density rhoWat "Density of liquid water"; Modelica.Units.SI.Mass m "Total mass of volume"; Modelica.Units.SI.Energy U "Internal energy"; Modelica.Units.SI.MassFlowRate mWat_flow "Water mass flow rate"; Modelica.Units.SI.MassFlowRate mSte_flow "Steam mass flow rate"; // Input Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort( T(final start=T_start)) if not steadyDynamics "Heat port"; //Output Modelica.Blocks.Interfaces.RealOutput VLiq(final unit="m3") "Liquid volume"; protected final parameter Boolean steadyDynamics= energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState "= true, if steady state formulation"; Buildings.HeatTransfer.Sources.PrescribedTemperature preTem if not steadyDynamics "Prescribed temperature"; Modelica.Blocks.Sources.RealExpression portT(y=T) if not steadyDynamics "Port temperature"; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFloSen if not steadyDynamics "Heat flow sensor"; Modelica.Blocks.Interfaces.RealInput Q_flow_internal "Needed to use conditional connector Q_flow"; initial equation // Make sure that if energyDynamics is SteadyState, then // massDynamics is also SteadyState. // Otherwise, the system of ordinary differential equations may be inconsistent. if energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState then assert(massDynamics == energyDynamics, "In " + getInstanceName() + ": If 'energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState', then it is required that 'massDynamics==Modelica.Fluid.Types.Dynamics.SteadyState'. Otherwise, the system of equations may not be consistent. You need to select other parameter values."); end if; // Initial conditions if energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyStateInitial then der(T) = 0; end if; if massDynamics == Modelica.Fluid.Types.Dynamics.SteadyStateInitial then der(p)=0; end if; equation // Total quantities m = rhoSte*VSte + rhoWat*VWat "Total mass"; U = rhoSte*VSte*hSte + rhoWat*VWat*hWat - p*V "Total energy"; V = VWat + VSte "Total volume"; // Mass balance if massDynamics == Modelica.Fluid.Types.Dynamics.SteadyState then 0 = mWat_flow + mSte_flow "Steady state mass balance"; else der(m) = mWat_flow + mSte_flow "Dynamic mass balance"; end if; der(VWat) = VWat_flow; // Energy balance if energyDynamics == Modelica.Fluid.Types.Dynamics.SteadyState then der(U) = 0; Q_flow_internal = 0; else connect(heaFloSen.Q_flow, Q_flow_internal) "Needed because of conditional input"; if allowFlowReversal then der(U) = Q_flow_internal + port_a.m_flow*actualStream(port_a.h_outflow) + port_b.m_flow*actualStream(port_b.h_outflow); else der(U) = Q_flow_internal + port_a.m_flow*inStream(port_a.h_outflow) + port_b.m_flow*port_b.h_outflow; end if; end if; // Properties of saturated liquid and steam T = MediumSte.saturationTemperature(p); hSte=MediumSte.specificEnthalpy(stateSte); hWat=MediumWat.specificEnthalpy(stateWat); rhoSte=MediumSte.density(stateSte); rhoWat=MediumWat.density(stateWat); // boundary conditions at the ports port_a.p = p; port_b.p = p; // outputs VLiq = VWat; // Check that evaporation is actually possible assert(VSte >= 0, "There is no more steam vapor in the volume."); assert(VWat >= 0, "There is no more liquid water in the volume."); connect(portT.y,preTem. T); connect(heaFloSen.port_b,preTem. port); connect(heaFloSen.port_a, heatPort); end PartialSaturatedControlVolume;

Buildings.Experimental.DHC.BaseClasses.Steam.PartialTwoPortTwoMedium Buildings.Experimental.DHC.BaseClasses.Steam.PartialTwoPortTwoMedium

Partial model with two ports with two separate medium models without storing mass or energy

Buildings.Experimental.DHC.BaseClasses.Steam.PartialTwoPortTwoMedium

Information

This partial model defines an interface for components with two ports and separate medium definitions at each port. The component transports fluid between two ports without storing mass or energy. The treatment of the design flow direction and of flow reversal are predefined based on the parameter allowFlowReversal.

This model is intended for steam heating applications, where phase change is inherently present. The split-medium approach enables a numerically-efficient liquid water model (i.e., Buildings.Media.Specialized.Water.TemperatureDependentDensity) to be implemented alongside various water/steam models for other phases. For most applications, an efficient model (i.e., Modelica.Media.Water.StandardWater is suitable as it covers the largest range of pressure-temperature conditions through its implementation of the IAPWS-IF97 water/steam formulation. If a reduce pressure-temperature range is applicable, Buildings.Media.Steam) provides a more efficient implementation. Through the split-medium approach, pressure and density calculations are decoupled, eliminating costly nonlinear systems of equations. This interface model also includes parameters for mass and energy dynamics as well as initialization.

Reference

Hinkelman, Kathryn, Saranya Anbarasu, Michael Wetter, Antoine Gautier, and Wangda Zuo. 2022. “A Fast and Accurate Modeling Approach for Water and Steam Thermodynamics with Practical Applications in District Heating System Simulation.” Preprint. February 24. doi:10.13140/RG.2.2.20710.29762.

Parameters

TypeNameDefaultDescription
replaceable package Medium_aModelica.Media.Interfaces.Pa...Medium model for port_a (inlet)
replaceable package Medium_bModelica.Media.Interfaces.Pa...Medium model for port_b (outlet)
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Advanced
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal. Used only if model has two ports.
Dynamics
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
DynamicsmassDynamicsenergyDynamicsType of mass balance: dynamic (3 initialization options) or steady state
Initialization
AbsolutePressurep_startMedium_b.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium_b.T_defaultStart value of temperature [K]

Connectors

TypeNameDescription
replaceable package Medium_aMedium model for port_a (inlet)
replaceable package Medium_bMedium model for port_b (outlet)
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)

Modelica definition

partial model PartialTwoPortTwoMedium "Partial model with two ports with two separate medium models without storing mass or energy" replaceable package Medium_a = Modelica.Media.Interfaces.PartialMedium "Medium model for port_a (inlet)"; replaceable package Medium_b = Modelica.Media.Interfaces.PartialMedium "Medium model for port_b (outlet)"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal "Nominal mass flow rate"; parameter Modelica.Units.SI.MassFlowRate m_flow_small(min=0) = 1E-4*abs(m_flow_nominal) "Small mass flow rate for regularization of zero flow"; // Diagnostics parameter Boolean show_T = false "= true, if actual temperature at port is computed"; Modelica.Units.SI.MassFlowRate m_flow(start=_m_flow_start) = 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(start=_dp_start, displayUnit="Pa") = port_a.p - port_b.p "Pressure difference between port_a and port_b"; Medium_a.ThermodynamicState sta_a= Medium_a.setState_phX(port_a.p, noEvent(actualStream(port_a.h_outflow)), noEvent(actualStream(port_a.Xi_outflow))) if show_T "Medium properties in port_a"; Medium_b.ThermodynamicState sta_b= Medium_b.setState_phX(port_b.p, noEvent(actualStream(port_b.h_outflow)), noEvent(actualStream(port_b.Xi_outflow))) if show_T "Medium properties in port_b"; Modelica.Fluid.Interfaces.FluidPort_a port_a( redeclare final package Medium = Medium_a, m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0), h_outflow(start = Medium_a.h_default, nominal = Medium_a.h_default)) "Fluid connector a (positive design flow direction is from port_a to port_b)"; Modelica.Fluid.Interfaces.FluidPort_b port_b( redeclare final package Medium = Medium_b, m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0), h_outflow(start = Medium_b.h_default, nominal = Medium_b.h_default)) "Fluid connector b (positive design flow direction is from port_a to port_b)"; // Assumptions parameter Boolean allowFlowReversal = true "= false to simplify equations, assuming, but not enforcing, no flow reversal. Used only if model has two ports."; //Dynamics parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Modelica.Fluid.Types.Dynamics massDynamics=energyDynamics "Type of mass balance: dynamic (3 initialization options) or steady state"; // Initialization parameter Medium_b.AbsolutePressure p_start = Medium_b.p_default "Start value of pressure"; parameter Medium_b.Temperature T_start=Medium_b.T_default "Start value of temperature"; protected final parameter Modelica.Units.SI.MassFlowRate _m_flow_start = 0 "Start value for m_flow, used to avoid a warning if not set in m_flow, and to avoid m_flow.start in parameter window"; final parameter Modelica.Units.SI.PressureDifference _dp_start(displayUnit="Pa") = 0 "Start value for dp, used to avoid a warning if not set in dp, and to avoid dp.start in parameter window"; end PartialTwoPortTwoMedium;