They are relatively simple to implement and, importantly, simple to document in form of ... enough to create a mathemati
Executing Physical Models on an ECU Using CONGRA to implement implicit time-discretization
Sounds familiar? It is challenging enough to create a mathematical model of a complex physical system. But you’ve mastered this already. You’ve not only created the model, you’ve even validated it via extensive simulation and with real-world data. The hard part is done. Now you’re asked to run this model on an ECU – in real-time, with extremely limited memory and processor resources. Can this be done?
Function Development with CONGRA Traditionally control algorithms on an ECU are time-discretized with explicit methods like forward Euler. They are relatively simple to implement and, importantly, simple to document in form of block diagrams. The downside of these methods is that the algorithms, which were stable and correct in continuous-time simulations, can become unstable under certain conditions (e.g. wrong calibration parameters or an unsuitable step-size). There are better methods for time-discretization, namely implicit ones (e.g. backward Euler), which are stable even in larger time slots. Unfortunately, such algorithms are usually not suitable to run on an embedded controller due to some computational overhead required. Moreover, in general, the documentation of these methods in a familiar form such as block diagrams was cumbersome at best. The ETAS CONGRA tool provides a solution to this challenge. CONGRA provides an environment to create a-causal physical models, derives stable and efficient implementations for embedded controllers (including implicit time-discretization and numerical solvers) and generates documentation in the familiar block diagram format.
Technical Details Why are implicit methods superior? The stability of numerical implementations of algorithms / integration methods on an ECU is highly dependent on the chosen discretization method. As an example, for a PT1 filter implementation, the choice of stability criteria k (depending on parameters such as integration step-size etc.) results in different possible behaviors on an ECU.
Figure 1
For each discretization method the stability criteria is calculated differently but the resulting qualitative behavior applies for all methods. In case of a PT1 filter, the expected stable behavior is achieved only when k is between 0 and 1, as shown in Figure 1.
1
© ETAS GmbH 2017. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.
Executing Physical Models on an ECU Using CONGRA to implement implicit time-discretization
𝑘𝑘 = 1 −
∆𝑡𝑡 𝑇𝑇
Figure 2 - stability criteria for explicit (forward) Euler
𝑘𝑘 =
1
∆𝑡𝑡 1+ 𝑇𝑇
Figure 3 - stability criteria for implicit (backward) Euler
For an explicit implementation such as an explicit (forward) Euler, the stability criteria is defined as in Figure 2. Here, ∆t is the integration stepsize (also known as the cycle-time) and T is the time constant of the physical system which is usually determined by intrinsic system properties such as volumes, lengths, diameters etc. The cycle-time ∆t is the only “free” variable. It is evident that the selection of this cycle-time has a huge impact on the stability of the system and, in order to guarantee stable operation (0