http://chess.eecs.berkeley.edu/
February 12, 2009 Center for Hybrid and Embedded Software Systems
Model Transformation Using ERG Controller
Thomas H. Feng
Edward A. Lee
Encapsulated Model Transformation Rule
A transformation rule contains 3 components:
1. Pattern: match a subgraph in a given model
1) It is a graph containing interconnected actors and relations.
2) Matchers (A in the example) can be used to match arbitrary actors satisfying certain criteria
3) Textual constraints are evaluated once a subgraph is found and for the match to be successful, all constraints must be true.
2. Replacement: replace the matched subgraph with a new graph. Operations can be performed on the actors. In this case, C1’s value is calculated and set by a (hidden) operation.
3. Correspondence: relate objects in pattern to replacement (e.g., C1 in pattern and C1 in replacement, and the two relations in them, are related)
Event Relationship Graph (ERG)
A discrete-event model of computation for event-oriented designs (compared toactor-oriented, object-oriented, state-oriented, etc) originally introduced in 1983.
Semantics
1. Initialize event queue to contain only the initial events (green ones)
2. Repeat until event queue is empty
1) Remove the first event from event queue
2) Execute its action
3) For each outgoing edge whose guard is true
• Schedule the event that the edge points to
4) If the event is a final event (red ones)
• Clear the event queue
Hierarchical Composition
1. Refinements in ERG: an event can be associated witha refinement. The refinement is fired when:
1) the event is processed, or
2) input is received at any input port
2. ERG as refinement in DE
Event Library (Compared to Actor Library)
Analysis
Analyze the model and annotate it with properties(Jackie Leung and Thomas Mandl)
Execution Control
Execute the model
Wait for real time to elapse
Stop the transformation workflow
Test the guards on the outgoing edges
IO
Clone the model
List all files in the directory with filters
Read the model stored in a file
Output the model to a file
User Interaction
Pop up a dialog to ask the user for parameters
Wait for input and report back after t in model time
Report a message in a window or a dialog
Set window properties (on-top, size, enabled, etc)
Transformation
Perform pattern matching and report result
Perform pattern matching and then transformation
View the model in a separate window
Generic
Fire an action specified in the Ptolemy actionlanguage, and fire the submodel if there is oneassociated with it as a refinement
And Much More…
Actions can be easily extended with an API. Override the fire method to perform customized actions (similar to the fire of actors):
public RefiringData fire(ArrayToken arguments) throws IllegalActionException;
Example Applications
ERG
o Simulate sequential discrete-event processes
o Compose with concurrent models of computation (DE, dataflow, etc) for parallel execution
o Describe dependency relationship between tasks in a workflow
o Model graphical user interface
Model Transformation
o Statically optimize models based on analysis result
o Automatically search and replace patterns
o Construct new models by transforming an empty model
o Dynamically configure model structures according to the run-time states
o Simulate structural evolution of systems
Statically evaluate anarithmetic operation(plus, multiply ormaximum) on 2 consts
Top Related