on open source tools for behavioral modeling and analysis ... · on open source tools for...
TRANSCRIPT
![Page 1: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/1.jpg)
Budapest University of Technology and EconomicsDepartment of Measurement and Information Systems
On Open Source Tools forBehavioral Modeling and Analysis
with fUML and Alf
Zoltán Micskei, Raimund-Andreas Konnerth, Benedek Horváth, Oszkár Semeráth,
András Vörös, and Dániel Varró
Open Source Software for Model Driven Engineering 2014
This work was partially supported by
![Page 2: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/2.jpg)
High-level
System Model
Model Based Analysis of Distributed SystemsSystem design
Mathematical
model
Model
generation
Mathematical analysis
List of
inconsistencies Analysis(e.g. model checker)
Fix problemReceive request
Calculate Rating
Send offer
Accept?
Receive answer
Send reply
Send rejection
Receiveupdate request
Update?YesNo
Yes No
![Page 3: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/3.jpg)
OMG standard
Formal MethodsfUML AlfUML
Overview of the Approach
3
Activity Diagram Alf Model Timed AutomataState Machine
1. What open source tools are available for fUML and Alf?2. What level of support do they provide?3. What are their maturity level?4. What techniques are available for model generation?
![Page 4: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/4.jpg)
Formal MethodsfUML AlfUML
UML Editor
Open Source Tooling Overview
4
Alf Editor Model Checker
fUML Reference Impl. AlfRef. Impl.
Papyrus Alf Editor
Moka
Moliz
UPPAAL
Activity Diagram Alf Model Timed AutomataState Machine
![Page 5: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/5.jpg)
Running Example: Fibonacci Calculation
5
let tmp: Integer = 0;if (input == 1) {
return 1;} else if (input ==2) {
return 1;
}let i: Integer = 3;while (i <= input) {
tmp = var1 + var2;
var1 = var2;
var2 = tmp;i++;
}return tmp;
UML State Machine ALF UPPAAL
![Page 6: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/6.jpg)
Lesson Learned
No list of tools: Even collecting the tools was considerable efforto Promote tools on OMG website
Few examples: Few example fUML models or Alf code available. o Version and tool incompatibility hinders
Reference implementations: o Help understand the specifications,
o Good starting point
Alf grammar: Complex structures to ensure unambiguity o Good for evaluation of expressions
o Not good for semantic information to help verification
Transformation: Mapping of state machines?
6
![Page 7: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/7.jpg)
Technologies for M2M
![Page 8: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/8.jpg)
Java over EMF API
8
Concrete Syntax
Abstract Syntax
while (i <= input){i++;
}
:WhileStatement
:Block
:Increment
:VariableRefname = "i"
:ConditionTest
conditionblock
:Relationop="<="
:VarRefname = "i"
:VarRefname = "input"
:Location
:Edge :Edge
:Guardexp="!(i<=input)"
:Location
:Edge :Edge
trg src
src trg
:Guardexp="!(i<=input)"
:Updateexp="i++"
srctrg
![Page 9: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/9.jpg)
Java over EMF API
Defined by Java code
1. Traversal by code
2. Manual model building
3. No traceability
- High Maintenance
- Low Reusability
+ Easy to start
9
Concrete Syntax
Abstract Syntax
while (i <= input){i++;
}
:WhileStatement
:Block
:Increment
:VariableRefname = "i"
:ConditionTest
conditionblock
:Relationop="<="
:VarRefname = "i"
:VarRefname = "input"
:Location
:Edge :Edge
:Guardexp="!(i<=input)"
:Location
:Edge :Edge
trg src
src trg
:Guardexp="!(i<=input)"
:Updateexp="i++"
srctrg
Transformation codeLocation transform(WhileStatement w) {
for(Statement s: w.block.statements) {/* map the inner states */}
for(Location l : locations) {/* Link the locations to a circle */}
// Map the condition// Set the guards of the outgoing edges
}
w.block.increment.variableRef.name 1
l = factory.createLocation(); 2
e.setSource(locationMap.get(
edgeMap.get(w.condition)));3
for(state:block)
instanceofA,B,CState
1
Factory.create
setTarget()
2
![Page 10: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/10.jpg)
M2M Languages
• Example: ATL
• Alternatives:
o Epsilon
o QVT
o Xtend
o …
10
Concrete Syntax
Abstract Syntax
while (i <= input){i++;
}
:WhileStatement
:Block
:Increment
:VariableRefname = "i"
:ConditionTest
conditionblock
:Relationop="<="
:VarRefname = "i"
:VarRefname = "input"
:Location
:Edge :Edge
:Guardexp="!(i<=input)"
:Location
:Edge :Edge
trg src
src trg
:Guardexp="!(i<=input)"
:Updateexp="i++"
srctrg
ATL Codemodule Alf2UPPAAL; create OUT : Machine from IN : Block {
rule Condition2Guard {from s: Alf!Conditionto positiveGuard: UPPAAL!Guard( location <- /*...*/
expression <- /*...*/)negativeGuard: UPPAAL!Guard( location <- /*...*/
expression <- /*...*/)}}
rule State2Location {from s: Alf!Stateto l: UPPAAL!Location}
rule Transition2Edge {from s1: Alf!State,
s2: Alf!State ( /* next state */ )to e: UPPAAL!Edge( src <- /*...*/
trg <- /*...*/ )}
![Page 11: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/11.jpg)
Declarative Queries + MT languages
Defined by Queries + Templates
1. Traversal Queries
2. Building by Templates
3. (Match, Result) traces
11
Concrete Syntax
Abstract Syntax
while (i <= input){i++;
}
:WhileStatement
:Block
:Increment
:VariableRefname = "i"
:ConditionTest
conditionblock
:Relationop="<="
:VarRefname = "i"
:VarRefname = "input"
:Location
:Edge :Edge
:Guardexp="!(i<=input)"
:Location
:Edge :Edge
trg src
src trg
:Guardexp="!(i<=input)"
:Updateexp="i++"
srctrg
Queriespattern While(W,Condition,States){
WhileStatement.condition(W,Condition);
WhileStatement.block(W,Block);}
pattern Relation(R,Op1,Op2){Relation.left(R,Op1);Relation.right(R,Op1);Relation.op(R,"<=");}
def dispatch transform(WhileStatement w) {val innerStates=WhilePattern.getStates(w).map[createState]val condition=WhilePattern.getCondition(w)/* link the edges */ }
def dispatch transform(Relation condition) {val m=RelationPattern.getMatch(condition)createGuard()=>[exp='''«m.op1.name» <= «m.op2.name»''']}
Templates
Whilematch
Relationmatch
Whiletemplate
Relationtemplate
http://eclipse.org/incquery
![Page 12: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/12.jpg)
Query-based Features
12
Declarative build by Queries
1. Queries
2. Declarative model buildObject, References, Attributes
3. Implicit, referrable traces"Guard Image of while"
Concrete Syntax
Abstract Syntax
while (i <= input){i++;
}
:WhileStatement
:Block
:Increment
:VariableRefname = "i"
:ConditionTest
conditionblock
:Relationop="<="
:VarRefname = "i"
:VarRefname = "input"
:Location
:Edge :Edge
:Guardexp="!(i<=input)"
:Location
:Edge :Edge
trg src
src trg
:Guardexp="!(i<=input)"
:Updateexp="i++"
srctrg
Query Based Features@QueryBasedObject(Location)pattern Statement(S)
@QueryBasedObject(Edge)@QueryBasedFeature(src, Edge, From)@QueryBasedFeature(trg, Edge, To)pattern nextState(From,To)
@QueryBasedObject(Guard)@QueryBasedFeature(exp, "($Expression$)")@TraceLookup(Incoming, Edge) @QueryBasedFeature(guard, Edge, Guard)pattern PositiveWhileCondition(Incoming, Condition, Expression)
@QueryBasedObject(Guard)@QueryBasedFeature(exp, "! ($Expression$)")@TraceLookup(Outgoing, Edge) @QueryBasedFeature(guard, Edge, Guard)pattern NegativeWhileCondition(Outgoing, Condition, Expression)
http://eclipse.org/incquery
![Page 13: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/13.jpg)
Technologies for M2T
![Page 14: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/14.jpg)
"<location name=\"Location_"+ i +"\"/>"
Native Java over EMF API
Defined by Java code
1. Traversal by code
2. Manual text building
3. No traceability
- High Maintenance
- Low Reusability
+ Easy to start
14
Concrete Syntax
Abstract Syntax
while (i <= input){i++;
}
:WhileStatement
:Block
:Increment
:VariableRefname = "i"
:ConditionTest
conditionblock
:Relationop="<="
:VarRefname = "i"
:VarRefname = "input"
:Location
:Edge :Edge
:Guardexp="!(i<=input)"
:Location
:Edge :Edge
trg src
src trg
:Guardexp="!(i<=input)"
:Updateexp="i++"
srctrg
Transformation codeLocation transform(WhileStatement w) {
for(Statement s: w.block.statements) {/* map the inner states */}
for(Location l : locations) {/* Link the locations to a circle */}
// Map the condition// Set the guards of the outgoing edges
}
2
![Page 15: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/15.jpg)
„M2T”: Queries + AST generation
15
Direct code generation Simple structure
Low complexity
Fast development
Linear output generation(single pass)
⁻ Problematic formatting
⁻ Problematic M2C synchronization
AST generation Represents the program
structure (PSM)
⁻ Can be very complex
⁻ Slower development
⁻ Distributed generation process
Support for M2C synchronization
Incremental code generation
”pretty formatting”
E.g., Eclipse JDT
Model Template Code Model Template Model Grammar Code
![Page 16: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/16.jpg)
Chaining Transformations alongViews
![Page 17: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/17.jpg)
Outlook: An Avionics Project
Avionics R&D project
o Model-driven toolchain
o Allocate SWs onto HWs
o Platform: ARINC 653
FunctionalArchitecture
Platform description
Componentdatabase
Allocation
IntegratedSystem Model
![Page 18: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/18.jpg)
Outlook: An Avionics Project
Avionics R&D project
o Model-driven toolchain
o Allocate SWs onto platform
Simplified Example
18
PilotControl
SubS1
Navigation
FMS
SubS2
EMS
tag: func
tag: func
tag: func
tag: func
InPort/OutPort
Simulink
Id
Id Other SubSystem without tag
Function SubSystem with "func" tag)
Port Blocks
FAM_PilotControl: Function
FAM_Navigation: Function
FAM_FMS : Function
FAM_EMS : Function
nav2ems:InformationLink
provider
consumer
subFunctions
provider
consumer
EMS: Engine Management System FMS: Flight Management System
nav2fms:InformationLink
FAM
id:Function id:InformationLink
View
Maintanence• Incrementally• Immediately
Maintenance:• Incrementally• Immediately
![Page 19: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/19.jpg)
Summary of Behavior Modeling ToolsTool Version Modified Platform Goal
fUM
L
fUML Ref. Impl. 1.1.0 2013-06 Java / console Interpreter
Moka 1.0.0 2014-06 Eclipse Execution engine
Moliz 1.0 2014-06 Eclipse Execution engine
Alf Alf Ref. Impl. 0.4.0 2014-05 Java / console Interpreter
Papyrus Alf Editor - 2014-07 Eclipse Editor
UPPAAL 4.0 2010-09 Application Model Checker
19
Maturity• Proven: Eclipse platform, UPPAAL• Early prototype: fUML engines (Moka, Moliz)• Alpha: Alf editor in Papyrus is still in active development
![Page 20: On Open Source Tools for Behavioral Modeling and Analysis ... · On Open Source Tools for Behavioral Modeling and Analysis with fUML and Alf Zoltán Micskei, Raimund-Andreas Konnerth,](https://reader034.vdocuments.net/reader034/viewer/2022052612/5f0e3daa7e708231d43e49ce/html5/thumbnails/20.jpg)
Summary of Transformation Tools
20
Tool Version Modified Platform Goal
Tran
sfo
rmat
ion EMF 2.10.0 2013-05 Eclipse Metamodelling tool
ATL 3.5 2013-13 Eclipse M2M transformation
XTend 2.7 2014-09 Eclipse Template Language
IncQuery 0.8 2014-07 Eclipse Query engine
Query Based Feat. Eclipse M2M transformation
Maturity• Proven: Eclipse platform and core services (e.g. EMF, Xtend), ATL• Stable: EMF-IncQuery (note: local developer support)