Modeling Heterogeneous Systems - Design f or Understanding - Design - - PowerPoint PPT Presentation

modeling heterogeneous systems
SMART_READER_LITE
LIVE PREVIEW

Modeling Heterogeneous Systems - Design f or Understanding - Design - - PowerPoint PPT Presentation

Modeling Heterogeneous Systems - Design f or Understanding - Design f or Saf ety Workshop Edward Lee NASA Ames Research Center UC Berkeley Mountain View, CA 11 October, 2000 Components and Composition vehicle controller model vehicle


slide-1
SLIDE 1

Modeling Heterogeneous Systems

Edward Lee UC Berkeley

Design f or Saf ety Workshop NASA Ames Research Center Mountain View, CA 11 October, 2000

  • Design f or Understanding -
slide-2
SLIDE 2

Edward A. Lee, UC Berkeley actuator controller

Br Acc Ba

vehicle model vehicle dynamics sensor

S

Components and Composition

modes

slide-3
SLIDE 3

Edward A. Lee, UC Berkeley

Common Approaches

Threads or processes

– Sun says in t he on-line J ava t ut orial:

“The f ir st r ule of using t hr eads is t his: avoid t hem if you can. Threads can be dif f icult t o use, and t hey t end t o make pr ogr ams har der t o debug.”

Semaphores, monit ors, mut ex

– Deadlock, livelock, liveness – hard t o underst and

Priorit ies, deadlines

– Plug and pray

slide-4
SLIDE 4

Edward A. Lee, UC Berkeley

Understanding Component I nteractions - Frameworks

What is a component (ont ology)?

– St at es? Pr ocesses? Thr eads? Dif f er ent ial equat ions?

Const r aint s? Obj ect s (dat a + met hods)?

What knowledge do component s share (epist emology)?

– Time? Name spaces? Signals? St at e?

How do component s communicat e (prot ocols)?

– Rendezvous? Message passing? Cont inuous-t ime signals?

St r eams? Met hod calls?

What do component s communicat e (lexicon)?

– Obj ect s? Tr ansf er of cont r ol? Dat a st r uct ur es? ASCI I t ext ?

slide-5
SLIDE 5

Edward A. Lee, UC Berkeley

A Laboratory f or Exploring Component Frameworks

Pt olemy I I –

– J ava based, net wor k int egr at ed – Sever al f r amewor ks implement ed –

A realizat ion of a f ramework is called a “domain.” Mult iple domains can be mixed hier ar chically in t he same model. ht t p:/ / pt olemy.eecs.ber keley.edu

slide-6
SLIDE 6

Edward A. Lee, UC Berkeley

act ion { … read(); … }

One Class of Component I nteraction Semantics: Producer / Consumer

act ion { … wr it e(); … } channel port port receiver Are act ors act ive? passive? react ive? Flow of cont rol is mediat ed by a direct or. Are communicat ions t imed? synchronized? buf f ered? Communicat ions are mediat ed by receivers.

slide-7
SLIDE 7

Edward A. Lee, UC Berkeley

Domain – A Realization of a Component Framework

CSP – concur r ent t hr eads wit h r endezvous CT – cont inuous-t ime modeling DE – discr et e-event syst ems DT – discr et e t ime (cycle dr iven) P

N – process net works

P

N’ – Pet ri net s

SDF – synchr onous dat af low SR – synchr onous/ r eact ive PS – publish-and-subscr ibe

Each of t hese def ines a component ont ology and an int er act ion semant ics bet ween component s. Ther e ar e many mor e possibilit ies! Each is r ealized as a direct or and a r eceiver class in Pt olemy I I

slide-8
SLIDE 8

Edward A. Lee, UC Berkeley

  • 1. Continuous Time (Coupled ODEs)

Semant ics:

– act ors def ine relat ions

bet ween f unct ions of t ime (ODEs or algebraic equat ions)

– a behavior is a set of

signals sat isf ying t hese relat ions Examples:

  • Spice,
  • HP ADS,
  • Simulink,
  • Saber,
  • Mat rix X,
slide-9
SLIDE 9

Edward A. Lee, UC Berkeley

  • 1. Continuous Time in Ptolemy I I

The cont inuous t ime (CT) domain in Pt olemy I I models component s int eract ing by cont inuous-t ime

  • signals. A variable-

st ep size, Runge- Kut t a ODE solver is used, augment ed wit h discret e-event management (via modeling of Dirac delt a f unct ions).

slide-10
SLIDE 10

Edward A. Lee, UC Berkeley

  • 1. CT: Strengths and Weaknesses

St rengt hs:

– Accur at e model f or many physical syst ems – Det er minat e under simple condit ions – Est ablished and mat ur e (appr oximat e) simulat ion t echniques

Weaknesses:

– Cover s a nar r ow applicat ion domain – Tight ly bound t o an implement at ion – Relat ively expensive t o simulat e – Dif f icult t o implement in sof t war e

slide-11
SLIDE 11

Edward A. Lee, UC Berkeley

  • 2. Discrete Time

Semant ics:

– blocks are relat ions

bet ween f unct ions of discret e t ime (dif f erence equat ions)

– a behavior is a set of

signals sat isf ying t hese relat ions

z-1 z-1 z-1 z-1

Examples:

  • Syst em C
  • HP Pt olemy,
  • Syst emView,
  • ...
slide-12
SLIDE 12

Edward A. Lee, UC Berkeley

  • 2. DT: Strengths and Weaknesses

St rengt hs:

– Usef ul model f or embedded DSP – Det er minat e under simple condit ions – Easy simulat ion (cycle-based) – Easy implement at ion (circuit s or sof t ware)

Weaknesses:

– Cover s a nar r ow applicat ion domain – Global synchrony may over specif y some syst ems

slide-13
SLIDE 13

Edward A. Lee, UC Berkeley

  • 3. Discrete Events

Examples:

  • SES Workbench,
  • Bones,
  • VHDL
  • Verilog
  • ...

Semant ics:

– Event s occur at discret e

point s on a t ime line t hat is of t en a cont inuum. The component s react t o event s in chronological

  • rder.

t ime event s

slide-14
SLIDE 14

Edward A. Lee, UC Berkeley

  • 3. Discrete- Events in Ptolemy I I

The discret e-event (DE) domain in Pt olemy I I models component s int eract ing by discret e event s placed in t ime. A calendar queue scheduler is used f or ef f icient event management , and simult aneous event s are handled syst emat ically and det erminist ically.

slide-15
SLIDE 15

Edward A. Lee, UC Berkeley

  • 3. DE: Strengths and Weaknesses

St rengt hs:

– Nat ural f or asynchronous digit al hardware – Global synchronizat ion – Det erminat e under simple condit ions – Simulat able under simple condit ions

Weaknesses:

– Expensive t o implement in sof t ware – May over-specif y and/ or over-model syst ems

slide-16
SLIDE 16

Edward A. Lee, UC Berkeley

Mixing Domains Example: MEMS Accelerometer

+

  • Digital

T

V/F

  • M. A. Lemkin, “Micro Acceleromet er

Design wit h Digit al Feedback Cont rol”, Ph.D. dissert at ion, EECS, Universit y of Calif ornia, Berkeley, Fall 1997

slide-17
SLIDE 17

Edward A. Lee, UC Berkeley

Accelerometer Applet

This model mixes t wo Pt olemy I I domains, DE (discret e event s) and CT (cont inuous t ime).

slide-18
SLIDE 18

Edward A. Lee, UC Berkeley

text

K(z)

Sin

+

1/s 1/s ZOH

DE CT

Sampler ZeroOrderHold CTPlot Integrator Integrator Gain Gain Gain Gain Source FIRFilter Quantizer accumulator DEPlot

Hierarchical Heterogeneous Models

Cont inuous-t ime model Discret e-event model

slide-19
SLIDE 19

Edward A. Lee, UC Berkeley

Hierarchical Heterogeneity vs. Amorphous Heterogeneity

Color is a domain, which def ines bot h t he f low of cont rol and int eract ion prot ocols.

Hierarchical

Color is a communicat ion prot ocol

  • nly, which int eract s in

unpredict able ways wit h t he f low

  • f cont rol.

Amorphous

slide-20
SLIDE 20

Edward A. Lee, UC Berkeley

  • 4. Synchronous/ Reactive Models

A discret e model of t ime progresses as a

sequence of “t icks.” At a t ick, t he signals are def ined by a f ixed point equat ion:

A C B

x y z

x y z f f z f x y

A t B t C t

L N M M M O Q P P P

L

N M M M O Q P P P

, , ,

( ) ( ) ( , ) 1

Examples:

  • Est erel,
  • Lust re,
  • Signal,
  • Argos,
  • ...
slide-21
SLIDE 21

Edward A. Lee, UC Berkeley

  • 4. SR: Strengths and Weaknesses

St rengt hs:

– Good mat ch f or cont r ol-int ensive syst ems – Tight ly synchr onized – Det er minat e in most cases – Maps well t o har dwar e and sof t war e

Weaknesses:

– Comput at ion-int ensive syst ems ar e overspecif ied – Modularit y is compromised – Causalit y loops ar e possible – Causalit y loops ar e har d t o det ect

slide-22
SLIDE 22

Edward A. Lee, UC Berkeley

  • 5. Process Networks

Processes are pref ix-

monot onic f unct ions mapping sequences int o sequences.

One implement at ion uses

blocking reads, non-blocking writ es, and unbounded FI FO channels.

Dat af low special cases have

st rong f ormal propert ies.

A C B

process channel st ream Examples:

  • SDL,
  • Unix pipes,
  • ...
slide-23
SLIDE 23

Edward A. Lee, UC Berkeley

  • 5. Strengths and Weaknesses

St rengt hs:

– Loose synchr onizat ion (dist r ibut able) – Det er minat e under simple condit ions – I mplement able under simple condit ions – Maps easily t o t hr eads, but much easier t o use – Tur ing complet e (expr essive)

Weaknesses:

– Cont rol-int ensive syst ems ar e har d t o specif y – Bounded r esour ces ar e undecidable

slide-24
SLIDE 24

Edward A. Lee, UC Berkeley

  • 6. Rendezvous Models

Event s represent rendezvous

  • f a sender and a receiver.

Communicat ion is unbuf f ered and inst ant aneous.

Of t en implicit ly assumed

wit h “process algebra” or even “concurrent .”

A C B

process event s

a a

1 2

, ,... b b

1 2

, ,...

Examples:

  • CSP,
  • CCS,
  • Occam,
  • Lot os,
  • ...
slide-25
SLIDE 25

Edward A. Lee, UC Berkeley

  • 6. Strengths and Weaknesses

St rengt hs:

– Models r esour ce shar ing well – Part ial-or der synchr onizat ion (dist r ibut able) – Suppor t s nat ur ally nondet er minat e int er act ions

Weaknesses:

– Over synchr onizes some syst ems – Dif f icult t o make det er minat e (and usef ul)

slide-26
SLIDE 26

Edward A. Lee, UC Berkeley

Making Sense of the Options: Component I nterf aces

act or act or r epr esent int er act ion semant ics as t ypes on t hese por t s. r epr esent dat a t ypes f or messages exchanged on port s. classical type system system- level types

slide-27
SLIDE 27

Edward A. Lee, UC Berkeley

Approach – System- Level Types

General St ring Scalar Boolean Complex Double Long I nt NaT

act or act or represent int eract ion semant ics as t ypes on t hese port s.

A classical t ype syst em is based on f ixed-point s of monot onic f unct ions on a lat t ice where order represent s

  • subclassing. Our syst em-level t ypes are use t he simulat ion

relat ion bet ween aut omat a t o provide an order relat ion.

slide-28
SLIDE 28

Edward A. Lee, UC Berkeley

Our Hope – Domain Polymorphic I nterf aces

act or act or domain polymorphic int erf aces

slide-29
SLIDE 29

Edward A. Lee, UC Berkeley

Benef its of System- Level Types

Clarif y assumpt ions of component s Underst andable component composit ion Dat a polymorphic component libraries Domain polymorphic component libraries More ef f icient synt hesis (?)

slide-30
SLIDE 30

Edward A. Lee, UC Berkeley

*Charts: Exploiting Domain Polymorphism

A C D B x y z G F E x y z G F E

FSM domain

Modal model

XXX domain YYY domain

Domain-polymorphic component int erf ace

slide-31
SLIDE 31

Edward A. Lee, UC Berkeley

Special Case: Hybrid Systems

The st ickiness is exponent ially decaying wit h respect t o t ime. Example: Two point masses on springs on a f r ict ionless t able. They collide and st ick t oget her.

slide-32
SLIDE 32

Edward A. Lee, UC Berkeley

Hybrid System: Block Diagram

  • ut = k1*(y1 - in)/m1
  • ut = k2*(y2 - in)/m2

=?

P1 P2 V1 V2 C

  • ut = (k1*y1+ k2*y2 - in)/(m1+m2)

P1 V P2

  • ut = k1*(y1-in) - k2*(y2 - in)

Fs St

C P:=P1 V:=(V1*m1+V2*m2)/(m1+m2) s:=5 |Fs|>St P1:=P P2:=P V1:=V V2:=V

P1 P2

Plot

  • s

FSM domain CT domain CT CT

slide-33
SLIDE 33

Edward A. Lee, UC Berkeley

Ptolemy I I Execution

Because of domain polymorphism, moreover, Pt olemy I I can combine FSMs hierarchically wit h any

  • t her domain,

delivering models like st at echar t s (wit h SR) and SDL (wit h pr ocess net wor ks) and many

  • t her modal modeling

t echniques.

slide-34
SLIDE 34

Edward A. Lee, UC Berkeley

Summary

There is a rich set of component int eract ion models

– models of comput at ion – domains

Hierarchical het erogeneit y

– yields mor e under st andable designs t han amor phous

het er ogeneit y

Syst em-level t ypes

– Def ine t he dynamics of a component int er f ace

Domain polymorphism

– Mor e f lexible component libr ar ies – A ver y power f ul appr oach t o het er ogeneous modeling

slide-35
SLIDE 35

Edward A. Lee, UC Berkeley

Acknowledgements

The ent ire Pt olemy proj ect t eam cont ribut ed immensely t o t his wor k, but par t icular ly

J ohn Davis

Chamberlain Fong

Tom Henzinger

Christ opher Hylands

J ie Liu

Xiaoj un Liu

St eve Neuendorf f er

Sonia Sachs

Neil Smyt h

Kees Vissers

Yuhong Xiong