Coupling
EnergyPlus with Functional Mock-up Units for
co-simulation[LINK]
The Functional Mock-up Unit (FMU) for co-simulation import
for EnergyPlus allows EnergyPlus to conduct co-simulation with
various programs that are packaged as FMUs. A FMU is a
component which implements the Functional Mock-up Interface
(FMI) standard (http://www.modelisar.com).
A FMU is distributed in the form of a zip file that may
contain physical models, model descriptions, source code, and
executable programs for various platforms. The FMU for
co-simulation import provides EnergyPlus with a standard
interface to conduct and control co-simulation with an
arbitrary number of FMUs without any middle-ware, such as the
Building
Controls Virtual Test Bed (BCVTB Documentation, 2011).
The FMU for co-simulation import allows coupling of
continuous-time and discrete-time models exported from
different simulation programs. In the current implementation,
EnergyPlus is implemented as the co-simulation master. It
controls the data exchange between the subsystems and the
synchronization of all slave simulation programs.
The FMU for co-simulation import enables the direct link
between the EnergyPlus kernel and other simulation tools. It
will make the co-simulation easier to conduct as no
middle-ware is involved. This direct link will decrease
run-time by eliminating the transaction layer. In addition, by
separating the co-simulation interface from the EnergyPlus
kernel, the FMU interface is reusable when EnergyPlus is
updated. Furthermore, the FMU contains executable files that
have the same interface to EnergyPlus regardless of their
original programming environment. Some commercial tools allow
running their FMU without licensing requirement.
Notes:
1) The current implementation of FMU for co-simulation is
only supported on Windows and Linux.
2) FMUs must be in a folder to which the user has
write access.
Prior to describing the data exchange between EnergyPlus
and FMUs, some definitions and terminologies used in the
remainder of this document will be introduced.
A variable of a system described by a system of
differential algebraic equations (DAE) is defined as
differential variable if its derivatives are present in the
DAE. A variable of a system described by a system of DAE is
defined as algebraic if its derivatives do not appear
explicitly in the DAE (Fabian et al., 2008).
System with two variables that
could be either differential or algebraic variables. [fig:system-with-two-variables-that-could-be]
Because in subsequent discussions, it will be distinguished
between algebraic and differential variables, a notation for
different system of equations that involve algebraic and
differential variables will be introduced. Let \(q\in\mathbf{N}\) , then
If x\(_{1}\) and x\(_{2}\) are differential
variables, then the system is
\(F\left(\dot x_1,x_1,\dot
x_2,x_2,u,t\right) = 0\) with F: ℝ\(^{n}\) x ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ\(^{m}\) x ℝ\(^{q}\) x ℝ → ℝ\(^{n+m}\).
If x\(_{1}\) is a
differential variable and x\(_{2}\) is an algebraic variable,
then the system is
\(G\left(\dot
x_1,x_1,x_2,u,t\right) = 0\) with G: ℝ\(^{n}\) x ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ\(^{q}\) x ℝ → ℝ\(^{n+m}\).
If x\(_{1}\) is an
algebraic variable and x\(_{2}\) is a differential
variable, then the system is
If x\(_{1}\) is an
algebraic variable and x\(_{2}\) is an algebraic variable,
then the system is
\(I\left(x_1,x_2,u,t\right) =
0\) with I: ℝ\(^{n}\) xℝ\(^{m}\) xℝ\(^{q}\) xℝ →ℝ\(^{n+m}\).
Figure 2 shows
a case where a FMU is linked to an EnergyPlus model for
co-simulation. The FMU and EnergyPlus could be linked through
differential or algebraic variables.
System with one FMU linked to
EnergyPlus. [fig:system-with-one-fmu-linked-to-energyplus.]
Table 1
shows the different system configurations that are
possible.
In the first case, the variable x\(_{1}\) and x\(_{2}\) are differential variables
in both systems.
In the second case, the variable x\(_{1}\) is a differential variable
and the variable x\(_{2}\) is
an algebraic variable.
In the third case, the variable x\(_{1}\) is an algebraic variable
and the variable x\(_{2}\) is
a differential variable.
In the fourth case, the variable x\(_{1}\) is an algebraic variable
and the variable x\(_{2}\) is
an algebraic variable.
In the current implementation, it will be focused on the
first and the second cases since the third and the fourth
cases will constrain the FMU to be solved numerically in the
iteration solver loop of EnergyPlus. This will necessitate the
ability of the FMU to reject time steps (Modelisar, 2010)
which is currently not implemented in the EnergyPlus FMU for
co-simulation import. Applications for case 1 and 2 are
described in the next sections.
Use cases with different system
configurations
Case
EnergyPlus
FMU (e.g. from Modelica)
(1)
Model1 (Differential
variable)
Model2 (Differential
variable)
(2)
Model1 (Differential
variable)
Model2 (Algebraic variable)
(3)
Model1 (Algebraic variable)
Model2 (Differential
variable)
(4)
Model1 (Algebraic variable)
Model2 (Algebraic variable)
Case
1: Linking two systems through differential variables[LINK]
This case could be for an application where a wall with a
phase change material (PCM) is modeled in a FMU and is linked
to a room model in EnergyPlus. The room air temperature is the
differential variable in EnergyPlus and the temperature of the
wall with PCM is the differential variable in the FMU. Each
system solves a differential equation that is connected to the
differential equation of the other system. For simplicity, we
assume that y\(_{1}\)(.) = x\(_{1}\)(.) and y\(_{2}\)(.) = x\(_{2}\)(.).The systems are
described by the ordinary differential equations
dx\(_{1}\)/dt = f\(_{1}\)(x\(_{1}\), x\(_{2}\)), with x\(_{1}\)(0) = x\(_{1,0}\) ,
dx\(_{2}\)/dt = f\(_{2}\)(x\(_{2}\), x\(_{1}\)), with x\(_{2}\)(0) = x\(_{2,0\\ .}\)
Let \(N\in\textbf{N}\)
denote the number of time steps and let t\(_{k}\) with \(k\in\left\{1,...,N\right\}\)
denote the time steps. We will use the subscripts 1
and 2 to denote the variables and the functions that
compute the next state variable of the simulator 1
and 2, respectively.
The first system computes, for \(k\in\left\{0,...,N-1\right\}\)
and some \(\tilde{F}_1\) :
ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ x ℝ → ℝ\(^{n}\), the sequence
with initial conditions x\(_{1}\)(0) = x\(_{1,0}\) and x\(_{2}\)(0) = x\(_{2,0.}\)\(\tilde{F}_1\) and \(\tilde{F}_2\) *are the functions
that are used to compute the value of the state variables at
the new time step
To advance from time t\(_{k}\) to t\(_{k+1}\), each system uses
its own time integration algorithm. At the end of the time
step, EnergyPlus sends the new state x\(_{1}\)(t\(_{k+1}\)) to the FMU and it
receives the state x\(_{2}\)(t\(_{k+1}\)) from the FMU. The
same procedure is done with the FMU.
Case
2: Linking two systems through algebraic and differential
variables[LINK]
This case could be for an application where a fan is
modeled in a FMU and is linked to a room model in EnergyPlus.
The room temperature is the differential variable in
EnergyPlus and the pressure difference of the fan is the
algebraic variable in the FMU. For simplicity, we assume that
y\(_{1}\)(.) =
x\(_{1}\)(.) and y\(_{2}\)(.) = x\(_{2}\)(.). In this
application, the systems are described by the following
equations
dx\(_{1}\)/dt = g\(_{1}\)(x\(_{1}\), x\(_{2}\)), with x\(_{1}\)(0) = x\(_{1,0,}\)
0 = g\(_{2}\)(x\(_{2}\), x\(_{1}\)).
Let \(N\in\mathbf{N}\)
denote the number of time steps and let t\(_{k}\) with \(k\in\left\{1,...,N\right\}\)
denote the time steps. We use the same subscripts 1
and 2 as for the first case to denote the variable
and the function that computes the next variable of the
simulator 1 and 2, respectively.
The first system computes, for \(k\in\left\{0,...,N-1\right\}\)
and some \(\tilde{G}_1\) :
ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ x ℝ → ℝ\(^{n}\), the sequence
with initial condition x\(_{1}\)(0) = x\(_{1,0}\). \(\tilde{G}_1\) and \(\tilde{G}_2\) are the functions
that compute the value of the variables at the new time
step.
To advance from time t\(_{k}\) to t\(_{k+1}\), each system uses
its own time integration algorithm. At the end of the time
step, EnergyPlus sends the new value x\(_{1}\)(t\(_{k+1}\)) to the FMU and it
receives the value x\(_{2}\)(t\(_{k+1}\)) from the FMU. The
same procedure is done with the FMU.
Coupling EnergyPlus with Functional Mock-up Units for co-simulation[LINK]
The Functional Mock-up Unit (FMU) for co-simulation import for EnergyPlus allows EnergyPlus to conduct co-simulation with various programs that are packaged as FMUs. A FMU is a component which implements the Functional Mock-up Interface (FMI) standard (http://www.modelisar.com).
A FMU is distributed in the form of a zip file that may contain physical models, model descriptions, source code, and executable programs for various platforms. The FMU for co-simulation import provides EnergyPlus with a standard interface to conduct and control co-simulation with an arbitrary number of FMUs without any middle-ware, such as the Building Controls Virtual Test Bed (BCVTB Documentation, 2011).
The FMU for co-simulation import allows coupling of continuous-time and discrete-time models exported from different simulation programs. In the current implementation, EnergyPlus is implemented as the co-simulation master. It controls the data exchange between the subsystems and the synchronization of all slave simulation programs.
The FMU for co-simulation import enables the direct link between the EnergyPlus kernel and other simulation tools. It will make the co-simulation easier to conduct as no middle-ware is involved. This direct link will decrease run-time by eliminating the transaction layer. In addition, by separating the co-simulation interface from the EnergyPlus kernel, the FMU interface is reusable when EnergyPlus is updated. Furthermore, the FMU contains executable files that have the same interface to EnergyPlus regardless of their original programming environment. Some commercial tools allow running their FMU without licensing requirement.
Notes:
1) The current implementation of FMU for co-simulation is only supported on Windows and Linux.
2) FMUs must be in a folder to which the user has write access.
Data exchange between EnergyPlus and FMUs[LINK]
Prior to describing the data exchange between EnergyPlus and FMUs, some definitions and terminologies used in the remainder of this document will be introduced.
A variable of a system described by a system of differential algebraic equations (DAE) is defined as differential variable if its derivatives are present in the DAE. A variable of a system described by a system of DAE is defined as algebraic if its derivatives do not appear explicitly in the DAE (Fabian et al., 2008).
Because in subsequent discussions, it will be distinguished between algebraic and differential variables, a notation for different system of equations that involve algebraic and differential variables will be introduced. Let \(q\in\mathbf{N}\) , then
\(F\left(\dot x_1,x_1,\dot x_2,x_2,u,t\right) = 0\) with F: ℝ\(^{n}\) x ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ\(^{m}\) x ℝ\(^{q}\) x ℝ → ℝ\(^{n+m}\).
\(G\left(\dot x_1,x_1,x_2,u,t\right) = 0\) with G: ℝ\(^{n}\) x ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ\(^{q}\) x ℝ → ℝ\(^{n+m}\).
\(H\left(x_1,\dot x_2,x_2,u,t\right) = 0\) with H: ℝ\(^{n}\) xℝ\(^{m}\) xℝ\(^{m}\) xℝ\(^{q}\) xℝ →ℝ\(^{n+m}\).
\(I\left(x_1,x_2,u,t\right) = 0\) with I: ℝ\(^{n}\) xℝ\(^{m}\) xℝ\(^{q}\) xℝ →ℝ\(^{n+m}\).
Figure 2 shows a case where a FMU is linked to an EnergyPlus model for co-simulation. The FMU and EnergyPlus could be linked through differential or algebraic variables.
Table 1 shows the different system configurations that are possible.
In the first case, the variable x\(_{1}\) and x\(_{2}\) are differential variables in both systems.
In the second case, the variable x\(_{1}\) is a differential variable and the variable x\(_{2}\) is an algebraic variable.
In the third case, the variable x\(_{1}\) is an algebraic variable and the variable x\(_{2}\) is a differential variable.
In the fourth case, the variable x\(_{1}\) is an algebraic variable and the variable x\(_{2}\) is an algebraic variable.
In the current implementation, it will be focused on the first and the second cases since the third and the fourth cases will constrain the FMU to be solved numerically in the iteration solver loop of EnergyPlus. This will necessitate the ability of the FMU to reject time steps (Modelisar, 2010) which is currently not implemented in the EnergyPlus FMU for co-simulation import. Applications for case 1 and 2 are described in the next sections.
Case 1: Linking two systems through differential variables[LINK]
This case could be for an application where a wall with a phase change material (PCM) is modeled in a FMU and is linked to a room model in EnergyPlus. The room air temperature is the differential variable in EnergyPlus and the temperature of the wall with PCM is the differential variable in the FMU. Each system solves a differential equation that is connected to the differential equation of the other system. For simplicity, we assume that y\(_{1}\)(.) = x\(_{1}\)(.) and y\(_{2}\)(.) = x\(_{2}\)(.).The systems are described by the ordinary differential equations
dx\(_{1}\)/dt = f\(_{1}\)(x\(_{1}\), x\(_{2}\)), with x\(_{1}\)(0) = x\(_{1,0}\) ,
dx\(_{2}\)/dt = f\(_{2}\)(x\(_{2}\), x\(_{1}\)), with x\(_{2}\)(0) = x\(_{2,0\\ .}\)
Let \(N\in\textbf{N}\) denote the number of time steps and let t\(_{k}\) with \(k\in\left\{1,...,N\right\}\) denote the time steps. We will use the subscripts 1 and 2 to denote the variables and the functions that compute the next state variable of the simulator 1 and 2, respectively.
The first system computes, for \(k\in\left\{0,...,N-1\right\}\) and some \(\tilde{F}_1\) : ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ x ℝ → ℝ\(^{n}\), the sequence
x\(_{1}\)(t\(_{k+1}\)) = \(\tilde{F}_1\) (x\(_{1}\)(t\(_{k}\)), x\(_{2}\)(t\(_{k}\)), t\(_{k}\), t\(_{k+1}\))
and, similarly, the simulator 2 computes for some \(\tilde{F}_2\) : ℝ\(^{m}\) x ℝ\(^{n}\) x ℝ x ℝ → ℝ\(^{m}\) the sequence
x\(_{2}\)(t\(_{k+1}\)) = \(\tilde{F}_2\) (x\(_{2}\)(t\(_{k}\)), x\(_{1}\)(t\(_{k}\)), t\(_{k}\), t\(_{k+1}\))
with initial conditions x\(_{1}\)(0) = x\(_{1,0}\) and x\(_{2}\)(0) = x\(_{2,0.}\) \(\tilde{F}_1\) and \(\tilde{F}_2\) *are the functions that are used to compute the value of the state variables at the new time step
To advance from time t\(_{k}\) to t\(_{k+1}\), each system uses its own time integration algorithm. At the end of the time step, EnergyPlus sends the new state x\(_{1}\)(t\(_{k+1}\)) to the FMU and it receives the state x\(_{2}\)(t\(_{k+1}\)) from the FMU. The same procedure is done with the FMU.
Case 2: Linking two systems through algebraic and differential variables[LINK]
This case could be for an application where a fan is modeled in a FMU and is linked to a room model in EnergyPlus. The room temperature is the differential variable in EnergyPlus and the pressure difference of the fan is the algebraic variable in the FMU. For simplicity, we assume that y\(_{1}\)(.) = x\(_{1}\)(.) and y\(_{2}\)(.) = x\(_{2}\)(.). In this application, the systems are described by the following equations
dx\(_{1}\)/dt = g\(_{1}\)(x\(_{1}\), x\(_{2}\)), with x\(_{1}\)(0) = x\(_{1,0,}\)
0 = g\(_{2}\)(x\(_{2}\), x\(_{1}\)).
Let \(N\in\mathbf{N}\) denote the number of time steps and let t\(_{k}\) with \(k\in\left\{1,...,N\right\}\) denote the time steps. We use the same subscripts 1 and 2 as for the first case to denote the variable and the function that computes the next variable of the simulator 1 and 2, respectively.
The first system computes, for \(k\in\left\{0,...,N-1\right\}\) and some \(\tilde{G}_1\) : ℝ\(^{n}\) x ℝ\(^{m}\) x ℝ x ℝ → ℝ\(^{n}\), the sequence
x\(_{1}\)(t\(_{k+1}\)) = \(\tilde{G}_1\) (x\(_{1}\)(t\(_{k}\)), x\(_{2}\)(t\(_{k}\)), t\(_{k}\), t\(_{k+1}\))
and, similarly, the simulator 2 computes for some \(\tilde{G}_2\) : ℝ\(^{m}\) x ℝ\(^{n}\) x ℝ → ℝ\(^{m}\) the sequence
x\(_{2}\)(t\(_{k+1}\)) = \(\tilde{G}_2\) (x\(_{2}\)(t\(_{k+1}\)), x\(_{1}\)(t\(_{k+1}\)), t\(_{k+1}\))
with initial condition x\(_{1}\)(0) = x\(_{1,0}\). \(\tilde{G}_1\) and \(\tilde{G}_2\) are the functions that compute the value of the variables at the new time step.
To advance from time t\(_{k}\) to t\(_{k+1}\), each system uses its own time integration algorithm. At the end of the time step, EnergyPlus sends the new value x\(_{1}\)(t\(_{k+1}\)) to the FMU and it receives the value x\(_{2}\)(t\(_{k+1}\)) from the FMU. The same procedure is done with the FMU.
Requirements[LINK]
The current implementation for linking EnergyPlus with the FMUs has the following requirements:
The data exchange between EnergyPlus and the FMUs is done at the zone time step of EnergyPlus.
Each FMU is linked to EnergyPlus only through a differential variable in EnergyPlus (see Figure 3 for one FMU).
Documentation content copyright © 1996-2026 The Board of Trustees of the University of Illinois and the Regents of the University of California through the Ernest Orlando Lawrence Berkeley National Laboratory. All rights reserved. EnergyPlus is a trademark of the US Department of Energy.
This documentation is made available under the EnergyPlus Open Source License v1.0.