model To_VolumeFraction
"Example problem for conversion model"
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air(extraPropertiesNames={"CO2"});
Buildings.Fluid.Sensors.Conversions.To_VolumeFraction conMasVolFra(MMMea=
Modelica.Media.IdealGases.Common.SingleGasesData.CO2.MM)
"Conversion from mass fraction CO2 to volume fraction CO2";
Modelica.Blocks.Sources.Constant volFra(k=1000E-6)
"Set point for volume fraction of 700PPM CO2";
Buildings.Controls.Continuous.LimPID limPID(
controllerType=Modelica.Blocks.Types.SimpleController.PI,
reverseAction=true,
Ti=600,
k=2,
Td=1);
Buildings.Fluid.Sensors.TraceSubstances senCO2(
redeclare package Medium =
Medium, substanceName="CO2")
"CO2 sensor";
Buildings.Fluid.MixingVolumes.MixingVolume vol(
nPorts=4,
redeclare package Medium = Medium,
V=4*4*2.7,
C_start={300E-6}*44.009544/28.9651159,
m_flow_nominal=0.1,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
"Volume of air";
Buildings.Fluid.Sources.TraceSubstancesFlowSource souCO2(
use_m_flow_in=true,
redeclare package Medium = Medium,
nPorts=1)
"CO2 source";
Modelica.Blocks.Math.Gain CO2Per(k=15/1000/3600*1.977)
"CO2 emission per person";
Buildings.Fluid.Sources.MassFlowSource_T sou(
use_m_flow_in=true,
redeclare package Medium = Medium,
C={300E-6}*44.009544/28.9651159,
nPorts=1)
"Source of fresh air with 300 PPM CO2";
Buildings.Fluid.Sources.FixedBoundary sin(
redeclare package Medium = Medium,
p=100000,
C={300E-6}*44.009544/28.9651159,
nPorts=1)
"Sink for exhaust air";
Modelica.Blocks.Math.Gain gai(k=50/3600)
"Gain for mass flow rate";
Modelica.Blocks.Sources.Constant nPeo(k=1)
"Number of people";
Buildings.Fluid.Sensors.VolumeFlowRate senVolFlo(
redeclare package Medium =
Medium, m_flow_nominal=0.1);
Modelica.Blocks.Math.Gain norSet(k=1/1000E-6)
"Normalization for set point (to scale control input)";
Modelica.Blocks.Math.Gain norMea(k=1/1000E-6)
"Normalization for measured concentration (to scale control input)";
Modelica.Blocks.Math.Gain conVolFlo(k=3600, y(unit="m3/h"))
"Conversion from m3/s to m3/h";
Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubPeo(m_flow_nominal=0.1,
redeclare package Medium = Medium,
C_start=0,
initType=Modelica.Blocks.Types.Init.InitialState)
"CO2 concentration in absorptance from people";
Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubFre(m_flow_nominal=0.1,
redeclare package Medium = Medium,
C_start=0,
initType=Modelica.Blocks.Types.Init.InitialState)
"CO2 concentration in fresh air supply";
Buildings.Fluid.FixedResistances.FixedResistanceDpM res(
redeclare package Medium = Medium,
dp_nominal=10,
m_flow_nominal=50/3600)
"Pressure drop to decouple the state of the volume from the state of the boundary condition";
equation
connect(souCO2.m_flow_in, CO2Per.y);
connect(gai.y, sou.m_flow_in);
connect(limPID.y, gai.u);
connect(nPeo.y, CO2Per.u);
connect(sou.ports[1], senVolFlo.port_a);
connect(senCO2.C, conMasVolFra.m);
connect(conMasVolFra.V, norMea.u);
connect(norMea.y, limPID.u_m);
connect(volFra.y, norSet.u);
connect(norSet.y, limPID.u_s);
connect(conVolFlo.u, senVolFlo.V_flow);
connect(souCO2.ports[1], senTraSubPeo.port_a);
connect(senTraSubPeo.port_b, vol.ports[1]);
connect(senVolFlo.port_b, senTraSubFre.port_a);
connect(senTraSubFre.port_b, vol.ports[2]);
connect(vol.ports[3], senCO2.port);
connect(vol.ports[4], res.port_a);
connect(res.port_b, sin.ports[1]);
end To_VolumeFraction;