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 |
MixingVolumeHeatConduction
|
Test model for heat transfer to volume |
MixingVolumeMoistAir
|
Test model for mixing volume with moist air input |
MixingVolumePrescribedHeatFlowRate
|
Test model for heat transfer to volume |
Test model for heat transfer to volume
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
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air;
Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10)
;
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFlo
;
Buildings.HeatTransfer.Sources.FixedTemperature TAmb(T=293.15)
;
Modelica.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
T=313.15,
nPorts=1) ;
Modelica.Fluid.Sources.FixedBoundary bou(
redeclare package Medium = Medium,
T=303.15,
nPorts=1) ;
Buildings.Fluid.MixingVolumes.MixingVolume vol(
V=1,
redeclare package Medium = Medium,
m_flow_nominal=0.01,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
massDynamics=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;
Test model for mixing volume with moist air input
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
Type | Name | Default | Description |
MassFlowRate | m_flow_nominal | 0.001 | Nominal mass flow rate [kg/s] |
Modelica definition
model MixingVolumeMoistAir
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 0.001
;
Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir vol1(
redeclare package Medium = Medium,
V=1,
nPorts=2,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
m_flow_nominal=m_flow_nominal) ;
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TSen
;
Modelica.Blocks.Sources.Constant XSet(k=0.005)
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo;
Modelica.Blocks.Sources.Constant TSet(k=273.15 + 20)
;
Buildings.Utilities.Psychrometrics.pW_X humRat( use_p_in=false)
;
Buildings.Utilities.Psychrometrics.TDewPoi_pW dewPoi ;
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor;
Modelica.Blocks.Continuous.Integrator QSen ;
Modelica.Blocks.Continuous.Integrator QLat ;
Modelica.Blocks.Sources.RealExpression QLat_flow(y=vol1.QLat_flow.y)
;
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,
controllerType=Modelica.Blocks.Types.SimpleController.PI,
wd=0,
yMin=-1000);
Buildings.Controls.Continuous.LimPID PI1(
Ni=0.1,
Ti=1,
controllerType=Modelica.Blocks.Types.SimpleController.PI,
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 each package Medium = Medium,
from_dp=true,
dp_nominal=2.5,
m_flow_nominal=m_flow_nominal);
equation
connect(preHeaFlo.port, heatFlowSensor.port_a);
connect(heatFlowSensor.Q_flow, QSen.u);
connect(QLat_flow.y,QLat. 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(dewPoi.T, vol1.TWat);
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(mIn_flow.port_b, vol1.ports[1]);
connect(mOut_flow.port_a, vol1.ports[2]);
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]);
end MixingVolumeMoistAir;
Test model for heat transfer to volume
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
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air;
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFlo
;
Modelica.Fluid.Sources.MassFlowSource_T sou(
nPorts=1,
redeclare package Medium = Medium,
use_m_flow_in=true,
T=313.15) ;
Modelica.Fluid.Sources.FixedBoundary bou(
redeclare package Medium = Medium,
nPorts=1,
T=303.15) ;
Buildings.Fluid.MixingVolumes.MixingVolume vol(
V=1,
nPorts=2,
redeclare package Medium = Medium,
m_flow_nominal=0.01,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
massDynamics=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
;
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;