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.

Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).

Package Content

NameDescription
DryBulbTemperature  
EnthalpyFlowRate Test model for enthalpy flow rate
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" annotation 1;
 package Medium = Modelica.Media.Air.MoistAir;
  Modelica_Fluid.Sources.Boundary_pT sin(             redeclare package Medium
      = Medium,
    nPorts=1,
    T=293.15);
  Modelica_Fluid.Sources.MassFlowSource_T masFloRat(
    redeclare package Medium = Medium,
    use_T_in=true,
    use_m_flow_in=true,
    nPorts=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.Diagnostics.AssertEquality assertEquality(
      threShold=0.001, startTime=0);
  Modelica.Blocks.Continuous.FirstOrder firOrd(T=10,
    initType=Modelica.Blocks.Types.Init.InitialState,
    y_start=293.15);
  Modelica_Fluid.Sensors.TemperatureTwoPort temSteSta(
                                               redeclare package Medium = 
        Medium) "Steady state temperature sensor";
  inner Modelica_Fluid.System system;
    Modelica.Blocks.Sources.Pulse m_flow(
    offset=-1,
    amplitude=2,
    period=30) "Mass flow rate";
  DryBulbTemperatureDynamic temDyn(
    redeclare package Medium = Medium,
    initType=Modelica.Blocks.Types.Init.InitialState,
    m0_flow=1,
    T_start=293.15);
equation 
  connect(TDB.y, masFloRat.T_in);
  connect(const.y, feedback.u1);
  connect(XHum.y, feedback.u2);
  connect(XHum.y, masFloRat.X_in[1]);
  connect(feedback.y, masFloRat.X_in[2]);
  connect(temSteSta.T, firOrd.u);
  connect(masFloRat.ports[1], temSteSta.port_a);
  connect(firOrd.y, assertEquality.u1);
  connect(m_flow.y, masFloRat.m_flow_in);
  connect(temSteSta.port_b, temDyn.port_a);
  connect(temDyn.port_b, sin.ports[1]);
  connect(temDyn.T, assertEquality.u2);
end DryBulbTemperature;

Buildings.Fluids.Sensors.Examples.EnthalpyFlowRate

Test model for enthalpy flow rate

Buildings.Fluids.Sensors.Examples.EnthalpyFlowRate

Modelica definition

model EnthalpyFlowRate "Test model for enthalpy flow rate"
  import Buildings;

  package Medium = Modelica.Media.Air.SimpleAir;
  Buildings.Fluids.Sensors.EnthalpyFlowRate senH_flow(redeclare package Medium
      = Medium) "Sensor for enthalpy flow rate";
  Modelica_Fluid.Sources.MassFlowSource_h sou(
    use_m_flow_in=true,
    use_h_in=true,
    redeclare package Medium = Medium,
    nPorts=1);
  Modelica_Fluid.Sources.Boundary_ph sin(use_h_in=true, redeclare package
      Medium = Medium,
    nPorts=1);
  Modelica.Blocks.Sources.Ramp ramp(
    duration=1,
    height=-2,
    offset=1);
  Modelica.Blocks.Sources.Constant const(k=10);
  Modelica.Blocks.Sources.Constant const1(k=20);
  inner Modelica_Fluid.System system;
  Modelica_Fluid.Sensors.SpecificEnthalpyTwoPort senH(redeclare package Medium
      = Medium);
  Modelica_Fluid.Sensors.MassFlowRate senM_flow(redeclare package Medium = 
        Medium);
  Buildings.Utilities.Diagnostics.AssertEquality assertEquality;
  Modelica.Blocks.Math.Product product;
equation 
  connect(ramp.y, sou.m_flow_in);
  connect(const.y, sou.h_in);
  connect(const1.y, sin.h_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, assertEquality.u1);
  connect(senH.h_out, product.u1);
  connect(senM_flow.m_flow, product.u2);
  connect(product.y, assertEquality.u2);
end EnthalpyFlowRate;

Buildings.Fluids.Sensors.Examples.ExtraProperty

Buildings.Fluids.Sensors.Examples.ExtraProperty

Modelica definition

model ExtraProperty
  import Buildings;
 package Medium = Buildings.Media.GasesPTDecoupled.SimpleAir(extraPropertiesNames={"CO2"});

  MixingVolumes.MixingVolume vol(
    redeclare package Medium = Medium,
    V=2*3*3,
    nPorts=4) "Mixing volume";
  inner Modelica_Fluid.System system;
  Sources.PrescribedExtraPropertyFlowRate sou(redeclare package Medium = Medium,
    nPorts=3,
    use_m_flow_in=true);
  Modelica.Blocks.Sources.Constant step(k=8.18E-6);
  Modelica_Fluid.Sensors.TraceSubstances senVol(
                    redeclare package Medium = Medium) "Sensor at volume";
  Modelica_Fluid.Sensors.TraceSubstances 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";
  Modelica_Fluid.Sources.MassFlowSource_T mSou(
                                          redeclare package Medium = Medium,
    use_m_flow_in=true,
    nPorts=2);
  Modelica.Blocks.Math.Gain gain(k=-1);
  Modelica_Fluid.Sources.MassFlowSource_T mSin(
                                          redeclare package Medium = Medium,
    use_m_flow_in=true,
    nPorts=2);
  Conversions.MassFractionVolumeFraction masFraSou(MMMea=Modelica.Media.
        IdealGases.Common.SingleGasesData.CO2.MM);
  Conversions.MassFractionVolumeFraction masFraVol(MMMea=Modelica.Media.
        IdealGases.Common.SingleGasesData.CO2.MM);
  Modelica_Fluid.Sensors.RelativePressure dp(
                      redeclare package Medium = Medium);
  Buildings.Utilities.Diagnostics.AssertEquality assertEquality(startTime=0,
      threShold=1E-8);
  Modelica.Blocks.Sources.Constant zer(k=0) "Zero signal";
  Modelica_Fluid.Sensors.Pressure preSen(  redeclare package Medium = Medium) 
    "Pressure sensor";
equation 
  connect(m_flow.y, mSou.m_flow_in);
  connect(m_flow.y, gain.u);
  connect(gain.y, mSin.m_flow_in);
  connect(senSou.C, masFraSou.m);
  connect(senVol.C, masFraVol.m);
  connect(dp.p_rel, assertEquality.u1);
  connect(zer.y, assertEquality.u2);
  connect(mSou.ports[1], dp.port_a);
  connect(mSin.ports[1], dp.port_b);
  connect(mSou.ports[2], vol.ports[1]);
  connect(mSin.ports[2], vol.ports[2]);
  connect(vol.ports[4], senVol.port);
  connect(sou.ports[1], vol.ports[3]);
  connect(sou.ports[2], preSen.port);
  connect(sou.ports[3], senSou.port);
  connect(step.y, sou.m_flow_in);
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);
  Modelica_Fluid.Sources.Boundary_pT sin(             redeclare package Medium
      = Medium,
    use_p_in=true,
    nPorts=1,
    T=293.15);
  Buildings.Fluids.Sensors.WetBulbTemperature senWetBul(redeclare package
      Medium = Medium) "Wet bulb temperature sensor";
  Modelica_Fluid.Sources.MassFlowSource_T massFlowRate(            redeclare 
      package Medium = Medium, m_flow=1,
    use_T_in=true,
    use_X_in=true,
    nPorts=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.Diagnostics.AssertEquality assertEquality(threShold=0.05);
  Modelica.Blocks.Sources.Constant TWBExp(k=273.15 + 25) 
    "Expected wet bulb temperature";
  inner Modelica_Fluid.System system;
equation 
  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(massFlowRate.ports[1], senWetBul.port_a);
  connect(senWetBul.port_b, sin.ports[1]);
  connect(TWBExp.y, assertEquality.u1);
  connect(senWetBul.T, assertEquality.u2);
end WetBulbTemperature;

HTML-documentation generated by Dymola Thu Feb 19 16:52:52 2009.