Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 38ba4063676a3a3cab96dd379ce1d007387b5397 (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
RoomModel cGenRef {
	import room.basic.types.* from "Types.room"
	
	LogicalSystem LS {
		SubSystemRef sys1: SubSys
//		SubSystemRef sys2: SubSys
	}
	
	SubSystemClass SubSys {
		ActorRef Sender: Sender
		ActorRef Receiver: Receiver
		Binding Sender.dataOut and Receiver.dataIn
	
		LogicalThread dflt_thread
		LogicalThread other_thread
		
		ActorInstanceMapping Receiver -> dflt_thread
		ActorInstanceMapping Sender -> other_thread
	}

//	SubSystemClass SubSysSomewhatBigger {
//		ActorRef Receiver: Receiver
//		ActorRef Sender: Sender
//		ActorRef Broadcast: Broadcast
//		ActorRef Receiver2: Receiver
//		ActorRef ref0: Broadcast
//		ActorRef ref1: Broadcast
//		ActorRef ref2: Receiver
//		ActorRef ref3: Receiver
//		Binding Sender.dataOut and Broadcast.dataIn
//		Binding Broadcast.dataOut and ref0.dataIn
//		Binding Broadcast.dataOut and ref1.dataIn
//		Binding Receiver.dataIn and ref0.dataOut
//		Binding Receiver2.dataIn and ref0.dataOut
//		Binding ref2.dataIn and ref1.dataOut
//		Binding ref3.dataIn and ref1.dataOut
//	}

	async ActorClass Receiver {
		Interface {
			Port dataIn: CommunicationProtocol
		}
		Structure {
			external Port dataIn
			Attribute attr1: DataClass1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> DataReceived {
					triggers {
						<sendData: dataIn>
					}
					action {
						"dataIn.receivedData();"
					}
				}
				Transition tr1: DataReceived -> DataReceived {
					triggers {
						<sendData: dataIn>
					}
					action {
						"dataIn.receivedData();"
					}
				}
				State Idle
				State DataReceived
			}
		}
	}

	ActorClass Broadcast {
		Interface {
			Port dataIn: CommunicationProtocol
			conjugated Port dataOut [2]: CommunicationProtocol
		}
		Structure {
			external Port dataIn
			external Port dataOut
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> tp0 of Sending {
					triggers {
						<sendData: dataIn>
					}
					action {
						"dataOut.sendData();"
					}
				}
				Transition tr1: tp1 of Sending -> ReceivedBoth {
					action {
						"dataIn.receivedData();"
					}
				}
				State Idle
				State Sending {
					subgraph {
						Transition tr0: my tp0 -> WaitingForReceived
						Transition tr1: WaitingForReceived -> ReceivedOne {
							triggers {
								<receivedData: dataOut>
							}
							action {
								"// Kommentar"
							}
						}
						Transition tr3: ReceivedOne -> my tp1 {
							triggers {
								<receivedData: dataOut>
							}
						}
						EntryPoint tp0
						ExitPoint tp1
						State WaitingForReceived
						State ReceivedOne
					}
				}
				State ReceivedBoth
			}
		}
	}

	ActorClass SenderManual {
		Interface {
			conjugated Port dataOut: CommunicationProtocol
		}
		Structure {
			external Port dataOut
			Attribute attribute1: int32
			Attribute attribute2: DataClass1
		}
		Behavior {
			//@BehaviorManual
			Operation operation1(argument1:int32, argument2: DataClass1 ref){""}
		}
	}
	ActorClass ReceiverManual {
		Interface {
			Port dataIn: CommunicationProtocol
		}
		Structure {
			external Port dataIn
		}
		Behavior {
			//@BehaviorManual
		}
	}
	
	

	async ActorClass Sender {
		Interface {
			conjugated Port dataOut: CommunicationProtocol
		}
		Structure {
			external Port dataOut
			Attribute counter: int32
			
		}
		Behavior {
			StateMachine {
				Transition init: initial -> SendingData {
					action {
						"counter=0;"
					}
				}
				Transition tr0: SendingData -> cp cp0 {
					triggers {
						<receivedData: dataOut>
					}
					action {
						"counter++;"
					}
				}
				Transition tr1: cp cp0 -> Done
				Transition tr2: cp cp0 -> SendingData {
					cond {
						"counter<10"
					}
				}
				ChoicePoint cp0
				State SendingData {
					entry {
						"dataOut.sendData();"
					}
					do {
						"etLogger_logInfo(\">>> sending tick\");"
					}
				}
				State Done {
					entry {
						"etLogger_logInfo(\"+++   Sender Done   +++\");"
					}
					do {
						"etLogger_logInfo(\">>> done tick\");"
						"if (++counter>20) etUnit_testFinished();"
					}
				}
			}
		}
	}

	ProtocolClass CommunicationProtocol {
		incoming {
			Message sendData()
		}
		outgoing {
			Message receivedData()
		}
	}
	
	ProtocolClass etRTSystemServicesProtocol {
		incoming {
			Message poll()
		}
	}
	
	DataClass DataClass1 {
		usercode1 {"// usercode1"}
		usercode2 {"// usercode2"}
		usercode3 {"// usercode3"}
		Attribute Attr1: int32
		Attribute ComplexAttr: DataClass2 
		Attribute Attr3: float32
		
		Operation MultiplyWithAttr1(value: int32): int32 {
			"return Attr1*value;"
		}
		Operation MultiplyWithAttr3(value: float32): float32 {
			"return Attr3*value;"
		}
	}

	DataClass DataClass2 {
		Attribute Attr1: int32
		Attribute Attr2: float32
		Attribute Attr3: int32
		Operation Operation1() {"/*nothing to do*/"}
	}

}

Back to the top