Event Relation Graphs and Extensions in Ptolemy II

Slides:



Advertisements
Similar presentations
Based on: Petri Nets and Industrial Applications: A Tutorial
Advertisements

Interaction Modeling for Testing We would generate the test cases based on our understanding of the interactions that may happen. The source is, again,
Semantic Translation of Simulink/Stateflow Models to Hybrid Automata using Graph Transformations A. Agarwal, Gy. Simon, G. Karsai ISIS, Vanderbilt University.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
DATAFLOW PROCESS NETWORKS Edward A. Lee Thomas M. Parks.
7th Biennial Ptolemy Miniconference Berkeley, CA February 13, 2007 Leveraging Synchronous Language Principles for Hybrid System Models Haiyang Zheng and.
Software modeling for embedded systems: static and dynamic behavior.
A Schedulability-Preserving Transformation of BDF to Petri Nets Cong Liu EECS 290n Class Project December 10, 2004.
February 12, 2009 Center for Hybrid and Embedded Software Systems Encapsulated Model Transformation Rule A transformation.
FunState – An Internal Design Representation for Codesign A model that enables representations of different types of system components. Mixture of functional.
Models of Computation for Embedded System Design Alvise Bonivento.
Heterochronous Dataflow in Ptolemy II Brian K. Vogel EE249 Project Presentation, Dec. 4, 1999.
Department of Electrical Engineering and Computer Sciences University of California at Berkeley Concurrent Component Patterns, Models of Computation, and.
February 12, 2009 Center for Hybrid and Embedded Software Systems Model Transformation Using ERG Controller Thomas H. Feng.
Chapter 3 : Software Process and Other Models Juthawut Chantharamalee Curriculum of Computer Science Faculty of Science and Technology, Suan Dusit University.
02/06/05 “Investigating a Finite–State Machine Notation for Discrete–Event Systems” Nikolay Stoimenov.
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
Composing Models of Computation in Kepler/Ptolemy II
Designing a Discrete Event Simulation Tool Peter L. Jackson School of Operations Research and Industrial Engineering March 15, 2003 Cornell University.
Entities and Objects The major components in a model are entities, entity types are implemented as Java classes The active entities have a life of their.
Internal Talk, Oct Executable Specifications using Message Sequence Charts Abhik Roychoudhury School of Computing National University of Singapore.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
CAP 4800/CAP 5805: Computer Simulation Concepts
School of Computer Science, The University of Adelaide© The University of Adelaide, Control Data Flow Graphs An experiment using Design/CPN Sue Tyerman.
CS3773 Software Engineering Lecture 06 UML State Machines.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
School of Computer Science & Software Engineering
Actor Oriented Programming with CAL -designing embedded system components Johan Eker Department of Automatic Control, Lund University Chris Chang, Jörn.
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
(C) J. M. Garrido1 Objects in a Simulation Model There are several objects in a simulation model The activate objects are instances of the classes that.
High Performance Embedded Computing © 2007 Elsevier Chapter 1, part 3: Embedded Computing High Performance Embedded Computing Wayne Wolf.
High Performance Embedded Computing © 2007 Elsevier Lecture 4: Models of Computation Embedded Computing Systems Mikko Lipasti, adapted from M. Schulte.
Language Translation Part 2: Finite State Machines.
From requirements to specification Specification is a refinement of requirements Can be included together as Software Requirements Specifications (SRS)
Week 8 Computational Level
Requirements Specification
Systems Analysis and Design in a Changing World, Fourth Edition
Modeling for Testing Interactions
State Machine Model.
Finite State Machines Dr K R Bond 2009
Main issues: • What do we want to build • How do we write this down
CPE555A: Real-Time Embedded Systems
POAD Book: Chapter 8 POAD: Analysis Phase
Dataflow analysis.
2. Specification and Modeling
Model-Based Testing Model the system
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Lecture 2 Introduction to Programming
Week 8 Computational Level
Model Transformation with Hierarchical Discrete-Event Control
Model Transformation with Hierarchical Discrete-Event Control
UML Activity Diagrams & State Charts
Shanna-Shaye Forbes Ben Lickly Man-Kit Leung
DEVS Background DEVS = Discrete Event System Specification
Workflow Management Systems
Chapter 14: Activity Diagrams
Event-Based Architecture Definition Language
Embedded Systems: A Focus on Time
Chapter 14: Activity Diagrams
Hybrid and Embedded Systems: Generalized Hybrid Systems
Model Transformation with the Ptera Controller
A Semantic Type System and Propagation
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
Concurrent Models of Computation
Concurrent Models of Computation
STATE MACHINE AND CONCURRENT PROCESS MODEL
STATE MACHINE AND CONCURRENT
Chapter 14. Activity Modeling for Transformational Systems
Prof. Onur Mutlu Carnegie Mellon University
Presentation transcript:

Event Relation Graphs and Extensions in Ptolemy II Thomas Huining Feng EECS, UC Berkeley

Background Finite State Machine Event Graph Activity Diagram Like activity diagram, nodes are in fact state transitions More expressive (equivalent to Petri net with inhibitor arcs and Turing machine) Model time and event queue (similar to DE)

Background Actor-Oriented Modeling Event-Oriented Modeling No bound on the number of events in between Different views of the system. Both require unbounded event queue in general.

CarWash: single queue multiple servers Syntax Based on event graphs [Schruben 1983] Visual representation Nodes are events Edges are scheduling relations Compare to FSM Actions on events Can schedule multiple events Timed Variable Initial Event Action Final Event Delay (δ) CarWash: single queue multiple servers Guard The CarWash model

Execution During execution, the event queue stores instances of events Start by scheduling an instance of each initial events at time 0 Remove and process the first instance in each firing Terminate when the event queue becomes empty Wash Enter 4 6 Wash Enter Enter Leave 2 4 6 8 Enter Enter Leave Leave Leave 2 4 8 8 10 Start End End End End End 50 50 50 50 50 0.0 2.0 2.0 4.0 4.0 6.0 time S = 3 Q = 0 S = 3 Q = 1 S = 2 Q = 0 S = 2 Q = 1 S = 1 Q = 0 S = 1 Q = 1

Simultaneous Events ... Events with instances that coexist in the event queue, and are scheduled to occur at the same time E.g., Enter and Leave. Wash Enter End Leave 50 12 10 Enter 8.0 8 6 8 Wash Enter Enter Leave 4 6 8 8 Enter Leave Leave Leave 6 8 8 10 Leave Leave Leave Leave ... 8 10 10 12 End End End End 50 50 50 50 4.0 6.0 6.0 8.0 time S = 1 Q = 0 S = 1 Q = 1 S = 0 S = 0 Q = 0 Q = 1

Simultaneous Events ... Events with instances that coexist in the event queue, and are scheduled to occur at the same time E.g., Enter and Leave. Wash Leave 6 8 Wash Enter Leave Enter End Leave 50 12 10 Enter 8 8.0 4 6 8 8 Enter Leave Enter Leave 6 8 8 10 Leave Leave Leave Leave ... 8 10 10 12 End End End End 50 50 50 50 4.0 6.0 6.0 8.0 time S = 1 Q = 0 S = 1 Q = 1 S = 0 S = 1 Q = 0 Q = 0

FIFO and LIFO Policies With FIFO (First In First Out) policy With LIFO (Last In First Out) policy time End Leave 50 10 8 Enter 6 6.0 ... Wash time End Leave 50 10 8 Enter 6 6.0 ... Wash

Rationale for FIFO and LIFO With FIFO, when x*t1 = y*t2 Λ t1 > t2 ReadOpen → WriteOpen → Read → Write → ReadClose → WriteClose With LIFO, always (ReadOpen → Read → ReadClose), (WriteOpen → Write → WriteClose)

Suggestions for This Case? Do not allow such design How to identify them? Leave undefined Ambiguous semantics Throw exception Maybe surprise the user Randomly pick one Unexpected nondeterministic behavior Use location of the events Forbid rerendering the graph Use names of the events Partially solves the problem Suppose a and b are defined elsewhere. In case a = b = 2, we have simultaneous instances of Event2 and Event3.

Suggestions for This Case? Do not allow such design How to identify them? Leave undefined Ambiguous semantics Throw exception Maybe surprise the user Randomly pick one Unexpected nondeterministic behavior Use location of the events Forbid rerendering the graph Use names of the events Partially solves the problem Now we really need some hidden info E.g., names of the scheduling relations Suppose a and b are defined elsewhere. In case a = b = 2, we have simultaneous instances of Event2 itself.

Execution Algorithm Initialize E to contain all initial events While E is not empty Remove the top instance t from E Execute t’s actions Terminate if t is a final event Schedule events in E in the order of Time stamp FIFO or LIFO policy Event name Scheduling relation name 0.0 2.0 Start time End Enter Wash 50 2 4

Model Hierarchy: Previous Attempts Submodel associated with scheduling relation [Schruben 1995] Submodel associated with event [Schruben 1995] LEGOs (Listener Event Graph Objects) [Buss & Sánchez 2002] Producer Consumer

Model Hierarchy: The Ptera Approach A submodel is itself a model No difference in syntax Conceptually equipped with an isolated event queue A global notion of model time Implication: events (or tasks) are no longer instantaneous Start of an event causes start of its submodel End of the submodel causes end of the event

Hierarchical CarWash Hierarchical workflow: ... Global time, separate event queues A composite task (CT) is composed of smaller tasks Execution of CTs interleave The whole workflow is a top-level CT (LIFO) Wash 4 Wash Wash Wash Enter Wash 2 3 4 4 5 Enter Enter Enter Wash Enter ... 4 4 4 5 6 End End End End End 50 50 50 50 50 2.0 3.0 4.0 4.0 4.0 HighPr 4 HighPr FoamP Wheel Rinse Rinse 2 3 4 5 5 2.0 3.0 4.0 4.0

Communication via Ports Event processing conditions Scheduled time is reached, or Tokens received at one or more triggering ports Inputs not triggering any event are ignored. Outputs can be sent in actions.

Hierarchical Multimodeling

Hierarchical Multimodeling Goal: reusable, robust and flexible design Choose DE at top level for Concurrency Concern separation Encapsulation Fixpoint semantics Out-of-order execution Distributed execution …

Hierarchical Multimodeling Choose Ptera to model a random process No need to depend on predefined actors Easy to control the exact behavior Totally sequential (but concurrency may be possible) Some predefined actors can be designed in this way (instead of Java) Source actors Math actors Time delay actors Flow control actors …

Hierarchical Multimodeling Use FSM to capture two modes Easy to understand Easy to model check, debug, convert into other languages, ... Submodel firing conditions The submodel itself requests (not in this case), or Input is received at a port, or The event containing the submodel is processed

Hierarchical Multimodeling Indefinitely wait for change of car number. A Ptera model similar to the standalone version. Listen to the input port for car arrivals. Composition with other components is richer than the LEGOs approach. Output both S and Q when either of them is changed

Future Work Composition with other MoCs (Especially, Ptides and continuous time) Formal analysis (Bound of event queue, simultaneous events, termination condition, model categorization, …) Behavior-preserving concurrent and distributed execution Other application domains (Currently studied: statistical analysis, model transformation) Tool support (Debugging and testing, code generation) Design patterns (Currently studied: Input, Output, LoopForCount, ParallelTasks, SingleQueueMultipleServers)