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 |
---|---|
HVACZone | Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU |
HVACZones | Partial block to export an HVAC system that has no radiative component and that serves multiple zones as an FMU |
PartialTwoPort | Partial block to be used as a container to export a thermofluid flow model with two ports |
ReplaceableTwoPort | Container to export thermofluid flow models with two ports as an FMU |
ThermalZone | Partial block to export a model of a thermal zone as an FMU |
ThermalZones | Partial block to export a model of multiple thermal zones as an FMU |
Examples | Collection of models that illustrate model use and test models |
Validation | Collection of validation models |
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
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
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component |
Connectors
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium in the component | |
Outlet | fluPor[size(hvacAda.fluPor, 1)] | Fluid connector |
input RealInput | TRadZon | Radiative temperature of the zone [K] |
output RealOutput | QGaiRad_flow | Radiant heat input into zone (positive if heat gain) [W] |
output RealOutput | QGaiSenCon_flow | Convective sensible heat input into zone (positive if heat gain) [W] |
output RealOutput | QGaiLat_flow | Latent heat input into zone (positive if heat gain) [W] |
Modelica definition
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
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
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Integer | nZon | nZon(min=1) | Number of thermal zones served by the HVAC system |
Integer | nPorts | nPorts(min=2) | Number of fluid ports for each zone (must be the same for every zone) |
Connectors
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium in the component | |
Outlet | fluPor[nZon, nPorts] | Fluid connectors |
input RealInput | TRadZon[nZon] | Radiative temperature of the zone [K] |
output RealOutput | QGaiRad_flow[nZon] | Radiant heat input into the zones (positive if heat gain) [W] |
output RealOutput | QGaiSenCon_flow[nZon] | Convective sensible heat input into the zones (positive if heat gain) [W] |
output RealOutput | QGaiLat_flow[nZon] | Latent heat input into the zones (positive if heat gain) [W] |
Modelica definition
Buildings.Fluid.FMI.ExportContainers.PartialTwoPort
Partial block to be used as a container to export a thermofluid flow model with two ports
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
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Boolean | use_p_in | true | = true to use a pressure from connector, false to output Medium.p_default |
Assumptions | |||
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 inlet |
Outlet | outlet | Fluid outlet |
Modelica definition
Buildings.Fluid.FMI.ExportContainers.ReplaceableTwoPort
Container to export thermofluid flow models with two ports as an FMU
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
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | PartialMedium | Medium in the component | |
Boolean | use_p_in | true | = true to use a pressure from connector, false to output Medium.p_default |
PartialTwoPort | com | redeclare Buildings.Fluid.In... | Component that holds the actual model |
Assumptions | |||
Boolean | allowFlowReversal | true | = true to allow flow reversal, false restricts to design direction (inlet -> outlet) |
Connectors
Type | Name | Description |
---|---|---|
Inlet | inlet | Fluid inlet |
Outlet | outlet | Fluid outlet |
Modelica definition
Buildings.Fluid.FMI.ExportContainers.ThermalZone
Partial block to export a model of a thermal zone as an FMU
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 vector of mass flow rate sensors is used to connect the thermal zone adapter and your thermal zone.
-
The vector of mass flow rate sensors must have the size
nPorts
. - All fluid ports of the mass flow rate sensor must be connected.
-
If the vector of mass flow rate sensors is not used, and your themal zone
has fluid ports which are autosized, then a direct connection between
the thermal zone adpater
theZonAda
and your thermal zone will be rejected. The reason is because autosized fluid ports can only be connected to vector of ports whose sizes are literal.
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.
For example,
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
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Integer | nPorts | nPorts(min=2) | Number of fluid ports |
Connectors
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium in the component | |
Inlet | fluPor[nPorts] | Fluid connector |
Modelica definition
Buildings.Fluid.FMI.ExportContainers.ThermalZones
Partial block to export a model of multiple thermal zones as an FMU
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- A vector of mass flow rate sensors is used to connect one element of the thermal zone adapter with one thermal zone.
- The size of the thermal zone adapter must be the same as the number of vectors of mass flow rate sensors.
-
The vector of mass flow rate sensors must have the size
nPorts
. - All fluid ports of the mass flow rate sensor must be connected.
-
If mass flow rate sensors are not used, and your themal zone
has fluid ports which are autosized, then a direct connection between
an element of the thermal zone adpater
theZonAda
and your thermal zone will be rejected. The reason is because autosized fluid ports can only be connected to vector of ports whose sizes are literal.
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.
For example,
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
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the component | |
Integer | nZon | nZon(min=1) | Number of thermal zones in this container |
Integer | nPorts | nPorts(min=2) | Number of fluid ports for each zone (must be the same for every zone) |
Connectors
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium in the component | |
Inlet | fluPor[nZon, nPorts] | Fluid connectors |