Buildings.Fluid.MixingVolumes.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.MixingVolumes.

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

Package Content

Name Description
Buildings.Fluid.MixingVolumes.Examples.MixingVolumeHeatConduction MixingVolumeHeatConduction Test model for heat transfer to volume
Buildings.Fluid.MixingVolumes.Examples.MixingVolumeMoistAir MixingVolumeMoistAir Test model for mixing volume with moist air input
Buildings.Fluid.MixingVolumes.Examples.MixingVolumePrescribedHeatFlowRate MixingVolumePrescribedHeatFlowRate Test model for heat transfer to volume

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeHeatConduction Buildings.Fluid.MixingVolumes.Examples.MixingVolumeHeatConduction

Test model for heat transfer to volume

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeHeatConduction

Information

This model demonstrates the use of the mixing volume with heat conduction to the ambient. The mixing volume is configured as a steady-state model.

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

Modelica definition

model MixingVolumeHeatConduction "Test model for heat transfer to volume" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10) "Thermal conductor"; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFlo "Heat flow sensor"; Buildings.HeatTransfer.Sources.FixedTemperature TAmb(T=293.15) "Ambient temperature"; Modelica.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, use_m_flow_in=true, T=313.15, nPorts=1) "Flow source and sink"; Modelica.Fluid.Sources.FixedBoundary bou( redeclare package Medium = Medium, T=303.15, nPorts=1) "Boundary condition"; Buildings.Fluid.MixingVolumes.MixingVolume vol( V=1, redeclare package Medium = Medium, m_flow_nominal=0.01, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=true, nPorts=2); Modelica.Blocks.Sources.Ramp ramp( duration=1, offset=1, height=-2); Modelica.Blocks.Math.Gain gain(k=0.01); equation connect(TAmb.port, theCon.port_a); connect(heaFlo.port_b, vol.heatPort); connect(ramp.y, gain.u); connect(gain.y, sou.m_flow_in); connect(theCon.port_b, heaFlo.port_a); connect(sou.ports[1], vol.ports[1]); connect(vol.ports[2], bou.ports[1]); end MixingVolumeHeatConduction;

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeMoistAir Buildings.Fluid.MixingVolumes.Examples.MixingVolumeMoistAir

Test model for mixing volume with moist air input

Buildings.Fluid.MixingVolumes.Examples.MixingVolumeMoistAir

Information

This model tests Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir. After an initial transient, the temperature and humidity of the volume stabilizes.

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

Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal0.001Nominal mass flow rate [kg/s]

Modelica definition

model MixingVolumeMoistAir "Test model for mixing volume with moist air input" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=0.001 "Nominal mass flow rate"; Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol1( redeclare package Medium = Medium, V=1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, m_flow_nominal=m_flow_nominal, nPorts=2) "Volume"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TSen "Temperature sensor"; Modelica.Blocks.Sources.Constant XSet(k=0.005) "Set point for water mass fraction"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo; Modelica.Blocks.Sources.Constant TSet(k=273.15 + 20) "Set point for temperature"; Buildings.Utilities.Psychrometrics.pW_X humRat(use_p_in=false) "Conversion from humidity ratio to partial water vapor pressure"; Buildings.Utilities.Psychrometrics.TDewPoi_pW dewPoi "Dew point temperature"; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor; Modelica.Blocks.Continuous.Integrator QSen "Sensible heat transfer"; Modelica.Blocks.Continuous.Integrator QLat "Enthalpy of extracted water"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, nPorts=1, T=293.15); Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=293.15, nPorts=1); Buildings.Controls.Continuous.LimPID PI( Ni=0.1, yMax=1000, k=1, Ti=1, Td=1, wd=0, yMin=-1000); Buildings.Controls.Continuous.LimPID PI1( Ni=0.1, Ti=1, k=10, yMax=1, yMin=-1, Td=1); Buildings.Fluid.Sensors.MassFlowRate mIn_flow(redeclare package Medium = Medium); Buildings.Fluid.Sensors.MassFlowRate mOut_flow(redeclare package Medium = Medium); Modelica.Blocks.Math.Add dM_flow(k2=-1); Modelica.Blocks.Math.Gain gai(k=200); Modelica.Blocks.Math.Gain gai1(k=0.1); Buildings.Fluid.FixedResistances.PressureDrop res1( redeclare package Medium = Medium, from_dp=true, dp_nominal=2.5, m_flow_nominal=m_flow_nominal); Sensors.LatentEnthalpyFlowRate senLatEnt( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0, initType=Modelica.Blocks.Types.Init.SteadyState) "Latent enthalpy inflow"; Sensors.LatentEnthalpyFlowRate senLatEnt1( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0, initType=Modelica.Blocks.Types.Init.SteadyState) "Latent enthalpy outflow"; Modelica.Blocks.Math.Add add; equation connect(preHeaFlo.port, heatFlowSensor.port_a); connect(heatFlowSensor.Q_flow, QSen.u); connect(TSet.y, PI.u_s); connect(TSen.T, PI.u_m); connect(XSet.y, PI1.u_s); connect(mOut_flow.m_flow, dM_flow.u1); connect(mIn_flow.m_flow, dM_flow.u2); connect(gai.y, preHeaFlo.Q_flow); connect(PI1.y, gai1.u); connect(gai1.y, vol1.mWat_flow); connect(vol1.X_w, PI1.u_m); connect(vol1.X_w, humRat.X_w); connect(sou.ports[1], mIn_flow.port_a); connect(heatFlowSensor.port_b, vol1.heatPort); connect(TSen.port, vol1.heatPort); connect(PI.y, gai.u); connect(humRat.p_w, dewPoi.p_w); connect(mOut_flow.port_b, res1.port_a); connect(res1.port_b, sin.ports[1]); connect(mIn_flow.port_b, senLatEnt.port_a); connect(senLatEnt.port_b, vol1.ports[1]); connect(vol1.ports[2], senLatEnt1.port_a); connect(senLatEnt1.port_b, mOut_flow.port_a); connect(add.y, QLat.u); connect(add.u1, senLatEnt.H_flow); connect(senLatEnt1.H_flow, add.u2); end MixingVolumeMoistAir;

Buildings.Fluid.MixingVolumes.Examples.MixingVolumePrescribedHeatFlowRate Buildings.Fluid.MixingVolumes.Examples.MixingVolumePrescribedHeatFlowRate

Test model for heat transfer to volume

Buildings.Fluid.MixingVolumes.Examples.MixingVolumePrescribedHeatFlowRate

Information

This model demonstrates the use of the mixing volume with a prescribed heat flow rate. The mixing volume is configured as a steady-state model. The heat flow rate is set to a very small value. This model is used to test convergence for the case the prescribed heat flow rate should be zero, but due to numerical solutions, it may have a small error that causes the signal to be non-zero.

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

Modelica definition

model MixingVolumePrescribedHeatFlowRate "Test model for heat transfer to volume" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFlo "Heat flow sensor"; Modelica.Fluid.Sources.MassFlowSource_T sou( nPorts=1, redeclare package Medium = Medium, use_m_flow_in=true, T=313.15) "Flow source and sink"; Modelica.Fluid.Sources.FixedBoundary bou( redeclare package Medium = Medium, nPorts=1, T=303.15) "Boundary condition"; Buildings.Fluid.MixingVolumes.MixingVolume vol( V=1, nPorts=2, redeclare package Medium = Medium, m_flow_nominal=0.01, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, allowFlowReversal=true, prescribedHeatFlowRate=true); Modelica.Blocks.Sources.Ramp ramp( duration=1, offset=1, height=-2); Modelica.Blocks.Math.Gain gain(k=0.01); Modelica.Blocks.Sources.Constant const(k=0); Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo "Prescribed heat flow rate"; equation connect(sou.ports[1], vol.ports[1]); connect(ramp.y, gain.u); connect(gain.y, sou.m_flow_in); connect(vol.ports[2], bou.ports[1]); connect(preHeaFlo.port, heaFlo.port_a); connect(preHeaFlo.Q_flow, const.y); connect(heaFlo.port_b, vol.heatPort); end MixingVolumePrescribedHeatFlowRate;