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

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

Package Content

Name Description
Buildings.Fluid.Sensors.Examples.Density Density Test model for the density sensor
Buildings.Fluid.Sensors.Examples.EnthalpyFlowRate EnthalpyFlowRate Test model for the enthalpy flow rate sensors
Buildings.Fluid.Sensors.Examples.EntropyFlowRate EntropyFlowRate Test model for the entropy flow rate sensors
Buildings.Fluid.Sensors.Examples.MassFraction MassFraction Test model for the mass fraction sensor
Buildings.Fluid.Sensors.Examples.MoistAirEnthalpyFlowRate MoistAirEnthalpyFlowRate Test model for the sensible and latent enthalpy flow rate sensors
Buildings.Fluid.Sensors.Examples.PPM PPM Test model for the extra property sensor outputting PPM
Buildings.Fluid.Sensors.Examples.Pressure Pressure Test model for the pressure sensor
Buildings.Fluid.Sensors.Examples.RelativeHumidity RelativeHumidity Test model for relative humidity sensor
Buildings.Fluid.Sensors.Examples.SpecificEnthalpy SpecificEnthalpy Test model for the enthalpy flow rate sensors
Buildings.Fluid.Sensors.Examples.SpecificEntropy SpecificEntropy Test model for the entropy flow rate sensors
Buildings.Fluid.Sensors.Examples.TemperatureDryBulb TemperatureDryBulb Test model for the dry bulb temperature sensor
Buildings.Fluid.Sensors.Examples.TemperatureWetBulb TemperatureWetBulb Test model for the wet bulb temperature sensor
Buildings.Fluid.Sensors.Examples.TraceSubstances TraceSubstances Test model for the extra property sensor
Buildings.Fluid.Sensors.Examples.Velocity Velocity Test model for the flow velocity sensor
Buildings.Fluid.Sensors.Examples.VolumeFlowRate VolumeFlowRate Test model for the volume flow rate sensor

Buildings.Fluid.Sensors.Examples.Density Buildings.Fluid.Sensors.Examples.Density

Test model for the density sensor

Buildings.Fluid.Sensors.Examples.Density

Information

This example tests the density sensors.

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

Modelica definition

model Density "Test model for the density sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=293.15, nPorts=1) "Flow boundary condition"; 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) "Flow boundary condition"; Buildings.Fluid.Sensors.Density senDenVol( redeclare package Medium = Medium) "Density sensor for the volume"; Buildings.Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, V=1, nPorts=3, m_flow_nominal=10, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Volume"; Buildings.Fluid.FixedResistances.PressureDrop dp( redeclare package Medium = Medium, m_flow_nominal=10, dp_nominal=200) "Flow resistance"; Buildings.Fluid.Sensors.DensityTwoPort senDenFlo( redeclare package Medium = Medium, m_flow_nominal=10) "Density sensor for the flowing medium"; 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;

Buildings.Fluid.Sensors.Examples.EnthalpyFlowRate Buildings.Fluid.Sensors.Examples.EnthalpyFlowRate

Test model for the enthalpy flow rate sensors

Buildings.Fluid.Sensors.Examples.EnthalpyFlowRate

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 "Test model for the enthalpy flow rate sensors" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sensors.EnthalpyFlowRate senH_flow( redeclare package Medium = Medium, m_flow_nominal=2) "Enthalpy flow rate sensor"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1, T=293.15) "Flow boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, T=313.15) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( height=-2, offset=1, duration=60) "Input signal for mass flow rate"; Buildings.Fluid.Sensors.SpecificEnthalpyTwoPort senH( redeclare package Medium = Medium, m_flow_nominal=2) "Specific enthalpy sensor"; Buildings.Fluid.Sensors.MassFlowRate senM_flow( redeclare package Medium = Medium) "Mass flow rate sensor"; Modelica.Blocks.Math.Add cheEqu(k2=-1) "Check for equality of the enthalpy flow rate computations"; Modelica.Blocks.Math.Product pro "Computes the enthalphy flow rate"; 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;

Buildings.Fluid.Sensors.Examples.EntropyFlowRate Buildings.Fluid.Sensors.Examples.EntropyFlowRate

Test model for the entropy flow rate sensors

Buildings.Fluid.Sensors.Examples.EntropyFlowRate

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 "Test model for the entropy flow rate sensors" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sensors.EntropyFlowRate senS_flow( redeclare package Medium = Medium, m_flow_nominal=2) "Entropy flow rate sensor"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1, T=293.15) "Flow boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, T=313.15) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( height=-2, offset=1, duration=60) "Input signal for mass flow rate"; Buildings.Fluid.Sensors.SpecificEntropyTwoPort senS( redeclare package Medium = Medium, m_flow_nominal=2) "Specific entropy sensor"; Buildings.Fluid.Sensors.MassFlowRate senM_flow( redeclare package Medium = Medium) "Mass flow rate sensor"; Buildings.Utilities.Diagnostics.AssertEquality assEqu "Asserts the equality of the entropy flow rate computations"; Modelica.Blocks.Math.Product pro "Computes the enthalphy flow rate"; 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;

Buildings.Fluid.Sensors.Examples.MassFraction Buildings.Fluid.Sensors.Examples.MassFraction

Test model for the mass fraction sensor

Buildings.Fluid.Sensors.Examples.MassFraction

Information

This example tests the mass fraction sensors.

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

Modelica definition

model MassFraction "Test model for the mass fraction sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, T=293.15) "Flow boundary condition"; 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) "Flow boundary condition"; Buildings.Fluid.Sensors.MassFraction senMasFra2( redeclare package Medium = Medium) "Mass fraction sensor for the volume"; Buildings.Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, V=1, nPorts=3, m_flow_nominal=10, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Volume"; Buildings.Fluid.FixedResistances.PressureDrop dp( redeclare package Medium = Medium, m_flow_nominal=10, dp_nominal=200) "Flow resistance"; Buildings.Fluid.Sensors.MassFractionTwoPort senMasFra1( redeclare package Medium = Medium, m_flow_nominal=10) "Mass fraction sensor for the flowing medium"; 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;

Buildings.Fluid.Sensors.Examples.MoistAirEnthalpyFlowRate Buildings.Fluid.Sensors.Examples.MoistAirEnthalpyFlowRate

Test model for the sensible and latent enthalpy flow rate sensors

Buildings.Fluid.Sensors.Examples.MoistAirEnthalpyFlowRate

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 "Test model for the sensible and latent enthalpy flow rate sensors" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Buildings.Fluid.Sensors.EnthalpyFlowRate senH_flow( redeclare package Medium = Medium, m_flow_nominal=1) "Sensor for enthalpy flow rate"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1, T=293.15) "Flow boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, X={0.02,0.98}, T=313.15) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( height=-2, offset=1, duration=60); Buildings.Fluid.Sensors.SpecificEnthalpyTwoPort senH( redeclare package Medium = Medium, m_flow_nominal=1) "Specific enthalpy sensor"; Buildings.Fluid.Sensors.MassFlowRate senM_flow( redeclare package Medium = Medium) "Mass flow rate sensor"; Modelica.Blocks.Math.Product pro "Product to compute enthalpy flow rate"; Buildings.Fluid.Sensors.LatentEnthalpyFlowRate senHLat_flow( redeclare package Medium = Medium, m_flow_nominal=1) "Latent enthalpy flow rate sensor"; Buildings.Fluid.Sensors.SensibleEnthalpyFlowRate senHSen_flow( redeclare package Medium = Medium, m_flow_nominal=1) "Sensible enthalpy flow rate sensor"; Modelica.Blocks.Math.Add add "Outputs the sensible plus latent enthalpy flow rate"; 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;

Buildings.Fluid.Sensors.Examples.PPM Buildings.Fluid.Sensors.Examples.PPM

Test model for the extra property sensor outputting PPM

Buildings.Fluid.Sensors.Examples.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

TypeNameDefaultDescription
MassFlowRatem_flow_nominalvolDyn.V*senPPMTwoPort.tau*3...Mass flow rate into and out of the volume [kg/s]

Modelica definition

model PPM "Test model for the extra property sensor outputting PPM" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}) "Medium model"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = volDyn.V*senPPMTwoPort.tau*3*rho_default "Mass flow rate into and out of the volume"; Buildings.Fluid.MixingVolumes.MixingVolume volDyn( redeclare package Medium = Medium, nPorts=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, V=1, use_C_flow=true, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, m_flow_nominal=m_flow_nominal) "Mixing volume with dynamics"; Buildings.Fluid.Sources.MassFlowSource_T mSou( redeclare package Medium = Medium, nPorts=2, m_flow=m_flow_nominal) "Fresh air supply"; Buildings.Fluid.Sources.FixedBoundary sin(redeclare package Medium = Medium, nPorts=2) "Exhaust air"; Buildings.Fluid.Sensors.PPM senPPMVol(redeclare package Medium = Medium) "PPM sensor for mixing volume"; Modelica.Blocks.Sources.Constant CO2In(k=m_flow_nominal/1000) "CO2 mass flow rate entering mixing volume"; Buildings.Fluid.Sensors.PPMTwoPort senPPMTwoPort( redeclare package Medium = Medium, allowFlowReversal=true, m_flow_nominal=m_flow_nominal) "PPM sensor"; Buildings.Fluid.Sensors.PPM senPPMIn(redeclare package Medium = Medium) "PPM sensor for inlet"; Buildings.Fluid.Sensors.PPMTwoPort senPPMNoRev( redeclare package Medium = Medium, allowFlowReversal=false, m_flow_nominal=m_flow_nominal) "PPM sensor without flow reversal disabled"; Buildings.Fluid.Sensors.PPMTwoPort senPPMRev( redeclare package Medium = Medium, allowFlowReversal=true, m_flow_nominal=m_flow_nominal) "PPM sensor with flow in reverse direction"; Buildings.Fluid.Sensors.PPMTwoPort senPPMSta( redeclare package Medium = Medium, allowFlowReversal=true, tau=0, m_flow_nominal=m_flow_nominal) "Static PPM sensor"; 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]) "Medium state at default values"; // Density at medium default values, used to compute the size of control volumes final parameter Modelica.SIunits.Density rho_default=Medium.density( state=state_default) "Density, used to compute fluid mass"; public Buildings.Fluid.MixingVolumes.MixingVolume volSte( redeclare package Medium = Medium, nPorts=3, V=1, use_C_flow=true, massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, m_flow_nominal=m_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Mixing volume without dynamics"; Buildings.Fluid.Sensors.PPM senPPMVol2( redeclare package Medium = Medium) "PPM sensor for mixing volume"; Buildings.Fluid.Sources.MassFlowSource_T mSouSta( redeclare package Medium = Medium, nPorts=1, m_flow=m_flow_nominal) "Fresh air supply for steady state volume"; 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(senPPMSta.port_b, sin.ports[1]); connect(CO2In.y,volSte. C_flow[1]); connect(volSte.ports[1], senPPMVol2.port); connect(volSte.ports[2], sin.ports[2]); connect(mSouSta.ports[1], volSte.ports[3]); end PPM;

Buildings.Fluid.Sensors.Examples.Pressure Buildings.Fluid.Sensors.Examples.Pressure

Test model for the pressure sensor

Buildings.Fluid.Sensors.Examples.Pressure

Information

This example tests the pressure sensors.

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

Modelica definition

model Pressure "Test model for the pressure sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=293.15, nPorts=1) "Flow boundary condition"; 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) "Flow boundary condition"; Buildings.Fluid.FixedResistances.PressureDrop dp( redeclare package Medium = Medium, m_flow_nominal=10, dp_nominal=200) "Flow resistance"; Modelica.Blocks.Sources.Ramp ramp( height=-20, offset=10, duration=1); Buildings.Fluid.Sensors.Pressure senPre_a(redeclare package Medium = Medium) "Pressure sensor at resistance port a"; Buildings.Fluid.Sensors.Pressure senPre_b(redeclare package Medium = Medium) "Pressure sensor at resistance port b"; Buildings.Fluid.Sensors.RelativePressure senRelPre( redeclare package Medium = Medium) "Pressure difference across resistance"; 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;

Buildings.Fluid.Sensors.Examples.RelativeHumidity Buildings.Fluid.Sensors.Examples.RelativeHumidity

Test model for relative humidity sensor

Buildings.Fluid.Sensors.Examples.RelativeHumidity

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 "Test model for relative humidity sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; 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_X_in=true, use_m_flow_in=true, nPorts=2) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp TDryBul( height=10, offset=273.15 + 30, duration=120) "Dry bulb temperature"; Modelica.Blocks.Sources.Ramp XHum( duration=1, height=(0.0133 - 0.0175), offset=0.0175) "Humidity concentration"; Modelica.Blocks.Sources.Constant const(k=1) "Constant"; Modelica.Blocks.Math.Feedback dif "Difference, used to compute the mass fraction of dry air"; Buildings.Fluid.Sensors.RelativeHumidity senRelHum( redeclare package Medium = Medium) "Relative humidity of the flow source if the medium were outflowing"; Modelica.Blocks.Sources.Ramp m_flow( height=-2, offset=1, duration=500) "Mass flow rate"; Buildings.Fluid.Sensors.RelativeHumidityTwoPort relHum( redeclare package Medium = Medium, m_flow_nominal=1, initType=Modelica.Blocks.Types.Init.InitialState) "Relative humidity of the passing fluid"; equation connect(TDryBul.y, sou.T_in); connect(const.y, dif.u1); connect(XHum.y, dif.u2); connect(XHum.y, sou.X_in[1]); connect(dif.y, sou.X_in[2]); 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); end RelativeHumidity;

Buildings.Fluid.Sensors.Examples.SpecificEnthalpy Buildings.Fluid.Sensors.Examples.SpecificEnthalpy

Test model for the enthalpy flow rate sensors

Buildings.Fluid.Sensors.Examples.SpecificEnthalpy

Information

This example tests the specific enthalpy sensors.

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

Modelica definition

model SpecificEnthalpy "Test model for the enthalpy flow rate sensors" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.MassFlowSource_h sou( redeclare package Medium = Medium, use_m_flow_in=true, use_h_in=false, nPorts=2) "Flow boundary condition"; Buildings.Fluid.Sources.Boundary_ph sin( redeclare package Medium = Medium, use_h_in=false, h=20, nPorts=1) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( height=-2, offset=1, duration=60); Buildings.Fluid.Sensors.SpecificEnthalpy senFloSou( redeclare package Medium = Medium) "Sensor at the flow source"; Buildings.Fluid.Sensors.SpecificEnthalpyTwoPort senStr( redeclare package Medium = Medium, m_flow_nominal=2) "Sensor in the fluid stream"; 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;

Buildings.Fluid.Sensors.Examples.SpecificEntropy Buildings.Fluid.Sensors.Examples.SpecificEntropy

Test model for the entropy flow rate sensors

Buildings.Fluid.Sensors.Examples.SpecificEntropy

Information

This example tests the specific entropy sensors.

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

Modelica definition

model SpecificEntropy "Test model for the entropy flow rate sensors" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.MassFlowSource_h sou( redeclare package Medium = Medium, use_m_flow_in=true, use_h_in=false, nPorts=2) "Flow boundary condition"; Buildings.Fluid.Sources.Boundary_ph sin( redeclare package Medium = Medium, use_h_in=false, h=20, nPorts=1) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( height=-2, offset=1, duration=60); Buildings.Fluid.Sensors.SpecificEntropy senFloSou( redeclare package Medium = Medium) "Sensor at the flow source"; Buildings.Fluid.Sensors.SpecificEntropyTwoPort senStr( redeclare package Medium = Medium, m_flow_nominal=2) "Sensor in the fluid stream"; 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;

Buildings.Fluid.Sensors.Examples.TemperatureDryBulb Buildings.Fluid.Sensors.Examples.TemperatureDryBulb

Test model for the dry bulb temperature sensor

Buildings.Fluid.Sensors.Examples.TemperatureDryBulb

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 "Test model for the dry bulb temperature sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.Boundary_pT amb( redeclare package Medium = Medium, T=298.15, nPorts=1) "Ambient conditions, used to test the relative temperature sensor"; Buildings.Fluid.Sources.MassFlowSource_T masFloRat( redeclare package Medium = Medium, use_T_in=true, use_m_flow_in=true, nPorts=1) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp TDryBul( height=10, duration=1, offset=273.15 + 30) "Dry bulb temperature"; Buildings.Fluid.Sensors.TemperatureTwoPort temSteSta( redeclare package Medium = Medium, m_flow_nominal=2, tau=0) "Steady state temperature sensor"; Modelica.Blocks.Sources.Pulse m_flow1( period=30, offset=0, amplitude=-1) "Mass flow rate"; Buildings.Fluid.Sensors.TemperatureTwoPort temDyn( redeclare package Medium = Medium, m_flow_nominal=2, initType=Modelica.Blocks.Types.Init.InitialState, T_start=293.15) "Dynamic temperature sensor"; RelativeTemperature senRelTem(redeclare package Medium = Medium) "Temperature difference sensor"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=293.15, nPorts=2) "Flow boundary condition"; 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) "Dynamic temperature sensor with heat transfer"; Modelica.Blocks.Math.Add add_m_flow "Add two pulse functions for mass flow rate"; Modelica.Blocks.Sources.Pulse m_flow2( amplitude=1, offset=0, period=45) "Mass flow rate"; 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;

Buildings.Fluid.Sensors.Examples.TemperatureWetBulb Buildings.Fluid.Sensors.Examples.TemperatureWetBulb

Test model for the wet bulb temperature sensor

Buildings.Fluid.Sensors.Examples.TemperatureWetBulb

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 "Test model for the wet bulb temperature sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Modelica.Blocks.Sources.Ramp p( duration=1, offset=101325, height=250) "Pressure boundary condition"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium=Medium, use_p_in=true, nPorts=1, T=293.15) "Flow boundary condition"; Buildings.Fluid.Sensors.TemperatureWetBulbTwoPort senWetBul( redeclare package Medium=Medium, m_flow_nominal=1, tau=0) "Wet bulb temperature sensor"; Buildings.Fluid.Sources.MassFlowSource_T sou( redeclare package Medium = Medium, m_flow=1, use_T_in=true, use_X_in=true, nPorts=1) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp TDryBul( height=10, offset=273.15 + 30, duration=50) "Dry bulb temperature"; Modelica.Blocks.Sources.Ramp XHum( height=(0.0133 - 0.0175), offset=0.0175, duration=50) "Humidity concentration"; Modelica.Blocks.Sources.Constant const(k=1); Modelica.Blocks.Math.Feedback dif "Difference, used to compute the mass fraction of dry air"; equation connect(TDryBul.y, sou.T_in); connect(const.y, dif.u1); connect(XHum.y, dif.u2); connect(XHum.y, sou.X_in[1]); connect(dif.y, sou.X_in[2]); connect(p.y, sin.p_in); connect(sou.ports[1], senWetBul.port_a); connect(senWetBul.port_b, sin.ports[1]); end TemperatureWetBulb;

Buildings.Fluid.Sensors.Examples.TraceSubstances Buildings.Fluid.Sensors.Examples.TraceSubstances

Test model for the extra property sensor

Buildings.Fluid.Sensors.Examples.TraceSubstances

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

TypeNameDefaultDescription
MassFlowRatem_flow_nominal15*1.2/3600Mass flow rate into and out of the volume [kg/s]

Modelica definition

model TraceSubstances "Test model for the extra property sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}) "Medium model"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 15*1.2/3600 "Mass flow rate into and out of the volume"; MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, V=2*3*3, m_flow_nominal=1E-6, nPorts=5, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume"; Sources.TraceSubstancesFlowSource sou( redeclare package Medium = Medium, nPorts=2, use_m_flow_in=true) "CO2 mass flow source"; Modelica.Blocks.Sources.Constant step(k=8.18E-6) "CO2 mass flow rate"; Buildings.Fluid.Sensors.TraceSubstances senVol( redeclare package Medium = Medium) "Sensor at volume"; Buildings.Fluid.Sensors.TraceSubstances senSou( redeclare package Medium = Medium, substanceName="CO2") "Sensor at source"; Modelica.Blocks.Sources.Constant m_flow(k=m_flow_nominal) "Fresh air mass flow rate"; Buildings.Fluid.Sources.MassFlowSource_T mSou( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1) "Fresh air supply"; Sources.FixedBoundary mSin( redeclare package Medium = Medium, nPorts=1) "Exhaust air"; Buildings.Fluid.Sensors.Conversions.To_VolumeFraction masFraSou( MMMea=Modelica.Media.IdealGases.Common.SingleGasesData.CO2.MM) "Conversion of mass ratio to volume ratio"; Buildings.Fluid.Sensors.Conversions.To_VolumeFraction masFraVol( MMMea=Modelica.Media.IdealGases.Common.SingleGasesData.CO2.MM) "Conversion of mass ratio to volume ratio"; Buildings.Fluid.Sensors.TraceSubstancesTwoPort senTraSub( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, tau=0) "Sensor at exhaust air"; 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) "Sensor at exhaust air, configured to not allow flow reversal"; Buildings.Fluid.Sensors.PPM senPPM(redeclare package Medium = Medium) "PPM sensor"; 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;

Buildings.Fluid.Sensors.Examples.Velocity Buildings.Fluid.Sensors.Examples.Velocity

Test model for the flow velocity sensor

Buildings.Fluid.Sensors.Examples.Velocity

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

TypeNameDefaultDescription
AreaA0.1*0.1/4*Modelica.Constants...Cross sectional area of flow channel [m2]

Modelica definition

model Velocity "Test model for the flow velocity sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; parameter Modelica.SIunits.Area A = 0.1*0.1/4*Modelica.Constants.pi "Cross sectional area of flow channel"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=293.15, nPorts=1) "Flow boundary condition"; 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) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( duration=60, height=-0.2, offset=0.1) "Signal for mass flow rate"; Buildings.Fluid.Sensors.Velocity senDyn( redeclare package Medium = Medium, m_flow_nominal=10, A=A) "Sensor configured to use a dynamic model for the density"; Buildings.Fluid.Sensors.Velocity senSteSta( redeclare package Medium = Medium, m_flow_nominal=10, tau=0, A=A) "Sensor configured to use a steady-state model for the density"; 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;

Buildings.Fluid.Sensors.Examples.VolumeFlowRate Buildings.Fluid.Sensors.Examples.VolumeFlowRate

Test model for the volume flow rate sensor

Buildings.Fluid.Sensors.Examples.VolumeFlowRate

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 "Test model for the volume flow rate sensor" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, T=293.15, nPorts=1) "Flow boundary condition"; 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) "Flow boundary condition"; Modelica.Blocks.Sources.Ramp ramp( height=-20, offset=10, duration=60); Buildings.Fluid.Sensors.VolumeFlowRate senDyn( redeclare package Medium = Medium, m_flow_nominal=10) "Sensor configured to use a dynamic model for the density"; Buildings.Fluid.Sensors.VolumeFlowRate senSteSta( redeclare package Medium = Medium, m_flow_nominal=10, tau=0) "Sensor configured to use a steady-state model for the density"; 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;