Buildings.Fluid.FMI.Adaptors

Package with adaptors to connect models with fluid ports and models with signal ports

Information

This package contains adaptors that allow connecting models with fluid ports and models with input and output signals. These adaptors are used, for example, to export an HVAC system as a Functional Mockup Unit.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Buildings.Fluid.FMI.Adaptors.HVAC HVAC Adaptor for connecting an HVAC system to signal ports which then can be exposed at an FMI interface
Buildings.Fluid.FMI.Adaptors.Inlet Inlet Adaptor for connecting a fluid inlet to the FMI interface
Buildings.Fluid.FMI.Adaptors.Outlet Outlet Adaptor for connecting a fluid outlet to the FMI interface
Buildings.Fluid.FMI.Adaptors.ThermalZone ThermalZone Adaptor for connecting a thermal zone to signal ports which then can be exposed at an FMI interface
Buildings.Fluid.FMI.Adaptors.Examples Examples Collection of models that illustrate model use and test models

Buildings.Fluid.FMI.Adaptors.HVAC Buildings.Fluid.FMI.Adaptors.HVAC

Adaptor for connecting an HVAC system to signal ports which then can be exposed at an FMI interface

Buildings.Fluid.FMI.Adaptors.HVAC

Information

Adaptor that can be used to connect an HVAC system (with acausal ports) to input/output signals, which then can be exposed in an FMI interface.

The adaptor has a vector of fluid ports called ports. The supply and return air ducts need to be connected to these ports. Also, if a thermal zone has interzonal air exchange or air infiltration, these flow paths also need be connected to ports.

This model outputs at the port fluPor the mass flow rate for each flow that is connected to ports, together with its temperature, water vapor mass fraction per total mass of the air (not per kg dry air), and trace substances. These quantities are always as if the flow enters the room, even if the flow is zero or negative. If a medium has no moisture, e.g., if Medium.nXi=0, or if it has no trace substances, e.g., if Medium.nC=0, then the output signal for these properties are removed. These quantities are always as if the flow enters the room, even if the flow is zero or negative. Thus, a thermal zone model that uses these signals to compute the heat added by the HVAC system need to implement an equation such as

Qsen = max(0, ṁsup)   cp   (Tsup - Tair,zon),

where Qsen is the sensible heat flow rate added to the thermal zone, sup is the supply air mass flow rate from the port fluPor (which is negative if it is an exhaust), cp is the specific heat capacity at constant pressure, Tsup is the supply air temperature and Tair,zon is the zone air temperature. Note that without the max(·, ·) function, the energy balance would be wrong.

The output signals of this model are the zone air temperature, the water vapor mass fraction per total mass of the air (unless Medium.nXi=0) and trace substances (unless Medium.nC=0). These output connectors can be used to connect to a controller. These values are obtained from the fluid stream(s) that flow into this component at the port fluPor, e.g., from the connector fluPor.backward. Note that there are nPorts of these signals. For a completely mixed room, they will all have the same value, but for a room with non-uniform temperatures, they can have different values.

Assumption and limitations

The mass flow rates at ports sum to zero, hence this model conserves mass.

This model does not impose any pressure, other than setting the pressure of all fluid connections to ports to be equal. The reason is that setting a pressure can lead to non-physical system models, for example if a mass flow rate is imposed and the HVAC system is connected to a model that sets a pressure boundary condition such as Buildings.Fluid.Sources.Outside. Also, setting a pressure would make it impossible to use multiple instances of this model (one for each thermal zone) and build in Modelica an airflow network model with pressure driven mass flow rates.

The model has no pressure drop. Hence, the pressure drop of an air diffuser or of an exhaust grill need to be modelled in models that are connected to ports.

Typical use and important parameters

See Buildings.Fluid.FMI.ExportContainers.HVACZone for a model that uses this model.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model within the source
IntegernPorts Number of ports

Connectors

TypeNameDescription
replaceable package MediumMedium model within the source
OutletfluPor[nPorts]Fluid connector
FluidPorts_bports[nPorts] 
output RealOutputTAirZon[nPorts]Temperature of the backward flowing medium in the connector outlet [K]
output RealOutputX_wZon[nPorts]Water mass fraction per total air mass of the backward flowing medium in the connector outlet [kg/kg]
output RealOutputCZon[nPorts, Medium.nC]Trace substances of the backward flowing medium in the connector outlet

Modelica definition

model HVAC "Adaptor for connecting an HVAC system to signal ports which then can be exposed at an FMI interface" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model within the source"; // Don't use annotation(Dialog(connectorSizing=true)) for nPorts because // otherwise, in Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones // the fluid ports can not be assigned between the different zones by the user. parameter Integer nPorts(min=2) "Number of ports"; Interfaces.Outlet fluPor[nPorts]( redeclare each final package Medium = Medium, each final allowFlowReversal=true, each final use_p_in=false) "Fluid connector"; Modelica.Fluid.Interfaces.FluidPorts_b ports[nPorts]( redeclare each final package Medium = Medium); Modelica.Blocks.Interfaces.RealOutput TAirZon[nPorts]( each final unit="K", each displayUnit="degC") "Temperature of the backward flowing medium in the connector outlet"; Modelica.Blocks.Interfaces.RealOutput X_wZon[nPorts]( each final unit="kg/kg") if Medium.nXi > 0 "Water mass fraction per total air mass of the backward flowing medium in the connector outlet"; Modelica.Blocks.Interfaces.RealOutput CZon[nPorts, Medium.nC]( final quantity=fill(Medium.extraPropertiesNames, nPorts)) "Trace substances of the backward flowing medium in the connector outlet"; protected Sources.MassFlowSource_T bou( final nPorts=nPorts, redeclare final package Medium = Medium, final use_m_flow_in=false, final use_T_in=true, final use_X_in=Medium.nXi > 0, final use_C_in=Medium.nC > 0, final m_flow=0) "Boundary conditions for HVAC system"; Buildings.Fluid.FMI.Conversion.AirToOutlet con[nPorts]( redeclare each final package Medium = Medium, each final allowFlowReversal=true) "Converter between the different connectors"; Sensors.MassFlowRate senMasFlo[nPorts]( redeclare each final package Medium = Medium, each allowFlowReversal=true) "Mass flow rate sensor"; Buildings.Fluid.FMI.BaseClasses.X_w_toX x_w_toX( redeclare final package Medium = Medium) if Medium.nXi > 0 "Conversion from X_w to X"; Modelica.Blocks.Sources.RealExpression hSup[nPorts]( final y={inStream(ports[i].h_outflow) for i in 1:nPorts}) "Supply air specific enthalpy"; RealVectorExpression XiSup[nPorts]( each final n = Medium.nXi, final y={inStream(ports[i].Xi_outflow) for i in 1:nPorts}) if Medium.nXi > 0 "Water vapor concentration of supply air"; RealVectorExpression CSup[nPorts]( each final n=Medium.nC, final y={inStream(ports[i].C_outflow) for i in 1:nPorts}) if Medium.nC > 0 "Trace substance concentration of supply air"; /////////////////////////////////////////////////////////////////////////// // Internal blocks block RealVectorExpression "Set vector output signal to a time varying vector Real expression" parameter Integer n "Dimension of output signal"; Modelica.Blocks.Interfaces.RealOutput[n] y "Value of Real output"; end RealVectorExpression; initial equation assert(Medium.nXi < 2, "The medium must have zero or one independent mass fraction Medium.nXi."); equation connect(con.outlet, fluPor); connect(senMasFlo.m_flow, con.m_flow); connect(hSup.y, con.h); for i in 1:nPorts loop connect(XiSup[i].y, con[i].Xi); connect(CSup[i].y, con[i].C); end for; connect(senMasFlo.port_b, bou.ports); connect(ports, senMasFlo.port_a); connect(con[1].TAirZon, bou.T_in); connect(con[1].X_wZon, x_w_toX.X_w); connect(x_w_toX.X, bou.X_in); connect(con[1].CZon, bou.C_in); connect(con.TAirZon, TAirZon); connect(con.X_wZon, X_wZon); connect(con.CZon, CZon); end HVAC;

Buildings.Fluid.FMI.Adaptors.Inlet Buildings.Fluid.FMI.Adaptors.Inlet

Adaptor for connecting a fluid inlet to the FMI interface

Buildings.Fluid.FMI.Adaptors.Inlet

Information

Model that is used to connect an input signal to a fluid port. The model needs to be used in conjunction with an instance of Buildings.Fluid.FMI.Adaptors.Outlet in order for fluid mass flow rate and pressure to be properly assigned to the acausal fluid models.

See Buildings.Fluid.FMI.ExportContainers.PartialTwoPort or Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume for how to use this model.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model within the source
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium model within the source
InletinletFluid inlet
FluidPort_bport_bFluid port
output PressureOutputpPressure [Pa]

Modelica definition

model Inlet "Adaptor for connecting a fluid inlet to the FMI interface" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model within the source"; parameter Boolean allowFlowReversal = true "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; parameter Boolean use_p_in = true "= true to use a pressure from connector, false to output Medium.p_default"; Buildings.Fluid.FMI.Interfaces.Inlet inlet( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Fluid inlet"; Modelica.Fluid.Interfaces.FluidPort_b port_b( redeclare final package Medium=Medium) "Fluid port"; Buildings.Fluid.FMI.Interfaces.PressureOutput p if use_p_in "Pressure"; protected Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal( redeclare final package Medium = Medium) "Internal connector for fluid properties for back flow"; Buildings.Fluid.FMI.Interfaces.PressureOutput p_in_internal "Internal connector for pressure"; Buildings.Fluid.FMI.Interfaces.MassFractionConnector X_w_in_internal "Internal connector for mass fraction of forward flow properties"; Buildings.Fluid.FMI.Interfaces.MassFractionConnector X_w_out_internal "Internal connector for mass fraction of backward flow properties"; initial equation assert(Medium.nXi < 2, "The medium must have zero or one independent mass fraction Medium.nXi."); equation // To locally balance the model, the pressure is only imposed at the // outlet model. // The sign is negative because inlet.m_flow > 0 // means that fluid flows out of this component -port_b.m_flow = inlet.m_flow; port_b.h_outflow = Medium.specificEnthalpy_pTX( p = p_in_internal, T = inlet.forward.T, X = if Medium.nXi == 1 then cat(1, {X_w_in_internal}, {1-X_w_in_internal}) else zeros(Medium.nX)); port_b.C_outflow = inlet.forward.C; // Conditional connector for mass fraction for forward flow if Medium.nXi == 0 then X_w_in_internal = 0; else connect(X_w_in_internal, inlet.forward.X_w); end if; port_b.Xi_outflow = fill(X_w_in_internal, Medium.nXi); // Conditional connector for flow reversal connect(inlet.backward, bacPro_internal); // Mass fraction for reverse flow X_w_out_internal = if Medium.nXi > 0 and allowFlowReversal then inStream(port_b.Xi_outflow[1]) else 0; connect(bacPro_internal.X_w, X_w_out_internal); if allowFlowReversal then bacPro_internal.T = Medium.temperature_phX( p = p_in_internal, h = inStream(port_b.h_outflow), X = cat(1, inStream(port_b.Xi_outflow), {1-sum(inStream(port_b.Xi_outflow))})); bacPro_internal.C = inStream(port_b.C_outflow); else bacPro_internal.T = Medium.T_default; bacPro_internal.C = fill(0, Medium.nC); end if; // Conditional connectors for pressure if use_p_in then connect(inlet.p, p_in_internal); else p_in_internal = Medium.p_default; end if; connect(p, p_in_internal); end Inlet;

Buildings.Fluid.FMI.Adaptors.Outlet Buildings.Fluid.FMI.Adaptors.Outlet

Adaptor for connecting a fluid outlet to the FMI interface

Buildings.Fluid.FMI.Adaptors.Outlet

Information

Model that is used to connect a fluid port with an output signal. The model needs to be used in conjunction with an instance of Buildings.Fluid.FMI.Adaptors.Inlet in order for fluid mass flow rate and pressure to be properly assigned to the acausal fluid models.

See Buildings.Fluid.FMI.ExportContainers.PartialTwoPort or Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume for how to use this model.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model within the source
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
replaceable package MediumMedium model within the source
OutletoutletFluid outlet
FluidPort_aport_aFluid port
input PressureInputpPressure to be sent to outlet [Pa]

Modelica definition

model Outlet "Adaptor for connecting a fluid outlet to the FMI interface" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model within the source"; parameter Boolean allowFlowReversal = true "= true to allow flow reversal, false restricts to design direction (inlet -> outlet)"; parameter Boolean use_p_in = true "= true to use a pressure from connector, false to output Medium.p_default"; Buildings.Fluid.FMI.Interfaces.Outlet outlet( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Fluid outlet"; Modelica.Fluid.Interfaces.FluidPort_a port_a( redeclare final package Medium=Medium) "Fluid port"; Buildings.Fluid.FMI.Interfaces.PressureInput p if use_p_in "Pressure to be sent to outlet"; protected Buildings.Fluid.FMI.Interfaces.FluidProperties bacPro_internal( redeclare final package Medium = Medium) "Internal connector for fluid properties for back flow"; Buildings.Fluid.FMI.Interfaces.PressureOutput p_in_internal "Internal connector for pressure"; Buildings.Fluid.FMI.Interfaces.MassFractionConnector X_w_in_internal "Internal connector for mass fraction of forward flow properties"; Buildings.Fluid.FMI.Interfaces.MassFractionConnector X_w_out_internal "Internal connector for mass fraction of backward flow properties"; initial equation assert(Medium.nXi < 2, "The medium must have zero or one independent mass fraction Medium.nXi."); equation port_a.m_flow = outlet.m_flow; outlet.forward.T = Medium.temperature_phX( p = p_in_internal, h = inStream(port_a.h_outflow), X = cat(1, inStream(port_a.Xi_outflow), {1-sum(inStream(port_a.Xi_outflow))})); inStream(port_a.C_outflow) = outlet.forward.C; // Mass fraction for forward flow X_w_in_internal = if Medium.nXi > 0 then inStream(port_a.Xi_outflow[1]) else 0; connect(outlet.forward.X_w, X_w_in_internal); // Conditional connector for mass fraction for backward flow if Medium.nXi > 0 and allowFlowReversal then connect(X_w_out_internal, outlet.backward.X_w); else X_w_out_internal = 0; end if; port_a.Xi_outflow = fill(X_w_out_internal, Medium.nXi); // Conditional connector for flow reversal connect(outlet.backward, bacPro_internal); if not allowFlowReversal then bacPro_internal.T = Medium.T_default; bacPro_internal.C = fill(0, Medium.nC); if Medium.nXi > 0 then // This test for nXi is needed for Buildings.Fluid.FMI.Validation.HeaterFan_noReverseFlow // to work with Buildings.Media.Water connect(bacPro_internal.X_w, X_w_out_internal); end if; end if; bacPro_internal.T = Medium.temperature_phX( p = p_in_internal, h = port_a.h_outflow, X = port_a.Xi_outflow); bacPro_internal.C = port_a.C_outflow; // Conditional connectors for pressure if use_p_in then connect(outlet.p, p_in_internal); else p_in_internal = Medium.p_default; end if; connect(p, p_in_internal); port_a.p = p_in_internal; end Outlet;

Buildings.Fluid.FMI.Adaptors.ThermalZone Buildings.Fluid.FMI.Adaptors.ThermalZone

Adaptor for connecting a thermal zone to signal ports which then can be exposed at an FMI interface

Buildings.Fluid.FMI.Adaptors.ThermalZone

Information

Adaptor that can be used to connect a model of a thermal zone (with acausal ports) to input/output signals, which can be exposed in an FMI interface.

This model has a vector fluPor with dimension nPorts which can be exposed at the FMI interface for the connecting the HVAC system. These connectors contain for each fluid inlet the mass flow rate, the temperature, the water vapor mass fraction per total mass of the air (unless Medium.nXi=0), and the trace substances (unless Medium.nC=0).

The connector ports can be used to connect the model with a thermal zone. The number of connections to ports must be equal to nPorts.

Assumption and limitations

The mass flow rates at ports sum to zero, hence this model conserves mass. If the mass flow rates at fluPor do not sum to zero, then this model stops with an error.

This model does not impose any pressure, other than setting the pressure of all fluid connections to ports to be equal. The reason is that setting a pressure can lead to non-physical system models, for example if a mass flow rate is imposed and the HVAC system is connected to a model that sets a pressure boundary condition such as Buildings.Fluid.Sources.Outside. Also, setting a pressure would make it impossible to use multiple instances of this model (one for each thermal zone) and build in Modelica an airflow network model with pressure driven mass flow rates.

The model has no pressure drop.

Typical use

See Buildings.Fluid.FMI.ExportContainers.ThermalZone for a model that uses this model.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model within the source
IntegernPorts Number of fluid ports

Connectors

TypeNameDescription
replaceable package MediumMedium model within the source
InletfluPor[nPorts]Fluid connector
FluidPorts_bports[nPorts] 
HeatPort_aheaPorAirHeat port for sensible heat input

Modelica definition

model ThermalZone "Adaptor for connecting a thermal zone to signal ports which then can be exposed at an FMI interface" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model within the source"; // Don't use annotation(Dialog(connectorSizing=true)) for nPorts because // otherwise, in Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones // the fluid ports can not be assigned between the different zones by the user. parameter Integer nPorts(final min=2) "Number of fluid ports"; Interfaces.Inlet fluPor[nPorts]( redeclare each final package Medium = Medium, each final allowFlowReversal=true, each final use_p_in=false) "Fluid connector"; Modelica.Fluid.Interfaces.FluidPorts_b ports[nPorts]( redeclare each final package Medium = Medium); Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heaPorAir "Heat port for sensible heat input"; protected x_i_toX_w x_i_toX( redeclare final package Medium = Medium) if Medium.nXi > 0 "Conversion from x_i to X_w"; RealVectorExpression XiSup( final n=Medium.nXi, final y=inStream(ports[1].Xi_outflow)) if Medium.nXi > 0 "Water vapor concentration of supply air"; RealVectorExpression CSup( final n=Medium.nC, final y=inStream(ports[1].C_outflow)) if Medium.nC > 0 "Trace substance concentration of supply air"; Sources.MassFlowSource_T bou[nPorts]( each final nPorts=1, redeclare each final package Medium = Medium, each final use_T_in=true, each final use_C_in=Medium.nC > 0, each final use_X_in=Medium.nXi > 0, each use_m_flow_in=true) "Mass flow source"; Conversion.InletToAir con[nPorts](redeclare each final package Medium = Medium) "Connector between FMI signals and real input and real outputs"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemAir "Room air temperature sensor"; BaseClasses.X_w_toX x_w_toX[nPorts](redeclare final package Medium = Medium) if Medium.nXi > 0 "Conversion from X_w to X"; Modelica.Blocks.Math.MultiSum multiSum(final nu=nPorts, final k=fill(1, nPorts)) "Sum of air mass flow rates"; Buildings.Utilities.Diagnostics.AssertEquality assEqu( message="\"Mass flow rate does not balance. The sum needs to be zero.", threShold=1E-4) "Tests whether the mass flow rates balance to zero"; Modelica.Blocks.Sources.Constant const(final k=0) "Outputs zero"; /////////////////////////////////////////////////////////////////////////// // Internal blocks block RealVectorExpression "Set vector output signal to a time varying vector Real expression" parameter Integer n "Dimension of output signal"; Modelica.Blocks.Interfaces.RealOutput[n] y "Value of Real output"; end RealVectorExpression; block x_i_toX_w "Conversion from Xi to X" extends Modelica.Blocks.Icons.Block; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model within the source"; Modelica.Blocks.Interfaces.RealInput Xi[Medium.nXi](each final unit="kg/kg") if Medium.nXi > 0 "Water vapor concentration in kg/kg total air"; Modelica.Blocks.Interfaces.RealOutput X_w( final unit="kg/kg") "Water vapor concentration in kg/kg total air"; 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"; equation // Conditional connector connect(Xi_internal, Xi); if Medium.nXi == 0 then Xi_internal = zeros(Medium.nXi); end if; X_w_internal = sum(Xi_internal); connect( X_w, X_w_internal); end x_i_toX_w; initial equation assert(Medium.nXi < 2, "The medium must have zero or one independent mass fraction Medium.nXi."); equation for i in 1:nPorts loop connect(bou[i].ports[1], ports[i]); end for; connect(con.inlet, fluPor); connect(con.X_w, x_w_toX.X_w); connect(x_w_toX.X, bou.X_in); connect(con.C, bou.C_in); connect(heaPorAir, senTemAir.port); connect(XiSup.y, x_i_toX.Xi); connect(con.T, bou.T_in); connect(con[1:nPorts].m_flow, multiSum.u[1:nPorts]); connect(multiSum.y, assEqu.u2); connect(const.y, assEqu.u1); for i in 1:nPorts loop connect(senTemAir.T, con[i].TAirZon); if Medium.nXi > 0 then connect(x_i_toX.X_w, con[i].X_wZon); end if; connect(CSup.y, con[i].CZon); end for; connect(bou.m_flow_in, con.m_flow); end ThermalZone;

Buildings.Fluid.FMI.Adaptors.HVAC.RealVectorExpression Buildings.Fluid.FMI.Adaptors.HVAC.RealVectorExpression

Set vector output signal to a time varying vector Real expression

Buildings.Fluid.FMI.Adaptors.HVAC.RealVectorExpression

Information

The (time varying) vector Real output signal of this block can be defined in its parameter menu via variable y. The purpose is to support the easy definition of vector-valued Real expressions in a block diagram.

Parameters

TypeNameDefaultDescription
Integern Dimension of output signal
Time varying output signal
RealOutputy[n] Value of Real output

Connectors

TypeNameDescription
Time varying output signal
output RealOutputy[n]Value of Real output

Modelica definition

block RealVectorExpression "Set vector output signal to a time varying vector Real expression" parameter Integer n "Dimension of output signal"; Modelica.Blocks.Interfaces.RealOutput[n] y "Value of Real output"; end RealVectorExpression;

Buildings.Fluid.FMI.Adaptors.ThermalZone.x_i_toX_w Buildings.Fluid.FMI.Adaptors.ThermalZone.x_i_toX_w

Conversion from Xi to X

Buildings.Fluid.FMI.Adaptors.ThermalZone.x_i_toX_w

Information

Block that converts a vector input for the water mass fraction Xi to a scalar output X. This is needed for models in which a scalar input signal Xi that may be conditionally removed is to be connected to a model with a vector input X, because the conversion from scalar to vector needs to access the conditional connector, but conditional connectors can only be used in connect statements.

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model within the source

Connectors

TypeNameDescription
replaceable package MediumMedium model within the source
input RealInputXi[Medium.nXi]Water vapor concentration in kg/kg total air [kg/kg]
output RealOutputX_wWater vapor concentration in kg/kg total air [kg/kg]

Modelica definition

block x_i_toX_w "Conversion from Xi to X" extends Modelica.Blocks.Icons.Block; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model within the source"; Modelica.Blocks.Interfaces.RealInput Xi[Medium.nXi](each final unit="kg/kg") if Medium.nXi > 0 "Water vapor concentration in kg/kg total air"; Modelica.Blocks.Interfaces.RealOutput X_w( final unit="kg/kg") "Water vapor concentration in kg/kg total air"; 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"; equation // Conditional connector connect(Xi_internal, Xi); if Medium.nXi == 0 then Xi_internal = zeros(Medium.nXi); end if; X_w_internal = sum(Xi_internal); connect( X_w, X_w_internal); end x_i_toX_w;

Buildings.Fluid.FMI.Adaptors.ThermalZone.RealVectorExpression Buildings.Fluid.FMI.Adaptors.ThermalZone.RealVectorExpression

Set vector output signal to a time varying vector Real expression

Buildings.Fluid.FMI.Adaptors.ThermalZone.RealVectorExpression

Information

The (time varying) vector Real output signal of this block can be defined in its parameter menu via variable y. The purpose is to support the easy definition of vector-valued Real expressions in a block diagram.

Parameters

TypeNameDefaultDescription
Integern Dimension of output signal
Time varying output signal
RealOutputy[n] Value of Real output

Connectors

TypeNameDescription
Time varying output signal
output RealOutputy[n]Value of Real output

Modelica definition

block RealVectorExpression "Set vector output signal to a time varying vector Real expression" parameter Integer n "Dimension of output signal"; Modelica.Blocks.Interfaces.RealOutput[n] y "Value of Real output"; end RealVectorExpression;