computing for embedded systems - ptolemy...

Post on 05-Aug-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

State of the Art LectureIEEE Instrumentation and Measurement

Technology ConferenceBudapest, Hungary, May 21-23, 2001

Computing for Embedded Systems

Edward A. LeeUC Berkeley

computers without actuators andsensors are destined to look like this.

Edward A. Lee, Berkeley, 2

What is an Embedded System?One or more computers

but not first-and-foremost a computerInteraction with physical processes

sensors, actuators, processesReactive

operating at the speed of the environmentHeterogeneous

hardware/software, mixed architecturesNetworked

adaptive software, shared data, resource discovery

primeexample

today

2

Edward A. Lee, Berkeley, 3

Why is Embedded SW an Issue?Embedded systems becoming networked

more complex, more vulnerablecan no longer use static point designs

Focus on non-functional properties is new for SWreal-time, fault recovery, power, security, robustness

Neglected areacomputer science has largely ignored itbest-of-class methods don’t help much

Edward A. Lee, Berkeley, 4

E.g. Object-Oriented DesignCall/return imperative semanticsConcurrency is via ad-hoc calling conventions

band-aids: futures, proxies, monitorsPoorly models the environment

which does not have call/return semanticsNothing at all to say about time

ComponentEntityCompositeEntity

AtomicActor

CompositeActor

0..10..n

«Interface»Actor

+getDirector() : Director+getExecutiveDirector() : Director+getManager() : Manager+inputPortList() : List+newReceiver() : Receiver+outputPortList() : List

«Interface»Executable

+fire()+initialize()+postfire() : boolean+prefire() : boolean+preinitialize()+stopFire()+terminate()+wrapup()

Director

Object modelingemphasizes inheritanceand procedural interfaces.

We need to emphasizesconcurrency andcommunicationabstractions.

3

Edward A. Lee, Berkeley, 5

E.g. Real-Time Corba

Component specification includesworst case execution timetypical execution timecached execution timepriorityfrequencyimportance

This is an elaborate prayer…

Edward A. Lee, Berkeley, 6

Alternative View of SW Architecture:Actors with Ports and Attributes

PortPort

Actor ActorLink

Relation

ActorPort

connection

connection conn

ectio

n

Link

Link

Attributes Attributes

Attributes

Model of Computation:

• Messaging schema• Flow of control• Concurrency

Examples:

• Time triggered• Process networks• Discrete-event systems• Dataflow systems• Publish & subscribe

Key idea: The model of computation is part of the frameworkwithin which components are embedded rather than part of thecomponents themselves.

4

Edward A. Lee, Berkeley, 7

Examples of Actors+PortsSoftware Architectures

Simulink (The MathWorks)Labview (National Instruments)OCP, open control platform (Boeing)SPW, signal processing worksystem (Cadence)System studio (Synopsys)ROOM, real-time object-oriented modeling (Rational)Port-based objects (U of Maryland)I/O automata (MIT)VHDL, Verilog, SystemC (Various)Polis & Metropolis (UC Berkeley)Ptolemy & Ptolemy II (UC Berkeley)…

Edward A. Lee, Berkeley, 8

What a Program Might Look Like

5

Edward A. Lee, Berkeley, 9

Ptolemy II – An Open SourceSoftware Laboratory

Ptolemy II –

Emphasis is on building a frameworksupporting experimentation withmodels of computation and theirinteractions.

http://ptolemy.eecs.berkeley.edu

Edward A. Lee, Berkeley, 10

Example: Controlling anInverted Pendulum

The Furuta pendulum hasa motor controlling theangle of an arm, fromwhich a free-swingingpendulum hangs. Theobjective is to swing thependulum up and thenbalance it.

6

Edward A. Lee, Berkeley, 11

Execution

An execution of themodel displays varioussignals and at the bottomproduces a 3-D animationof the physical system.

Model by Johan Eker

Edward A. Lee, Berkeley, 12

Top-Level Model

The top-level is a continuous-time model that specifies thedynamics of the physical system as a set of nonlinear ordinarydifferential equations, and encapsulates a closed loop controller.

Framework by Jie Liu

7

Edward A. Lee, Berkeley, 13

Higher-Order Components

Complexsubmodels aregeneratedautomaticallyfrom equationsdescribing thephysicaldynamics. Framework by Jie Liu

Edward A. Lee, Berkeley, 14

A Modal Controller

The controlleritself is modal,with three modesof operation,where a differentcontrol law isspecified foreach mode.

Framework by Xiaojun Liu

8

Edward A. Lee, Berkeley, 15

The Discrete Controllers

Three discretesubmodels(dataflowmodels) specifycontrol laws foreach of threemodes ofoperation.

Framework by Steve Neuendorffer

Edward A. Lee, Berkeley, 16

The Graphical AnimatorA 3-D graphicalanimation isconstructedmodularly as aparametricscene graphthat is driven bythe physicalmodel.

Framework by Chamberlain Fong

9

Edward A. Lee, Berkeley, 17

The Key Idea

Components are actors with portsInteraction is governed by a model of computation

flow of controlmessaging protocols

So what is a model of computation?

It is the “laws of physics” governing theinteraction between componentsIt is the modeling paradigm

Edward A. Lee, Berkeley, 18

Model of Computation

What is a component? (ontology)States? Processes? Threads? Differential equations?Constraints? Objects (data + methods)?

What knowledge do components share? (epistemology)Time? Name spaces? Signals? State?

How do components communicate? (protocols)Rendezvous? Message passing? Continuous-time signals?Streams? Method calls? Events in time?

What do components communicate? (lexicon)Objects? Transfer of control? Data structures? ASCII text?

10

Edward A. Lee, Berkeley, 19

Domains – Ptolemy II Realizations ofModels of Computation

CSP – concurrent threads with rendezvousCT – continuous-time modelingDE – discrete-event systemsDDE – distributed discrete-event systemsDT – discrete time (cycle driven)FSM – finite state machinesGiotto – time driven cyclic modelsGR – graphicsPN – process networksSDF – synchronous dataflowxDF – other dataflow

Each of these defines a component ontology and an interactionsemantics between components. There are many morepossibilities!

Each isrealized as adirector and areceiver classin Ptolemy II

Edward A. Lee, Berkeley, 20

Heterogeneity – Hierarchical Mixturesof Models of Computation

Modal ModelsFSM + anything

Hybrid systemsFSM + CT

Mixed-signal systemsDE + CTDT + CT

Complex systemsResource managementSignal processingReal time

11

Edward A. Lee, Berkeley, 21

Domain

Domain

Domain

Hierarchical, Compositional Models

Schedulers (Directors) arenested hierarchically,each interacting withcomponents through theExecutable interface.Directors themselvesimplement this sameinterface, so the model iscompositional.

Edward A. Lee, Berkeley, 22

Key Advantages

Domains are specializedleantargetedoptimizableunderstandable

Domains are mixable (hierarchically)structureddisciplined interactionunderstandable interaction

12

Edward A. Lee, Berkeley, 23

Ptolemy IIOpen source frameworkBlock diagram user interfaceXML persistent file formatJava basedNetwork integratedFully extensibleExperiment with models of computation

http://ptolemy.eecs.berkeley.edu

Edward A. Lee, Berkeley, 24

Example Ptolemy II Experiment:Connecting to Smart Sensors

Ethernet Hub

AgilentNCAP

TelemonitorTilt sensor

1451.2

Simple demonstration project forDARPA software-enabled control(SEC) project.

13

Edward A. Lee, Berkeley, 25

Networked Smart Sensors

Ethernet

AgilentNCAP

TelemonitorTilt sensor

1451.2

HTTPinterface

HTTP queries

Edward A. Lee, Berkeley, 26

Abstraction of the Sensoras a Software Component

Ethernet

AgilentNCAP

TelemonitorTilt sensor

1451.2

HTTP queries

14

Edward A. Lee, Berkeley, 27

Discovery – Realizing More SpecializedCommunication with the Sensors

Ethernet

AgilentNCAP

TelemonitorTilt sensor

Hub

JINI

1451.2

Register a Service

Edward A. Lee, Berkeley, 28

Ethernet

AgilentNCAP

TelemonitorTilt sensor

Hub

JINI

1451.2

Discover a Service

Discovery – Realizing More SpecializedCommunication with the Sensors

15

Edward A. Lee, Berkeley, 29

Ethernet

AgilentNCAP

TelemonitorTilt sensor

Hub

JINI

1451.2

Download Interface Software

Discovery – Realizing More SpecializedCommunication with the Sensors

Edward A. Lee, Berkeley, 30

Ethernet

AgilentNCAP

TelemonitorTilt sensor

Hub

JINI

1451.2

Communicate

This wouldprovide a vendor-neutral softwarecomponent.

Discovery – Realizing More SpecializedCommunication with the Sensors

16

Edward A. Lee, Berkeley, 31

Smart Sensor + Ptolemy II

Tilt sensor connected to a plotter.

Edward A. Lee, Berkeley, 32

Actuator Setup

Proxy

serial port

IR tower

Lego Mindstorm

17

Edward A. Lee, Berkeley, 33

Distributed Lego Controller

Tilt sensor data published, controller subscribes.

left = 4 * xTilt - 2 * yTiltright = 4 * xTilt + 2 * yTilt

Edward A. Lee, Berkeley, 34

Issues Raised

Concurrency management with I/O

Separate threads handling I/O communication?Rendezvous with computational thread?Publish & subscribe buffering strategy?How to maintain time consistency?How to ensure no deadlock?Is HTTP a good way to communicate with sensors?

18

Edward A. Lee, Berkeley, 35

Conclusions

Actors with ports are better than objects withmethods for embedded system design.

Models of computation matter a great deal, andspecialization can help.

Ptolemy II provides an excellent openarchitecture for experimentation.

http://ptolemy.eecs.berkeley.edu

top related