Overview of Ptolemy IIGraduate Students:J. Adam CataldoChris ChangElaine CheongXiaojun LiuStephen NeuendorfferJames YehYang ZhaoHaiyang ZhengRachel ZhouPrincipal Investigator:Edward A. LeeTechnical Staff:Christopher HylandsJoern JanneckJohn ReekieMary P. StewartKees VissersEE249, Fall 2002 2Embedded Systems• Systems that tightly integrate information processing with physical processes, such as:–Aircraft– Factory robots–Cars– Trains– AppliancesOnly 2% of computers today are first and foremost “computers.”The fate of computers lacking interaction with physical processes.EE249, Fall 2002 3Example: Automotive Engine Control Systemcylinderpower trainsensoractuatorcylindercylindercylinderembedded controllerengineHybrid AutomataDifferential EquationsContinuous TimeTimed MultitaskingDiscrete EventEE249, Fall 2002 4Components & CompositioncontrollerICHcar modelenginepowertrainEEE249, Fall 2002 5Actor-Oriented Design• Components are actors, which are concurrent, parameterized objects• Actors are composed according to a model of computation (MoC), such as:– Communicating sequential processes– Continuous time– Discrete event–Discrete time– Process networks– Synchronous dataflow– Synchronous/reactiveEE249, Fall 2002 6Object-Oriented andActor-Oriented Design• Object orientation– strong typing–inheritance– procedural interfaces• Actor orientation– concurrency–communication–real time• These are complementaryComponentEntityCompositeEntityAtomicActorCompositeActor0..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()DirectorActor orientation offers:• modeling the continuous environment (and hybrid systems)• understandable concurrency (vs. RPC, semaphores, and mutexes)• specifications of temporal behavior (vs. “prioritize and pray”)UML object model emphasizes inheritance and procedural interfaces.EE249, Fall 2002 7Ptolemy II – A Software LaboratoryPtolemy II:A framework supporting experimentation withz actor-oriented designz concurrent semanticsz visual syntaxeshttp://ptolemy.eecs.berkeley.educontinuous environmentmodal modeldiscrete controllerexample Ptolemy model: hybrid control systemEE249, Fall 2002 8Ptolemy II Infrastructure•kernel package– hierarchical component architecture• actor package– executable interface– message-passing interface– basic message passing and execution sequencing functionalities that are not specific to a particular model of computation• support packages– data (tokens, type system, expression language)– graph (graph algorithms)– math (math algorithms)– media (audio/video)–moml(persistence)– plot (signal plotters)– vergil (visual editor)EE249, Fall 2002 9Basic Kernel ClassesNamedObjEntity+connectedPortList() : List+connectionsChanged(port : Port)+getPort(name : String) : Port+linkedRelationList() : List+newPort(name : String) : Port+portList() : List+removeAllPorts()#_addPort(port : Port)#_removePort(port : Port)-_portList : NamedListPort+connectedPortList() : List+insertLink(int : index, relation : Relation)+isLinked(r : Relation) : boolean+linkedRelationList() : List+link(relation : Relation)+numLinks() : int+unlink(index : int)+unlink(relation : Relation)+unlinkAll()#_checkContainer(container : Entity)#_checkLink(relation : Relation)-_container : Entity-_relationsList : CrossRefList0..n0..1containeecontainerRelation+linkedPortList() : List+linkedPortList(except : Port) : List+numLinks() : int+unlinkAll()-_portList : CrossRefList0..n0..nlinklinkCrossRefList1..11..11..11..1Attribute0..n0..1EE249, Fall 2002 10Abstract SyntaxPortPortEntity EntityLinkRelationEntityPortconnectionconnectionconnectionLinkLinkThe Ptolemy II kernel defines an abstract syntax-clustered graphs -that is well suited to a wide variety of component-based modeling strategies, ranging from state machines to process networks.EE249, Fall 2002 11Clustered Graphtoplevel CompositeEntitytransparent CompositeEntityAtomicEntityRelationdanglingtransparentPorttransparentPortopaque PortThe ports deeply connected to the red port are the blue ones.Composite entities and ports in Ptolemy II provide a simple and general abstraction mechanism.EE249, Fall 2002 12MutationsThe NamedObj class provides support for• Processing requests for topology changes• Delegating change requests to containers• Registering listeners• Notifying listeners of topology changesThus, models with dynamically changing topologies are cleanly supported. For each model of computation, mutations can be performed in a controlled way.EE249, Fall 2002 13Actor PackageObject Model for Executable ComponentsComponentEntityCompositeEntityAtomicActorCompositeActor0..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()DirectorEE249, Fall 2002 14The Executable Interfaceexecutionpreinitialize()initialize()wrapup()prefire()fire()postfire()iterate()EE249, Fall 2002 15Manager and DirectorsP6P3P2P5P1E1E2E4E0M: ManagerD1: local directorD2: local directorP4P7E3E5OpaqueCompositeActorTransparentCompositeActorHierarchical Heterogeneity:• Each director implements a model of computation.• A composite actor with a director becomes opaque.•The manager provides support for interactive simulation.EE249, Fall 2002 16Hierarchical vs. Amorphous HeterogeneityColor is a domain, which defines both the flow of control and the communication protocol.HierarchicalColor is a communication protocol only, which interacts in unpredictable ways with the flow of control.AmorphousEE249, Fall 2002 17Execution SequencingDirectoropaqueCompositeActorDirectortop levelCompositeActorManagerExecution Sequence: Manager.run()initializetop levelprocessmutationsinitializationchecktypesprefiretop levelready?nofiretop levelyespostfiretop leveldone?noyesexecutionprefiredirectorfiredirectorpostfiredirectorrequesttransferinputsprefiredirectorfiredirectorrequesttransferoutputstransferinputspostfireactor... done?noprefireprefireactorfireactorpostfireactor...
View Full Document