Buildings.Fluid.FMI.Conversion

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
Buildings.Fluid.FMI.Conversion.AirToOutlet AirToOutlet Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Outlet connector
Buildings.Fluid.FMI.Conversion.InletToAir InletToAir Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Inlet connector
Buildings.Fluid.FMI.Conversion.Validation Validation Collection of models that illustrate model use and test models

Buildings.Fluid.FMI.Conversion.AirToOutlet Buildings.Fluid.FMI.Conversion.AirToOutlet

Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Outlet connector

Buildings.Fluid.FMI.Conversion.AirToOutlet

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

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
input RealInputm_flowMass flow rate [kg/s]
input RealInputhSpecific enthalpy [J/kg]
input RealInputXi[Medium.nXi]Water vapor concentration in kg/kg total air [kg/kg]
input RealInputC[Medium.nC]Prescribed boundary trace substances
OutletoutletFluid outlet
output RealOutputTAirZonTemperature of the backward flowing medium in the connector outlet [K]
output RealOutputX_wZonWater mass fraction per total air mass of the backward flowing medium in the connector outlet [kg/kg]
output RealOutputCZon[Medium.nC]Trace substances of the backward flowing medium in the connector outlet

Modelica definition

block AirToOutlet "Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Outlet connector" extends Modelica.Blocks.Icons.Block; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Boolean allowFlowReversal = true "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; Modelica.Blocks.Interfaces.RealInput m_flow( final unit="kg/s") "Mass flow rate"; Modelica.Blocks.Interfaces.RealInput h(final unit="J/kg") "Specific enthalpy"; Modelica.Blocks.Interfaces.RealInput Xi[Medium.nXi]( each final unit="kg/kg") "Water vapor concentration in kg/kg total air"; Modelica.Blocks.Interfaces.RealInput C[Medium.nC]( final quantity=Medium.extraPropertiesNames) "Prescribed boundary trace substances"; Buildings.Fluid.FMI.Interfaces.Outlet outlet( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=false) "Fluid outlet"; Modelica.Blocks.Interfaces.RealOutput TAirZon( final unit="K", displayUnit="degC") if allowFlowReversal "Temperature of the backward flowing medium in the connector outlet"; Modelica.Blocks.Interfaces.RealOutput X_wZon( final unit="kg/kg") if Medium.nXi > 0 and allowFlowReversal "Water mass fraction per total air mass of the backward flowing medium in the connector outlet"; Modelica.Blocks.Interfaces.RealOutput CZon[Medium.nC]( final quantity=Medium.extraPropertiesNames) if allowFlowReversal "Trace substances of the backward flowing medium in the connector outlet"; protected Modelica.Blocks.Interfaces.RealInput Xi_internal[Medium.nXi]( each final unit = "kg/kg") "Internal connector for water vapor concentration in kg/kg total air"; Modelica.Blocks.Interfaces.RealInput X_w_internal( final unit = "kg/kg") "Internal connector for water vapor concentration in kg/kg total air"; // Conditional connectors for the backward flowing medium Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal( redeclare final package Medium = Medium) "Internal connector for fluid properties for back flow"; Modelica.Blocks.Interfaces.RealOutput TAirZon_internal( final unit="K", displayUnit="degC") "Conditinal connector for zone air temperature"; Modelica.Blocks.Interfaces.RealOutput X_wZon_internal( final unit="kg/kg") "Internal connector for zone water vapor mass fraction"; Modelica.Blocks.Interfaces.RealOutput X_wZon_internal2( final unit="kg/kg") = 0 if Medium.nXi == 0 or not allowFlowReversal "Internal connector for zone water vapor mass fraction, required if X_wZon is removed"; Modelica.Blocks.Interfaces.RealOutput CZon_internal[Medium.nC] "Internal connector for trace substances"; equation // Conditional connectors connect(Xi_internal, Xi); if Medium.nXi == 0 then Xi_internal = zeros(Medium.nXi); end if; outlet.m_flow = m_flow; // If m_flow <= 0, output default properties. // This avoids that changes in state variables of the return // air are propagated to the room model which may trigger an // evaluation of the room ODE, even though Q=max(0, m_flow) c_p (TSup-TZon). 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)})); // Xi internal has 1 or zero components, hence we can use the sum. 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; // Connectors for backward flow 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;

Buildings.Fluid.FMI.Conversion.InletToAir Buildings.Fluid.FMI.Conversion.InletToAir

Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Inlet connector

Buildings.Fluid.FMI.Conversion.InletToAir

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

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
InletinletFluid outlet
input RealInputTAirZonZone air temperature [K]
input RealInputX_wZonZone air water mass fraction per total air mass [kg/kg]
input RealInputCZon[Medium.nC]Zone air trace substances
output RealOutputm_flowMass flow rate of the inlet [kg/s]
output RealOutputTTemperature of the inlet [K]
output RealOutputX_wWater mass fraction per total air mass of the inlet [kg/kg]
output RealOutputC[Medium.nC]Trace substances of the inlet

Modelica definition

block InletToAir "Conversion from real signals for a fluid to a Buildings.Fluid.FMI.Interfaces.Inlet connector" extends Modelica.Blocks.Icons.Block; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Boolean allowFlowReversal = true "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; Buildings.Fluid.FMI.Interfaces.Inlet inlet( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=false) "Fluid outlet"; Modelica.Blocks.Interfaces.RealInput TAirZon( final unit="K", displayUnit="degC") if allowFlowReversal "Zone air temperature"; Modelica.Blocks.Interfaces.RealInput X_wZon( final unit="kg/kg") if Medium.nXi > 0 and allowFlowReversal "Zone air water mass fraction per total air mass"; Modelica.Blocks.Interfaces.RealInput CZon[Medium.nC]( final quantity=Medium.extraPropertiesNames) if allowFlowReversal "Zone air trace substances"; Modelica.Blocks.Interfaces.RealOutput m_flow( final unit="kg/s") "Mass flow rate of the inlet"; Modelica.Blocks.Interfaces.RealOutput T(final unit="K") "Temperature of the inlet"; Modelica.Blocks.Interfaces.RealOutput X_w(final unit="kg/kg") if Medium.nXi > 0 "Water mass fraction per total air mass of the inlet"; Modelica.Blocks.Interfaces.RealOutput C[Medium.nC]( final quantity=Medium.extraPropertiesNames) "Trace substances of the inlet"; protected Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal( redeclare final package Medium = Medium) "Internal connector for fluid properties for back flow"; Modelica.Blocks.Interfaces.RealInput TAirZon_internal( final unit="K", displayUnit="degC") "Conditinal connector for zone air temperature"; Modelica.Blocks.Interfaces.RealInput X_wZon_internal( final unit="kg/kg") "Internal connector for zone water vapor mass fraction"; Modelica.Blocks.Interfaces.RealInput X_wZon_internal2( final unit="kg/kg") = 0 if Medium.nXi == 0 or not allowFlowReversal "Internal connector for zone water vapor mass fraction, required if X_wZon is removed"; Modelica.Blocks.Interfaces.RealInput CZon_internal[Medium.nC] "Internal connector for trace substances"; equation // Conditional connectors 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); // Mass flow rate m_flow = inlet.m_flow; // Temperature T = inlet.forward.T; // Vapor concentration // X_w_internal = inlet.forward.X_w; connect(inlet.forward.X_w, X_w); // Species concentration C = inlet.forward.C; end InletToAir;