Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f05f4071936582ccbb0e0c8d35b6f5af2dd341ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
RoomModel Semantics {

	// simple cascade
	ActorClass AETest1  {
		Interface {
			Port p0: PC1
		}
		Structure {
			external Port p0
		}
		Behavior {
			StateMachine {
				Transition init: initial -> state0 { }
				Transition tr0: state0 -> state1 {
					triggers {
						<in1: p0>
					}
					action {
						"p0.out1();"
					}
				}
				Transition tr1: state1 -> state2 {
					triggers {
						<in2: p0>
					}
					action {
						"p0.out2();"
					}
				}
				Transition tr2: state2 -> state3 {
					triggers {
						<in3: p0>
					}
					action {
						"p0.out3();"
					}
				}
				Transition tr3: state3 -> state4 {
					triggers {
						<in4: p0>
					}
					action {
						"p0.out4();"
					}
				}
				Transition tr4: state1 -> wrong {
					triggers {
						// this trigger receives a warning
						<in1: p0>
					}
				}
				State state0
				State state1
				State state2
				State state3
				State state4
				State wrong
			}
		}
	}


	/*
	 * examples from Thomas
	 */
	
	// correct client for one motor
	ActorClass AETest2  {
		Interface {
			Port dummy: Dummy
			conjugated Port motor1: PMotor
		}
		Structure {
			external Port dummy
			external Port motor1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> MotorStarted {
					triggers {
						<someEvent1: dummy>
					}
					action {
						"motor1.start();"
					}
				}
				Transition tr1: MotorStarted -> Idle {
					triggers {
						<done: motor1>
					}
					action {
						// this action code receives a warning
						"motor1.start();"
					}
				}
				Transition tr2: MotorStarted -> Idle {
					triggers {
						<error: motor1>
					}
				}
				State Idle
				State MotorStarted
			}
		}
	}

	// client missing 'done'
	ActorClass AETest3 {
		Interface {
			Port dummy: Dummy
			conjugated Port motor1: PMotor
		}
		Structure {
			external Port dummy
			external Port motor1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> MotorStarted {
					triggers {
						<someEvent1: dummy>
					}
					action {
						"motor1.start();"
					}
				}
				Transition tr2: MotorStarted -> Idle {
					triggers {
						<error: motor1>
					}
				}
				State Idle
				State MotorStarted
			}
		}
	}

	// correct client for two motors
	ActorClass AETest4 {
		Interface {
			Port dummy: Dummy
			conjugated Port motor1: PMotor
			conjugated Port motor2: PMotor
		}
		Structure {
			external Port dummy
			external Port motor1
			external Port motor2
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> MotorStarted {
					triggers {
						<someEvent1: dummy>
					}
					action {
						"motor1.start();"
						"motor2.start();"
					}
				}
				Transition tr1: MotorStarted -> Motor1done {
					triggers {
						<done: motor1>
					}
				}
				Transition tr2: MotorStarted -> SomeMotorError {
					triggers {
						<error: motor1>
					}
				}
				Transition tr3: Motor1done -> Idle {
					triggers {
						<done: motor2>
					}
				}
				Transition tr4: MotorStarted -> Motor2done {
					triggers {
						<done: motor2>
					}
				}
				Transition tr5: Motor2done -> Idle {
					triggers {
						<done: motor1>
					}
				}
				Transition tr6: Motor1done -> SomeMotorError {
					triggers {
						<error: motor2>
					}
				}
				Transition tr7: Motor2done -> SomeMotorError {
					triggers {
						<error: motor1>
					}
				}
				Transition tr8: MotorStarted -> SomeMotorError {
					triggers {
						<error: motor2>
					}
				}
				Transition tr9: SomeMotorError -> SomeMotorError {
					triggers {
						<done: motor1>
					}
				}
				Transition tr10: SomeMotorError -> SomeMotorError {
					triggers {
						<error: motor1>
					}
				}
				Transition tr11: SomeMotorError -> SomeMotorError {
					triggers {
						<done: motor2>
					}
				}
				Transition tr12: SomeMotorError -> SomeMotorError {
					triggers {
						<error: motor2>
					}
				}
				State Idle
				State MotorStarted
				State Motor1done
				State Motor2done
				State SomeMotorError
			}
		}
	}

	ProtocolClass PC1 {
		incoming {
			Message in1()
			Message in2()
			Message in3()
			Message in4()
		}
		outgoing {
			Message out1()
			Message out2()
			Message out3()
			Message out4()
		}
		
		semantics {
			in: in1 -> out: out1 -> in: in2 -> out: out2 -> in: in3 -> out: out3 -> in: in4 -> out: out4
		}
	}

	ProtocolClass PMotor {
		incoming {
			Message start()
		}
		outgoing {
			Message done()
			Message error()
		}
		
		semantics {
			in: start -> (out: done, out: error)
		}
	}

	ProtocolClass Dummy {
		incoming {
			Message someEvent1()
			Message someEvent2()
			Message someEvent3()
		}
		outgoing {
			Message someEvent1()
			Message someEvent2()
			Message someEvent3()
		}
	}

}

Back to the top