Rule Based Operational Semantics Specification in Ptolemy
description
Transcript of Rule Based Operational Semantics Specification in Ptolemy
![Page 1: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/1.jpg)
Rule Based Operational Semantics Specification in Ptolemy
Yanwar Asrigo
COMP 763B - Modeling and Simulation Based Design
30th April 2008
![Page 2: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/2.jpg)
Overview
• Recap: Ptolemy• Problem Statement• Implementation• Testing
30th April 2008 2
![Page 3: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/3.jpg)
• Started at UC Berkeley by Prof. Edward Lee• Studies modeling, simulation, and design of
concurrent, real-time, and embedded systems• Developed using Java and truly free software (GPL)• Special features:
– Actor Orientation + Domain– Hierarchically Heterogeneous Model
30th April 2008 3
[1] Eker, J., Janneck, J., Lee, E., Liu, J., Liu, X., Ludvig, J., Nuendorffer, S., Sachs, S., Xiong, Y. : Taming Heterogeneity – The Ptolemy Approach. Proceedings of the IEEE 91(1) (Jan 2003) 127-144.
[1]
![Page 4: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/4.jpg)
• Actors are concurrent components that communicate through ports by passing messages
• Actor-oriented view of a system decouples the transmission of data from the transfer of control.
Actor Orientation
30th April 2008 4
actor name
data (state)
portsInput data
parameters Output data
What flows through an object is streams
of data
![Page 5: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/5.jpg)
Domains
• Domains provide semantic models for component interactions. Domain is realized by:– Director: governs the execution of a composite entity– Receiver: implements the communication semantics
30th April 2008 5
Director D1 Controls the execution order of actors A1 and A2Director D2 controls the execution of A3 and A4 whenever A2 is
executed.
![Page 6: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/6.jpg)
Actor Execution
30th April 2008 6
Initialization Execution Finalization
fire() postfire()prefire()
Iterate()
• The domain of a composite actor determines how the iteration of one actor is related to the iterations of other actors in the same composite
Despite computation occurs during the fire() phase, the state of the actor is not updated until postfire()
![Page 7: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/7.jpg)
Hierarchical Heterogeneous Composition
30th April 2008 7
FSM
SDF
CT
• Divide a complex model into a tree of nested submodels
• Each level is composed of a network of interacting components
• Network at each level is locally homogenous, while allowing different interaction mechanisms to be specified at different levels in the hierarchy
![Page 8: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/8.jpg)
What is Missing? Meta-Modeling!
30th April 2008 8
Meta Model
IntermediateRepresentation
Implementation
ModelTransformation
CodeGeneration
The Ultimate Test
![Page 9: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/9.jpg)
The Project
• Using external tool for Meta-modeling formalisms and automatically synthesize the codes for Ptolemy
Specifically:• Specify operational semantics using rules and
compile these rules into Ptolemy’s code (Java)• Tools: AToM3 and Motif• Target Formalism: Finite State Automata / Machine
30th April 2008 9
![Page 10: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/10.jpg)
Finite State Automata (Example)
30th April 2008 10
Positive Negative
1/-1
0/0 0/0
1/1
Alternate Mark Inversion (AMI) Coder Input Output
0 0
1 1
1 -1
1 1
0 0
1 -1
![Page 11: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/11.jpg)
Specifying and Compiling Operational Semantics Rules in AToM3
30th April 2008 11
Meta-model of domain specific
notation
Specify operational semantics as graph transformation rule
Compiled rule-basedoperational semantics
Finite State Automata Meta-
Model
Graph Grammar Rule defining FSM
execution transformation
Compiled GGRule in Java
![Page 12: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/12.jpg)
Finite State Automata Meta Model
30th April 2008 12
* This can be transformed to UML class diagram which eventually can be used to generate the code
![Page 13: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/13.jpg)
Initialization Rule
30th April 2008 13
![Page 14: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/14.jpg)
Update Rule
30th April 2008 14
![Page 15: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/15.jpg)
Motif [2] GG Compiler
• Used Motif GG compiler to extract and compile rule defined in AToM3
• Modified to produce Java code suitable for Ptolemy• Logic is mainly based on AToM3 graph representation
– Ptolemy data structure is modified to support this
30th April 2008 15
[2] Eugène Syriani and Hans Vangheluwe. Programmed Graph Rewriting with DEVS. In Manfred Nagl and Andy Schür, editors, Applications of Graph Transformations with Industrial Relevance (AGTIVE 2007), Lecture Notes in Computer Science (LNCS). Springer-Verlag, October 2007. Kassel, Germany.
Rule
+ checkCondition()+ executeAction()+ executeLHS(ASG)+ executeRHS()
![Page 16: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/16.jpg)
Modifications in Ptolemy (1)
30th April 2008 16
ASG
+ getNodeTypes()+ getListNodes()
ASGNode <<interface>>
+ getInConnection()+ getOutConnection()
State Transition Current Points_To
Existing Ptolemy ClassesNew ClassesLegend :
![Page 17: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/17.jpg)
Modifications in Ptolemy (2)
30th April 2008 17
Execution Finalization
prefire()
Initialization
fire() postfire()
Computation Update State
FSM Actor
![Page 18: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/18.jpg)
Modifications in Ptolemy (2)
30th April 2008 18
UpdateRule
+ executeLHS(ASG)+ executeRHS()
InitRule
+ executeLHS(ASG)+ executeRHS()
Execution Finalization
prefire()
Initialization
executeLHS()executeRHS()
fire() postfire()
executeLHS() executeRHS()
FSM Actor
• fire() corresponds to the left hand side matching, and • postfire() corresponds to transforming the matched sub-graph to right hand side
of the transformation rule
![Page 19: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/19.jpg)
Testing – AMI Coder
30th April 2008 19
![Page 20: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/20.jpg)
Testing – AMI Coder
30th April 2008 20
![Page 21: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/21.jpg)
Testing – AMI Coder
30th April 2008 21
Input Output
0 0
1 1
1 -1
1 1
0 0
1 -1
Expected Result
![Page 22: Rule Based Operational Semantics Specification in Ptolemy](https://reader033.fdocuments.in/reader033/viewer/2022051401/5681494a550346895db698bb/html5/thumbnails/22.jpg)
Thank You
30th April 2008 22