Timing analysis and Design Optimization for Real-Time Engine...
Transcript of Timing analysis and Design Optimization for Real-Time Engine...
Timing analysis and Design Optimization for Real-Time
Engine ControlsAlessandro Biondi
Scuola Superiore Sant’Anna, Pisa, Italy
2A. Biondi – IWES 2016
THIS TALK
1 Engine Control Applications
2 Our Contribution
3 Ongoing Work
A LOOK INTO ENGINE CONTROL
APPLICATIONSTiming, macro-functional aspects
and challenges
1
4A. Biondi – IWES 2016
INTRODUCTION
Engine control is a very interesting andchallenging CPS problem
• Software plays a key role
• Design constraints (due tolimited computational power)
• Timing significantly influencessystem performance
• Both time- and event-drivenbehavior
5A. Biondi – IWES 2016
ENGINE CONTROL APPLICATIONS
• Engine control applications include
• Periodic Tasks, with fixed periods (1-500 ms)
• Angular Tasks, linked to the rotation of the crankshaft
(t)
t
t
/2
3/2
2
Task activations
activate task
10-120 ms
6A. Biondi – IWES 2016
ENGINE CONTROL APPLICATIONS
CPU
ECU
Set of Periodic Tasks
Set of Engine-triggered Tasks
7A. Biondi – IWES 2016
1 2
C(1)
C(2)
C(3)
1
2
3
To prevent overload at high rates, different control implementations are used
speed time
timeexec time
ADAPTIVE BEHAVIOUR
speed
8A. Biondi – IWES 2016
ADAPTIVE BEHAVIOUR
fuel injections
controller controller controller controller
~C
Engine-triggered Task
To prevent overload at high rates, different control implementations are used
9A. Biondi – IWES 2016
A FAMILY OF CONTROLLERS
C C
C C
C C
C
C C
C
C C
#1
#2
#3
#N
~
10A. Biondi – IWES 2016
TIMING IS IMPORTANT
Timing properties of the controllers “rules theroost”
• Scheduling plays a key role
• Engine performance depends (in differentand complex ways) on timing parameters
• Accurate timing analysis is useful to drivedesign choices
11A. Biondi – IWES 2016
EXAMPLE OF IMPACT
EngineplantTPUCPU
Latch
Angular
Trigger
Injector
• TPU uses data produced from the CPU
(injection angle, quantity of fuel, CR pressure…)
If deadlines are missed (on the CPU), theTPU uses old data for the next injection
FUEL INJECTION
12A. Biondi – IWES 2016
EXAMPLE OF IMPACT
• Deadline misses can be penalizing if the conditions
of the engine changed (too much) from previous
cycles.
• The use of old data can produce errors in the
injection angle.
Scheduling errors
FUEL INJECTION
Inaccurate injection
Decreasing performance
13A. Biondi – IWES 2016
THE MULTICORE DIMENSION
• Introduce further complications
E.g., syncronization, task placement,…
• If we are not able to understand timingaspects of such applications it is hard toattack real-world problems
Engine control systems are (inevitably) switching to multicore platforms
OUR CONTRIBUTIONMajor achievements during the last ~3 years of research
2
15A. Biondi – IWES 2016
TIMING ANALYSIS
Periodic computational activities
Periodic Real-Time Tasks – Studied since 70’s
Engine-triggered computational activities
Adaptive Variable-Rate (AVR) Tasks –Studied only in the last years
Davis et al. RTAS14Buttazzo et al. DATE14 Guo and Baruah ICCPS15Biondi et al. ICCPS15
16A. Biondi – IWES 2016
TIMING ANALYSIS WITH AVR TASKS
• Exact response-time analysis under fixed-priority scheduling
• Exact schedulability analysis under dynamic-priority (EDF) scheduling
• Linear-time approximation scheme for thedynamic-priority (EDF) schedulability analysis
State-of-the-art analysis techniques failed with engine-
control tasks
Novel timing analysis techniques
for the AVR task model
Major Achievements
17A. Biondi – IWES 2016
DYNAMIC-PRIORITY SCHEDULING
Significant benefitsobserved (in theory), much higher than those well-known for periodic tasks
Priority
Assignment
Law
Dynamic-priority
Scheduler
Engine Speed
Processor load
No
de
adlin
e m
iss
Dynamic-priority
Fixed-priority
18A. Biondi – IWES 2016
RTOS SUPPORT
OSEK-like support for dynamic-priorityscheduling of engine control applications
• Requires minimal changes to existing applications
• Integrated with OSEK configuration language (OIL)
• Low run-time overhead (+1.5 𝝁𝒔 over fixed-priority)
• Low additional footprint (<500 bytes)on STM32 @ 160Mhz
19A. Biondi – IWES 2016
MULTICORE REVOLUTIONC
urr
en
tly
ma
pp
ed
in 1
2 t
as
ks
Mapped onto
the tasksCalling 100s of DD
functions
Ap
pro
x
20
0 r
un
na
ble
s
With
internal
depend
-encies
Using the
devices of
the micro
2 Cores
Mapped onto
the tasks
Ma
pp
ed
?
Allocated and scheduled on 2 cores
+ INTER-CORE SYNCHRONIZATION
? ? ?
Ap
pro
x
20
0 r
un
na
ble
s
Calling 100s of DD
functionsSharing
the
devices of
the micro
With
internal
depend
-encies
Scheduled by FP
on 1 core
1 Core
20A. Biondi – IWES 2016
MULTICORE REVOLUTION
CC++
Static code analysis
AUTOSAR model + extensions(for detailed timing info and improved HW model)
Execution trace data Optimization
algorithms(wrt time only)
2 Cores
OUR APPROACH
21A. Biondi – IWES 2016
DESIGN ISSUES
C C
C C
C C
C
C C
C
C C
#1
#2
#3
#N
~
Engine control involves multiple complex multi-
criteria design optimization problems
(power, fuel efficiency, noise, emissions,…)
An Example:
22A. Biondi – IWES 2016
DESIGN ISSUESSWITCHING SPEEDS
𝜔
WCET(𝜔) Most complex
implementation
impl. #2
impl. #3
impl. #4
𝜔𝑚𝑖𝑛 𝜔1 𝜔2 𝜔3 𝜔𝑚𝑎𝑥
simplified control implementations giving lower performance
Which is the best speed to switch control
implementation?
TODAY’S APPROACH:ITERATIONS BETWEEN
TEST-BENCH AND TUNING
“Something” more systematic supported by a
model and an analysis would be very useful…
24A. Biondi – IWES 2016
OUR APPROACH
Formulated as an optimization problem
Find the switching speeds that maximize the engine performance
such that no deadline misses occur
𝜔1
𝜔2
𝜔2 > 𝜔1
no deadline miss
Non-convex optimization
25A. Biondi – IWES 2016
CONTRIBUTION
Algorithm to bound the design space
Effective heuristics, empirically very close
to the optimum (>95%)
Ad-hoc branch-and-bound algorithm
Analytical performance model based on
real-world data𝑝 𝜔 = 𝑘1𝑒
−𝑘2𝜔
ONGOING WORK
3
27A. Biondi – IWES 2016
TIMING ANALYSIS: OPEN PROBLEMS
• The timing analysis for the AVR model is stillnot able to capture some real-world designsolutions, such that
• Different angular periods
• Angular phases
• Hysteresis in mode-change
• Multiframe behavior
• Fine-grained Synchronization
• Multi-priority tasks
currently solved only under approximation schemes
28A. Biondi – IWES 2016
CPS ANALYSIS: THE (REAL) PROBLEM
Enginemodel
Control laws
SimulinkScheduler interface
External SchedulingSimulator
Sensors
Actuation
Control
Unit
Simulink architecture
Deadline misses can be tolerated
“…but not that many”… and “what matters is performance”
Work by Paolo Pazzaglia
29A. Biondi – IWES 2016
MULTICORE: OPEN PROBLEMS
SingleCore MultiCore
• Scalability issues of optimization algorithmsfor task placement
• Platform-aware placement (device sharing)
• Support for bus and memory contention
• Support for adaptive variable-rate tasks
• …
Thank you!Alessandro Biondi