Package Sensors consists of idealized sensor components that provide variables of a medium model and/or fluid ports as output signals. These signals can be, e.g., further processed with components of the Modelica.Blocks library. Also more realistic sensor models can be built, by further processing (e.g., by attaching block Modelica.Blocks.FirstOrder to model the time constant of the sensor).
For the thermodynamic state variables temperature, specific entalpy, specific entropy and density the fluid library provides two different types of sensors: regular one port and two port sensors.
Modelica.Fluid.Examples.Explanatory.MeasuringTemperature demonstrates the differences between one- and two-port sensor at hand of a simple example.
Extends from Modelica.Icons.SensorsPackage (Icon for packages containing sensors).
Name | Description |
---|---|
Pressure | Ideal pressure sensor |
Density | Ideal one port density sensor |
DensityTwoPort | Ideal two port density sensor |
Temperature | Ideal one port temperature sensor |
TemperatureTwoPort | Ideal two port temperature sensor |
SpecificEnthalpy | Ideal one port specific enthalpy sensor |
SpecificEnthalpyTwoPort | Ideal two port sensor for the specific enthalpy |
SpecificEntropy | Ideal one port specific entropy sensor |
SpecificEntropyTwoPort | Ideal two port sensor for the specific entropy |
TraceSubstances | Ideal one port trace substances sensor |
TraceSubstancesTwoPort | Ideal two port sensor for trace substance |
MassFlowRate | Ideal sensor for mass flow rate |
VolumeFlowRate | Ideal sensor for volume flow rate |
RelativePressure | Ideal relative pressure sensor |
RelativeTemperature | Ideal relative temperature sensor |
BaseClasses | Base classes used in the Sensors package (only of interest to build new component models) |
This component monitors the absolute pressure at its fluid port. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable), Modelica.Icons.RotationalSensor (Icon representing a round measurement device).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the sensor |
Type | Name | Description |
---|---|---|
FluidPort_a | port | |
output RealOutput | p | Pressure at port [Pa] |
model Pressure "Ideal pressure sensor" extends Sensors.BaseClasses.PartialAbsoluteSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput p(final quantity="Pressure", final unit="Pa", displayUnit="bar", min=0) "Pressure at port"; equation p = port.p;end Pressure;
This component monitors the density of the fluid passing its port. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable), Modelica.Icons.RotationalSensor (Icon representing a round measurement device).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the sensor |
Type | Name | Description |
---|---|---|
FluidPort_a | port | |
output RealOutput | d | Density in port medium [kg/m3] |
model Density "Ideal one port density sensor" extends Sensors.BaseClasses.PartialAbsoluteSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput d(final quantity="Density", final unit="kg/m3", displayUnit="g/cm3", min=0) "Density in port medium"; equation d = Medium.density(Medium.setState_phX(port.p, inStream(port.h_outflow), inStream(port.Xi_outflow)));end Density;
This component monitors the density of the fluid flowing from port_a to port_b. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing a round 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) |
Advanced | |||
MassFlowRate | m_flow_small | system.m_flow_small | For bi-directional flow, density 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 | d | Density of the passing fluid [kg/m3] |
model DensityTwoPort "Ideal two port density sensor" extends Sensors.BaseClasses.PartialFlowSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput d(final quantity="Density", final unit="kg/m3", displayUnit="g/cm3", min=0) "Density of the passing fluid"; parameter Medium.MassFlowRate m_flow_small(min=0) = system.m_flow_small "For bi-directional flow, density is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)"; protected Medium.Density rho_a_inflow "Density of inflowing fluid at port_a"; Medium.Density rho_b_inflow "Density of inflowing fluid at port_b or rho_a_inflow, if uni-directional flow"; equation if allowFlowReversal then rho_a_inflow = Medium.density(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); rho_b_inflow = Medium.density(Medium.setState_phX(port_a.p, port_a.h_outflow, port_a.Xi_outflow)); d = Modelica.Fluid.Utilities.regStep(port_a.m_flow, rho_a_inflow, rho_b_inflow, m_flow_small); else d = Medium.density(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); rho_a_inflow = d; rho_b_inflow = d; end if;end DensityTwoPort;
This component monitors the temperature of the fluid passing its port. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the sensor |
Type | Name | Description |
---|---|---|
FluidPort_a | port | |
output RealOutput | T | Temperature in port medium [K] |
model Temperature "Ideal one port temperature sensor" extends Sensors.BaseClasses.PartialAbsoluteSensor;Modelica.Blocks.Interfaces.RealOutput T(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Temperature in port medium"; equation T = Medium.temperature(Medium.setState_phX(port.p, inStream(port.h_outflow), inStream(port.Xi_outflow)));end Temperature;
This component monitors the temperature of the passing fluid. The sensor is ideal, i.e., it does not influence the fluid.
Extends from 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 | system.m_flow_small | 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 TemperatureTwoPort "Ideal two port temperature sensor" extends Sensors.BaseClasses.PartialFlowSensor;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_small(min=0) = system.m_flow_small "For bi-directional flow, temperature is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)"; 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"; 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)); T = Modelica.Fluid.Utilities.regStep(port_a.m_flow, T_a_inflow, T_b_inflow, m_flow_small); else T = Medium.temperature(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); T_a_inflow = T; T_b_inflow = T; end if;end TemperatureTwoPort;
This component monitors the specific enthalpy of the fluid passing its port. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable), Modelica.Icons.RotationalSensor (Icon representing a round measurement device).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the sensor |
Type | Name | Description |
---|---|---|
FluidPort_a | port | |
output RealOutput | h_out | Specific enthalpy in port medium [J/kg] |
model SpecificEnthalpy "Ideal one port specific enthalpy sensor" extends Sensors.BaseClasses.PartialAbsoluteSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput h_out(final quantity="SpecificEnergy", final unit="J/kg") "Specific enthalpy in port medium"; equation h_out = inStream(port.h_outflow);end SpecificEnthalpy;
This component monitors the specific enthalpy of a passing fluid. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing a round 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) |
Advanced | |||
MassFlowRate | m_flow_small | system.m_flow_small | 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 | h_out | Specific enthalpy of the passing fluid [J/kg] |
model SpecificEnthalpyTwoPort "Ideal two port sensor for the specific enthalpy" extends Sensors.BaseClasses.PartialFlowSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput h_out(final quantity="SpecificEnergy", final unit="J/kg") "Specific enthalpy of the passing fluid"; parameter Medium.MassFlowRate m_flow_small(min=0) = system.m_flow_small "For bi-directional flow, specific enthalpy is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)"; equation if allowFlowReversal then h_out = Modelica.Fluid.Utilities.regStep(port_a.m_flow, port_b.h_outflow, port_a.h_outflow, m_flow_small); else h_out = port_b.h_outflow; end if;end SpecificEnthalpyTwoPort;
This component monitors the specific entropy of the fluid passing its port. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable), Modelica.Icons.RotationalSensor (Icon representing a round measurement device).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the sensor |
Type | Name | Description |
---|---|---|
FluidPort_a | port | |
output RealOutput | s | Specific entropy in port medium [J/(kg.K)] |
model SpecificEntropy "Ideal one port specific entropy sensor" extends Sensors.BaseClasses.PartialAbsoluteSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput s(final quantity="SpecificEntropy", final unit="J/(kg.K)") "Specific entropy in port medium"; equation s = Medium.specificEntropy(Medium.setState_phX(port.p, inStream(port.h_outflow), inStream(port.Xi_outflow)));end SpecificEntropy;
This component monitors the specific entropy of the passing fluid. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing a round 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) |
Advanced | |||
MassFlowRate | m_flow_small | system.m_flow_small | For bi-directional flow, specific entropy 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 | s | Specific entropy of the passing fluid [J/(kg.K)] |
model SpecificEntropyTwoPort "Ideal two port sensor for the specific entropy" extends Sensors.BaseClasses.PartialFlowSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput s(final quantity="SpecificEntropy", final unit="J/(kg.K)") "Specific entropy of the passing fluid"; parameter Medium.MassFlowRate m_flow_small(min=0) = system.m_flow_small "For bi-directional flow, specific entropy is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)"; protected Medium.SpecificEntropy s_a_inflow "Specific entropy of inflowing fluid at port_a"; Medium.SpecificEntropy s_b_inflow "Specific entropy of inflowing fluid at port_b or s_a_inflow, if uni-directional flow"; equation if allowFlowReversal then s_a_inflow = Medium.specificEntropy(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); s_b_inflow = Medium.specificEntropy(Medium.setState_phX(port_a.p, port_a.h_outflow, port_a.Xi_outflow)); s = Modelica.Fluid.Utilities.regStep(port_a.m_flow, s_a_inflow, s_b_inflow, m_flow_small); else s = Medium.specificEntropy(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); s_a_inflow = s; s_b_inflow = s; end if;end SpecificEntropyTwoPort;
This component monitors the trace substances contained in the fluid passing its port. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialAbsoluteSensor (Partial component to model a sensor that measures a potential variable), Modelica.Icons.RotationalSensor (Icon representing a round measurement device).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the sensor | |
String | substanceName | "CO2" | Name of trace substance |
Type | Name | Description |
---|---|---|
FluidPort_a | port | |
output RealOutput | C | Trace substance in port medium |
model TraceSubstances "Ideal one port trace substances sensor" extends Sensors.BaseClasses.PartialAbsoluteSensor; extends Modelica.Icons.RotationalSensor; parameter String substanceName = "CO2" "Name of trace substance";Modelica.Blocks.Interfaces.RealOutput C "Trace substance in port medium"; protected parameter Integer ind(fixed=false) "Index of species in vector of auxiliary substances"; Medium.ExtraProperty CVec[Medium.nC]( 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.nC loop if ( Modelica.Utilities.Strings.isEqual(Medium.extraPropertiesNames[i], substanceName)) then ind := i; end if; end for; assert(ind > 0, "Trace substance '" + substanceName + "' is not present in medium '" + Medium.mediumName + "'.\n" + "Check sensor parameter and medium model."); equation CVec = inStream(port.C_outflow); C = CVec[ind];end TraceSubstances;
This component monitors the trace substance of the passing fluid. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing a round measurement device).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
String | substanceName | "CO2" | Name of trace substance |
Assumptions | |||
Boolean | allowFlowReversal | system.allowFlowReversal | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Advanced | |||
MassFlowRate | m_flow_small | system.m_flow_small | For bi-directional flow, trace substance 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 | C | Trace substance of the passing fluid |
model TraceSubstancesTwoPort "Ideal two port sensor for trace substance" extends Sensors.BaseClasses.PartialFlowSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput C "Trace substance of the passing fluid"; parameter String substanceName = "CO2" "Name of trace substance"; parameter Medium.MassFlowRate m_flow_small(min=0) = system.m_flow_small "For bi-directional flow, trace substance is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)"; protected parameter Integer ind(fixed=false) "Index of species in vector of auxiliary substances"; initial algorithm ind:= -1; for i in 1:Medium.nC loop if ( Modelica.Utilities.Strings.isEqual(Medium.extraPropertiesNames[i], substanceName)) then ind := i; end if; end for; assert(ind > 0, "Trace substance '" + substanceName + "' is not present in medium '" + Medium.mediumName + "'.\n" + "Check sensor parameter and medium model."); equation if allowFlowReversal then C = Modelica.Fluid.Utilities.regStep(port_a.m_flow, port_b.C_outflow[ind], port_a.C_outflow[ind], m_flow_small); else C = port_b.C_outflow[ind]; end if;end TraceSubstancesTwoPort;
This component monitors the mass flow rate flowing from port_a to port_b. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing a round 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 | m_flow | Mass flow rate from port_a to port_b [kg/s] |
model MassFlowRate "Ideal sensor for mass flow rate" extends Sensors.BaseClasses.PartialFlowSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput m_flow(quantity="MassFlowRate", final unit="kg/s") "Mass flow rate from port_a to port_b"; equation m_flow = port_a.m_flow;end MassFlowRate;
This component monitors the volume flow rate flowing from port_a to port_b. The sensor is ideal, i.e., it does not influence the fluid.
Extends from Sensors.BaseClasses.PartialFlowSensor (Partial component to model sensors that measure flow properties), Modelica.Icons.RotationalSensor (Icon representing a round 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) |
Advanced | |||
MassFlowRate | m_flow_small | system.m_flow_small | For bi-directional flow, density 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 | V_flow | Volume flow rate from port_a to port_b [m3/s] |
model VolumeFlowRate "Ideal sensor for volume flow rate" extends Sensors.BaseClasses.PartialFlowSensor; extends Modelica.Icons.RotationalSensor;Modelica.Blocks.Interfaces.RealOutput V_flow(final quantity="VolumeFlowRate", final unit="m3/s") "Volume flow rate from port_a to port_b"; parameter Medium.MassFlowRate m_flow_small(min=0) = system.m_flow_small "For bi-directional flow, density is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required)"; protected Medium.Density rho_a_inflow "Density of inflowing fluid at port_a"; Medium.Density rho_b_inflow "Density of inflowing fluid at port_b or rho_a_inflow, if uni-directional flow"; Medium.Density d "Density of the passing fluid"; equation if allowFlowReversal then rho_a_inflow = Medium.density(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); rho_b_inflow = Medium.density(Medium.setState_phX(port_a.p, port_a.h_outflow, port_a.Xi_outflow)); d = Modelica.Fluid.Utilities.regStep(port_a.m_flow, rho_a_inflow, rho_b_inflow, m_flow_small); else d = Medium.density(Medium.setState_phX(port_b.p, port_b.h_outflow, port_b.Xi_outflow)); rho_a_inflow = d; rho_b_inflow = d; end if; V_flow = port_a.m_flow/d;end VolumeFlowRate;
The relative pressure "port_a.p - port_b.p" is determined between the two ports of this component and is provided as output signal. The sensor should be connected in parallel with other equipment, no flow through the sensor is allowed.
Extends from Modelica.Icons.TranslationalSensor (Icon representing a linear measurement device).
Type | Name | Description |
---|---|---|
FluidPort_a | port_a | |
FluidPort_b | port_b | |
output RealOutput | p_rel | Relative pressure signal [Pa] |
model RelativePressure "Ideal relative pressure sensor" extends Modelica.Icons.TranslationalSensor; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the sensor";Modelica.Fluid.Interfaces.FluidPort_a port_a(m_flow(min=0), redeclare package Medium = Medium); Modelica.Fluid.Interfaces.FluidPort_b port_b(m_flow(min=0), redeclare package Medium = Medium); Modelica.Blocks.Interfaces.RealOutput p_rel(final quantity="Pressure", final unit="Pa", displayUnit="bar") "Relative pressure signal"; equation // Zero flow equations for connectors port_a.m_flow = 0; port_b.m_flow = 0; // No contribution of specific quantities port_a.h_outflow = 0; port_b.h_outflow = 0; port_a.Xi_outflow = zeros(Medium.nXi); port_b.Xi_outflow = zeros(Medium.nXi); port_a.C_outflow = zeros(Medium.nC); port_b.C_outflow = zeros(Medium.nC); // Relative pressure p_rel = port_a.p - port_b.p;end RelativePressure;
The relative temperature "T(port_a) - T(port_b)" is determined between the two ports of this component and is provided as output signal. The sensor should be connected in parallel with other equipment, no flow through the sensor is allowed.
Extends from Modelica.Icons.TranslationalSensor (Icon representing a linear measurement device).
Type | Name | Description |
---|---|---|
FluidPort_a | port_a | |
FluidPort_b | port_b | |
output RealOutput | T_rel | Relative temperature signal [K] |
model RelativeTemperature "Ideal relative temperature sensor" extends Modelica.Icons.TranslationalSensor; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the sensor";Modelica.Fluid.Interfaces.FluidPort_a port_a(m_flow(min=0), redeclare package Medium = Medium); Modelica.Fluid.Interfaces.FluidPort_b port_b(m_flow(min=0), redeclare package Medium = Medium); Modelica.Blocks.Interfaces.RealOutput T_rel(final quantity="ThermodynamicTemperature", final unit = "K", displayUnit = "degC", min=0) "Relative temperature signal"; equation // Zero flow equations for connectors port_a.m_flow = 0; port_b.m_flow = 0; // No contribution of specific quantities port_a.h_outflow = 0; port_b.h_outflow = 0; port_a.Xi_outflow = zeros(Medium.nXi); port_b.Xi_outflow = zeros(Medium.nXi); port_a.C_outflow = zeros(Medium.nC); port_b.C_outflow = zeros(Medium.nC); // Relative temperature T_rel = Medium.temperature(Medium.setState_phX(port_a.p, inStream(port_a.h_outflow), inStream(port_a.Xi_outflow))) - Medium.temperature(Medium.setState_phX(port_b.p, inStream(port_b.h_outflow), inStream(port_b.Xi_outflow)));end RelativeTemperature;