You are on page 1of 44

René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann

Incremental Causal Connection for Self-Adaptive


Systems Based on Relational Reference Attribute
Grammars
Montréal, October 26th 2022
A Case Study

Site A Site B
R1
2
R1 R2
4
1 R3
3
Collabo-
R2 ration
1 B1 Robot Zone
Operator
Controller
Scene
Controller A R3
2 3 4 B2 Robot
Controller

MovableObject Region Component Causal Connection Port Port Target

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 2 of 14
Montréal, October 26th 2022
A Case Study

Site A Site B
R1
2
R1 R2
4
1 R3
3
Collabo-
R2 ration
1 B1 Robot Zone
Operator
Controller
Scene
Controller A R3
2 3 4 B2 Robot
Controller

scenecommand

command
scene

scene
RAG Model A logical scene RAG Model B

MovableObject Region Component Causal Connection Port Port Target

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 2 of 14
Montréal, October 26th 2022
Combining Two Concepts
Self-Adaptive Systems (SAS) Reference Attribute Grammars (RAG) [Hed00]
• Modern software: Start small. Gets
complex, distributed, heterogeneous • Based on Attribute Grammars [Knu68]
• Goals: Separation of concerns, fast • Origin: compiler construction (program
prototyping, theoretical grounding, analysis)
efficiency • Advantages: concise specification, efficient
• One approach: Model-driven evaluation, natural separation of concerns
engineering / Models@run.time

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 3 of 14
Montréal, October 26th 2022
Combining Two Concepts
Self-Adaptive Systems (SAS) Reference Attribute Grammars (RAG) [Hed00]
• Modern software: Start small. Gets
complex, distributed, heterogeneous • Based on Attribute Grammars [Knu68]
• Goals: Separation of concerns, fast • Origin: compiler construction (program
prototyping, theoretical grounding, analysis)
efficiency • Advantages: concise specification, efficient
• One approach: Model-driven evaluation, natural separation of concerns
engineering / Models@run.time

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 3 of 14
Montréal, October 26th 2022
Combining Two Concepts
Self-Adaptive Systems (SAS) Reference Attribute Grammars (RAG) [Hed00]
• Modern software: Start small. Gets
complex, distributed, heterogeneous • Based on Attribute Grammars [Knu68]
• Goals: Separation of concerns, fast • Origin: compiler construction (program
prototyping, theoretical grounding, analysis)
efficiency • Advantages: concise specification, efficient
• One approach: Model-driven evaluation, natural separation of concerns
engineering / Models@run.time

What if: we use RAGs as technological space for the model?

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 3 of 14
Montréal, October 26th 2022
Challenges Ahead
Specifications of Managing System
• modular
Self-adaptive System

• (re-)usable
read
Adaptation Goals
Managing
System

• understandable
• correct
adapt

sense • efficient
Managed System

Connections from Managing System


• modular
• declarative
sense effect
sense

Environment • reusable
[Wey19]

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 3 of 14
Montréal, October 26th 2022
Challenges Ahead

Self-adaptive System Specifications of Managing System


• modular
read
Adaptation Goals

• (re-)usable
Managing
System

• understandable
• correct
adapt

• efficient
sense

Managed System

Connections from Managing System


sense effect
• modular
• declarative
sense

Environment
• reusable
[Wey19]

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 3 of 14
Montréal, October 26th 2022
Challenges Ahead
Specifications of Managing System
• modular
Self-adaptive System

• (re-)usable
read
Adaptation Goals
Managing
System

• understandable
• correct
adapt

sense • efficient
Managed System

Connections from Managing System


• modular
• declarative
sense effect
sense

Environment • reusable
[Wey19]

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 3 of 14
Montréal, October 26th 2022
Model Specification using Attribute Grammars (AGs)

Attribute Grammars specify semantics/behaviour for a tree of a context-free grammar.

We use the JastAdd object-oriented Reference AG system [HM03].

• Efficient evaluation
Tree Structure Declarative Specification
• Concise specification along tree
inherited (↓), synthesized (↑) attributes – Incremental evaluation
– Concurrent evaluation
• Collections (JastAdd)
• Circular attributes, AOP features (JastAdd)

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 4 of 14
Montréal, October 26th 2022
Grammars as Models

• In models:
Main Difference: Relations RC

– Containment relations form overlay tree


L L

– Non-containment relations
Rou. Reg.

– Bidirectional relations
• In grammars:
L L

}
L

– Containment references:
SwP. Sen.

– Non-containment references
Seg.
AST

– Bidirectional references
Relational RAGs [Mey+20] Seg. Sw. Seg.

Sem. Sem.

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 5 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
Grammars as Models

WorldModel ::= [MyScene:Scene]


WorldModel
ExecutedOperation:Operation*
/NextOperation:Operation/;
NextOperation MyScene
Position ::= <X:double> <Y:double> <Z:double>; ExecutedOperation
1 0 .. 1
* Object
Scene ::= DropOffLocation* MovableObject*; Operation Scene
String Name

abstract Object ::= <Name:String> Position;


1
DropOffLocation : Object ::= ; Position
MovableObject : Object ::= ; * * double X
double Y
abstract Operation ; PickAndPlace DropOffLocation MovableObject double Z
1 TargetLocation
PickAndPlace : Operation ::= ; 1 ObjectToPick

rel PickAndPlace.ObjectToPick -> MovableObject;


rel PickAndPlace.TargetLocation -> DropOffLocation;

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 6 of 14
Montréal, October 26th 2022
An Iterative Process to Build Self-Adaptive Systems

add/refine computations Structure


(Grammar)

revisit structure

Computation
(Attributes)

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 7 of 14
Montréal, October 26th 2022
An Iterative Process to Build Self-Adaptive Systems

add/refine computations Structure


(Grammar) revisit structure

revisit structure

Computation add/refine Semantics


(Attributes) semantics (Connections)

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 7 of 14
Montréal, October 26th 2022
Coming Back to our Case Study
Site A Site B
R1
2
R1 R2
4
1 R3
3
Collabo-
R2 ration
Operator
1 B1 Robot Zone
Controller
Scene
Controller A R3
2 3 4 B2 Robot
Controller

command
scene

command
scene

scene
RAG Model A logical scene RAG Model B
MovableObject Region Component Causal Connection Port Port Target

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 8 of 14
Montréal, October 26th 2022
Coming Back to our Case Study
Site A Site B
R1
2
R1 R2
4
1 R3
3
Collabo-
R2 ration
Operator
1 B1 Robot Zone
Controller
Scene
Controller A R3
2 3 4 B2 Robot
Controller

command
scene

command
scene

scene
RAG Model A logical scene RAG Model B
MovableObject Region Component Causal Connection Port Port Target

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 8 of 14
Montréal, October 26th 2022
ect
Ports Mark Required Connections for our Case Study
AST as model@run.time
send port Region
WorldModelB
OtherScene [0] LogicalScene
name = "A"
receive port
② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene LogicalMovableObject LogicalRegion
CurrentPosition

Reachability [0] ObjectToPick

CanReachObjectOfInterest MovableObject LogicalScene


DropOffLocation
ObjectName = "blue2" Name = "blue2"

Driver Code

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 9 of 14
Montréal, October 26th 2022
ect
Ports Mark Required Connections for our Case Study
AST as model@run.time
send port Region
WorldModelB
OtherScene [0] LogicalScene
name = "A"
receive port
② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene LogicalMovableObject LogicalRegion
CurrentPosition

Reachability [0] ObjectToPick

CanReachObjectOfInterest MovableObject LogicalScene


DropOffLocation
ObjectName = "blue2" Name = "blue2"

Driver Code

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 9 of 14
Montréal, October 26th 2022
send port
A DSL to Specify Connections
Region
WorldModelB
OtherSce
name = "A"
receive port
send WorldModelB.NextOperation using PrintOperation ;
PrintOperation maps Operation op to byte[] {: ② NextOperation MyScen
byte[] result = op.toProtobufByteArray();
if (result == null) { reject(); }
Robot

return result;
OwnedCollaborationZoneNames RobotToExecute
:} PickAndPlace Scene
OccupiedCollaborationZoneNames
CurrentPosition
Port target Recompute Apply Different yes Send
has changed port target mappings value?
message
Reachability [0] ObjectToPick

Recognized by incremental if rejected no


evaluation feature of JastAdd Message
CanReachObjectOfInterest MovableObject
DropOffLoc
ObjectName = "blue2" Name = "blue2"

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 10 of 14
Montréal, October 26th 2022
Supported Grammar Elements of the DSL
Support for Different Parts of the Grammar Using Send
and Receive Ports. Legend: Full support, G
# Partly
supported, # Not supported, / not applicable
Element of a grammar Send Receive
Terminal
Non-Terminal (Context-free)
Non-Terminal (Single)
Non-Terminal (List)
Non-Terminal (Optional)
Relation G
# #
Attribute /

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 11 of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Compu- Driver
Grammar
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect Connection Generated
Specification
RagConnect
Aspect JastAdd
Code
HM03] + Relational RAGs [Mey+20] + RagConnect
1st phase: Specification 2nd phase: Generation 3rd phase: Usage
Grammar (Structure) AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Compu- Driver
Grammar
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect Connection Generated
Specification
RagConnect
Aspect JastAdd
Code
WorldModelB ::= Region* Robot* ExecutedOperation:Operation
[MyScene:Scene] OtherScene:LogicalScene*
HM03] + Relational/NextOperation:Operation/
RAGs [Mey+20] + RagConnect ;
1st phase: Specification
abstract Operation ; 2nd phase: Generation 3rd phase: Usage
Grammar (Structure)
PickAndPlace : Operation ; AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Compu- Driver
Grammar
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect Connection Generated
Specification
RagConnect
Aspect JastAdd
Code
WorldModelB ::= Region* Robot* ExecutedOperation:Operation
[MyScene:Scene] OtherScene:LogicalScene*
HM03] + Relational/NextOperation:Operation/
RAGs [Mey+20] + RagConnect ;
1st phase: Specification
abstract Operation ; 2nd phase: Generation 3rd phase: Usage
Grammar (Structure)
PickAndPlace : Operation ; AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar
✓ Compu- Driver
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect Connection Generated
Specification
RagConnect
Aspect JastAdd
Code
HM03] + Relational RAGs [Mey+20] + RagConnect
1st phase: Specification 2nd phase: Generation 3rd phase: Usage
Grammar (Structure) AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar

syn Operation WorldModelB.getNextOperation() {
Compu- Driver
❌ Notation Code
if (diffToOperations().getNumChild() == 0)

uses
return errorNoOperationComputed(); connections to other systems possi
cation ⬋
⬊ for (Operation op : diffToOperations()) { (only for simple tokens [Sch+20])
uation
Connect Connection Generated
JastAdd
Robot executingRobot = op.getRobotToExecute();

RagConnect
Specification Aspect Code
if (!op.isErrorOperation()) {
if (op.equals(lastOperationFor(executingRobot))) {
return errorDuplicateOperation();
HM03] + Relational} RAGs [Mey+20] + RagConnect
1st}phase: Specification 2nd phase: Generation 3rd phase: Usage
return op;
Grammar (Structure) AST as model@run.time
}
return errorNoExecutableOperation(); send port Region OtherScene [0] L

.
① } receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar
✓ Compu- ✓ Driver
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect Connection Generated
Specification
RagConnect
Aspect JastAdd
Code
HM03] + Relational RAGs [Mey+20] + RagConnect
1st phase: Specification 2nd phase: Generation 3rd phase: Usage
Grammar (Structure) AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar
✓ Compu- ✓ Driver
❌ Notation Code
uses;
connections to other systems possi
cation ⬋
⬊ (only for simple tokens [Sch+20])
uation
Connect PrintOperation Connection Generated
send WorldModelB.NextOperation using PrintOperation

Specification
RagConnect
byte[] result =Aspect JastAdd
Code
maps Operation op to byte[] {:
op.toProtobufByteArray();
if (result == null) { reject(); }
HM03] + Relational RAGs [Mey+20]return+ RagConnect
1st phase: Specification 2nd phase: Generation 3rd phase: Usage
result;
:}
Grammar (Structure) AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar
✓ Compu- ✓ Driver
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect ✓ RagConnect
Connection
JastAdd Generated
Specification Aspect Code
HM03] + Relational RAGs [Mey+20] + RagConnect
1st phase: Specification 2nd phase: Generation 3rd phase: Usage
Grammar (Structure) AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar

WorldModelB model = new WorldModelB(); Compu- ✓ Driver
❌ Notation Code
model.ragconnectResetEvaluationCounter();

uses [Sch+20])
connections to other systems possi
cation model.addOtherScene(new LogicalScene()); ⬋
⬊ (only for simple tokens
uation
Connect ✓ RagConnect
Connection
for (String topic : config.forB.topicsSceneUpdate)
JastAdd
{
Generated
Specification
model.connectMyScene(topic); Aspect Code
}
HM03] + Relational RAGs [Mey+20] + RagConnect
1stmodel.connectOtherScene("place-a/logical/update",
phase: Specification 2nd phase: Generation 0); 3rd phase: Usage
Grammar model.connectNextOperation("robot/operation",
(Structure) AST as model@run.time
false);
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
✅ Declarative and concise textual specification
olves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]
Detailed Generation Process

Grammar
✓ Compu- ✓ Driver ✓
❌ Notation Code
uses [Sch+20])
connections to other systems possi
cation ⬋
⬊ (only for simple tokens
uation
Connect ✓ RagConnect
Connection
JastAdd Generated
Specification Aspect Code
HM03] + Relational RAGs [Mey+20] + RagConnect
1st phase: Specification 2nd phase: Generation 3rd phase: Usage
Grammar (Structure) AST as model@run.time
send port Region OtherScene [0] L

.
① receive port
name = "A"
WorldModelB


② NextOperation MyScene

Robot
OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene Logic
CurrentPosition

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Reachability [0] Slide 12ObjectToPick
of 14
Montréal, October 26th 2022
Evaluation of Concisness

LOC of all Case Studies

es
ar

ut

t
m

ec
ib
m

va
r

on
ra

tt

Ja
Case Study Part

C
Common (manual) 15 255 52 318
Site A (manual) 1 17 2 136
Site A (generated) 31 2570 11 042
Main
Site B (manual) 29 668 136 350
Site B (generated) 69 5443 23 075
Main (manual) 15 261 8 144
Coordinator
Main (generated) 28 1510 9592

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 13 of 14
Montréal, October 26th 2022
Evaluation of Concisness

LOC of all Case Studies

es
ar

ut

t
m

ec
ib
m

va
r

on
ra

tt

Ja
Case Study Part

C
Common (manual) 15 255 52 318
Site A (manual) 1 17 2 136
Site A (generated) 31 2570 11 042
Main
Site B (manual) 29 668 136 350
Site B (generated) 69 5443 23 075
Main (manual) 15 261 8 144
Coordinator
Main (generated) 28 1510 9592

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 13 of 14
Montréal, October 26th 2022
Conclusion

This work presents


• a way to connect RAG-based models with external systems
• easily, with a DSL
• efficiently, exploiting RAG technology

We showed this
• in a robot coordination case study
• . . . for solving a cooperative task
• . . . and for coordinating the runtime components.

We provide the missing concepts to use RAGs for Models@run.time!

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 14 of 14
Montréal, October 26th 2022
Visit us at our poster!
Conclusion
Incremental Causal Connection for Self-Adaptive Systems
Based on Relational Reference Attribute Grammars

This work presents


• a way to connect RAG-based models with external systems
René Schöne* (✉ rene.schoene@tu-dresden.de) // Johannes Mey* (✉ johannes.mey@tu-dresden.de) //
Sebastian Ebert*,‡ (✉ sebastian.ebert@tu-dresden.de) // Sebastian Götz* (✉ sebastian.goetz1@tu-dresden.de) //
Uwe Aßmann*,‡ (✉ uwe.assmann@tu-dresden.de)
*
Technische Universität Dresden // ‡Centre for Tactile Internet with Human-in-the-Loop (CeTI)
DOI 10.5281/zenodo.6963426 connect.relational-rags.eu

Context and Problem: Specifying Causal Connections for models@run.time


•Model-driven enginering reduces complexity during development of self-adaptive systems
•Models@run.time enables using models during runtime
✅ Declarative and concise textual specification
•Connecting models to different external systems involves manual work
⬋ ✅ Similar to a metamodel using [Mey+20]

• easily, with a DSL


RQ1 How to send and receive updates of a
runtime model or any part of it to/from an add/refine computations Structure
revisit structure
external system? (Grammar)
RQ2 How to manage these updates
automatically and efficiently? revisit structure
❌ No connections to other systems possible
✅ Declarative specification ⬋
⬊ (only for simple tokens [Sch+20])
✅ Efficient execution using incremental evaluation Computation add/refine Semantics
(Attributes) semantics (Connections)

Solution: Self-Adaptive Systems with JastAdd [HM03] + Relational RAGs [Mey+20] + RagConnect

• efficiently, exploiting RAG technology


Connect Specification (Semantics) Grammar (Structure) AST as model@run.time
receive WorldModelB.MyScene using ParseScene, ConvertScene ; ① WorldModelB ::= Region* Robot* ExecutedOperation:Operation* send port Region OtherScene [0] LogicalScene
receive indexed WorldModelB.OtherScene ; ① [MyScene:Scene] OtherScene:LogicalScene*
receive port
name = "A"
WorldModelB

receive Robot.CurrentPosition ; // default mapping used /NextOperation:Operation/ ; ②


receive indexed with add WorldModelB.ExecutedOperation using
ParseCommand, ConvertCommand ;
Robot ::= <Name:String> <CurrentPosition> ;
② NextOperation MyScene

send WorldModelB.NextOperation using PrintOperation ; ② PickAndPlace ;


rel PickAndPlace.RobotToExecute? -> Robot ; Robot
send Robot.myPosition(String) ;
rel PickAndPlace.ObjectToPick -> LogicalMovableObject ; OwnedCollaborationZoneNames
OccupiedCollaborationZoneNames
RobotToExecute
PickAndPlace ① Scene LogicalMovableObject LogicalRegion

PrintOperation maps Operation op to byte[] {: rel PickAndPlace.TargetLocation -> DropOffLocation ; CurrentPosition


byte[] result = op.toProtobufByteArray(); // embedded java
if (result == null) { reject(); } // code for the // some of the nonterminals shared by both sites
Reachability [0] ObjectToPick
Scene ::= DropOffLocation* MovableObject* RobotObject* ;
return result; // mapping content
LogicalScene ::= LogicalRegion* LogicalMovableObject* ;
:} CanReachObjectOfInterest MovableObject
Region ::= <Name:String> <LocationNames> ; LogicalScene
DropOffLocation
CollaborationZone : DropOffLocation ; ObjectName = "blue2" Name = "blue2"

RagConnect
Driver Code
⟨port⟩ ::= ⟨direction⟩ ⟨options⟩ ⟨target⟩ using ⟨mappings⟩ ; WorldModelB model = new WorldModelB();
model.ragconnectResetEvaluationCounter();
⟨direction⟩ ::= send | receive model.addOtherScene(new LogicalScene());

for (String topic : config.forB.topicsSceneUpdate) {


⟨options⟩ ::= ϵ | indexed | with add | indexed with add Attributes (Computation) model.connectMyScene(mqttUri(topic, config));
}
⟨target⟩ ::= ⟨nt-name⟩ syn Operation WorldModelB.getNextOperation() { ② model.connectOtherScene(mqttUri("place-a/logical/update", config), 0); ①
| ⟨nt-name⟩ . ⟨child-name⟩ if (diffToOperations().getNumChild() == 0) { model.connectNextOperation(mqttUri(config.forB.topicCommand, config), false);
model.connectExecutedOperation(mqttUri(config.forB.topicCommand, config));

return errorNoOperationComputed();
| ⟨nt-name⟩ . ⟨attr-name⟩ ( ⟨type-name⟩ )
}
⟨mappings⟩ ::= ⟨mapping-name⟩ , ⟨mappings⟩ | ⟨mapping-name⟩
for (Operation op : diffToOperations()) { JastAdd
Robot executingRobot = op.getRobotToExecute();
⟨mapping⟩ ::=
if (!op.isErrorOperation()) { uses
if (op.equals(lastOperationFor(executingRobot))) {
⟨mapping-name⟩ maps ⟨type-use⟩ ⟨ident⟩ to return errorDuplicateOperation();
⟨type-use⟩ {: ⟨mapping-content⟩ :} }
return op; Generated Code
⟨type-use⟩ ::= ⟨type-name⟩ | ⟨array-type-name⟩ [] }
} LOC of all Case Studies
return errorNoExecutableOperation();

es
ar
Support for Different Parts of the Grammar Using Send

ut

t
}

ec
ib
and Receive Ports. Legend: Full support, G
# Partly

nn

va
tr
ra

Co
At

Ja
supported, # Not supported, / not applicable Case Study Part

G
Element of a grammar Send Receive Connection Aspect Common (manual) 15 255 52 318
Message Receive Apply yes
Update Site A (manual) 1 17 2 136
Terminal message mappings
Different
value?
port
target Site A (generated) 31 2570 11 042
Main

We showed this
Non-Terminal (Context-free) if rejected Site B (manual) 29 668 136 350
no
Non-Terminal (Single) Site B (generated) 69 5443 23 075

• in a robot coordination case study


Non-Terminal (List) Main (manual) 15 261 8 144
Non-Terminal (Optional) Apply
Coordinator
Port target
has changed
Recompute
port target Different yes Send
message
Main (generated) 28 1510 9592
mappings
Relation G
# # value?

Attribute / Recognized by incremental if rejected no


evaluation feature of JastAdd Message

1st phase: Specification 2nd phase: Generation 3rd phase: Usage

Evaluation: Collaborative, Teaching-Based Robotic Cells (Case study 1) and Coordinator (Case study 2)

← Conceptual view of the two robots (site B) moving


Site A Site B objects to desired locations defined by an
Site A Site B
R1 operator (site A) MQTT
2 Broker
R1 R2

• . . . for solving a cooperative task


4

Two Franka Emica robot arms (site B) move


1 R3
3
Collabo-
ration
⬋ one object each to a new location in parallel.
R2
1 B1 Robot Zone B1 Robot
Operator Operator
Controller Controller
Scene Scene
Controller A R3 Controller A
2 3 4 B2 Robot B2 Robot

command
scene
Controller Controller

command
scene

scene
RAG command status RAG
Model A status Coordinator command Model B
RAG Model A logical scene RAG Model B
Conceptual view on the coordinator starting →

• . . . and for coordinating the runtime components.


MovableObject Region Component Causal Connection Port Port Target components according to component dependencies Component Start Strategy Causal Connection Port Port Target

Our approach uses models based on relational RAGs and RagConnect enables adding efficient connections to all possible parts of a given model specification.

References
[HM03] Görel Hedin and Eva Magnusson. “JastAdd—an Aspect-Oriented Compiler Construction System”. In: Science of Computer Programming [Sch+20] René Schöne et al. “Connecting Conceptual Models Using Relational Reference Attribute Grammars”. In: Proceedings of the 23rd ACM/
47.1 (Apr. 1, 2003). IEEE International Conference on Model Driven Engineering Languages and Systems: Companion Proceedings. New York, NY, USA: ACM, Oct.
[Mey+20] Johannes Mey et al. “Relational Reference Attribute Grammars: Improving Continuous Model Validation”. In: Journal of Computer 16, 2020, pp. 1–11.
Languages 57 (2020).

Member in the network of:


This work is partly supported by the German Research Foundation (DFG) as
part of Germany's Excellence Strategy -- EXC 2050/1 -- Project 390696704
-- "Centre for Tactile Internet with Human-in-the-Loop" (CeTI), by the
Federal Ministry of Education and Research of Germany in the programme
of "Souverän. Digital. Vernetzt." Joint project 6G-life, project identification
number: 16KISK001K, and using tax money based on the budget approved
by the Saxon state parliament for the project "PROSPER".

We provide the missing concepts to use RAGs for Models@run.time!

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 14 of 14
Montréal, October 26th 2022
References I

[Hed00] Görel Hedin. “Reference attributed grammars”. In: Informatica (Slovenia) 24.3
(2000), pp. 301–317. URL: http://citeseerx.ist.psu.edu/viewdoc/download?doi=
10.1.1.108.8792&rep=rep1&type=pdf (visited on 08/03/2015).
[HM03] Görel Hedin and Eva Magnusson. “JastAdd: an aspect-oriented compiler
construction system”. In: Science of Computer Programming. Special Issue on
Language Descriptions, Tools and Applications (L DTA’01) 47.1 (Apr. 2003),
pp. 37–58. ISSN: 0167-6423. DOI: 10.1016/S0167-6423(02)00109-0. URL:
http://www.sciencedirect.com/science/article/pii/S0167642302001090 (visited on
10/01/2019).
[Knu68] Donald E. Knuth. “Semantics of context-free languages”. In: Mathematical systems
theory 2.2 (1968), pp. 127–145. URL:
http://link.springer.com/article/10.1007/BF01692511 (visited on 08/03/2015).

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 15 of 14
Montréal, October 26th 2022
References II

[Mey+20] Johannes Mey et al. “Relational Reference Attribute Grammars: Improving


Continuous Model Validation”. en. In: Journal of Computer Languages 57 (Jan. 2020),
p. 21. ISSN: 2590-1184. DOI: 10.1016/j.cola.2019.100940. URL:
http://www.sciencedirect.com/science/article/pii/S2590118419300656 (visited on
02/14/2020).
[Wey19] Danny Weyns. “Software Engineering of Self-adaptive Systems”. en. In: Handbook
of Software Engineering. Cham: Springer International Publishing, 2019,
pp. 399–443. ISBN: 978-3-030-00262-6. URL:
https://doi.org/10.1007/978-3-030-00262-6_11.

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 16 of 14
Montréal, October 26th 2022
RagConnect DSL // Grammar
⟨port⟩ ::= ⟨direction⟩ ⟨options⟩ ⟨target⟩ using ⟨mappings⟩ ;

⟨direction⟩ ::= send | receive

⟨options⟩ ::= ϵ | indexed | with add | indexed with add

⟨target⟩ ::= ⟨nt-name⟩


| ⟨nt-name⟩ . ⟨child-name⟩
| ⟨nt-name⟩ . ⟨attr-name⟩ ( ⟨type-name⟩ )

⟨mappings⟩ ::= ⟨mapping-name⟩ , ⟨mappings⟩ | ⟨mapping-name⟩


⟨mapping⟩ ::=
⟨mapping-name⟩ maps ⟨type-use⟩ ⟨ident⟩ to
⟨type-use⟩ {: ⟨mapping-content⟩ :}

⟨type-use⟩ ::= ⟨type-name⟩ | ⟨array-type-name⟩ []

Incremental Causal Connection for Self-Adaptive Systems Based on Relational Reference Attribute Grammars
René Schöne, Johannes Mey, Sebastian Ebert, Sebastian Götz, Uwe Aßmann Slide 17 of 14
Montréal, October 26th 2022

You might also like