• No results found

Real-Time Systems Versus Cyber-Physical Systems: Where is the Difference?

N/A
N/A
Protected

Academic year: 2021

Share "Real-Time Systems Versus Cyber-Physical Systems: Where is the Difference?"

Copied!
84
0
0

Loading.... (view fulltext now)

Full text

(1)

Real-Time Systems Versus Cyber-Physical

Systems: Where is the Difference?

Samarjit Chakraborty

www.rcs.ei.tum.de

TU Munich, Germany

Joint work with

(2)

Technische Universität München

Control Systems Design

2

System

identification

Controller

design

Control system

analysis

system

model controller

(3)

Control Systems Implementation

System

identification

Controller

design

Control system

analysis

system model controller

Code

generation

Task

partitioning

Task mapping

& scheduling

Message

scheduling

partitioning

Task mapping

& scheduling

generation

Control system

Equations

(4)

Technische Universität München

The Design Flow

4

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

System

identification

Controller

design

Control system

analysis

system model

model controller controller

Control system

Code

generation

Task

partitioning

Task mapping

& scheduling

Message

scheduling

Timing & performance

analysis

Are control

objectives satisfied

partitioning

Task mapping

& scheduling

Timing & performance

generation

NO

System

model

System

model

Controller Design

partitioning

& scheduling

scheduling

& scheduling

& scheduling

scheduling

& scheduling

(5)

The Design Flow

Controller Design

Controller Implementation

Control theorist

Controller Design

Design assumptions

!! Infinite numerical accuracy

!! Computing control law takes negligible time

!! No delay from sensor to controller

!! No delay from controller to actuator

!! No jitter

!!!

Controller Implementation

Implementation reality

!! Fixed-precision arithmetic

!! Tasks have non-negligible execution times

(6)

Technische Universität München

The Design Flow

6

Controller Design

Controller Implementation

Control theorist

Embedded systems

engineer

Controller Design

These are implementation details

Controller Implementation

Model-level assumptions

are not satisfied by

implementation

Not my problem!

(7)

Semantic Gap

Controller Design

Controller Implementation

Semantic gap

between

model and implementation

Research Questions?

!

!

How should we quantify this gap?

(8)

Technische Universität München

Current Design Flow

8

High-level requirements

Applications

HW/SW architecture

Multiple processor units (PUs) connected via a shared bus connected via a shared bus

!

Controller design

Model

Code synthesis & Task partitioning T1 T2 T3 T4 Task mapping m2 m1 mm2 m m1 Task and Message scheduling code generation

(9)

Current Design Flow

High-level requirements

Applications

HW/SW architecture

Multiple processor units (PUs) connected via a shared bus connected via a shared bus

!

Controller design

Model

Code synthesis & Task partitioning T1 T2 T3 T4 Task mapping m2 m1 mm2 m m1 Fixed-precision arithmetic

Multiple processor units (PUs) connected via a shared bus connected via a shared bus

(10)

Technische Universität München

Current Design Flow

10

High-level requirements

Applications

HW/SW architecture

Multiple processor units (PUs) connected via a shared bus connected via a shared bus

!

Controller design

Model

Code synthesis & Task partitioning T1 T2 T3 T4 Task mapping m2 m1 mm2 m m1 Task and Message scheduling Fixed-precision arithmetic

Delay / jitter message loss Multiple processor units (PUs)

connected via a shared bus connected via a shared bus connected via a shared bus

Unreliable hardware soft-errors, aging,

!

Multiple processor units (PUs)

connected via a shared bus T

Delay / jitter message loss Multiple processor units (PUs)

Unreliable hardware soft-errors, aging,

Multiple processor units (PUs) T

Multiple processor units (PUs) Multiple processor units (PUs)

Delay / jitter message loss Unreliable hardware soft-errors, aging,

Algorithm & Architecture designed separately

(11)

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:

(12)

Technische Universität München 12

DC motor:

Objective:

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0 10 20 30 40 50 60 70 Seconds S peed 33% Drop 25% Drop 0% 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

(13)

10 15 20 25 30 35 40 45 50 S peed 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

(14)

Technische Universität München

Bottomline

!

!

Real-time Systems View

!

!

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

!

14

Control performance constraints reduced to

satisfaction of real-time constraints

(15)

What about NCS?

!

Take network characteristics into account when

designing the control laws

!

Packet drops, delays, jitter

!

Plant T3 T4 Sensor T1 T2 m1 m2 m3 + - Controller

Network

(16)

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

!

Co-design Problem:

How to design the network and

the controller together?

16 Plant T3 T4 Sensor T1 T2 m1 m2 m3 + - Controller

Network

(17)
(18)

Technische Universität München

Embedded control systems

18 Physical System Actuators Sensors Shared Communication Shared Computation

Embedded platform: Control software

Continuous-time Discrete-time D/A A/D Real-time applications Multimedia applications !

(19)

Dynamical Systems: DC Motor

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,

(20)

Technische Universität München

System models

•! Input-output model (Transfer function) – suitable for frequency domain analysis

•! The relation between input u(t) and output y(t) (observed variable – e.g., position, temperature)

•! The analysis is done in frequency domain by taking Laplace transform

where s is the complex frequency

•! State-space model – suitable for time domain analysis

•! Represent the system in terms of a number of internal states --

(21)

Computing state-space model

(1) System dynamics:

(3) States:

(4) State-space model: (2) Input and output: Example

Input

Output

(22)

Technische Universität München

Laplace Transform

(23)

Computing transfer function

(1) System dynamics:

(3) Take Laplace transform with zero initial condition:

(4) Transfer function: (2) Input and output: Example

Input

Output

(24)

Technische Universität München

State-space to Transfer Function

24

Laplace transform And x(0) = 0

State-space model

(25)

Poles and Zeros

•! Given transfer function , the system poles are roots of the polynomial D(s) and the system zeros are roots of polynomial N(s)

•! Example

Zeros: -0.2, -1 Poles: 1, 2, 3

(26)

Technische Universität München

Eigenvalues of a Matrix

(27)
(28)

Technische Universität München

Characteristic equation

•! Alternatively, system poles can also be computed from the state-space model by computing Characteristic Equation which is given by:

•! System poles are the roots of Characteristic polynomial

!

System

poles

are the

eigenvalues of A

(29)

Stability

There are various notions --

•! Bounded-Input Bounded-Output (BIBO) stability •! Stability in the sense of Lyapunov

•! Asymptotic stability •! Exponential stability •! !

Our lecture is mainly confined to the following aspects: (1)!|x(t)|, |y(t)|, |u(t)| < ! (all signals are bounded), (2)!y(t) " 0 as t " ! (asymptotic stability)

(30)

Technische Universität München

Implications of System Poles on Stability

!

Consider the following system (discrete model)

!

Intuition behind the continuous time mo

(31)

Stability condition: continuous-time case

•! Stable system

All poles should have negative real part •! Marginally stable system

One or multiple poles are on imaginary axis and all other poles have negative real parts

•! Unstable system

One or more poles with positive real part.

Stable Unstable Marginally stable

(32)

Technische Universität München

Stability

•! Example Poles at +1, +2, +3 Unstable! 32 •! Example

Poles at 0, 0 Marginally stable •! Example

(33)

Summary

System dynamics:

State-space Transfer function

Poles at +10.9, -3.4 Roots of

(34)

Technische Universität München

Summary

How to compute system poles?

1.! Roots of

2.! Eigenvalues of system matrix A

3.! Solution of system characteristics equation

4.! Roots of D(s) for the transfer function

34

•! Stable system

All poles with negative real part •! Marginally stable system

One or multiple poles are on imaginary axis and all other poles have negative real parts

•! Unstable system

(35)

•! We have a linear system given by the state-space model

•! For n-dimensional Single-Input-Single-Output (SISO) systems

•! Objective

•! u = ?

(36)

Technische Universität München

•! Control law

r = reference

K = feedback gain

F = static feedforward gain

•! How to design K? •! How to design F?

36

(37)

•! Choose the desired closed-loop poles at

•! Using Ackermann’s formula we get

•! Poles of (A+BK) are at

(38)

Technische Universität München

Static Feedforward Gain

38

Closed-loop system

F should be chosen such that y(t) " r (constant) as t " ! i.e.,

Using final value theorem

Taking Laplace transform

(39)

Digital Platform: Sample and Hold

u(t) x(t) D/A A/D Processor clock u(tk) x(tk) Control Algorithm

D/A " digital-to-analog converter A/D " analog-to-digital converter Hold Continuous-time Sampler

(40)

Technische Universität München 40 x(t) x(tk) u(t) t "

t "

tk tk+1 t k+2

ZOH Sampling

Sampling period = h

(41)

ZOH periodic sampling with period = h

(42)

Technische Universität München

•! Given system: •! Control law:

1.! Check controllability of (!,") " must be controllable. # must be invertible.

2.! Apply Ackermann’s formula 3.! Feedforward gain

42

Objectives

(i)! Place system poles (ii)! Achieve y " r as t " ! (iii) Design K and F

(43)

•! Given

•! The control input such that closed-loop poles are at

•! Using Ackermann’s formula:

(44)

Technische Universität München

Continuous Vs Discrete Time

Continuous-time ZOH periodic sampled

44

Input: Input:

(45)

The Real Case

Loop start u = K*[x1(i);x2(i)] + r*F; xkp1 = phi*[x1(i);x2(i)]+ Gamma*u; x1(i+1) = xkp1(1); x2(i+1) = xkp1(2); Loop end Tm: measure Tc : compute Ta : actuate Feedback loop

(46)

Technische Universität München

Control Loop

46 Tm Ta Tc h= sampling period $ = sensor-to-actuator delay Sensor reading Actuation Tm : measure Tc : compute Ta : actuate Feedback loop

(47)

Control Task Triggering

Tm Tc Ta

•! In general, Tm and Ta tasks consume negligible computational time and are time-triggered

•! Tc needs finite computation time and is preemptive

(48)

Technische Universität München

Control Task Model: Constant Delay

48 Deadline Dc Tc preemption wait Tm Sampling period = h Tm Ta

(49)

Design Steps

Real-time tasks + control applications

Overall response time analysis

Task models

Schedulability test +Timing properties

Controller design

Partial

redesign

Stage I

(50)

Technische Universität München

Response Time Analysis

50

!

Periodic tasks with

fixed-priority

scheduling

!

Solution to a fixed point computation

(51)

Controller design steps for D

c

< h

Continuous-time model

New discrete-time model:

Sampled-data model

Controller design based on the

sampled-data model

ZOH sampling with period h and constant sensor-to-actuator delay Dc Step I

(52)

Technische Universität München 52

Dc

Tc

t

k

t

k+1

Snapshot of One Sampling Period

x(t

k

)

x(t

k+1

)

(53)
(54)
(55)
(56)

Technische Universität München

Sampled-data Model

56

Continuous-time model

ZOH sampling with period h and constant sensor-to-actuator delay Dc

!

End of Step 1

(57)

•! We define new system states:

•! With the new definition of states, the state-space becomes

where the augmented matrices are defined as follows

(58)

Technische Universität München

•! Given system: •! Control law:

1.! Check controllability of " must be controllable. # must be invertible where # is defined as follows

2.! Apply Ackermann’s formula 3.! Feedforward gain

58

Objectives

(i)! Place system poles (ii)! Achieve y " r as t " ! (iii) Design K and F

Controller Design for D

c

< h

(59)

Summary: Design for D

c

< h

Continuous-time model Sampled-data model Augmented system Controller

(60)

Technische Universität München

A More Complex Case

(involves stability analysis of switched systems)

(61)

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

Challenge:

(62)

Technische Universität München 62

FlexRay – Event Vs Time-triggered

task

message

task

x

Asynchronous

task

message

task

Synchronous

Jitter, lost/unused data

Predictable

(63)

Communication Schedules

!

!

The temporal behavior is

predictable

!

!

The bandwidth utilization is

poor

!

!

Availability is limited

!

!

The temporal behavior is

unpredictable

!

!

The bandwidth utilization is

better

!

!

Availability is higher

Time-triggered (TT)

Event-triggered (ET)

Conventional design: Use TT for control-messages

Problem:

(64)

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

64

r

t

Transient State Steady State

Observations

(65)

Mode Switching Scheme

Plant in Steady-State Plant in Transient Mode Change Protocol Plant in Transient Plant in Steady- State

TT :

ET :

Schedule :

Schedule :

Controller :

Controller :

S

" "

!

S

"#

!

K

"#

!

K

" "!

M

! !

M

!"

x

[

k

]

!

x

[

k

]

> E

"# Mode Change Request After

Schedule :

Controller :

S

"

!

S

"

S

#

K

"

!

K

"

K

#

Schedule :

Controller :

S

"

!

S

"

S

"

K

"!

K

"

K

"

(66)

Technische Universität München

Example

!

!

We consider two distributed control applications

communicating via a hybrid communication bus

66

!

!

We apply state-feedback controller for both, i.e.,

(67)

Performance with TT Communication

Control Gains

Quality of control

C

1

(68)

Technische Universität München

Performance with ET Communication

68

Control Gains

Quality of control

C

1

C

2

(69)

Performance with Switching

Quality of control

C

1

C

We have one shared TT communication slot. The control messages are transmitted via ET communication when they are in s t e a d y s t a t e a n d s w i t c h e s t o T T communication when transient state occurs due to some disturbance

(70)

Technische Universität München

Experimental Setup

(71)

Mixed time-/event-triggered

Purely event-triggered Purely time-triggered

(72)

Technische Universität München

Controller Design with Signal Drops

(73)

Actuator: u[k]

--

f(x[0]) f(x[1]) f(x[4]) 1 = !! " ## $ h % 1 = !! " ## $ h % 1 = !! " ## $ h % 1 = !! " ## $ h % x[0] x[1] x[2] x[4] x[5] f(x[2]) x[3] Sensor: x[k] f(x[3]) 1 = !! " ## $ h %

Control Law for stable samples

1 = !! " ## $ h %

]

1

[

]

[

]

1

[

k

+

=

Ax

k

+

BFx

k

!

x

]

1

[

]

[

k

=

Fx

k

!

u

Control Law: Closed-loop Dynamics:

h

!

!

"

0

Stable samples:

(74)

Technische Universität München

1

2

3

4

5

0

Sampling instant: k Actuator: u[k]

--

f(x[0])

f(x[1])

f(x[4])

stable

stable

stable

unstable

stable

1 = !! " ## $ h % 1 = !! " ## $ h % 2 = !! " ## $ h % 1 = !! " ## $ h % 1 = !! " ## $ h %

x[0]

x[1]

x[2]

x[4]

time

x[5]

f(x[2])

x[3]

Sensor: x[k]

f(x[2])

1 = !! " ## $ h %

Control with

stable

and

unstable

Samples

!

!

"

!

!

#

$

%

&&

'

((

)

=

&&

'

((

)

*

=

samples

unstable

or

h

if

samples

stable

or

h

if

k

Fx

k

u

,

1

0

1

]

1

[

]

[

:

Scheme

Control

Proposed

+

+

(75)

Asymptotic Stability

The distributed control application is asymptotically stable as

long as the ratio between number of stable and unstable

samples is greater than or equal to certain upper bound, i.e.,

the condition for guaranteed asymptotic stability is (

!

is a

positive integer)

µ

!

samples

unstable

of

number

samples

stable

of

number

Therefore, we allow a fraction of samples to be

unstable

or violate

the deadlines but still guarantee asymptotic stability!

µ

(76)

Technische Universität München

!"#$%&'()*+

( !" #" $" %" &" '" (" )" *" 1 =

!

!

=1

2

=

!

3

=

!

1 =

!

+,-./0"

12345-" 6,12345-"

!!

"

##

$

=

h

%

&

!

723485820"9:"2;-"<9,2.95"1012-="81"431->"9,"2;-":3<2"2;32"2;-"" 1012-="!"!#$%&'()!*+,"-./"*>-<.-31-1"?82;"@=-" +,-./0">-<.-31-1"-A-,"8:"2;-.-"81"59<35"8,<.-31-"" 8,"-,-./0"4-<361-"9:"6,12345-"13=B5-1"

Intuitive Proof

(77)

Intuitive Proof – Illustration

"

!

Does exist for any discrete-time system?

!

!

Yes.

Let u assume the closed-loop dynamics at: Stable samples:

Unstable samples:

As the closed-loop dynamics is stable at the stable samples,

Resultant Dynamics

(78)

Technische Universität München

Example: Control over FlexRay

We have found that the closed-loop system with the above

Controller is stable as long as the ratio between the number of

stable and unstable samples

µ

!

52

ms

Interval

Sampling

k

as

k

x

stability

Goal

Design

k

x

k

Fx

k

u

Controller

Poles

loop

Open

k

u

k

x

k

x

Plant

40

:

0

]

[

:

)

(

]

1

[

]

0355

.

1

2858

.

0

8622

.

1

[

]

1

[

]

[

:

Plant

System

Unstable

Highly

],

3283

.

0

,

4

.

1

,

57

.

1

[

:

]

[

5

.

0

7

.

0

1

.

0

]

[

8

.

2

2

.

1

6

.

3

6

.

0

9

.

0

56

.

0

7

.

0

6

.

0

4

.

0

]

1

[

:

!

"

"

#

#

#

#

=

#

=

#

#

#

#

$

$

$

%

&

'

'

'

(

)

+

$

$

$

%

&

'

'

'

(

)

#

#

#

#

#

#

=

+

(79)

Scheduling: Example 1

(80)

Technische Universität München

Scheduling: Example 2

72345-"13=B5-1" G,12345-"13=B5-1" 7012-="81"12345-"31""x[k]"0 as k"!

H-.238,"91<8553@9,1">6-"29"2;-"B.-1-,<-" 9:"6,12345-"13=B5-1"

(81)

Scheduling: Example 3

(82)

Technische Universität München

Current Design Flow

82

High-level requirements

Applications

HW/SW architecture

Multiple processor units (PUs) connected via a shared bus connected via a shared bus

!

Controller design

Model

Code synthesis & Task partitioning T1 T2 T3 T4 Task mapping m2 m1 mm2 m m1 Task and Message scheduling Fixed-precision arithmetic

Delay / jitter message loss Multiple processor units (PUs)

connected via a shared bus connected via a shared bus

Unreliable hardware soft-errors, aging,

(83)

Open Issues

!

Integration of control theory, program analysis,

embedded systems modeling & analysis

!

How to

synthesize

implementation platform & software

that minimizes error?

!

Cross-layer modeling & optimization techniques

necessary (interplay between delay & numerical

accuracy)

!

Open issues in hardware/circuit design

!

dynamically adjust precision during runtime or based on plant

state (using reconfigurable computing)

(84)

Technische Universität München

Concluding Remarks

84

!

!

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

References

Related documents

supply of a tourism product involves both, tourism specific entities (e.g. ho- tels, restaurants, travel agencies, tourism information points, etc.), as well as other companies

proposed penalties in each case; (4) the distinct differences in the identity and number of fact witnesses for each case; (4) the breadth of documentary evidence that will be

Fire protection must be applied to the beams over a minimum length equal to the distance separating the wall with the first vertical member of lattice frame (see Figure 5.21 (b)).

The bridging technique of two SSH tunnels at the pass-through system running DIRECWAY can be adapted to any system furnished with a NIC, SSH software, and Internet access at

Consumer Product Safety Commission has designated window coverings with exposed cords to be one of the top five hidden hazards in homes with young children.. Strangulation deaths

DURATION: 15 working days (Under normal circumstances; subject further to the submission of additional documents and information as may be required by PEZA) PROCEDURAL PROCESS FLOW

If you obtain a setline permit, and a Utah fishing or combination license, you can use a setline to take fish from the following waters: Bear River proper (downstream from the Idaho

sexual violence. The top law officer pointed out that the Supreme Court currently has only two women judges as against the sanctioned strength of 34 judges and