39
CIS 4930/6930 Principles of Cyber- Physical Systems Instructor: Hao Zheng

CIS 4930/6930 Principles of Cyber-Physical Systems Instructor: Hao Zheng

Embed Size (px)

Citation preview

CIS 4930/6930Principles of Cyber-Physical

Systems

Instructor: Hao Zheng

2

What are Embedded Systems?

Computers whose job is not primarily information processing, but rather is interacting (sensing and control) with physical processes

Examples: Automotive controllers Avionics Medical devices Industrial control Infrastructure Transportation Energy management and conservation

A broader view is that of cyber-physical systems (CPS)

3

Embedded Everywhere!

4

What are Embedded Systems?

Computationalbut not first-and-foremost a computer

Integral with physical processessensors, actuators, physical dynamics

Reactiveat the speed of the environment (timing matters!)

Heterogeneoushardware/software/networks, mixed architectures

Networkedconcurrent, distributed, dynamic

5

Differences Between Embedded Systems and General-Purpose Computation:

Time matters “as fast as possible” is not good enough

Concurrency is intrinsic it’s not an illusion (as in time sharing), and it’s not (necessarily) about exploiting parallelism

Processor requirements can be specialized predictable, repeatable timing support for common operations (e.g. FIR filters) need for specialized data types (fixed point, bit vectors)

Programs need to run (essentially) forever memory usage has to be bounded (no leaks!!) rebooting is not acceptable

6

Other Characteristics of Embedded Sys.

• Dependable• Reliability R(t) = probability of system working correctly

provided that is was working at t=0• Maintainability M(d) = probability of system working

correctly d time units after error occurred.• Availability A(t): probability of system working at time t• Safety: no harm to be caused• Security: confidential and authentic communication

• Making the system dependable must not be an after-thought, it must be considered from the very beginning

7

Other Characteristics of Embedded Sys.

• Efficiency• Code-size efficient (especially for systems on a chip)• Run-time efficient• Weight efficient• Cost efficient• Energy efficient

8

Cyber-Physical Systems (CPS)

CPS are the tight integration of and coordination between computation with physical processes.

CPS include embedded systems and networks to monitor and control physical processes.

Future CPS will be much stronger in Adaptability, autonomy, efficiency, functionality, reliability,

safety, and usability. The challenge is the interactions between the

embedded computers and the physical processes. Need to understand the joint dynamics of HW, SW,

networks and physical processes.

9

Applications

10

Medical Devices

Emerging direction: Cell phone based medical devices for affordable healthcare

e.g. “Telemicroscopy” project at Berkeley

Robotic surgery

11

Medical Devices: Assisted Living

For example:• Artificial eye: several

approaches, e.g.:• Camera attached to

glasses; computer worn at belt; output directly connected to the brain, “pioneering work by William Dobelle”. Previously at [www.dobelle.com]

Translation into sound; claiming much better resolution.[http://www.seeingwithsound.com/etumble.htm]

12

Medical Devices: Assisted Living (cont’d)

IEEE Spectrum, 1/2012

13

Infrastructures: Smart buildings

Examples Integrated cooling, lightning,

room reservation, emergency handling, communication

Goal: zero-net energy buildings Expected contribution to fight

against global warming

14

Transportation: Avionics

Flight control systems, Autonomous-collision avoidance, pilot information systems, power supply system, flap control system, entertainment system, …

Dependability is of outmost importance.

15

Transportation: Automotive electronics

About 80 computers (electronic control units, ECUs) in a premium car today:

engine control, transmission, anti-lock brakes, electronic suspension, parking assistance, climate control, audio system, “body electronics” (seat belt, etc.), display and instrument panel, etc.

linked together by CAN bus (today), FlexRay (tomorrow) with up to 2km of wiring.

growing fraction of development costs, manufacturing costs, and fuel consumption.

16

Transportation: DARPA Grand Challenge

17

Google Self-Drive Cars

http://youtu.be/PgTc4Np9YX4

18

Typical Embedded System Architecture

19

Structure of CPS

20

Where CPS Differs from the traditional embedded systems problem:

The traditional embedded systems problem:Embedded software is software on small computers. The technical problem is one of optimization (coping with limited resources and extracting performance).

The CPS problem:Computation and networking integrated with physical processes. The technical problem is managing dynamics, time, and concurrency in networked cyber + physical systems.

21

A Key Challenge on the Cyber Side:Real-Time Software

Correct execution of a program in C, C#, Java, Haskell, etc. has nothing to do with how long it takes to do anything. All our computation and networking abstractions are built on this premise.

Timing of programs is not repeatable, except at very coarse granularity.

Programmers have to step outside the programming abstractions to specify timing behavior.

22

Techniques Exploiting the Fact that Time is Irrelevant

Programming languagesVirtual memoryCachesDynamic dispatchSpeculative executionPower management (voltage scaling)Memory management (garbage collection)Just-in-time (JIT) compilationMultitasking (threads and processes)Component technologies (OO design)Networking (TCP)…

23

What about “Real Time”?

What if you need “absolutely positively on time”?

Today, most embedded software engineers write code, build your system, and test for timing.

The resulting system is brittle, meaning the slight changes in the operating conditions (or in the design of the system) can cause big changes in behavior. For example, replacing the processor with a faster one can cause real-time failures.

Prioritize and Pray!

24

A Story

A “fly-by-wire” aircraft, expected to be made for 50 years, requires a 50-year stockpile of the hardware components that execute the software.

All must be made from the same mask set on the same production line. Even a slight change or “improvement” might affect timing and require the software to be re-certified.

25

Abstraction Layers

The purpose for an abstraction is to hide details of the implementation below and provide a platform for design from above.

26

Abstraction Layers

Every abstraction layer has failed for time-sensitive applications.

27

Is the problem intrinsic in the technology?

Electronics technology delivers highly repeatable and precise timing…

… and the overlaying software abstractions discard it.

20.000 MHz (± 100 ppm)

28

Cyber Physical Systems:Computational +

Physical

CPS is Multidisciplinary

Computer Science:

Carefully abstracts the physical world

System Theory:

Deals directly with physical quantities

29

CPS is at boundary of EE and CS

30

Traditionally, embedded systems has been an industrial (not academic) problem, principally about resource limitations.

Small memory Small data word sizes Relatively slow clocks

When these are the key problems, emphasize efficiency: write software at a low level (in assembly code or C) avoid operating systems with a rich suite of services develop specialized computer architectures:

programmable DSPs network processors

develop specialized networks Can, FlexRay, TTP/C, MOST, etc.

This is how embedded systems have been designed for 30 years

31

Content of an Embedded Systems Course

Traditional focus• Hardware interfacing• Interrupts• Memory systems• C programming• Assembly language• FPGA design• RTOS design• …

CPS focus• Modeling• Timing• Dynamics• Imperative logic• Concurrency• Verification• …

32

Main Challenge

Models for the physical world and for computation diverge.

Physical: continuous time, differential equations Computational: discrete time, logic

There is a huge cultural gap.

Physical system models must be viewed as semantic frameworks, and theories of computation must be viewed as alternative ways of talking about dynamics.

33

What this course is about

A principled, scientific approach to modeling and analysis of embedded systems

Not about specific designs

Ad hoc designs can be fun, but it can also be very painful when things go wrong…

Focus on model-based design for embedded systems

34

Course Theme: Model-Based Design

• A principled, scientific approach to designing and implementing embedded systems.• Modeling of cyber and physical processes

• Analyze the model.

• Synthesize the cyber control for the physical processes.

• MBD allows rapid prototyping, system verification, and design reuse.• Reduce the development cost.

• Speed up development process.

35

Modeling, Design, Analysis

Modeling is the process of gaining a deeper understanding of a system through imitation. Models specify what a system does.

Design is the structured creation of artifacts. It specifies how a system does what it does. This includes optimization.

Analysis is the process of gaining a deeper understanding of a system through dissection. It specifies why a system does what it does (or fails to do what a model says it should do).

36

What is Modeling?

Developing insight about a system, process, or artifact through imitation.

A model is the artifact that imitates the system, process, or artifact of interest.•If a model = good abstraction of a physical sys.•Assertions about models => confidence in the realization of the system.

37

More on Model-Based Design

1. Create a mathematical model of all the parts of the embedded system Physical world Control system Software environment Hardware platform Network Sensors and actuators

2. Construct the implementation from the model Construction may be automated, like a compiler More commonly, portions are automatically constructed

38

Topics we will study

Model-Based DesignRepresent systems based on mathematical models

System Analysis Verify that your model & implementation will meet a spec.

ConcurrencyRun multiple tasks correctly and efficiently

Real-Time Ensuring that tasks finish on time

Joint discrete-continuous dynamicsConsider CPS as a whole

39

Read Chapter 1 of Lee & Seshia