Buildings.Fluid.FMI.ExportContainers

Package with containers to export thermofluid flow models

Information

This package contains containers that can be used, either with replaceable models or through object inheritance, to export HVAC models, HVAC systems and thermal zones. See the Buildings.Fluid.FMI.UsersGuide for instructions.

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

Package Content

Name Description
Buildings.Fluid.FMI.ExportContainers.HVACZone HVACZone Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU
Buildings.Fluid.FMI.ExportContainers.HVACZones HVACZones Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU
Buildings.Fluid.FMI.ExportContainers.PartialTwoPort PartialTwoPort Partial block to be used as a container to export a thermofluid flow model with two ports
Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort ReplaceableTwoPort Container to export thermofluid flow models with two ports as an FMU
Buildings.Fluid.FMI.ExportContainers.ThermalZone ThermalZone Partial block to export a model of a thermal zone as an FMU
Buildings.Fluid.FMI.ExportContainers.ThermalZones ThermalZones Partial block to export a model of multiple thermal zones as an FMU
Buildings.Fluid.FMI.ExportContainers.Examples Examples Collection of models that illustrate model use and test models
Buildings.Fluid.FMI.ExportContainers.Validation Validation Collection of validation models

Buildings.Fluid.FMI.ExportContainers.HVACZone Buildings.Fluid.FMI.ExportContainers.HVACZone

Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU

Buildings.Fluid.FMI.ExportContainers.HVACZone

Information

Model that is used as a container for an HVAC system that is to be exported as an FMU and that serves a single zone.

Typical use and important parameters

To use this model as a container for an FMU, extend from this model, rather than instantiate it, and add your HVAC system. By extending from this model, the top-level signal connectors on the right stay at the top-level, and hence will be visible at the FMI interface. The example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZone shows how a simple HVAC system can be implemented and exported as an FMU. The example Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC shows how such an FMU can be connected to a room model that has signal flow.

The conversion between the fluid ports and signal ports is done in the HVAC adapter hvacAda. This adapter has a vector of fluid ports called ports. The supply and return air ducts, including any resistance model for the inlet diffusor or exhaust grill, need to be connected to these ports. Also, if a thermal zone has interzonal air exchange or air infiltration, these flows need to 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 needs 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(·, ·), the energy balance would be wrong.

The input signals of this model are the zone radiative temperature. The 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) are obtained from the connector fluPor.backward. The outflowing fluid stream(s) at the port ports will be at the states obtained from fluPor.backward. All fluid streams at port ports are at the same pressure. For convenience, the instance hvacAda also outputs the properties obtained from fluPor.backward. These can be used to connect a controller. The properties are available for each flow path in fluPor.backward. For a thermal zone with mixed air, these are all equal, while for a stratified room model, they can be different.

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

For models that multiple thermal zones connected to the HVAC system, use the model Buildings.Fluid.FMI.ExportContainers.HVACZones.

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 needs to be modelled in models that are connected to ports.

Parameters

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

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
OutletfluPor[size(hvacAda.fluPor, 1)]Fluid connector
input RealInputTRadZonRadiative temperature of the zone [K]
output RealOutputQGaiRad_flowRadiant heat input into zone (positive if heat gain) [W]
output RealOutputQGaiSenCon_flowConvective sensible heat input into zone (positive if heat gain) [W]
output RealOutputQGaiLat_flowLatent heat input into zone (positive if heat gain) [W]

Modelica definition

partial block HVACZone "Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; // Set allowFlowReversal = true to get access to the states of the zone. Interfaces.Outlet fluPor[size(hvacAda.fluPor, 1)]( redeclare each final package Medium = Medium, each final use_p_in=false, each final allowFlowReversal=true) "Fluid connector"; Modelica.Blocks.Interfaces.RealInput TRadZon( final unit="K", displayUnit="degC") "Radiative temperature of the zone"; Modelica.Blocks.Interfaces.RealOutput QGaiRad_flow(final unit="W") "Radiant heat input into zone (positive if heat gain)"; Modelica.Blocks.Interfaces.RealOutput QGaiSenCon_flow(final unit="W") "Convective sensible heat input into zone (positive if heat gain)"; Modelica.Blocks.Interfaces.RealOutput QGaiLat_flow(final unit="W") "Latent heat input into zone (positive if heat gain)"; Adaptors.HVAC hvacAda(redeclare final package Medium = Medium) "Adapter between the HVAC supply and return air, and its connectors for the FMU"; equation connect(hvacAda.fluPor, fluPor); end HVACZone;

Buildings.Fluid.FMI.ExportContainers.HVACZones Buildings.Fluid.FMI.ExportContainers.HVACZones

Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU

Buildings.Fluid.FMI.ExportContainers.HVACZones

Information

Model that is used as a container for an HVAC system that is to be exported as an FMU and that serves multiple zones.

Typical use and important parameters

To use this model as a container for an FMU, simply extend from this model, rather than instantiate it, and add your HVAC system. By extending from this model, the top-level signal connectors on the right stay at the top-level, and hence will be visible at the FMI interface. The example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones shows how a simple HVAC system that serves two rooms can be implemented and exported as an FMU. The example Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC shows how such an FMU can be connected to a room model that has signal flow.

The following two parameters need to be assigned by the user: Set nZon to the number of thermal zones to which the FMU will be connected. Set nPorts to the largest number of fluid ports that the thermal zones has. For example, if nZon=2 and zone 1 has one inlet and one outlet (hence it has 2 ports), and zone 2 has one inlets and two outlets (hence it has 3 ports), then set nPorts=3. This will add more fluid ports than are needed for zone 1, but this causes no overhead if they are not connected.

The conversion between the fluid ports and signal ports is done in the HVAC adapter hvacAda. This adapter has a vector of fluid ports called ports. The supply and return air ducts, including any resistance model for the inlet diffusor or exhaust grill, need to be connected to these ports. Also, if a thermal zone has interzonal air exchange or air infiltration, these flows need to 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(·, ·), the energy balance would be wrong.

The input signals of this model are the radiative temperature of each zone. The the zone air temperatures, the water vapor mass fractions per total mass of the air (unless Medium.nXi=0) and trace substances (unless Medium.nC=0) are obtained from the connector fluPor.backward. The outflowing fluid stream(s) at the port ports will be at the states obtained from fluPor.backward. For any given izon ∈ {1, ..., nzon}, for each iports ∈ {1, ..., nports} all fluid streams at port ports[izon, iports] are at the same pressure. For convenience, the instance hvacAda also outputs the properties obtained from fluPor.backward. These can be used to connect a controller. The properties are available for each flow path in fluPor.backward. For a thermal zone with mixed air, these are all equal, while for a stratified room model, they can be different.

See Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HVACZones for a model that uses this model.

For models that only have one thermal zone connected to the HVAC system, use the simpler model Buildings.Fluid.FMI.ExportContainers.HVACZone.

Assumption and limitations

The mass flow rates at ports sum to zero, hence this model conserves mass for each thermal zone.

This model does not impose any pressure, other than, for any given izon ∈ {1, ..., nzon} and for each j,k ∈ {1, ..., nports}, setting the pressure of ports[izon, j].p = ports[izon, k].p to be the same. 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 needs to be modelled in models that are connected to ports.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
IntegernZon Number of thermal zones served by the HVAC system
IntegernPorts Number of fluid ports for each zone (must be the same for every zone)

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
OutletfluPor[nZon, nPorts]Fluid connectors
input RealInputTRadZon[nZon]Radiative temperature of the zone [K]
output RealOutputQGaiRad_flow[nZon]Radiant heat input into the zones (positive if heat gain) [W]
output RealOutputQGaiSenCon_flow[nZon]Convective sensible heat input into the zones (positive if heat gain) [W]
output RealOutputQGaiLat_flow[nZon]Latent heat input into the zones (positive if heat gain) [W]

Modelica definition

partial block HVACZones "Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Integer nZon(min=1) "Number of thermal zones served by the HVAC system"; parameter Integer nPorts(min=2) "Number of fluid ports for each zone (must be the same for every zone)"; // Set allowFlowReversal = true to get access to the states of the zone. Interfaces.Outlet fluPor[nZon, nPorts]( redeclare each final package Medium = Medium, each final use_p_in = false, each final allowFlowReversal = true) "Fluid connectors"; Modelica.Blocks.Interfaces.RealInput TRadZon[nZon]( each final unit="K", each displayUnit="degC") "Radiative temperature of the zone"; Modelica.Blocks.Interfaces.RealOutput QGaiRad_flow[nZon](each final unit="W") "Radiant heat input into the zones (positive if heat gain)"; Modelica.Blocks.Interfaces.RealOutput QGaiSenCon_flow[nZon](each final unit="W") "Convective sensible heat input into the zones (positive if heat gain)"; Modelica.Blocks.Interfaces.RealOutput QGaiLat_flow[nZon](each final unit="W") "Latent heat input into the zones (positive if heat gain)"; Adaptors.HVAC hvacAda[nZon](redeclare each final package Medium = Medium, each final nPorts=nPorts) "Adapter between the HVAC supply and return air, and its connectors for the FMU"; equation for iZon in 1:nZon loop for iPor in 1:nPorts loop connect(hvacAda[iZon].fluPor[iPor], fluPor[iZon, iPor]); end for; end for; end HVACZones;

Buildings.Fluid.FMI.ExportContainers.PartialTwoPort Buildings.Fluid.FMI.ExportContainers.PartialTwoPort

Partial block to be used as a container to export a thermofluid flow model with two ports

Buildings.Fluid.FMI.ExportContainers.PartialTwoPort

Information

Partial model that can be used to export thermofluid flow models as an FMU. This model only declares the inlet and outlet ports, the medium and whether flow reversal is allowed.

See Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ResistanceVolume for a block that extends this partial block.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
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 in the component
InletinletFluid inlet
OutletoutletFluid outlet

Modelica definition

partial block PartialTwoPort "Partial block to be used as a container to export a thermofluid flow model with two ports" 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)"; parameter Boolean use_p_in = true "= true to use a pressure from connector, false to output Medium.p_default"; Interfaces.Inlet inlet( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Fluid inlet"; Interfaces.Outlet outlet( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Fluid outlet"; end PartialTwoPort;

Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort

Container to export thermofluid flow models with two ports as an FMU

Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort

Information

Block that serves as a container to export a thermofluid flow component. This block contains a replaceable model com that needs to be redeclared to export any model that has as its base class Buildings.Fluid.Interfaces.PartialTwoPort. This allows exporting a large variety of thermofluid flow models with a simple redeclare.

See for example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.PressureDrop or Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u for how to use this block.

Note that this block must not be used if the instance com sets a constant pressure. In such a situation, use Buildings.Fluid.FMI.ExportContainers.PartialTwoPort together with Buildings.Fluid.FMI.Adaptors.Inlet and Buildings.Fluid.FMI.Adaptors.Outlet and set the pressure to be equal to the port p of Buildings.Fluid.FMI.Adaptors.Outlet.

Extends from Buildings.Fluid.FMI.ExportContainers.PartialTwoPort (Partial block to be used as a container to export a thermofluid flow model with two ports).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_p_intrue= true to use a pressure from connector, false to output Medium.p_default
PartialTwoPortcomredeclare Buildings.Fluid.In...Component that holds the actual model
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (inlet -> outlet)

Connectors

TypeNameDescription
InletinletFluid inlet
OutletoutletFluid outlet

Modelica definition

block ReplaceableTwoPort "Container to export thermofluid flow models with two ports as an FMU" extends Buildings.Fluid.FMI.ExportContainers.PartialTwoPort; replaceable Buildings.Fluid.Interfaces.PartialTwoPort com constrainedby Buildings.Fluid.Interfaces.PartialTwoPort( redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal) "Component that holds the actual model"; Modelica.Blocks.Sources.RealExpression dpCom(y=com.port_a.p - com.port_b.p) if use_p_in "Pressure drop of the component"; protected Buildings.Fluid.FMI.Adaptors.Inlet bouIn( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Boundary model for inlet"; Buildings.Fluid.FMI.Adaptors.Outlet bouOut( redeclare final package Medium=Medium, final allowFlowReversal=allowFlowReversal, final use_p_in=use_p_in) "Boundary component for outlet"; Modelica.Blocks.Math.Feedback pOut if use_p_in "Pressure at component outlet"; equation connect(pOut.u1, bouIn.p); connect(com.port_a, bouIn.port_b); connect(com.port_b, bouOut.port_a); connect(inlet, bouIn.inlet); connect(bouOut.outlet, outlet); connect(dpCom.y, pOut.u2); connect(pOut.y, bouOut.p); end ReplaceableTwoPort;

Buildings.Fluid.FMI.ExportContainers.ThermalZone Buildings.Fluid.FMI.ExportContainers.ThermalZone

Partial block to export a model of a thermal zone as an FMU

Buildings.Fluid.FMI.ExportContainers.ThermalZone

Information

Model that is used as a container for a single thermal zone that is to be exported as an FMU.

Typical use and important parameters

To use this model as a container for an FMU, extend from this model, rather than instantiate it, add your thermal zone and a vector of mass flow rate sensors. By extending from this model, the top-level signal connectors on the left stay at the top-level, and hence will be visible at the FMI interface.

Note that

The example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone shows how a simple thermal zone can be implemented and exported as an FMU. The example Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC shows how such an FMU can be connected to an HVAC system that has signal flow.

The conversion between the fluid ports and signal ports is done in the thermal zone adapter theZonAda. This adapter has a vector of fluid ports called ports[nPorts] which needs to be connected to the air volume of the thermal zone. At this port, air exchanged between the thermal zone, the HVAC system and any infiltration flow paths.

This model has input signals fluPor[nPorts], which carry 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. 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(·, ·), the energy balance would be wrong. Models in the package Buildings.ThermalZones.Detailed as well as the control volumes in Buildings.Fluid.MixingVolumes implement such a max(·, ·) function.

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) can be obtained from the outupt connector fluPor.backward. These signals are the same as the inflowing fluid stream(s) at the port theAdaZon.ports[1:nPorts]. The fluid connector ports[nPorts] has a prescribed mass flow rate, but it does not set any pressure.

This model has a user-defined parameter nPorts which sets the number of fluid ports, which in turn is used for the ports fluPor and ports. All nPorts ports[1:nPorts] need to be connected as demonstrated in the example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZone.

The example Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC shows conceptually how such an FMU can then be connected to a HVAC system that has signal flow.

Parameters

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

Connectors

TypeNameDescription
replaceable package MediumMedium model
InletfluPor[nPorts]Fluid connector

Modelica definition

partial block ThermalZone "Partial block to export a model of a thermal zone as an FMU" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model"; parameter Integer nPorts(min=2) "Number of fluid ports"; Interfaces.Inlet fluPor[nPorts]( redeclare each final package Medium = Medium, each final use_p_in=false, each final allowFlowReversal=true) "Fluid connector"; Adaptors.ThermalZone theZonAda( redeclare final package Medium = Medium, final nPorts=nPorts) "Adapter between the HVAC supply and return air, and its connectors for the FMU"; equation connect(theZonAda.fluPor, fluPor); end ThermalZone;

Buildings.Fluid.FMI.ExportContainers.ThermalZones Buildings.Fluid.FMI.ExportContainers.ThermalZones

Partial block to export a model of multiple thermal zones as an FMU

Buildings.Fluid.FMI.ExportContainers.ThermalZones

Information

Model that is used as a container for a multiple thermal zones that are to be exported as an FMU.

Typical use and important parameters

To use this model as a container for an FMU, extend from this model, rather than instantiate it, add your thermal zones. For each thermal zone, add a vector of mass flow rate sensors. By extending from this model, the top-level signal connectors on the left stay at the top-level, and hence will be visible at the FMI interface.

Note that

The example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZones shows how multiple simple thermal zones can be implemented and exported as an FMU. The example Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC shows how such an FMU can be connected to an HVAC system that has signal flow.

The conversion between the fluid ports and signal ports is done in the thermal zone adapter theZonAda[nZon]. This adapter has a vector of fluid ports called ports[nPorts] which needs to be connected to the air volume of the thermal zones. At this port, air exchanged between the thermal zones, the HVAC system and any infiltration flow paths.

This model has input signals fluPor[nZon, nPorts] which carry the mass flow rate for each flow that is connected to ports[1:nPorts] for the respective zone, 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 respective 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. 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(·, ·), the energy balance would be wrong. Models in the package Buildings.ThermalZones.Detailed as well as the control volumes in Buildings.Fluid.MixingVolumes implement such a max(·, ·) function.

For each zone, its air temperature, water vapor mass fraction per total mass of the air (unless Medium.nXi=0) and trace substances (unless Medium.nC=0) can be obtained from the outupt connector fluPor[1:nZon].backward. These signals are the same as the inflowing fluid stream(s) at the port theAdaZon[1:nZon].ports[1:nPorts]. The fluid connector ports[nPorts] has a prescribed mass flow rate, but it does not set any pressure.

This model has a user-defined parameter nPorts which sets the number of fluid ports, which in turn is used for the ports fluPor and ports. All zones must have the same number of fluid ports nPorts. All nPorts ports[1:nPorts] need to be connected as demonstrated in the example Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.ThermalZones.

The example Buildings.Fluid.FMI.ExportContainers.Validation.RoomHVAC shows conceptually how such an FMU can then be connected to a HVAC system that has signal flow.

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model
IntegernZon Number of thermal zones in this container
IntegernPorts Number of fluid ports for each zone (must be the same for every zone)

Connectors

TypeNameDescription
replaceable package MediumMedium model
InletfluPor[nZon, nPorts]Fluid connectors

Modelica definition

partial block ThermalZones "Partial block to export a model of multiple thermal zones as an FMU" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model"; parameter Integer nZon(min=1) "Number of thermal zones in this container"; parameter Integer nPorts(min=2) "Number of fluid ports for each zone (must be the same for every zone)"; Interfaces.Inlet fluPor[nZon, nPorts]( redeclare each final package Medium = Medium, each final use_p_in=false, each final allowFlowReversal=true) "Fluid connectors"; Adaptors.ThermalZone theZonAda[nZon]( redeclare each final package Medium = Medium, each final nPorts=nPorts) "Adapter between the HVAC supply and return air, and its connectors for the FMU"; equation for iZon in 1:nZon loop for iPor in 1:nPorts loop connect(theZonAda[iZon].fluPor[iPor], fluPor[iZon, iPor]); end for; end for; end ThermalZones;