Package with blocks that convert between different connectors
Information
This package contains blocks to convert between scalar input-output signals
and the composite input-output connectors
Buildings.Fluid.FMI.Interfaces.Inlet
and
Buildings.Fluid.FMI.Interfaces.Outlet.
Extends from Modelica.Icons.Package (Icon for standard packages).
Package Content
| Name |
Description |
AirToOutlet
|
Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Outlet connector |
InletToAir
|
Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Inlet connector |
Validation
|
Collection of models that illustrate model use and test models |
Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Outlet connector
Information
Block that takes real inputs for properties of an air-based HVAC
system and converts them to an outlet connector of type
Buildings.Fluid.FMI.Interfaces.Outlet.
See
Buildings.Fluid.FMI.Adaptors.HVAC
for its usage.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
| Type | Name | Default | Description |
| replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
| Boolean | allowFlowReversal | true | = true to allow flow reversal, false restricts to design direction (inlet -> outlet) |
Connectors
| Type | Name | Description |
| replaceable package Medium | Medium in the component |
| input RealInput | m_flow | Mass flow rate [kg/s] |
| input RealInput | h | Specific enthalpy [J/kg] |
| input RealInput | Xi[Medium.nXi] | Water vapor concentration in kg/kg total air [kg/kg] |
| input RealInput | C[Medium.nC] | Prescribed boundary trace substances |
| Outlet | outlet | Fluid outlet |
| output RealOutput | TAirZon | Temperature of the backward flowing medium in the connector outlet [K] |
| output RealOutput | X_wZon | Water mass fraction per total air mass of the backward flowing medium in the connector outlet [kg/kg] |
| output RealOutput | CZon[Medium.nC] | Trace substances of the backward flowing medium in the connector outlet |
Modelica definition
block AirToOutlet
extends Modelica.Blocks.Icons.Block;
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Boolean allowFlowReversal = true
;
Modelica.Blocks.Interfaces.RealInput m_flow(
final unit="kg/s") ;
Modelica.Blocks.Interfaces.RealInput h(
final unit="J/kg")
;
Modelica.Blocks.Interfaces.RealInput Xi[Medium.nXi](
each final unit="kg/kg")
;
Modelica.Blocks.Interfaces.RealInput C[Medium.nC](
final quantity=Medium.extraPropertiesNames)
;
Buildings.Fluid.FMI.Interfaces.Outlet outlet(
redeclare final package Medium =
Medium,
final allowFlowReversal=allowFlowReversal,
final use_p_in=false) ;
Modelica.Blocks.Interfaces.RealOutput TAirZon(
final unit="K",
displayUnit="degC")
if allowFlowReversal
;
Modelica.Blocks.Interfaces.RealOutput X_wZon(
final unit="kg/kg")
if Medium.nXi > 0
and allowFlowReversal
;
Modelica.Blocks.Interfaces.RealOutput CZon[Medium.nC](
final quantity=Medium.extraPropertiesNames)
if allowFlowReversal
;
protected
Modelica.Blocks.Interfaces.RealInput Xi_internal[Medium.nXi](
each final unit = "kg/kg")
;
Modelica.Blocks.Interfaces.RealInput X_w_internal(
final unit = "kg/kg")
;
output Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal(
redeclare final package Medium =
Medium)
;
Modelica.Blocks.Interfaces.RealOutput TAirZon_internal(
final unit="K",
displayUnit="degC")
;
Modelica.Blocks.Interfaces.RealOutput X_wZon_internal(
final unit="kg/kg")
;
Modelica.Blocks.Interfaces.RealOutput X_wZon_internal2(
final unit="kg/kg") = 0
if Medium.nXi == 0
or not allowFlowReversal
;
Modelica.Blocks.Interfaces.RealOutput CZon_internal[Medium.nC]
;
equation
connect(Xi_internal, Xi);
if Medium.nXi == 0
then
Xi_internal =
zeros(Medium.nXi);
end if;
outlet.m_flow = m_flow;
connect(outlet.forward.X_w, X_w_internal);
if m_flow >= 0
then
outlet.forward.T =
Medium.temperature_phX(
p=Medium.p_default,
h=h,
X=
cat(1, Xi_internal, {1-
sum(Xi_internal)}));
X_w_internal =
sum(Xi_internal);
outlet.forward.C = C;
else
outlet.forward.T = Medium.T_default;
X_w_internal = Medium.X_default[1];
outlet.forward.C =
zeros(Medium.nC);
end if;
connect(TAirZon_internal, TAirZon);
bacPro_internal.T = TAirZon_internal;
connect(bacPro_internal.X_w, X_wZon_internal);
connect(CZon_internal, CZon);
bacPro_internal.C = CZon_internal;
connect(X_wZon_internal, X_wZon);
connect(X_wZon_internal, X_wZon_internal2);
if not allowFlowReversal
then
TAirZon_internal = Medium.T_default;
CZon_internal =
zeros(Medium.nC);
end if;
connect(outlet.backward, bacPro_internal);
end AirToOutlet;
Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Inlet connector
Information
Block that takes an inlet connector of type
Buildings.Fluid.FMI.Interfaces.Inlet
and converts
it to real outputs for properties of an air-based
HVAC system.
The output signal m_flow is equal to
inlet.m_flow, whereas the output signals
T, X_w and C
are set the the properties
inlet.forward.
Similarly, the properties of
inlet.backward are set the the values
of the input signals
TAirZon, X_wZon and CZon.
If allowFlowReversal = true,
input signal connectors are enabled that are used
to set the fluid properties for backflow in the connector
inlet.backward.
This can be used if this block is used to connect an HVAC
system to a thermal zone, in which case the supply air
properties are in the connector
inlet.forward,
and the return air properties are in the connector
inlet.backward.
See
Buildings.Fluid.FMI.Adaptors.ThermalZone
for its usage.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
| Type | Name | Default | Description |
| replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
| Boolean | allowFlowReversal | true | = true to allow flow reversal, false restricts to design direction (inlet -> outlet) |
Connectors
| Type | Name | Description |
| replaceable package Medium | Medium in the component |
| Inlet | inlet | Fluid outlet |
| input RealInput | TAirZon | Zone air temperature [K] |
| input RealInput | X_wZon | Zone air water mass fraction per total air mass [kg/kg] |
| input RealInput | CZon[Medium.nC] | Zone air trace substances |
| output RealOutput | m_flow | Mass flow rate of the inlet [kg/s] |
| output RealOutput | T | Temperature of the inlet [K] |
| output RealOutput | X_w | Water mass fraction per total air mass of the inlet [kg/kg] |
| output RealOutput | C[Medium.nC] | Trace substances of the inlet |
Modelica definition
block InletToAir
extends Modelica.Blocks.Icons.Block;
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium ;
parameter Boolean allowFlowReversal = true
;
Buildings.Fluid.FMI.Interfaces.Inlet inlet(
redeclare final package Medium =
Medium,
final allowFlowReversal=allowFlowReversal,
final use_p_in=false) ;
Modelica.Blocks.Interfaces.RealInput TAirZon(
final unit="K",
displayUnit="degC")
if allowFlowReversal
;
Modelica.Blocks.Interfaces.RealInput X_wZon(
final unit="kg/kg")
if Medium.nXi > 0
and allowFlowReversal
;
Modelica.Blocks.Interfaces.RealInput CZon[Medium.nC](
final quantity=Medium.extraPropertiesNames)
if allowFlowReversal
;
Modelica.Blocks.Interfaces.RealOutput m_flow(
final unit="kg/s") ;
Modelica.Blocks.Interfaces.RealOutput T(
final unit="K") ;
Modelica.Blocks.Interfaces.RealOutput X_w(
final unit="kg/kg")
if Medium.nXi > 0
;
Modelica.Blocks.Interfaces.RealOutput C[Medium.nC](
final quantity=Medium.extraPropertiesNames)
;
protected
input Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal(
redeclare final package Medium =
Medium)
;
Modelica.Blocks.Interfaces.RealInput TAirZon_internal(
final unit="K",
displayUnit="degC")
;
Modelica.Blocks.Interfaces.RealInput X_wZon_internal(
final unit="kg/kg")
;
Modelica.Blocks.Interfaces.RealInput X_wZon_internal2(
final unit="kg/kg") = 0
if Medium.nXi == 0
or not allowFlowReversal
;
Modelica.Blocks.Interfaces.RealInput CZon_internal[Medium.nC]
;
equation
connect(TAirZon_internal, TAirZon);
bacPro_internal.T = TAirZon_internal;
connect(bacPro_internal.X_w, X_wZon_internal);
connect(CZon_internal, CZon);
bacPro_internal.C = CZon_internal;
connect(X_wZon_internal, X_wZon);
connect(X_wZon_internal, X_wZon_internal2);
if not allowFlowReversal
then
TAirZon_internal = Medium.T_default;
CZon_internal =
zeros(Medium.nC);
end if;
connect(inlet.backward, bacPro_internal);
m_flow = inlet.m_flow;
T = inlet.forward.T;
connect(inlet.forward.X_w, X_w);
C = inlet.forward.C;
end InletToAir;