Timing analysis and Design Optimization for Real-Time Engine...

30
Timing analysis and Design Optimization for Real-Time Engine Controls Alessandro Biondi Scuola Superiore Sant’Anna, Pisa, Italy

Transcript of Timing analysis and Design Optimization for Real-Time Engine...

Page 1: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

Timing analysis and Design Optimization for Real-Time

Engine ControlsAlessandro Biondi

Scuola Superiore Sant’Anna, Pisa, Italy

Page 2: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

2A. Biondi – IWES 2016

THIS TALK

1 Engine Control Applications

2 Our Contribution

3 Ongoing Work

Page 3: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

A LOOK INTO ENGINE CONTROL

APPLICATIONSTiming, macro-functional aspects

and challenges

1

Page 4: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 5: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 6: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

6A. Biondi – IWES 2016

ENGINE CONTROL APPLICATIONS

CPU

ECU

Set of Periodic Tasks

Set of Engine-triggered Tasks

Page 7: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 8: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 9: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

9A. Biondi – IWES 2016

A FAMILY OF CONTROLLERS

C C

C C

C C

C

C C

C

C C

#1

#2

#3

#N

~

Page 10: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 11: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 12: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 13: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 14: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

OUR CONTRIBUTIONMajor achievements during the last ~3 years of research

2

Page 15: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 16: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 17: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 18: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 19: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 20: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 21: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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:

Page 22: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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?

Page 23: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

TODAY’S APPROACH:ITERATIONS BETWEEN

TEST-BENCH AND TUNING

“Something” more systematic supported by a

model and an analysis would be very useful…

Page 24: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 25: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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𝜔

Page 26: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

ONGOING WORK

3

Page 27: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 28: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

Page 29: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

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

• …

Page 30: Timing analysis and Design Optimization for Real-Time Engine …retis.sssup.it/iwes/technical/biondi.pdf · 2016. 9. 30. · A. Biondi –IWES 2016 15 TIMING ANALYSIS Periodic computational

Thank you!Alessandro Biondi

[email protected]