| Name | Description | 
|---|---|
| Package with conversions for sensor models | |
| Ideal temperature sensor | |
| Ideal enthalphy flow rate sensor | |
| Collection of models that illustrate model use and test models | |
| Ideal one port mass fraction sensor | |
| Ideal wet bulb temperature sensor | 
Buildings.Fluids.Sensors.DryBulbTemperatureDynamic
This component monitors the temperature of the medium in the flow between fluid ports. The sensor does not influence the fluid. Its output is computed using a first order differential equation.
Extends from Modelica_Fluid.Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties).
| Type | Name | Default | Description | 
|---|---|---|---|
| replaceable package Medium | PartialMedium | Medium in the component | |
| Time | tau | 10 | Time constant [s] | 
| Nominal condition | |||
| MassFlowRate | m_flow_nominal | Nominal mass flow rate [kg/s] | |
| Initialization | |||
| Init | initType | Modelica.Blocks.Types.Init.N... | Type of initialization (InitialState and InitialOutput are identical) | 
| Temperature | T_start | Medium.T_default | Initial or guess value of output (= state) [K] | 
| Assumptions | |||
| Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) | 
| Advanced | |||
| MassFlowRate | m_flow_small | 1E-4*m_flow_nominal | For bi-directional flow, temperature is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required) [kg/s] | 
| Type | Name | Description | 
|---|---|---|
| FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) | 
| FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) | 
| output RealOutput | T | Temperature of the passing fluid [K] | 
model DryBulbTemperatureDynamic "Ideal temperature sensor"
  extends Modelica_Fluid.Sensors.BaseClasses.PartialFlowSensor;
  parameter Modelica.SIunits.Time tau(min=0) = 10 "Time constant";
  Modelica.Blocks.Interfaces.RealOutput T( final quantity="ThermodynamicTemperature",
                                           final unit="K",
                                           min = 0,
                                           displayUnit="degC") 
    "Temperature of the passing fluid";
  parameter Medium.MassFlowRate m_flow_nominal(min=0) "Nominal mass flow rate";
  parameter Medium.MassFlowRate m_flow_small(min=0) = 1E-4*m_flow_nominal 
    "For bi-directional flow, temperature is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)";
  parameter Modelica.Blocks.Types.Init initType = Modelica.Blocks.Types.Init.NoInit 
    "Type of initialization (InitialState and InitialOutput are identical)";
  parameter Modelica.SIunits.Temperature T_start=Medium.T_default 
    "Initial or guess value of output (= state)";
protected 
  Medium.Temperature T_a_inflow "Temperature of inflowing fluid at port_a";
  Medium.Temperature T_b_inflow 
    "Temperature of inflowing fluid at port_b or T_a_inflow, if uni-directional flow";
  Medium.Temperature TMed "Medium to which sensor is exposed";
initial equation 
  if initType == Modelica.Blocks.Types.Init.SteadyState then
    der(T) = 0;
  elseif initType == Modelica.Blocks.Types.Init.InitialState or 
         initType == Modelica.Blocks.Types.Init.InitialOutput then
    T = T_start;
  end if;
equation 
  if allowFlowReversal then
     T_a_inflow = Medium.temperature(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow));
     T_b_inflow = Medium.temperature(Medium.setState_phX(port_a.p, port_a.h_outflow, port_a.Xi_outflow));
     TMed = Modelica_Fluid.Utilities.regStep(port_a.m_flow, T_a_inflow, T_b_inflow, m_flow_small);
  else
     TMed = Medium.temperature(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow));
     T_a_inflow = TMed;
     T_b_inflow = TMed;
  end if;
  der(T)  = (TMed-T)/tau;
end DryBulbTemperatureDynamic;
Buildings.Fluids.Sensors.EnthalpyFlowRate
This component monitors the enthalphy flow rate of the medium in the flow between fluid ports. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Modelica_Fluid.Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing rotational measurement device).
| Type | Name | Default | Description | 
|---|---|---|---|
| replaceable package Medium | PartialMedium | Medium in the component | |
| Assumptions | |||
| Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) | 
| Type | Name | Description | 
|---|---|---|
| FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) | 
| FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) | 
| output RealOutput | H_flow | Enthalpy flow rate, positive if from port_a to port_b [W] | 
model EnthalpyFlowRate "Ideal enthalphy flow rate sensor"
  extends Modelica_Fluid.Sensors.BaseClasses.PartialFlowSensor;
  extends Modelica.Icons.RotationalSensor;
  Modelica.Blocks.Interfaces.RealOutput H_flow(unit="W") 
    "Enthalpy flow rate, positive if from port_a to port_b";
equation 
  if allowFlowReversal then
     H_flow = port_a.m_flow * actualStream(port_a.h_outflow);
  else
     H_flow = port_a.m_flow * port_b.h_outflow;
  end if;
end EnthalpyFlowRate;
Buildings.Fluids.Sensors.MassFraction
This component monitors the mass fraction contained in the fluid passing its port. The sensor is ideal, i.e. it does not influence the fluid.
Extends from Modelica_Fluid.Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable), Modelica.Icons.RotationalSensor (Icon representing rotational measurement device).
| Type | Name | Default | Description | 
|---|---|---|---|
| replaceable package Medium | PartialMedium | Medium in the sensor | |
| String | substanceName | "water" | Name of species substance | 
| Type | Name | Description | 
|---|---|---|
| FluidPort_a | port | |
| output RealOutput | X | Mass fraction in port medium | 
model MassFraction "Ideal one port mass fraction sensor"
  extends Modelica_Fluid.Sensors.BaseClasses.PartialAbsoluteSensor;
  extends Modelica.Icons.RotationalSensor;
  parameter String substanceName = "water" "Name of species substance";
  Modelica.Blocks.Interfaces.RealOutput X "Mass fraction in port medium";
protected 
  parameter Integer ind(fixed=false) 
    "Index of species in vector of auxiliary substances";
  Medium.MassFraction XiVec[Medium.nXi](
      quantity=Medium.extraPropertiesNames) 
    "Trace substances vector, needed because indexed argument for the operator inStream is not supported";
initial algorithm 
  ind:= -1;
  for i in 1:Medium.nX loop
    if ( Modelica.Utilities.Strings.isEqual(Medium.substanceNames[i], substanceName)) then
      ind := i;
    end if;
  end for;
  assert(ind > 0, "Species with name '" + substanceName + "' is not present in medium '"
         + Medium.mediumName + "'.\n"
         + "Check sensor parameter and medium model.");
equation 
  XiVec = inStream(port.Xi_outflow);
  X = if ind > Medium.nXi then (1-sum(XiVec)) else XiVec[ind];
end MassFraction;
Buildings.Fluids.Sensors.WetBulbTemperature
This component monitors the wet bulb temperature of the medium in the flow between fluid ports. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Modelica_Fluid.Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties).
| Type | Name | Default | Description | 
|---|---|---|---|
| replaceable package Medium | PartialMedium | Medium in the component | |
| Assumptions | |||
| Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) | 
| Advanced | |||
| MassFlowRate | m_flow_small | 1e-4 | For bi-directional flow, specific enthalpy is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required) [kg/s] | 
| Type | Name | Description | 
|---|---|---|
| FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) | 
| FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) | 
| output RealOutput | T | Wet bulb temperature in port medium [K] | 
model WetBulbTemperature "Ideal wet bulb temperature sensor"
  extends Modelica_Fluid.Sensors.BaseClasses.PartialFlowSensor;
  Modelica.Blocks.Interfaces.RealOutput T(
    start=Medium.T_default,
    final quantity="Temperature",
    final unit="K") "Wet bulb temperature in port medium";
  parameter Medium.MassFlowRate m_flow_small(min=0) = 1e-4 
    "For bi-directional flow, specific enthalpy is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)";
  Buildings.Utilities.Psychrometrics.WetBulbTemperature wetBulMod(redeclare 
      package Medium = Medium) "Model for wet bulb temperature";
equation 
  if allowFlowReversal then
    wetBulMod.dryBul.h  = Modelica_Fluid.Utilities.regStep(port_a.m_flow, port_b.h_outflow, port_a.h_outflow, m_flow_small);
    wetBulMod.dryBul.Xi = Modelica_Fluid.Utilities.regStep(port_a.m_flow, port_b.Xi_outflow, port_a.Xi_outflow, m_flow_small);
  else
    wetBulMod.dryBul.h = port_b.h_outflow;
    wetBulMod.dryBul.Xi = port_b.Xi_outflow;
  end if;
  wetBulMod.dryBul.p  = port_a.p;
  // Compute wet bulb temperature
  T = wetBulMod.wetBul.T;
end WetBulbTemperature;