Академический Документы
Профессиональный Документы
Культура Документы
Michaela Huhn1 , Martin Sjölund2 , Wuzhu Chen1 , Christan Schulze1 , and Peter Fritzson2
1 Clausthal University of Technology, Department of Informatics
for real-time simulation are derived from off-line sim- matically processed either by commercial Modelica
ulation models developed in an earlier design phase. compilers or free ones, some non-linear implicit re-
Such adaptations on a model are called real-time op- lations often remain on the RHS of the ODE system.
timization (RTO) of the design model. Some parts These mathematically complex interdependencies be-
can be automated, but due to the diversity of model tween state variables cause algebraic loops that signifi-
domains and simulation goals, model engineers com- cantly contribute to execution times during simulation.
monly need to manually optimize the models to en- Breaking up algebraic loops, i.e. decoupling state vari-
hance time determinism and performance for RT sim- ables, decomposes the system model into a set of sub-
ulations [2]. systems that is computationally simpler to handle. We
The numerous variants to be performed on off-line briefly sketch some strategies for decoupling:
models can be roughly categorized into two groups: The most straightforward approach is to eliminate
state variables which are of minor relevance to sys-
• RTO by adapting the system behaviors tem dynamics, like for instance the fluid temperature
in a 1-D momentum equation. Library elements offer-
• RTO by mathematical reduction of complexity ing different model variants of the same physical en-
tity support the modeler with this strategy: The vari-
2.1 RTO by adapting the system behavior ants, which may be selected via parameters, may be
optimized for the calculation of different sets of in-
Hybrid dynamic systems can be adequately described put/output variables. Such variants may exploit spe-
as a set of nonlinear differential algebraic equations cific solvers for subproblems or differ wrt. numerical
accuracy or completeness of the physical effects be- A brief introduction of the so-called projection-
ing modeled. All this will result in differences in the based model oder reduction (PBMOR) will be given
computational complexity and the real-time behavior. here to show the philosophy of MOR. The PBMOR
As described in [3], knowledge on weak dynamic can be roughly performed in three steps:
interactions between system parts may be used to de- 1) Choice of ansatz:
couple the system by introducing pre-announced weak The state variables x ∈ Rn is approximated by xq ∈ Rq
dynamic state variables which are solved by implicit (q n):
integration. Such a decoupling leads to strong im- q
provements on the Block Lower Triangle (BLT) trans- x ≈ xq = ∑ v j ξ j = Vq ξ (2.6)
formation, since the off-diagonal entries will decrease j=0
inside the BLT structure.
An another alternative is the mixed-mode integra- where v j is the basis spanning a subspace Vq = span
tion approach described in [11], which tries to partition {v1 , . . . , vq } called ansatz space of the reduced model,
an entire dynamic system into separate fast/slow sub- ξ ∈ Rq and the matrix Vq = [v1 , . . . , vq ] (q n). The
systems by analyzing the eigenvalues of the system. choice of decent basis v j plays a significant role in PB-
In contrast to weak dynamic decoupling, mixed-mode MOR, there exist many methods on the market [8, 5].
integration can be fully automated. 2) Insert the ansatz:
It has to be noted that all these approaches require a Inserting the ansatz (2.6) into (2.5) delivers the follow-
modeler with strong backgrounds on the problem do- ing over-determined system:
main, as they are only applicable under certain con- EVq ξ˙ = AVq ξ + Bu (2.7)
straints, e.g. a loose coupling system, a reasonable dif-
y = CVq ξ + Du (2.8)
ference between subsystem dynamics, etc.
As there are more equations than unknowns in this re-
2.2 RTO by mathematical reduction of com- duced model representation, in general the residual of
plexity the system will not equal zero.
3) Projection of the residual:
A system’s complexity is characterized by the num-
The residual is projected onto a subspace Wq spanned
ber of its state variables (or number of dimensions of
by the columns of so-called weighting factors Wq .
the model). Some state variables de facto dominate
the dynamic behavior of the system, which gives us a WTq EVq ξ˙ = WTq AVq ξ + WTq Bu (2.9a)
possibility to reduce the complexity of the system by
disregarding some subordinate ones. Provided that a y = CVq ξ + Du (2.9b)
DAE system has been transformed into the following
Thus, an optimal solution of the over-determined
continuous generalized state-space form:
system can be attained in a least square sense. The
Eẋ = Ax + Bu (state equation) (2.5a) input-output properties of the reduced model de-
y = Cx + Du (output equation) (2.5b) scribed in (2.9) depends only on matrices Vq and Wq .
Model
User Space
(Kernel module) Buffer FIFO
Application
Realtime Task
data exchange data storage
VA = E (5.2a)
VA = V1 +VC (5.2b)
V1 = der(Φ(1) ) = der( f (1) (I1 ) · I1 ) (5.2c)
IC = C · der(VC ) (5.2d)
I1 = I2 + IC (5.2e)
V2 = VC (5.2f)
V2 = der(Φ(2) ) = der( f (2) (I2 ) · I2 ) (5.2g)
6 Conclusion
Adapting simulation models for execution in a real-
time context is often a complex task that requires two-
folded verification. First, accuracy of the results ob-
Figure 13: Workload in global steps (optimized) tained with an optimized model and its stability have
to be proven. Second, it has to be shown that the
5.2.3 Deviation Analysis real-time constraints are met and if not, which are the
most promising parts for further improvements. We
Model optimizations by introducing an element with presented two tools, a ModelComparator and the RT-
some capacity is a good idea to break up the algebraic Profiling, to support the developer with these tasks and
loops. But as shown in 5.1, one should be cautious illustrated their usage in two small case studies.
when applying this technique on a model. If the time However, an open issue is how to relate the verifi-
constant of the capacity is less than the integration step cation results from both, model comparison and RT-
size, this will cause instability in a system. Unlike in Profiling, back to the variables and equations of the
case 1, where the voltage between those two inductors optimized model. To solve this issue will be a pre-
depends on the time derivatives of the current flowing condition to enable real-time adaptation of models of
through, here the thermal resistance R is just a func- another scale of complexity.
tion of the temperature. Hence R can be calculated
directly from C.T. The following figure gives the com-
parison of the temperature TA from original and opti- References
mized models.
[1] MODELISAR (ITEA 2 07006). Functional
Mock-up Interface for Model Exchange, January
26 2010.