Buildings.Fluid.Sensors.BaseClasses

Package with base classes for Buildings.Fluid.Sensors

Information

This package contains base classes that are used to construct the models in Buildings.Fluid.Sensors.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Fluid.Sensors.BaseClasses.PartialAbsoluteSensor PartialAbsoluteSensor Partial component to model a sensor that measures a potential variable
Buildings.Fluid.Sensors.BaseClasses.PartialDynamicFlowSensor PartialDynamicFlowSensor Partial component to model sensors that measure flow properties using a dynamic model
Buildings.Fluid.Sensors.BaseClasses.PartialFlowSensor PartialFlowSensor Partial component to model sensors that measure flow properties

Buildings.Fluid.Sensors.BaseClasses.PartialAbsoluteSensor Buildings.Fluid.Sensors.BaseClasses.PartialAbsoluteSensor

Partial component to model a sensor that measures a potential variable

Buildings.Fluid.Sensors.BaseClasses.PartialAbsoluteSensor

Information

Partial component to model an absolute sensor. The component can be used for pressure sensor models. Use for other properties such as temperature or density is discouraged, because the enthalpy at the connector can have different meanings, depending on the connection topology. For these properties, use Buildings.Fluid.Sensors.BaseClasses.PartialFlowSensor.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the sensor

Connectors

TypeNameDescription
replaceable package MediumMedium in the sensor
FluidPort_aport 

Modelica definition

partial model PartialAbsoluteSensor "Partial component to model a sensor that measures a potential variable" replaceable package Medium=Modelica.Media.Interfaces.PartialMedium "Medium in the sensor"; Modelica.Fluid.Interfaces.FluidPort_a port(redeclare package Medium=Medium, m_flow(min=0)); equation port.m_flow = 0; port.h_outflow = 0; port.Xi_outflow = zeros(Medium.nXi); port.C_outflow = zeros(Medium.nC); end PartialAbsoluteSensor;

Buildings.Fluid.Sensors.BaseClasses.PartialDynamicFlowSensor Buildings.Fluid.Sensors.BaseClasses.PartialDynamicFlowSensor

Partial component to model sensors that measure flow properties using a dynamic model

Buildings.Fluid.Sensors.BaseClasses.PartialDynamicFlowSensor

Information

Partial component to model a sensor that measures any intensive properties of a flow, e.g., to get temperature or density in the flow between fluid connectors.

The sensor computes a gain that is zero at zero mass flow rate. This avoids fast transients if the flow is close to zero, thereby improving the numerical efficiency.

Extends from PartialFlowSensor (Partial component to model sensors that measure flow properties).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Timetau1Time constant at nominal flow rate (use tau=0 for steady-state sensor, but see user guide for potential problems) [s]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate, used for regularization near zero flow [kg/s]
Initialization
InitinitTypeModelica.Blocks.Types.Init.I...Type of initialization (InitialState and InitialOutput are identical)
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*m_flow_nominalFor bi-directional flow, temperature is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required) [kg/s]

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialDynamicFlowSensor "Partial component to model sensors that measure flow properties using a dynamic model" extends PartialFlowSensor; parameter Modelica.SIunits.Time tau(min=0) = 1 "Time constant at nominal flow rate (use tau=0 for steady-state sensor, but see user guide for potential problems)"; parameter Modelica.Blocks.Types.Init initType = Modelica.Blocks.Types.Init.InitialState "Type of initialization (InitialState and InitialOutput are identical)"; protected Real k(start=1) "Gain to take flow rate into account for sensor time constant"; final parameter Boolean dynamic = tau > 1E-10 or tau < -1E-10 "Flag, true if the sensor is a dynamic sensor"; Real mNor_flow "Normalized mass flow rate"; final parameter Real tauInv(final unit="s-1")= if dynamic then 1/tau else 0 "Inverse of tau"; equation if dynamic then mNor_flow = port_a.m_flow/m_flow_nominal; k = Modelica.Fluid.Utilities.regStep(x=port_a.m_flow, y1= mNor_flow, y2=-mNor_flow, x_small=m_flow_small); else mNor_flow = 1; k = 1; end if; end PartialDynamicFlowSensor;

Buildings.Fluid.Sensors.BaseClasses.PartialFlowSensor Buildings.Fluid.Sensors.BaseClasses.PartialFlowSensor

Partial component to model sensors that measure flow properties

Buildings.Fluid.Sensors.BaseClasses.PartialFlowSensor

Information

Partial component to model a sensor. The sensor is ideal. It does not influence mass, energy, species or substance balance, and it has no flow friction.

Extends from Buildings.Fluid.Interfaces.PartialTwoPort (Partial component with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominalm_flow_nominal(min=0)Nominal mass flow rate, used for regularization near zero flow [kg/s]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*m_flow_nominalFor bi-directional flow, temperature is regularized in the region |m_flow| < m_flow_small (m_flow_small > 0 required) [kg/s]

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)

Modelica definition

partial model PartialFlowSensor "Partial component to model sensors that measure flow properties" extends Buildings.Fluid.Interfaces.PartialTwoPort; parameter Modelica.SIunits.MassFlowRate m_flow_nominal(min=0) "Nominal mass flow rate, used for regularization near zero flow"; parameter Modelica.SIunits.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)"; equation // mass balance port_b.m_flow = -port_a.m_flow; // momentum equation (no pressure loss) port_a.p = port_b.p; // isenthalpic state transformation (no storage and no loss of energy) port_a.h_outflow = if allowFlowReversal then inStream(port_b.h_outflow) else Medium.h_default; port_b.h_outflow = inStream(port_a.h_outflow); port_a.Xi_outflow = if allowFlowReversal then inStream(port_b.Xi_outflow) else Medium.X_default[1:Medium.nXi]; port_b.Xi_outflow = inStream(port_a.Xi_outflow); port_a.C_outflow = if allowFlowReversal then inStream(port_b.C_outflow) else zeros(Medium.nC); port_b.C_outflow = inStream(port_a.C_outflow); end PartialFlowSensor;