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.Sensors.
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
Density
|
Test model for the density sensor |
EnthalpyFlowRate
|
Test model for the enthalpy flow rate sensors |
EntropyFlowRate
|
Test model for the entropy flow rate sensors |
MassFraction
|
Test model for the mass fraction sensor |
MoistAirEnthalpyFlowRate
|
Test model for the sensible and latent enthalpy flow rate sensors |
PPM
|
Test model for the extra property sensor outputting PPM |
Pressure
|
Test model for the pressure sensor |
RelativeHumidity
|
Test model for relative humidity sensor |
SpecificEnthalpy
|
Test model for the enthalpy flow rate sensors |
SpecificEntropy
|
Test model for the entropy flow rate sensors |
TemperatureDryBulb
|
Test model for the dry bulb temperature sensor |
TemperatureWetBulb
|
Test model for the wet bulb temperature sensor |
TraceSubstances
|
Test model for the extra property sensor |
Velocity
|
Test model for the flow velocity sensor |
VolumeFlowRate
|
Test model for the volume flow rate sensor |
Test model for the density sensor
Information
This example tests the density sensors.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model Density
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=293.15,
nPorts=1) ;
Buildings.Fluid.Sources.MassFlowSource_T masFloRat(
redeclare package Medium = Medium,
use_T_in=false,
X={0.02,0.98},
nPorts=1,
use_m_flow_in=true) ;
Buildings.Fluid.Sensors.Density senDenVol(
redeclare package Medium = Medium, warnAboutOnePortConnection=false)
;
Buildings.Fluid.MixingVolumes.MixingVolume vol(
redeclare package Medium = Medium,
V=1,
nPorts=3,
m_flow_nominal=10,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) ;
Buildings.Fluid.FixedResistances.PressureDrop dp(
redeclare package Medium = Medium,
m_flow_nominal=10,
dp_nominal=200) ;
Buildings.Fluid.Sensors.DensityTwoPort senDenFlo(
redeclare package Medium = Medium,
m_flow_nominal=10) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-20,
offset=10,
duration=60);
equation
connect(masFloRat.ports[1], vol.ports[1]);
connect(vol.ports[2], dp.port_a);
connect(vol.ports[3], senDenVol.port);
connect(dp.port_b, senDenFlo.port_a);
connect(senDenFlo.port_b, sin.ports[1]);
connect(ramp.y, masFloRat.m_flow_in);
end Density;
Test model for the enthalpy flow rate sensors
Information
This example tests the enthalpy flow rate sensor and the
specific enthalpy sensor.
The model compares the output of the enthalpy flow rate sensor with
the product of the output of the enthalpy and the mass flow rate sensor.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model EnthalpyFlowRate
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sensors.EnthalpyFlowRate senH_flow(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
Buildings.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1,
T=293.15) ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1,
T=313.15) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-2,
offset=1,
duration=60) ;
Buildings.Fluid.Sensors.SpecificEnthalpyTwoPort senH(
redeclare package Medium = Medium,
m_flow_nominal=2,
tau=0) ;
Buildings.Fluid.Sensors.MassFlowRate senM_flow(
redeclare package Medium = Medium) ;
Modelica.Blocks.Math.Add cheEqu(k2=-1)
;
Modelica.Blocks.Math.Product pro ;
equation
connect(ramp.y, sou.m_flow_in);
connect(sou.ports[1], senH_flow.port_a);
connect(senH_flow.port_b, senH.port_a);
connect(senH.port_b, senM_flow.port_a);
connect(senM_flow.port_b, sin.ports[1]);
connect(senH_flow.H_flow,cheEqu. u1);
connect(senH.h_out, pro.u1);
connect(senM_flow.m_flow, pro.u2);
connect(pro.y,cheEqu. u2);
end EnthalpyFlowRate;
Test model for the entropy flow rate sensors
Information
This example tests the entropy flow rate sensor and the
specific entropy sensor.
The model compares the output of the entropy flow rate sensor with
the product of the output of the entropy and the mass flow rate sensor.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model EntropyFlowRate
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sensors.EntropyFlowRate senS_flow(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
Buildings.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1,
T=293.15) ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1,
T=313.15) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-2,
offset=1,
duration=60) ;
Buildings.Fluid.Sensors.SpecificEntropyTwoPort senS(
redeclare package Medium = Medium,
m_flow_nominal=2,
tau=0) ;
Buildings.Fluid.Sensors.MassFlowRate senM_flow(
redeclare package Medium = Medium) ;
Buildings.Utilities.Diagnostics.AssertEquality assEqu
;
Modelica.Blocks.Math.Product pro ;
equation
connect(ramp.y, sou.m_flow_in);
connect(sou.ports[1],senS_flow. port_a);
connect(senS_flow.port_b,senS. port_a);
connect(senS.port_b, senM_flow.port_a);
connect(senM_flow.port_b, sin.ports[1]);
connect(senM_flow.m_flow, pro.u2);
connect(pro.y, assEqu.u2);
connect(senS_flow.S_flow, assEqu.u1);
connect(senS.s, pro.u1);
end EntropyFlowRate;
Test model for the mass fraction sensor
Information
This example tests the mass fraction sensors.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model MassFraction
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1,
T=293.15) ;
Buildings.Fluid.Sources.MassFlowSource_T masFloRat(
redeclare package Medium = Medium,
use_m_flow_in=false,
use_T_in=false,
X={0.02,0.98},
m_flow=10,
nPorts=1) ;
Buildings.Fluid.Sensors.MassFraction senMasFra2(
redeclare package Medium = Medium, warnAboutOnePortConnection=false)
;
Buildings.Fluid.MixingVolumes.MixingVolume vol(
redeclare package Medium = Medium,
V=1,
nPorts=3,
m_flow_nominal=10,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) ;
Buildings.Fluid.FixedResistances.PressureDrop dp(
redeclare package Medium = Medium,
m_flow_nominal=10,
dp_nominal=200) ;
Buildings.Fluid.Sensors.MassFractionTwoPort senMasFra1(
redeclare package Medium = Medium, m_flow_nominal=10)
;
equation
connect(dp.port_b, sin.ports[1]);
connect(masFloRat.ports[1], senMasFra1.port_a);
connect(senMasFra1.port_b, vol.ports[1]);
connect(vol.ports[2], dp.port_a);
connect(vol.ports[3], senMasFra2.port);
end MassFraction;
Test model for the sensible and latent enthalpy flow rate sensors
Information
This example tests the sensible and latent enthalpy sensors.
It compares the output from the enthalpy sensor with the sum of the
sensible and latent enthalpy sensors.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model MoistAirEnthalpyFlowRate
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air;
Buildings.Fluid.Sensors.EnthalpyFlowRate senH_flow(
redeclare package Medium = Medium,
m_flow_nominal=1) ;
Buildings.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1,
T=293.15) ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=1,
X={0.02,0.98},
T=313.15) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-2,
offset=1,
duration=60);
Buildings.Fluid.Sensors.SpecificEnthalpyTwoPort senH(
redeclare package Medium = Medium,
m_flow_nominal=1) ;
Buildings.Fluid.Sensors.MassFlowRate senM_flow(
redeclare package Medium = Medium) ;
Modelica.Blocks.Math.Product pro ;
Buildings.Fluid.Sensors.LatentEnthalpyFlowRate senHLat_flow(
redeclare package Medium = Medium,
m_flow_nominal=1) ;
Buildings.Fluid.Sensors.SensibleEnthalpyFlowRate senHSen_flow(
redeclare package Medium = Medium, m_flow_nominal=1)
;
Modelica.Blocks.Math.Add add
;
equation
connect(ramp.y, sou.m_flow_in);
connect(sou.ports[1], senH_flow.port_a);
connect(senH_flow.port_b, senH.port_a);
connect(senH.port_b, senM_flow.port_a);
connect(senH.h_out, pro.u1);
connect(senM_flow.m_flow, pro.u2);
connect(senHLat_flow.H_flow, add.u1);
connect(senHSen_flow.H_flow, add.u2);
connect(senM_flow.port_b, senHLat_flow.port_a);
connect(senHLat_flow.port_b, senHSen_flow.port_a);
connect(senHSen_flow.port_b, sin.ports[1]);
end MoistAirEnthalpyFlowRate;
Test model for the extra property sensor outputting PPM
Information
This example tests the sensors that measure trace substances
using an output in parts per million.
Various configurations with and without flow reversal
and with or without dynamics are tested.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
MassFlowRate | m_flow_nominal | volDyn.V*senPPMTwoPort.tau*3... | Mass flow rate into and out of the volume [kg/s] |
Modelica definition
model PPM
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air(extraPropertiesNames={"CO2"})
;
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=volDyn.V*
senPPMTwoPort.tau*3*rho_default
;
Buildings.Fluid.MixingVolumes.MixingVolume volDyn(
redeclare package Medium = Medium,
nPorts=3,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
V=1,
use_C_flow=true,
m_flow_nominal=m_flow_nominal) ;
Buildings.Fluid.Sources.MassFlowSource_T mSou(
redeclare package Medium = Medium,
nPorts=2,
m_flow=m_flow_nominal) ;
Buildings.Fluid.Sensors.PPM senPPMVol(
redeclare package Medium = Medium,
warnAboutOnePortConnection=false)
;
Modelica.Blocks.Sources.Constant CO2In(k=m_flow_nominal/1000)
;
Buildings.Fluid.Sensors.PPMTwoPort senPPMTwoPort(
redeclare package Medium = Medium,
allowFlowReversal=true,
m_flow_nominal=m_flow_nominal) ;
Buildings.Fluid.Sensors.PPM senPPMIn(
redeclare package Medium = Medium,
warnAboutOnePortConnection=false)
;
Buildings.Fluid.Sensors.PPMTwoPort senPPMNoRev(
redeclare package Medium = Medium,
allowFlowReversal=false,
m_flow_nominal=m_flow_nominal) ;
Buildings.Fluid.Sensors.PPMTwoPort senPPMRev(
redeclare package Medium = Medium,
allowFlowReversal=true,
m_flow_nominal=m_flow_nominal) ;
Buildings.Fluid.Sensors.PPMTwoPort senPPMSta(
redeclare package Medium = Medium,
allowFlowReversal=true,
tau=0,
m_flow_nominal=m_flow_nominal) ;
Buildings.Fluid.MixingVolumes.MixingVolume volSte(
redeclare package Medium = Medium,
nPorts=3,
V=1,
use_C_flow=true,
m_flow_nominal=m_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
;
Buildings.Fluid.Sensors.PPM senPPMVol2(
redeclare package Medium = Medium,
warnAboutOnePortConnection=false)
;
Buildings.Fluid.Sources.MassFlowSource_T mSouSta(
redeclare package Medium = Medium,
nPorts=1,
m_flow=m_flow_nominal) ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=2) ;
protected
final parameter Medium.ThermodynamicState state_default =
Medium.setState_pTX(
T=Medium.T_default,
p=Medium.p_default,
X=Medium.X_default[1:Medium.nXi]) ;
final parameter Modelica.Units.SI.Density rho_default=
Medium.density(state=
state_default) ;
equation
connect(mSou.ports[1], volDyn.ports[1]);
connect(CO2In.y, volDyn.C_flow[1]);
connect(senPPMVol.port, volDyn.ports[2]);
connect(senPPMIn.port, mSou.ports[2]);
connect(senPPMTwoPort.port_a, volDyn.ports[3]);
connect(senPPMNoRev.port_a, senPPMTwoPort.port_b);
connect(senPPMRev.port_b, senPPMNoRev.port_b);
connect(senPPMSta.port_a, senPPMRev.port_a);
connect(CO2In.y,volSte. C_flow[1]);
connect(volSte.ports[1], senPPMVol2.port);
connect(mSouSta.ports[1], volSte.ports[2]);
connect(sin.ports[1], senPPMSta.port_b);
connect(sin.ports[2], volSte.ports[3]);
end PPM;
Test model for the pressure sensor
Information
This example tests the pressure sensors.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model Pressure
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=293.15,
nPorts=1) ;
Buildings.Fluid.Sources.MassFlowSource_T masFloRat(
redeclare package Medium = Medium,
use_T_in=false,
X={0.02,0.98},
use_m_flow_in=true,
nPorts=1) ;
Buildings.Fluid.FixedResistances.PressureDrop dp(
redeclare package Medium = Medium,
m_flow_nominal=10,
dp_nominal=200) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-20,
offset=10,
duration=1);
Buildings.Fluid.Sensors.Pressure senPre_a(
redeclare package Medium = Medium)
;
Buildings.Fluid.Sensors.Pressure senPre_b(
redeclare package Medium = Medium)
;
Buildings.Fluid.Sensors.RelativePressure senRelPre(
redeclare package Medium = Medium) ;
equation
connect(ramp.y, masFloRat.m_flow_in);
connect(masFloRat.ports[1], dp.port_a);
connect(dp.port_b, sin.ports[1]);
connect(senPre_a.port, dp.port_a);
connect(senPre_b.port, dp.port_b);
connect(senRelPre.port_a, dp.port_a);
connect(senRelPre.port_b, dp.port_b);
end Pressure;
Test model for relative humidity sensor
Information
This example tests the relative humidity sensors.
Note that the sensor with one port always measures the humidity
as if the flow would be leaving the source.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model RelativeHumidity
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
use_p_in=false,
T=293.15,
nPorts=1);
Buildings.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
m_flow=1,
use_T_in=true,
use_m_flow_in=true,
nPorts=2,
use_Xi_in=true)
;
Modelica.Blocks.Sources.Ramp TDryBul(
height=10,
offset=273.15 + 30,
duration=120) ;
Modelica.Blocks.Sources.Ramp XHum(
duration=1,
height=(0.0133 - 0.0175),
offset=0.0175) ;
Buildings.Fluid.Sensors.RelativeHumidity senRelHum(
redeclare package Medium = Medium, warnAboutOnePortConnection=false)
;
Modelica.Blocks.Sources.Ramp m_flow(
height=-2,
offset=1,
duration=500) ;
Buildings.Fluid.Sensors.RelativeHumidityTwoPort relHum(
redeclare package Medium = Medium, m_flow_nominal=1,
initType=Modelica.Blocks.Types.Init.InitialState)
;
equation
connect(TDryBul.y, sou.T_in);
connect(m_flow.y, sou.m_flow_in);
connect(relHum.port_b, sin.ports[1]);
connect(senRelHum.port, sou.ports[1]);
connect(sou.ports[2], relHum.port_a);
connect(sou.Xi_in[1], XHum.y);
end RelativeHumidity;
Test model for the enthalpy flow rate sensors
Information
This example tests the specific enthalpy sensors.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model SpecificEnthalpy
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sources.MassFlowSource_h sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
use_h_in=false,
nPorts=2) ;
Buildings.Fluid.Sources.Boundary_ph sin(
redeclare package Medium = Medium,
use_h_in=false,
h=20,
nPorts=1) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-2,
offset=1,
duration=60);
Buildings.Fluid.Sensors.SpecificEnthalpy senFloSou(
redeclare package Medium = Medium, warnAboutOnePortConnection=false)
;
Buildings.Fluid.Sensors.SpecificEnthalpyTwoPort senStr(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
equation
connect(ramp.y, sou.m_flow_in);
connect(sou.ports[1], senFloSou.port);
connect(sou.ports[2], senStr.port_a);
connect(senStr.port_b, sin.ports[1]);
end SpecificEnthalpy;
Test model for the entropy flow rate sensors
Information
This example tests the specific entropy sensors.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model SpecificEntropy
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sources.MassFlowSource_h sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
use_h_in=false,
nPorts=2) ;
Buildings.Fluid.Sources.Boundary_ph sin(
redeclare package Medium = Medium,
use_h_in=false,
h=20,
nPorts=1) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-2,
offset=1,
duration=60);
Buildings.Fluid.Sensors.SpecificEntropy senFloSou(
redeclare package Medium = Medium, warnAboutOnePortConnection=false)
;
Buildings.Fluid.Sensors.SpecificEntropyTwoPort senStr(
redeclare package Medium = Medium,
m_flow_nominal=2) ;
equation
connect(ramp.y, sou.m_flow_in);
connect(sou.ports[1], senFloSou.port);
connect(sou.ports[2], senStr.port_a);
connect(senStr.port_b, sin.ports[1]);
end SpecificEntropy;
Test model for the dry bulb temperature sensor
Information
This example tests the dry bulb temperature sensors.
One sensor is configured to be a steady-state model,
a second sensor is configured to be a dynamic sensor and
the third sensors is a dynamic sensor with heat transfer.
There is also a sensor that measures the temperature difference.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model TemperatureDryBulb
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Buildings.Fluid.Sources.Boundary_pT amb(
redeclare package Medium = Medium,
T=298.15,
nPorts=1)
;
Buildings.Fluid.Sources.MassFlowSource_T masFloRat(
redeclare package Medium = Medium,
use_T_in=true,
use_m_flow_in=true,
nPorts=1) ;
Modelica.Blocks.Sources.Ramp TDryBul(
height=10,
duration=1,
offset=273.15 + 30) ;
Buildings.Fluid.Sensors.TemperatureTwoPort temSteSta(
redeclare package Medium = Medium,
m_flow_nominal=2,
tau=0) ;
Modelica.Blocks.Sources.Pulse m_flow1(
period=30,
offset=0,
amplitude=-1) ;
Buildings.Fluid.Sensors.TemperatureTwoPort temDyn(
redeclare package Medium = Medium,
m_flow_nominal=2,
initType=Modelica.Blocks.Types.Init.InitialState,
T_start=293.15) ;
RelativeTemperature senRelTem(
redeclare package Medium = Medium)
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=293.15,
nPorts=2) ;
Buildings.Fluid.Sensors.TemperatureTwoPort temDynLoss(
redeclare package Medium = Medium,
m_flow_nominal=2,
initType=Modelica.Blocks.Types.Init.InitialState,
transferHeat=true,
T_start=293.15,
TAmb=293.15,
tauHeaTra=30) ;
Modelica.Blocks.Math.Add add_m_flow
;
Modelica.Blocks.Sources.Pulse m_flow2(
amplitude=1,
offset=0,
period=45) ;
equation
connect(TDryBul.y, masFloRat.T_in);
connect(masFloRat.ports[1], temSteSta.port_a);
connect(temSteSta.port_b, temDyn.port_a);
connect(amb.ports[1], senRelTem.port_a);
connect(temDyn.port_b, temDynLoss.port_a);
connect(masFloRat.m_flow_in, add_m_flow.y);
connect(add_m_flow.u1, m_flow1.y);
connect(m_flow2.y, add_m_flow.u2);
connect(sin.ports[1], temDynLoss.port_b);
connect(sin.ports[2], senRelTem.port_b);
end TemperatureDryBulb;
Test model for the wet bulb temperature sensor
Information
This example tests the wet bulb temperature sensor.
The problem setup is such that the moisture concentration and
the dry bulb temperature are varied simultaneously in such a way
that the wet bulb temperature remains close to a constant value.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model TemperatureWetBulb
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
Modelica.Blocks.Sources.Ramp p(
duration=1,
offset=101325,
height=250) ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium=Medium,
use_p_in=true,
nPorts=1,
T=293.15) ;
Buildings.Fluid.Sensors.TemperatureWetBulbTwoPort senWetBul(
redeclare package Medium=Medium,
m_flow_nominal=1,
tau=0) ;
Buildings.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
m_flow=1,
use_T_in=true,
nPorts=1,
use_Xi_in=true)
;
Modelica.Blocks.Sources.Ramp TDryBul(
height=10,
offset=273.15 + 30,
duration=50) ;
Modelica.Blocks.Sources.Ramp XHum(
height=(0.0133 - 0.0175),
offset=0.0175,
duration=50) ;
equation
connect(TDryBul.y, sou.T_in);
connect(p.y, sin.p_in);
connect(sou.ports[1], senWetBul.port_a);
connect(senWetBul.port_b, sin.ports[1]);
connect(XHum.y, sou.Xi_in[1]);
end TemperatureWetBulb;
Test model for the extra property sensor
Information
This example tests the sensors that measure trace substances.
A CO2 mass flow rate of 8.18E-8 kg/kg is added to the
volume. The volume also has a fresh air mass flow rate and
an exhaust air mass flow rate. The initial CO2 concentration
of the volume is 0 kg/kg.
Note that the fresh air supply has zero carbon dioxide concentration.
Therefore, if it were outside air, then all concentrations are relative
to the outside air concentration.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
MassFlowRate | m_flow_nominal | 15*1.2/3600 | Mass flow rate into and out of the volume [kg/s] |
Modelica definition
model TraceSubstances
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air(extraPropertiesNames={"CO2"})
;
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=15*1.2/3600
;
MixingVolumes.MixingVolume vol(
redeclare package Medium = Medium,
V=2*3*3,
m_flow_nominal=1E-6,
nPorts=5,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) ;
Sources.TraceSubstancesFlowSource sou(
redeclare package Medium = Medium,
nPorts=2,
use_m_flow_in=true) ;
Modelica.Blocks.Sources.Constant step(k=8.18E-6) ;
Buildings.Fluid.Sensors.TraceSubstances senVol(
redeclare package Medium = Medium, warnAboutOnePortConnection=false)
;
Buildings.Fluid.Sensors.TraceSubstances senSou(
redeclare package Medium = Medium,
warnAboutOnePortConnection=false,
substanceName="CO2") ;
Modelica.Blocks.Sources.Constant m_flow(k=m_flow_nominal)
;
Buildings.Fluid.Sources.MassFlowSource_T mSou(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1) ;
Buildings.Fluid.Sources.Boundary_pT mSin(
redeclare package Medium = Medium, nPorts=1) ;
Buildings.Fluid.Sensors.Conversions.To_VolumeFraction masFraSou(
MMMea=Modelica.Media.IdealGases.Common.SingleGasesData.CO2.MM)
;
Buildings.Fluid.Sensors.Conversions.To_VolumeFraction masFraVol(
MMMea=Modelica.Media.IdealGases.Common.SingleGasesData.CO2.MM)
;
Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSub(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
tau=0) ;
FixedResistances.PressureDrop res(
redeclare package Medium = Medium,
dp_nominal=10,
m_flow_nominal=0.005,
linearized=true);
Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSubNoFlorRev(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
allowFlowReversal=false,
tau=0) ;
Buildings.Fluid.Sensors.PPM senPPM(
redeclare package Medium = Medium,
warnAboutOnePortConnection=false)
;
equation
connect(m_flow.y, mSou.m_flow_in);
connect(senSou.C, masFraSou.m);
connect(senVol.C, masFraVol.m);
connect(sou.ports[1], senSou.port);
connect(step.y, sou.m_flow_in);
connect(sou.ports[2], vol.ports[1]);
connect(mSou.ports[1], vol.ports[2]);
connect(res.port_a, senTraSub.port_a);
connect(res.port_b, vol.ports[3]);
connect(senVol.port, vol.ports[4]);
connect(senTraSubNoFlorRev.port_a, senTraSub.port_b);
connect(senTraSubNoFlorRev.port_b, mSin.ports[1]);
connect(senPPM.port, vol.ports[5]);
end TraceSubstances;
Test model for the flow velocity sensor
Information
This example tests the flow velocity sensor.
One sensor is configured to be steady-state, and the other is
configured to be dynamic.
Note that steady-state sensors can lead to numerical problems
if used incorrectly.
See
Buildings.Fluid.Sensors.UsersGuide for an explanation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Area | A | 0.1*0.1/4*Modelica.Constants... | Cross sectional area of flow channel [m2] |
Modelica definition
model Velocity
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air ;
parameter Modelica.Units.SI.Area A=0.1*0.1/4*Modelica.Constants.pi
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=293.15,
nPorts=1) ;
Buildings.Fluid.Sources.MassFlowSource_T masFloRat(
redeclare package Medium = Medium,
use_T_in=false,
X={0.02,0.98},
use_m_flow_in=true,
nPorts=1) ;
Modelica.Blocks.Sources.Ramp ramp(
duration=60,
height=-0.2,
offset=0.1) ;
Buildings.Fluid.Sensors.Velocity senDyn(
redeclare package Medium = Medium,
m_flow_nominal=10,
A=A) ;
Buildings.Fluid.Sensors.Velocity senSteSta(
redeclare package Medium = Medium,
m_flow_nominal=10,
tau=0,
A=A) ;
equation
connect(ramp.y, masFloRat.m_flow_in);
connect(masFloRat.ports[1], senDyn.port_a);
connect(senDyn.port_b, senSteSta.port_a);
connect(senSteSta.port_b, sin.ports[1]);
end Velocity;
Test model for the volume flow rate sensor
Information
This example tests the volume flow rate sensor.
One sensor is configured to be steady-state, and the other is
configured to be dynamic.
Note that steady-state sensors can lead to numerical problems
if used incorrectly.
See
Buildings.Fluid.Sensors.UsersGuide for an explanation.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model VolumeFlowRate
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Air
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=293.15,
nPorts=1) ;
Buildings.Fluid.Sources.MassFlowSource_T masFloRat(
redeclare package Medium = Medium,
use_T_in=false,
X={0.02,0.98},
use_m_flow_in=true,
nPorts=1) ;
Modelica.Blocks.Sources.Ramp ramp(
height=-20,
offset=10,
duration=60);
Buildings.Fluid.Sensors.VolumeFlowRate senDyn(
redeclare package Medium = Medium,
m_flow_nominal=10,
tau=1)
;
Buildings.Fluid.Sensors.VolumeFlowRate senSteSta(
redeclare package Medium = Medium,
m_flow_nominal=10,
tau=0) ;
equation
connect(ramp.y, masFloRat.m_flow_in);
connect(masFloRat.ports[1], senDyn.port_a);
connect(senDyn.port_b, senSteSta.port_a);
connect(senSteSta.port_b, sin.ports[1]);
end VolumeFlowRate;