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

Package Content

NameDescription
DryBulbTemperature  
ExtraProperty  
WetBulbTemperature  


Buildings.Fluids.Sensors.Examples.DryBulbTemperature

Buildings.Fluids.Sensors.Examples.DryBulbTemperature

Information


This examples is a unit test for the dynamic dry bulb temperature sensor.

Modelica definition

model DryBulbTemperature 
  
  
 package Medium = Buildings.Media.PerfectGases.MoistAir "Medium model";
  
    Modelica.Blocks.Sources.Ramp p(
    duration=1,
    offset=101325,
    height=250);
  Buildings.Fluids.Sources.PrescribedBoundary_pTX sin(redeclare package Medium 
      = Medium, T=293.15);
  Buildings.Fluids.Sensors.DryBulbTemperatureDynamic sen(
                            redeclare package Medium = Medium,
    T_start=Medium.T_default,
    initType=Modelica.Blocks.Types.Init.SteadyState) 
    "Dynamic temperature sensor";
  Buildings.Fluids.Sources.PrescribedMassFlowRate_pTX massFlowRate(redeclare 
      package Medium = Medium, m_flow=1);
    Modelica.Blocks.Sources.Ramp TDB(
    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;
  Modelica.Blocks.Math.Feedback feedback;
  Buildings.Utilities.Controls.AssertEquality assertEquality(startTime=0,
      threShold=0.001);
  Modelica.Blocks.Continuous.FirstOrder firOrd(T=10, initType=Modelica.Blocks.
        Types.Init.SteadyState);
  Modelica_Fluid.Sensors.Temperature temSteSta(redeclare package Medium = 
        Medium) "Steady state temperature sensor";
equation 
  connect(sen.port_b, sin.port);
  connect(TDB.y, massFlowRate.T_in);
  connect(const.y, feedback.u1);
  connect(XHum.y, feedback.u2);
  connect(XHum.y, massFlowRate.X_in[1]);
  connect(feedback.y, massFlowRate.X_in[2]);
  connect(p.y, sin.p_in);
  connect(sen.T, assertEquality.u1);
  connect(firOrd.y, assertEquality.u2);
  connect(massFlowRate.port, temSteSta.port_a);
  connect(temSteSta.port_b, sen.port_a);
  connect(temSteSta.T, firOrd.u);
end DryBulbTemperature;

Buildings.Fluids.Sensors.Examples.ExtraProperty

Buildings.Fluids.Sensors.Examples.ExtraProperty

Parameters

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.GasesPTDecou... 

Connectors

TypeNameDescription
replaceable package Medium 

Modelica definition

model ExtraProperty 
  import Buildings;
 package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir(extraPropertiesNames={"CO2"});
 // package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir;
  
  MixingVolumes.MixingVolume vol(
    redeclare package Medium = Medium,
    initType=Modelica_Fluid.Types.Init.InitialValues,
    nP=4,
    V=2*3*3) "Mixing volume";
  inner Modelica_Fluid.Ambient ambient;
  Sources.PrescribedExtraPropertyFlowRate sou(redeclare package Medium = Medium);
  Modelica.Blocks.Sources.Constant step(k=8.18E-6);
  Buildings.Fluids.Sensors.ExtraPropertyOnePort senVol(
                    redeclare package Medium = Medium) "Sensor at volume";
  Buildings.Fluids.Sensors.ExtraPropertyOnePort senSou(
                    redeclare package Medium = Medium, substanceName="CO2") 
    "Sensor at source";
  Modelica.Blocks.Sources.Constant m_flow(k=15*1.2/3600) "Fresh air flow rate";
  Sources.PrescribedMassFlowRate_phX mSou(redeclare package Medium = Medium, h=
        293.15);
  Modelica.Blocks.Math.Gain gain(k=-1);
  Sources.PrescribedMassFlowRate_phX mSin(redeclare package Medium = Medium, h=
        293.15);
  Conversions.MassFractionVolumeFraction masFraSou(MMMea=Modelica.Media.
        IdealGases.Common.SingleGasesData.CO2.MM);
  Conversions.MassFractionVolumeFraction masFraVol(MMMea=Modelica.Media.
        IdealGases.Common.SingleGasesData.CO2.MM);
  RelativePressure dp(redeclare package Medium = Medium);
  Buildings.Utilities.Controls.AssertEquality assertEquality(startTime=0,
      threShold=1E-8);
  Modelica.Blocks.Sources.Constant zer(k=0) "Zero signal";
  Buildings.Fluids.Sensors.Pressure preSen(redeclare package Medium = Medium) 
    "Pressure sensor";
equation 
  connect(sou.port, vol.port[1]);
  connect(step.y, sou.mC_flow_in[1]);
  connect(sou.port, senSou.port);
  connect(vol.port[2], senVol.port);
  connect(m_flow.y, mSou.m_flow_in);
  connect(mSou.port, vol.port[3]);
  connect(m_flow.y, gain.u);
  connect(gain.y, mSin.m_flow_in);
  connect(mSin.port, vol.port[4]);
  connect(senSou.C, masFraSou.m);
  connect(senVol.C, masFraVol.m);
  connect(mSou.port, dp.port_a);
  connect(mSin.port, dp.port_b);
  connect(dp.p_rel, assertEquality.u1);
  connect(zer.y, assertEquality.u2);
  connect(preSen.port, sou.port);
end ExtraProperty;

Buildings.Fluids.Sensors.Examples.WetBulbTemperature

Buildings.Fluids.Sensors.Examples.WetBulbTemperature

Information


This examples is a unit test for the wet bulb 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 is constant.
This wet bulb temperature is checked against a constant value with
an assert statement.
In case this assert is triggered, then either the wet bulb sensor or
the medium model got broken (assuming that the inputs remained unchanged).

Modelica definition

model WetBulbTemperature 
  
  
 package Medium = Buildings.Media.PerfectGases.MoistAir "Medium model";
  
    Modelica.Blocks.Sources.Ramp p(
    duration=1,
    offset=101325,
    height=250);
  Buildings.Fluids.Sources.PrescribedBoundary_pTX sin(redeclare package Medium 
      = Medium, T=293.15);
  Buildings.Fluids.Sensors.WetBulbTemperature senWetBul(redeclare package 
      Medium = Medium) "Wet bulb temperature sensor";
  Buildings.Fluids.Sources.PrescribedMassFlowRate_pTX massFlowRate(redeclare 
      package Medium = Medium, m_flow=1);
    Modelica.Blocks.Sources.Ramp TDB(
    height=10,
    duration=1,
    offset=273.15 + 30) "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;
  Modelica.Blocks.Math.Feedback feedback;
  Buildings.Utilities.Controls.AssertEquality assertEquality(threShold=0.05);
  Modelica.Blocks.Sources.Constant TWBExp(k=273.15 + 25) 
    "Expected wet bulb temperature";
equation 
  connect(senWetBul.port_b, sin.port);
  connect(massFlowRate.port, senWetBul.port_a);
  connect(TDB.y, massFlowRate.T_in);
  connect(const.y, feedback.u1);
  connect(XHum.y, feedback.u2);
  connect(XHum.y, massFlowRate.X_in[1]);
  connect(feedback.y, massFlowRate.X_in[2]);
  connect(senWetBul.TWB, assertEquality.u1);
  connect(TWBExp.y, assertEquality.u2);
  connect(p.y, sin.p_in);
end WetBulbTemperature;

HTML-documentation generated by Dymola Fri Oct 31 16:23:51 2008.