-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcs_3_with_invariants_summaryAT.xml
314 lines (291 loc) · 10.2 KB
/
gcs_3_with_invariants_summaryAT.xml
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
<nta>
<declaration>// TODO:
// at the moment the specifications allow to say that:
// - it is always possible to reach a synchronization state
// - once clocks are synchronized, they always can return to a synchronized state
//
// it is not clear how to "bound" the interval in which two clocks can be un-synchronized (given the restrictive syntax of Uppaal specifications);
// we should also see how it scales to a cutoff size and double check the model actually falls in the family of disjunctive timed networks
// SIZE: number of copies in the system
const int SIZE = 1;
clock g;
// PERIOD: discrete clock period; the clock cycles from 0 till PERIOD-1, than it goes back to 0
const int PERIOD = 3;
// tick: it stores, for each process id, the current clock value
meta int[0,PERIOD] tick[SIZE];
// high: an array storing, for each process id, whether it is currently synchronized with the clock source (high[id] = true) or not (high[id] = false);
// this array is used to encode the disjunctive guard, since Uppaal does not allow to refer to other process locations
int synched[SIZE]={1};
void inc_tick(int[0,SIZE] id) {
tick[id] = (tick[id] + 1) % PERIOD;
}
int[0,PERIOD] get_tick(int[0,SIZE] id) {
return tick[id];
}
void set_tick(int[0,SIZE] id, int[0,PERIOD] value) {
tick[id] = value;
}
int get_synched(int[0,SIZE] id) {
return synched[id];
}
void set_synched(int [0,SIZE] id, bool is_synched) {
synched[id] = is_synched;
}
int num_synched() {
int i=0, res=0;
for (i=0; i<SIZE; i++) {
res = res + synched[i];
}
return res;
}</declaration>
<template>
<name>GTPUser</name>
<parameter>int id</parameter>
<declaration>// sync_proc: it stores the identify of the process from which it receives a message, or -1
//int sync_proc = -1;
// ph: it represents the phase of the oscillator; in theory the oscillator should fire when its phase equals 1, but it may be the case that the oscillator
// drifts (e.g. it fires too early, or too low); we model this by assuming that the phase is a precise clock (no drifts) but the oscillator may fire
// when ph == 1, ph < 1, or ph > 1, and react accordingly
clock ph;
clock c_resync;
//meta int[0, PERIOD] tick = 0;
// Open questions:
//
// 1. number of actual locations is not the visible ones, but we must multiply it by the number of values of high[id] times the values of tick[id]
// 2. we use the array high[sync_id] to check whether the quality of clock of sync_id is better than the one in the local process; this is like saying that we abstract from the metric
// for judging the quality of a timestamp, assuming that such metric is able to distinguish (most of the times?) between clocks with good timestamps (i.e. synchronized with the Controller)
// and clocks with bad timestamps
// 3.
</declaration>
<location id="id0" x="-807" y="93">
</location>
<location id="id1" x="-799" y="-51">
</location>
<location id="id2" x="246" y="59">
<name x="236" y="25">L2</name>
<label kind="invariant" x="263" y="76">ph <= 4</label>
</location>
<location id="id3" x="-34" y="51">
<name x="-44" y="17">L1</name>
<label kind="invariant" x="-76" y="68">ph <= 4</label>
</location>
<location id="id4" x="-382" y="51">
<name x="-392" y="17">L0</name>
<label kind="invariant" x="-450" y="59">ph <= 4</label>
</location>
<location id="id5" x="204" y="-289">
<name x="194" y="-323">H2</name>
<label kind="invariant" x="194" y="-272">ph<=2</label>
</location>
<location id="id6" x="-51" y="-289">
<name x="-61" y="-323">H1</name>
<label kind="invariant" x="-61" y="-272">ph<=2</label>
</location>
<location id="id7" x="-391" y="-289">
<name x="-401" y="-323">H0</name>
<label kind="invariant" x="-401" y="-272">ph<=2</label>
</location>
<init ref="id7"/>
<transition>
<source ref="id0"/>
<target ref="id7"/>
<label kind="guard" x="-789" y="8">g>=0</label>
<label kind="assignment" x="-789" y="42">set_tick(id,0),set_synched(id,true), ph := 0</label>
<nail x="-416" y="-8"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id6"/>
<label kind="guard" x="-789" y="4">g>=2</label>
<label kind="assignment" x="-789" y="38">set_tick(id, 1), set_synched(id, true), ph := 0</label>
<nail x="-195" y="-17"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id5"/>
<label kind="guard" x="-789" y="16">g>=4</label>
<label kind="assignment" x="-789" y="50">set_tick(id, 2), set_synched(id, true), ph := 0</label>
<nail x="-204" y="8"/>
</transition>
<transition>
<source ref="id4"/>
<target ref="id0"/>
<nail x="-603" y="102"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id4"/>
<nail x="-620" y="25"/>
</transition>
<transition>
<source ref="id7"/>
<target ref="id1"/>
<nail x="-629" y="-212"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id7"/>
<nail x="-586" y="-93"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id5"/>
<label kind="guard" x="-781" y="-374">g>=4</label>
<label kind="assignment" x="-781" y="-340">set_tick(id, 2), set_synched(id, true),ph := 0</label>
<nail x="-272" y="-629"/>
<nail x="85" y="-629"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id6"/>
<label kind="guard" x="-781" y="-357">g>=2</label>
<label kind="assignment" x="-781" y="-323">set_tick(id, 1), set_synched(id, true), ph := 0</label>
<nail x="-484" y="-595"/>
<nail x="-93" y="-595"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id7"/>
<label kind="guard" x="-755" y="-578">g>=0</label>
<label kind="assignment" x="-755" y="-544">set_tick(id, 0), set_synched(id, true),ph:=0</label>
<nail x="-773" y="-527"/>
<nail x="-416" y="-561"/>
</transition>
<transition>
<source ref="id5"/>
<target ref="id4"/>
<label kind="guard" x="85" y="195">g>=0 and ph >2</label>
<label kind="assignment" x="-25" y="212">inc_tick(id), ph := 0, set_synched(id, false), c_resync := 0</label>
<nail x="357" y="-229"/>
<nail x="382" y="238"/>
<nail x="-365" y="246"/>
</transition>
<transition>
<source ref="id6"/>
<target ref="id2"/>
<label kind="guard" x="-51" y="-102">g>=0 and ph>2</label>
<label kind="assignment" x="-42" y="-59">inc_tick(id), ph := 0,
set_synched(id, false),
c_resync := 0</label>
<nail x="-34" y="-212"/>
<nail x="144" y="0"/>
</transition>
<transition>
<source ref="id7"/>
<target ref="id3"/>
<label kind="guard" x="-544" y="-161">g>=0 and ph<2</label>
<label kind="assignment" x="-408" y="-93">inc_tick(id), ph := 0,
set_synched(id, false), c_resync := 0</label>
<nail x="-391" y="-221"/>
<nail x="-110" y="25"/>
</transition>
<transition>
<source ref="id2"/>
<target ref="id4"/>
<label kind="guard" x="-313" y="140">ph >= 1</label>
<label kind="assignment" x="-280" y="153">inc_tick(id), ph := 0, set_synched(id, false)</label>
<nail x="255" y="170"/>
<nail x="-331" y="178"/>
</transition>
<transition>
<source ref="id3"/>
<target ref="id2"/>
<label kind="guard" x="34" y="34">ph >= 1</label>
<label kind="assignment" x="34" y="59">inc_tick(id), ph := 0,
set_synched(id, false)</label>
</transition>
<transition>
<source ref="id4"/>
<target ref="id3"/>
<label kind="guard" x="-272" y="25">ph >= 1</label>
<label kind="assignment" x="-280" y="51">inc_tick(id), ph := 0,
set_synched(id, false)</label>
</transition>
<transition>
<source ref="id5"/>
<target ref="id4"/>
<label kind="guard" x="425" y="-153">g>=0 and ph<2</label>
<label kind="assignment" x="433" y="-127">inc_tick(id), ph := 0,
set_synched(id, false),
c_resync := 0</label>
<nail x="399" y="-263"/>
<nail x="433" y="255"/>
<nail x="-391" y="263"/>
</transition>
<transition>
<source ref="id6"/>
<target ref="id2"/>
<label kind="guard" x="42" y="-178">g>=0 and ph<2</label>
<label kind="assignment" x="76" y="-153">inc_tick(id), ph := 0,
set_synched(id, false), c_resync := 0</label>
<nail x="-8" y="-263"/>
</transition>
<transition>
<source ref="id7"/>
<target ref="id3"/>
<label kind="guard" x="-374" y="-255">g>=0 and ph>2</label>
<label kind="assignment" x="-348" y="-238">inc_tick(id), ph := 0,
set_synched(id, false), c_resync := 0</label>
<nail x="-340" y="-272"/>
</transition>
<transition>
<source ref="id5"/>
<target ref="id7"/>
<label kind="guard" x="-289" y="-484">ph == 2</label>
<label kind="assignment" x="-323" y="-450">inc_tick(id), ph := 0, c_resync := 0, set_synched(id, true)</label>
<nail x="204" y="-459"/>
<nail x="-399" y="-459"/>
</transition>
<transition>
<source ref="id6"/>
<target ref="id5"/>
<label kind="guard" x="-34" y="-357">ph == 2</label>
<label kind="assignment" x="-34" y="-331">inc_tick(id), ph := 0, c_resync := 0,
set_synched(id, true)</label>
</transition>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="-340" y="-348">ph == 2</label>
<label kind="assignment" x="-348" y="-331">inc_tick(id), ph := 0, c_resync := 0,
set_synched(id, true)</label>
</transition>
</template>
<system>// Place template instantiations here.
u0 = GTPUser(0);
// List one or more processes to be composed into a system.
system u0;</system>
<queries>
<query>
<formula>get_synched(0) == true --> get_synched(0) == false
</formula>
<comment>Phi_3 : it does hold
</comment>
</query>
<query>
<formula>get_synched(0) == false--> get_synched(0) == true
</formula>
<comment>Phi_4: this does not hold
</comment>
</query>
<query>
<formula>get_synched(0) == true --> get_synched(0) == true
</formula>
<comment>Phi_5: this does not hold
</comment>
</query>
<query>
<formula>get_synched(0) == false --> get_synched(0) == false
</formula>
<comment></comment>
</query>
<query>
<formula>u0.H0-->u0.H0
</formula>
<comment>
</comment>
</query>
</queries>
</nta>