Description: "Collection of models that illustrate model use and test models"

- Home > Modelica

## 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
--- | ---
Density | Test model for the density sensor
EnthalpyFlowRate | Test model for the enthalpy flow rate sensors
MassFraction | Test model for the mass fraction sensor
MoistAirEnthalpyFlowRate | Test model for the sensible and latent enthalpy flow rate sensors
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
VolumeFlowRate | Test model for the volume flow rate sensor

## Buildings.Fluid.Sensors.Examples.Density

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 "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.FixedResistanceDpM 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

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 "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); 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"; Buildings.Utilities.Diagnostics.AssertEquality assEqu "Asserts the 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, assEqu.u1); connect(senH.h_out, pro.u1); connect(senM_flow.m_flow, pro.u2); connect(pro.y, assEqu.u2); end EnthalpyFlowRate;

## Buildings.Fluid.Sensors.Examples.MassFraction

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 "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.FixedResistanceDpM 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

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. If they differ, the model stops with an error.

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"; Buildings.Utilities.Diagnostics.AssertEquality assEqu1 "Assert to check then enthalpy flow rate sensor"; Modelica.Blocks.Math.Product product "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"; Buildings.Utilities.Diagnostics.AssertEquality assEqu2 "Assert to check the sensible and latent enthalpy flow rate sensors"; 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_flow.H_flow, assEqu1.u1); connect(senH.h_out, product.u1); connect(senM_flow.m_flow, product.u2); connect(product.y, assEqu1.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(senH_flow.H_flow, assEqu2.u1); connect(add.y, assEqu2.u2); connect(senHSen_flow.port_b, sin.ports[1]); end MoistAirEnthalpyFlowRate;

## Buildings.Fluid.Sensors.Examples.Pressure

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 "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.FixedResistanceDpM 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

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 "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

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 "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

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 "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

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, and the other sensor is configured to be a dynamic sensor.

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"; Modelica.Blocks.Sources.Ramp XHum( height=(0.0133 - 0.0175), offset=0.0175, duration=60) "Humidity concentration"; Modelica.Blocks.Sources.Constant const(k=1); Modelica.Blocks.Math.Feedback dif "Difference, used to compute the mass fraction of dry air"; Buildings.Fluid.Sensors.TemperatureTwoPort temSteSta( redeclare package Medium = Medium, m_flow_nominal=2, tau=0) "Steady state temperature sensor"; Modelica.Blocks.Sources.Pulse m_flow( offset=-1, amplitude=2, period=30) "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, nPorts=2, T=293.15) "Flow boundary condition"; equation connect(TDryBul.y, masFloRat.T_in); connect(const.y, dif.u1); connect(XHum.y, dif.u2); connect(XHum.y, masFloRat.X_in[1]); connect(dif.y, masFloRat.X_in[2]); connect(masFloRat.ports[1], temSteSta.port_a); connect(m_flow.y, masFloRat.m_flow_in); connect(temSteSta.port_b, temDyn.port_a); connect(temDyn.port_b, sin.ports[1]); connect(amb.ports[1], senRelTem.port_a); connect(senRelTem.port_b, sin.ports[2]); end TemperatureDryBulb;

## Buildings.Fluid.Sensors.Examples.TemperatureWetBulb

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 "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

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 "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=4, 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) "Sensor at exhaust air"; FixedResistances.FixedResistanceDpM res( redeclare package Medium = Medium, dp_nominal=10, m_flow_nominal=0.005, linearized=true); 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(mSin.ports[1], senTraSub.port_b); 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]); end TraceSubstances;

## Buildings.Fluid.Sensors.Examples.VolumeFlowRate

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 "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;