Introduction to Embedded Systems & Control: What...

34
Technische Universität München Technische Universität München Introduction to Embedded Systems & Control: What are Cyber-Physical Systems? Samarjit Chakraborty www.rcs.ei.tum.de TU Munich, Germany

Transcript of Introduction to Embedded Systems & Control: What...

Page 1: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München Technische Universität München

Introduction to Embedded Systems & Control: What are Cyber-Physical Systems?

Samarjit Chakraborty www.rcs.ei.tum.de

TU Munich, Germany

Page 2: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

What are Cyber-Physical Systems?

Networked Embedded Systems Sensor network based systems Internet of Things (IoT) Embedded Control Systems

… will use automotive as a running example

2

Page 3: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

This image cannot currently be displayed.

1993

2009

1 3 13

90 100

175

240

5 50

100

0

50

100

150

200

250

300

350

400

Memory [MB] ECUs

Automotive E/E Architecture Trends

1993

2009

3

Page 4: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

The Modern Car

50 – 100 Electronic Control Units (ECUs) Complex in-vehicle network (CAN, FlexRay, Ethernet) Complex systems software, operating systems Several distributed control applications (safety-critical & comfort)

4

source: Bosch

Page 5: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

5

Actuator System Sensor

Controller Network Network

τnetwork τnetwork

ACC ECU

Radar

Speed adjustment

Control Applications

Many of the safety-critical, driver assistance and comfort applications implement control functionality

Page 6: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Current Design Flow

6

High-level requirements

Applications

HW/SW architecture Multiple processor units (PUs) connected via a shared bus

… algorithm

design

Model

Task partitioning

T1 T2

T3

T4

Task mapping

m2 m1

Task and Message

scheduling

code generation

Algorithm & Architecture designed separately followed by integration, testing, debugging, …

Page 7: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Control Systems Design

7

System identification

Controller design

Control system analysis

system model controller

Equations

Page 8: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Control Systems Implementation

8

System identification

Controller design

Control system analysis

system model controller

Code generation

Task partitioning

Task mapping & scheduling

Message scheduling

Timing & performance analysis

Are control objectives satisfied

NO

Equations

Software

Page 9: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

The Design Flow

9

System identification

Controller design

Control system analysis

system model controller

Code generation

Task partitioning

Task mapping & scheduling

Message scheduling

Timing & performance analysis

Are control objectives satisfied

NO

Controller Design

Controller Implementation

Page 10: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

The Design Flow

10

Controller Design

Controller Implementation

Control theorist

Embedded systems engineer

Design assumptions Computing control law takes negligible time No delay from sensor to controller No delay from controller to actuator No jitter …

Implementation reality Tasks have non-negligible execution times Often large message delays Time and event-triggered communication

Page 11: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

The Design Flow

11

Controller Design

Controller Implementation

Control theorist

Embedded systems engineer

These are implementation details

Model-level assumptions are not satisfied by

implementation

Not my problem!

Page 12: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Semantic Gap

12

Controller Design

Controller Implementation

Semantic gap between

model and implementation

Research Questions? How should we quantify this gap? How should we close this gap? Solution: Controller/Architecture Co-design

Page 13: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Cyber-Physical Systems

Tight interaction between computational (cyber) and physical systems

Isolated design of the two systems leads to: Higher integration, testing and debugging costs Poor resource utilization (e.g., unnecessarily high sampling

rates)

Question: Can existing techniques from real-time & embedded systems be

directly applied? We know hardware/software co-design

Answer: New techniques are required Traditional embedded systems design have focused only on

meeting deadlines Here, deadlines take a back seat

13

Page 14: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Dynamical Systems: DC Motor

14

The time dependence of the various states of dynamical systems is described by a set of difference or differential equations.

i

J = moment of inertia of the rotor b = system damping ratio, K = EMF and Torque constant, R = armature resistance, L = armature inductance, i = armature current, V = input, DC terminal voltage θ = output, position of shaft

Page 15: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Modeling Approaches: State-space

System states x(t): (1) motor shaft position, (2) motor shaft velocity, and (3) armature current, i

System Input u(t): Terminal voltage, V One might want to regulate one or more system states.

The regulated states are known as output y(t). E.g., motor speed or position

15

Page 16: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Performance Metrics

Transient Behavior:

16

The rise time tr is the time it takes the system to reach the vicinity of its set point or reference command The settling time ts is the time it takes the system transients to decay The overshoot Mp is the maximum amount the system overshoots (and often expressed as a percentage of reference command)

1

0.1

0.9

tr ts

Mp

t

Page 17: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Performance Metrics

17

Steady-state Behavior: Integral Input Cost:

- indicator of how much effort is needed for the control

Integral Error Cost: - indicator of how accurate the control performance is

There are many possible metrics. Moreover, one can also consider a weighted combination of the various cost such metrics

Page 18: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München 18

DC motor:

Objective:

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.50

10

20

30

40

50

60

70

Seconds

Spee

d

33% Drop25% Drop0% Drop

A fraction of feedback signals being dropped

Controllers can be designed to be robust to

drops and deadline-misses

The deadlines are usually not hard for control-related messages

Control Tasks - Characteristics

Page 19: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München 19

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50

5

10

15

20

25

30

35

40

45

50

Seconds

Spee

d

Disturbance

h =20ms h =200ms

(1) The computation requirement at the

steady state is less, i.e., sampling frequency can be reduced (e.g., event-triggered sampling)

(2) The communication requirements are less at the steady state, (e.g., lower priority can be assigned to the feedback signals)

Sensitivity of control performance depends on the state of the controlled plant

Control Tasks - Characteristics

Page 20: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Bottomline

Real-time Systems Meeting deadlines is the center of attraction

CPS View Deadline takes the back seat As a result, the design space becomes bigger Resulting design is better, robust, cost-effective …

20

Page 21: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

What about NCS?

Take network characteristics into account when designing the control laws Packet drops, delays, jitter …

21

Plant

T3 T4

Sensor

T1

T2

m1

m2 m3 +

- Controller

Network

Networked Control Systems

Page 22: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

What about NCS? Answer: ANCS

ANCS – We can design the network By taking into account control performance constraints

Problem: How to design the network? Given a network, how to design the controller?

NCS problem

CPS Problem: How to design the network and the controller together? Co-design Problem

22

Plant

T3 T4

Sensor

T1

T2

m1

m2 m3 +

- Controller

Network

Arbitrated Networked Control Systems

Page 23: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

CPS-Oriented Design Example

Control over FlexRay FlexRay is made up of time-triggered (TT) and event-

triggered (ET) segments Conventional design

Use time-triggered segment for control messages – one slot for each control message

Expensive

23

Challenge: Can we achieve the same control performance

with fewer time-triggered slots?

Page 24: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München 24

FlexRay – Event Vs Time-triggered

task

message

task x

Asynchronous

task

message

task

Synchronous

Jitter, lost/unused data

Predictable

x

Page 25: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Quality of Control vs. System State

The performance of a control application is more sensitive to the applied control input in transient state compared to that in steady-state

ET communication for the control signals is good enough in the steady-state

TT communication is better suited for transient state

25

r

t

Transient State Steady State

Observations

Settling time

Page 26: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Mode Switching Scheme

26

Plant in Steady-

State

Plant in Transient

Mode Change Protocol

Plant in Transient

Plant in Steady-

State

TT : ET : Schedule : Schedule :

Controller : Controller :

SissSi

t r

K it r

K iss

M ssM t r

x[k]T x[k] > Et r

Mode Change Request After

After dwell time Tidw

Page 27: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Example

We consider two distributed control applications communicating via a hybrid communication bus

27

We apply state-feedback controller for both, i.e., u[k] =Fx[k]

Page 28: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Performance with TT Communication

28

Control Gains

Quality of control

Converges very fast without any oscillation

C1

C2

Page 29: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Performance with ET Communication

29

Control Gains

Quality of control

C1

C2 Large oscillations and long settling time

Page 30: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Performance with Switching

30

Quality of control

C1

C2 Performance is better than that with ET communication but we consume less TT communication slots

We have one shared TT communication slot. The control messages are transmitted via ET communication when they are in steady state and switches to TT communication when transient state occurs due to some disturbance

Page 31: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Experimental Setup

31

Page 32: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München 32

Mixed time-/event-triggered Purely event-triggered Purely time-triggered

Experimental Results

Page 33: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München

Concluding Remarks

33

Viewing cyber-physical systems not as traditional real-time systems Breaks traditional concepts of abstraction? Current practice:

Specify control laws Specify architecture and schedules Test and debug (modify architecture and schedule)

Problem: Synthesize the architecture/schedule from control performance constraints Large constrained optimization problem

Page 34: Introduction to Embedded Systems & Control: What …acps.mit.edu/cpstutorialfiles/CPSWeek14_Tutorial_part1.pdfTechnische Universität München Introduction to Embedded Systems & Control:

Technische Universität München 34

… and now something more futuristic