Introduction to Embedded Systems -...

18
1 Introduction to Embedded Systems A Cyber-Physical Systems Approach Source: Resources for Instructors at http://leeseshia.org Copyright © 2008-11, Edward A. Lee & Sanjit Seshia, All rights reserved Chapter 1: Cyber Physical Systems What are Embedded Systems? Computers whose job is not primarily information processing, but rather is information processing, but rather is interacting with physical processes. Examples: Automotive controllers Avionics Medical devices 2 Medical devices Industrial control Energy management and conservation A broader view is that of cyber-physical systems (CPS)

Transcript of Introduction to Embedded Systems -...

Page 1: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

1

Introduction toEmbedded SystemsA Cyber-Physical Systems Approach

Source: Resources for Instructors at http://leeseshia.org

Copyright © 2008-11, Edward A. Lee & Sanjit Seshia, All rights reserved

Chapter 1: Cyber Physical Systems

What are Embedded Systems?

Computers whose job is not primarily information processing, but rather isinformation processing, but rather is interacting with physical processes.

Examples:

Automotive controllers

Avionics

Medical devices

2

Medical devices

Industrial control

Energy management and conservation

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

Page 2: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

2

What are Embedded Systems?

Computational systems but not first and foremost a computer but not first-and-foremost a computer

Integral with physical processes sensors, actuators, physical dynamics

Reactive at the speed of the environment (timing matters!)

Heterogeneous

3

Heterogeneous hardware/software/networks, mixed architectures

Networked concurrent, distributed, dynamic

2001 National Research Council ReportEmbedded Everywhere

“Information technology (IT) is on the verge of another revolution. Driven by the increasing capabilities and ever declining costs of computing and communications devices, IT is being embedded into a growing range of physical devices linked together through networks and will become ever more pervasive as the component technologies become smaller, faster, and cheaper... These networked systems of embedded computers ... have the potential to change radically the way people interact with their environment by linking together a range of devices and sensors that will allow information to be collected, shared, and processed in unprecedented ways. ... The use of [these embedded computers] throughout society could well dwarf previous milestones in the information revolution ”

4

well dwarf previous milestones in the information revolution.

Page 3: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

3

Cyber-Physical Systems (CPS):Orchestrating networked computational resources with physical systems

Transportation(Air traffic control at SFO)

Avionics

TelecommunicationsAutomotive

Building Systems

Power generation and distribution

E-Corner, Siemens

Factory automation

Instrumentation(Soleil Synchrotron)

Daimler-Chrysler

5Courtesy of Kuka Robotics Corp.Courtesy of Doug SchmidtCourtesy of Doug SchmidtCourtesy of

General Electric

Military systems:

Daimler-Chrysler

What is cyber-physical systems (CPS)?

Tight coordination between computational and physical elements [NSF Program 10 515 30M USDphysical elements [NSF Program 10-515, 30M USD each year]

Network of interacting elements instead of standalone devices

System of systems

6

Various applications; aerospace, automotive, healthcare, chemical processes, civil infrastructure, energy, manufacturing, transportation, entertainment

Virtually, every complex man-made system is CPS

Page 4: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

4

More about CPS

“Physical and engineered systems whose operations are monitored controlled coordinated and integrated by amonitored, controlled, coordinated, and integrated by a computing and communication core” [Rajkumar2010]

“CPS is an integration of computation with physical processes. Embedded computers and networks monitor and control the physical processes, usually with feedback loops where physical processes affect

7

feedback loops where physical processes affect computations and vice versa. CPS is about the intersection, not the union, of the physical and the cyber. It is not sufficient to separately understand the physical components and the computational components” [Lee&Leshia2011]

CPS as next theme after Internet

8

Page 5: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

5

Key components of CPS

Cyber + Networks + Physical

9

NSF CPS Program in US

Joint initiative of Directorate for Computer and Information Science and Engineering (CISE) andInformation Science and Engineering (CISE) and Directorate for Engineering (ENG)

Total funding of up to about $30M, 30-40 awards

Proposals due February 27, 2009

10

Continuation in future years

Page 6: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

6

NSF model for expediting progress

A new underlying discipline

Abstracting from sectors to more general principles

Apply these to problems in new sectors

B ild CPS it

11

Build a new CPS community

Three CPS themes

FoundationsDevelop new scientific and engineering principles,

algorithms models and theories for analysis and design ofalgorithms, models, and theories for analysis and design of CPS

Research on methods and toolsBridge gaps between approaches to cyber and physical

elements of systems through innovations such as novel support for multiple views, new programming languages,

d l ith f i b t d f ll if i

12

and algorithms for reasoning about and formally verifying properties of integrations of cyber and physical resources

Components and SystemsNew hardware and software infrastructure and platforms

and engineered systems motivated by grand challenge applications

Page 7: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

7

First year (2009) CPS awards

527 proposals, 58 awardedH lth d di iHealth and medicine

Energy and environment

Aviation and automotive

New system science

Platforms

13

CPS Example: Medical Devices

Emerging direction: Cell phone based medical devices forbased medical devices for affordable healthcare

e.g. “Telemicroscopy” project at Berkeley

e.g. Cell-phone based blood testing device developed at

14

g pUCLA

Page 8: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

8

CPS Example – Printing Press

• High‐speed, high precision• Speed 1 inch/ms• Speed: 1 inch/ms

• Precision: 0.01 inch

‐> Time accuracy: 10us

• Open standards (Ethernet)• Synchronous, Time‐Triggered

• IEEE 1588  time‐sync protocol

A li ti t

15

• Application aspects• local (control)

• distributed (coordination)

• global (modes)Bosch‐Rexroth

Example: Toyota autonomous vehicle technology roadmap, c. 2007Source: Toyota Web site

16

Page 9: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

9

Example: Automotive electronics today

About 80 computers (electronic control units, ECUs) in a premium car today: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) i h 2k f i i

17

with up to 2km of wiring.

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

DARPA Grand Challenge

18

Page 10: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

10

Where CPS Differs fromthe traditional embedded systems problem:

The traditional embedded systems problem:Embedded software is software on small computers The technicalEmbedded 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

19

p g g y , , yin networked computational + physical systems.

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 itHaskell, 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.

20

p y g y

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

Page 11: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

11

Techniques Exploitingthe Fact that Time is Irrelevant

Programming languagesProgramming languagesVirtual memoryCachesDynamic dispatchSpeculative executionPower management (voltage scaling)Memory management (garbage collection)Just-in-time (JIT) compilationM ltit ki (th d d )

21

Multitasking (threads and processes)Component technologies (OO design)Networking (TCP)…

Content of an Embedded Systems Course

Traditional focus CPS focus

• Hardware interfacing

• Interrupts

• Memory systems

• C programming

• Assembly language

• Modeling

• Timing

• Dynamics

• Concurrency

• Verification

22

• Assembly language

• FPGA design

• RTOS design

• …

• Verification

• …

Page 12: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

12

CPS is Multidisciplinary

Computer Science: System Theory:Computer Science:

Carefully abstracts the physical world

System Theory:

Deals directly with physical quantities

23

Cyber Physical Systems:Computational +

Physical

First Challenge

Models for the physical world and for computation diverge.

physical: time continuum, ODEs, dynamics

computational: a “procedural epistemology,” logic

There is a huge cultural gap.

24

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

Page 13: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

13

An Advantage: A Unified EECS Department

25

Second Challenge

We typically learn to use modeling techniques, not to evaluate modeling techniquesevaluate modeling techniques.

“this is how computers work”

“this equation describes that feedback circuit”

rather than “this is how Von Neumann proposed that we control

automatic machines”

“ignoring the intrinsic randomness and latency in this

26

ignoring the intrinsic randomness and latency in this circuit, Black proposed that we could idealize its behavior in this way”

We need to think about meta-modeling, not just modeling. They must learn to think critically about modeling methods, not just about models.

Page 14: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

14

What this course is about

A principled, scientific approach to designing and i l ti b dd d timplementing embedded systems

Focus on model-based system design

27

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

28

network processors

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

This is how embedded SW has been designed for 30 years

Page 15: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

15

But embedded systems do have more fundamental differences from general-purpose computation:

time matters “as fast as possible” is not good enough 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)

29

pp p ( g ) 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

What about “real time”?

Make it faster!

30

Make it faster!

What if you need “absolutely positively on time”?

Today, most embedded software engineers write code, build your system, and test for timing. Model-based design seeks to specify dynamic behavior (including timing) and “compile” implementations that meet the behavior.

Page 16: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

16

Real-Time Multitasking?

All too often, real-time operating systems (RTOSs) are used in a

th d h With trather ad hoc way. Without any particular principles, engineers tweak priorities until the prototype works under test.

The resulting system is brittle, meaning the small changes in the operating conditions (or in

31

Prioritize and Pray!

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.

An engineer’s responsibility

32

Korean Air 747 in Guam, 200 deaths (1997) 30,000 deaths and 600,000 injuries from medical devices (1985-2005)

perhaps 8% due to software?

source: D. Jackson, M. Thomas, L. I. Millett, and the Committee on Certifiably Dependable Software Systems, "Software for Dependable Systems: Sufficient Evidence?," National Academies Press, May 9 2007.

Page 17: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

17

Abstraction Layers

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

33

Abstraction Layers

Every abstraction layer has failed for time-sensitivetime-sensitive applications.

34

Page 18: Introduction to Embedded Systems - wits.gist.ac.krwits.gist.ac.kr/restricted/courses/cps/01_CyberPhysicalSystems.pdf · Courtesy of Doug Schmidt Courtesy of Kuka Robotics Corp. 5

18

Some CPS applications:

telepresencedistributed physical games

Dec. 11, 2006: Dancers in Berkeley dancing in

real time with dancers in p y gtraffic control and safetyfinancial networksmedical devices and systemsassisted livingadvanced automotive systems,energy conservationenvironmental control

Potential impactsocial networking and gamessafe/efficient transportationfair financial networksintegrated medical systemsdistributed micro power generation military dominance

Urbana-Champaign

35

environmental controlaviation systemscritical infrastructure (power, water) distributed roboticsmilitary systemssmart structuresbiosystems (morphogenesis,…)

yeconomic dominancedisaster recoveryenergy efficient buildingsalternative energypervasive adaptive communicationsdistributed service delivery…

Topics we will study

Modeling dynamic behaviors Continuous time, discrete time, feedback, control, …

Real-time scheduling Various scheduling algorithms, scheduling anomalies, …

Wireless networking

36

gCapacity of wireless networks, wireless MAC, …