130 likes | 254 Views
Model Transformation with the Ptera Controller. Thomas Huining Feng CHESS, EECS, UC Berkeley. Motivating Sinewave Example. An SDF model to generate a sine wave with Automatic partial evaluation improves performance. Intuition of Model Transformation.
E N D
Model Transformationwith the Ptera Controller Thomas Huining Feng CHESS, EECS, UC Berkeley
Motivating Sinewave Example • An SDF model to generate a sine wave with • Automatic partial evaluation improves performance
Intuition of Model Transformation • Pattern matching – find a context-free part of the model
Intuition of Model Transformation • Pattern matching – find a context-free part of the model • Replace it with a more compact design (value statically computed)
Intuition of Model Transformation • Pattern matching – find a context-free part of the model • Replace it with a more compact design (value statically computed) • Continue with similar transformations until fixpoint
Ptera (Ptolemy Event Relationship Actor) Workflow RemoveMultiply SimplifyDivide SimplifyMultiply
Syntax and Semantics for Ptera • Based on event graphs [Schruben 1983] • Visual representation • Nodes are events • Edges are scheduling relations Variable Final Event Action Guard Initial Event Delay
Syntax and Semantics of Ptera • Based on event graphs [Schruben 1983] • Visual representation • Nodes are events • Edges are scheduling relations • Execution with an unbounded event queue 0.0 1.0 1.0 1.0 1.0 End … Increase Start Increase Increase Increase 0.0 1.0 2.0 10.0 10.0 time
Hierarchical Model • Each event can be associated with a submodel • A submodel is itself a model • No difference in syntax • Conceptually equipped with a separate event queue • Model time is global • When Compute occurs at time 1, the submodel starts • When the submodel ends at time t (t ≥ 2), Compute is finished • End is processed at time t + 1
Events for Model Transformation A simple workflow for repeating a transformation
The Sinewave Optimizer RemoveMultiply SimplifyDivide SimplifyMultiply
The Sinewave Optimizer • Hierarchical workflow breaks down complexity • All transformation rules access the shared Model variable. No need for messaging. • Order of the 3 transformations is unimportant (but a deterministic order exists) • When model time is synchronized with real time, execution produces animation
Conclusion • Transformation rule specified in the modeling language • The control is essentially a model(so we call it model-based transformation) • The Ptera model of computation • Supports hierarchical workflows • Better expressiveness than state machines and control flow diagrams • Shares data with variables instead of messages • Permits heterogeneous composition (with DE, FSM, dataflow, etc) • Applications • Model optimization • Model construction • Design refactoring • Ptera can also simulate discrete-event systems Available from Ptolemy II 8.0More demos in ptolemy/actor/gt/demo, ptolemy/domains/ptera/demo