z = h
state
(t, x, u; d, p). (2)
If one of the event indicators, z
i
, switches domain, there is a state event.
The integrator is then responsible for finding the time when the event
occurred.
• Time Events
These events on the other hand are known a prior, meaning that for each
simulation segment it is known when the time event occur and thus this
time is set as the simulation end time for that segment. Given a previous
time event, T
pre
(or the initial time, T
0
), the next time event is computed
using,
T
next
= h
time
(t
T
pre
, x
T
pre
, u
T
pre
; d
T
pre
, p). (3)
An example is that after a certain elapsed time in the integration, a force
is applied on the model.
• Step Events
These last type of events are events that typically do not influence the
model behavior, instead they are events to ease the numerical integration.
For instance it can be a change of the continuous states in the model as the
current states are no longer appropriate numerically. After each successful
integrator step, T
accepted
, the equation,
E
step
= h
step
(t
T
accepted
, x
T
accepted
, u
T
accepted
; d
T
accepted
, p) (4)
is evaluated and if E
step
is True, a step event is triggered.
Further, Equation 1 is valid during continuous simulation and prior to this,
the FMI specifies that the FMU need to be initialized. The simulation and
initialization is separated as to allow a flexible definition of initial conditions.
An example could be that the initial values for the states are computed using
an initial equation, which is only active during the initialization. The initial
equations are described by,
ˆx
0
,
ˆ
d
0
, ˆp = f
init
(t
0
, ¯x
0
, u
0
;
¯
d
0
, ¯p), (5)
where ¯x
0
are states with known initial values,
¯
d
0
are the known discrete variables
and ¯p are known parameters. The complete initial states vector is x
0
= [¯x
0
, ˆx
0
],
and for discrete variables, d
0
= [
¯
d
0
,
ˆ
d
0
], while the full parameter vector is p =
[¯p, ˆp].
For full details about the mathematical representation, cf. [1] for version 2.0
and [13] for version 1.0.
For co-simulation, the standard rather describes a discrete interface to the
underlying dynamic model, i.e. given the current internal state, input u
n
and
step size H of the model, return the outputs, y
n+1
, at a time T
n
+ H = T
n+1
,
y
n+1
= Φ(H, u
n
; p), (6)
5
如果其中一个事件指标z
i
发生转换,则存在
状态事件。 然后,积分器负责查找事件发
生的时间。
·时间事件
另一方面,这些事件是先验已知的,这意
味着对于每个模拟段,已知时间事件何时发
生,因此该时间被设置为该段的模拟结束时
间。 给定前一个时间事件T
pre
(或初始时间
T
0
),下次使用时计算事件:
一个例子是在积分中经过一定时间后,在模
型上施加力。
·步骤事件
这些最后类型的事件是通常不影响模型行
为的事件,而是它们是简化数值集成的事件。
例如,它可以是模型中连续状态的变化,因为
当前状态不再适合于数字。 在每个成功的积分
步长(
T
accepted
)后
,等式
:
进行评估,如果Es
tep
为True,则触发步骤事件。
此外,等式
1在连续仿真期间有效,在此之
前,FMI指定需要初始化FMU。 仿真和初始化
分离以允许灵活地定义初始条件。 一个示例可
以是使用初始方程计算状态的初始值,该初始
方程仅在初始化期间有效。 初始方程描述为:
其中x¯0是具有已知初始值的状态,d¯0是已知
的离散变量,而p¯是已知参数。 完整的初始状
态向量是x0 = [x¯0,x0],对于离散变量,d0 =
[d¯0,d0],而全参数向量是p = [p,p]。
有关数学表示的完整详细信息,请参阅版本
2.0的[1]和版本1.0的[13]。
对于协同仿真,标准描述的是底层动态模型
的离散接口,即给定当前内部状态、输入u
n
和
模型的步长H,在时间T
n
+ H =T
N +1
时返回输
出y
n
+ 1
: