Johan ARCILE

Replace test4_bis.xml

<?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>
<?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>//Global clocks
clock C1; // in 1/scale seconds
clock C2; // in 1/scale seconds
clock C3; // in 1/scale seconds
clock x_A; // in 1/scale seconds
clock x_B; // in 1/scale seconds
clock x_C; // in 1/scale seconds
//Synchronisation channel
broadcast chan k;
......@@ -60,7 +60,7 @@ const int J_sup := marking[1]+(C_wid/2); // used for posY update
const int nb_car := 3; // number of vehicles (&gt;= 2)
typedef int[0,nb_car-1] RangeId; // ids range
const int freq[nb_car] := {10,10,10}; // activation sample of the controler for each vehicle in 1/scale second
const int ctr_freq[nb_car] := {10,10,10}; // activation sample of the controler for each vehicle in 1/scale second
const int min_com_delay[nb_car] := {3,3,3}; // min communication delay for each vehicle in 1/scale second, must be smaller than the vehicle's controller sample
const int max_com_delay[nb_car] := {4,4,4}; // max communication delay for each vehicle in 1/scale second, must be smaller than the vehicle's controller sample
const int init_posX[nb_car] := {0,3000,4000}; // initial longitudinal position for each vehicle in 1/scale meters
......@@ -272,7 +272,7 @@ RangeDelay read_delay(RangeId id, RangeId n){
return car[id].delay;
}
void communicate(RangeId id){
void broadcasting(RangeId id){
// Send goal and data value to other vehicles
for(n : int[0,nb_car-1]){
if(id&lt;n){
......@@ -288,7 +288,7 @@ void communicate(RangeId id){
//End of editable module related functions
void decision(RangeId id){
void controller(RangeId id){
RangeD temp_dir;
RangeA temp_acc;
......@@ -444,8 +444,14 @@ int time_to_collision(RangeId id1, RangeId id2){
else X_in := 0;
// X_out if faster B
if(vx_a &lt; vx_b){
if(((px_b-px_a-C_len)*GranX)/((vx_b-vx_a)*GranV) &lt; 100) X_out := ((px_b-px_a-C_len)*GranX*scale)/((vx_b-vx_a)*GranV);
else X_out := 100*scale;
if(px_b-px_a-C_len &gt; 0){
if(((px_b-px_a-C_len)*GranX)/((vx_b-vx_a)*GranV) &lt; 100) X_out := ((px_b-px_a-C_len)*GranX*scale)/((vx_b-vx_a)*GranV);
else X_out := 100*scale;
}
else{
if(((C_len-(px_b-px_a))*GranX)/((vx_b-vx_a)*GranV) &lt; 100) X_out := ((C_len-(px_b-px_a))*GranX*scale)/((vx_b-vx_a)*GranV);
else X_out := 100*scale;
}
}
// X_out if equal speed
else{
......@@ -481,319 +487,321 @@ int time_to_collision(RangeId id1, RangeId id2){
if(X_in &lt;= Y_in and Y_in &lt;= X_out) return Y_in;
if(Y_in &lt;= X_in and X_in &lt;= Y_out) return X_in;
return 100*scale;
}</declaration>
<template>
<name x="5" y="5">A0</name>
<declaration>clock C0; // in 1/scale seconds</declaration>
<location id="id0" x="-161" y="0">
<name x="-178" y="-34">I</name>
<urgent/>
</location>
<location id="id1" x="-17" y="0">
<name x="-42" y="-34">s0</name>
<label kind="invariant" x="-34" y="17">C0&lt;=S</label>
</location>
<init ref="id0"/>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-229" y="-204">C0&lt;S and C1&lt;freq[0] and C2&lt;freq[1] and C3&gt;=freq[2]</label>
<label kind="synchronisation" x="-25" y="-187">k!</label>
<nail x="-348" y="-187"/>
<nail x="280" y="-187"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-170" y="-161">C0&lt;S and C1&lt;freq[0] and C2&gt;=freq[1]</label>
<label kind="synchronisation" x="-25" y="-144">k!</label>
<nail x="-272" y="-144"/>
<nail x="212" y="-144"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-110" y="-119">C0&lt;S and C1&gt;=freq[0]</label>
<label kind="synchronisation" x="-25" y="-102">k!</label>
<nail x="-195" y="-102"/>
<nail x="144" y="-102"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-42" y="-76">C0&gt;=S</label>
<label kind="synchronisation" x="34" y="-59">k!</label>
<label kind="assignment" x="-76" y="-59">C0=0,update()</label>
<nail x="-119" y="-59"/>
<nail x="76" y="-59"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id1"/>
<label kind="assignment" x="-119" y="0">update()</label>
</transition>
</template>
<template>
<name>A1</name>
<parameter>int[0,nb_car-1] id</parameter>
<location id="id2" x="-289" y="-85">
<name x="-306" y="-119">I</name>
<urgent/>
</location>
<location id="id3" x="161" y="-85">
<name x="136" y="-110">s1</name>
<label kind="invariant" x="102" y="-68">C1&lt;=max_com_delay[id]</label>
</location>
<location id="id4" x="-102" y="-85">
<name x="-127" y="-110">s0</name>
<label kind="invariant" x="-153" y="-68">C1&lt;=freq[id]</label>
</location>
<init ref="id2"/>
<transition>
<source ref="id2"/>
<target ref="id4"/>
<label kind="assignment" x="-263" y="-85">C1=init_clock[id]</label>
</transition>
<transition>
<source ref="id3"/>
<target ref="id4"/>
<label kind="guard" x="-42" y="-102">C1&gt;=min_com_delay[id]</label>
<label kind="assignment" x="-25" y="-85">communicate(id)</label>
</transition>
<transition>
<source ref="id4"/>
<target ref="id3"/>
<label kind="guard" x="-25" y="-178">C1&gt;=freq[id]</label>
<label kind="synchronisation" x="25" y="-161">k?</label>
<label kind="assignment" x="-34" y="-144">C1=0, decision(id)</label>
<nail x="-102" y="-145"/>
<nail x="161" y="-145"/>
</transition>
</template>
<template>
<name>A2</name>
<parameter>int[0,nb_car-1] id</parameter>
<location id="id5" x="-289" y="-85">
<name x="-299" y="-119">I</name>
<urgent/>
</location>
<location id="id6" x="161" y="-85">
<name x="136" y="-110">s1</name>
<label kind="invariant" x="102" y="-68">C2&lt;=max_com_delay[id]</label>
</location>
<location id="id7" x="-102" y="-85">
<name x="-127" y="-110">s0</name>
<label kind="invariant" x="-153" y="-68">C2&lt;=freq[id]</label>
</location>
<init ref="id5"/>
<transition>
<source ref="id5"/>
<target ref="id7"/>
<label kind="assignment" x="-263" y="-85">C2=init_clock[id]</label>
</transition>
<transition>
<source ref="id6"/>
<target ref="id7"/>
<label kind="guard" x="-42" y="-102">C2&gt;=min_com_delay[id]</label>
<label kind="assignment" x="-25" y="-85">communicate(id)</label>
</transition>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="-25" y="-178">C2&gt;=freq[id]</label>
<label kind="synchronisation" x="25" y="-161">k?</label>
<label kind="assignment" x="-34" y="-144">C2=0, decision(id)</label>
<nail x="-102" y="-145"/>
<nail x="161" y="-145"/>
</transition>
</template>
<template>
<name>A3</name>
<parameter>int[0,nb_car-1] id</parameter>
<location id="id8" x="-289" y="-85">
<name x="-299" y="-119">I</name>
<urgent/>
</location>
<location id="id9" x="161" y="-85">
<name x="136" y="-110">s1</name>
<label kind="invariant" x="102" y="-68">C3&lt;=max_com_delay[id]</label>
</location>
<location id="id10" x="-102" y="-85">
<name x="-127" y="-110">s0</name>
<label kind="invariant" x="-153" y="-68">C3&lt;=freq[id]</label>
</location>
<init ref="id8"/>
<transition>
<source ref="id8"/>
<target ref="id10"/>
<label kind="assignment" x="-263" y="-85">C3=init_clock[id]</label>
</transition>
<transition>
<source ref="id9"/>
<target ref="id10"/>
<label kind="guard" x="-42" y="-102">C3&gt;=min_com_delay[id]</label>
<label kind="assignment" x="-25" y="-85">communicate(id)</label>
</transition>
<transition>
<source ref="id10"/>
<target ref="id9"/>
<label kind="guard" x="-17" y="-178">C3&gt;=freq[id]</label>
<label kind="synchronisation" x="25" y="-161">k?</label>
<label kind="assignment" x="-34" y="-144">C3=0, decision(id)</label>
<nail x="-102" y="-145"/>
<nail x="161" y="-145"/>
</transition>
</template>
<system>Environment = A0();
VehicleA = A1(0);
VehicleB = A2(1);
VehicleC = A3(2);
system Environment, VehicleA, VehicleB, VehicleC;</system>
<queries>
<query>
<formula>E&lt;&gt; car[0].posX == LengthX and car[0].posX &gt; car[1].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].posX == LengthX and car[1].posX &gt; car[0].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].posX == LengthX and car[0].posX &gt; car[2].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].posX == LengthX and car[2].posX &gt; car[0].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].posX == LengthX and car[1].posX &gt; car[2].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].posX == LengthX and car[2].posX &gt; car[1].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and nb_updates+1 &gt;= 146
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and nb_updates+1 &gt;= 146
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[1].on_the_road and nb_updates+1 &gt;= 144
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].on_the_road and nb_updates+1 &gt;= 144
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[2].on_the_road and nb_updates+1 &gt;= 132
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].on_the_road and nb_updates+1 &gt;= 132
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and car[1].on_the_road and time_to_collision(0,1) &lt;=95
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and car[1].on_the_road and time_to_collision(0,1) &lt;=95
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and car[2].on_the_road and time_to_collision(0,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and car[2].on_the_road and time_to_collision(0,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].on_the_road and car[2].on_the_road and time_to_collision(1,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[1].on_the_road and car[2].on_the_road and time_to_collision(1,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and car[0].acceleration &lt;= -2
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and car[0].acceleration &lt;= -2
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].on_the_road and car[1].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[1].on_the_road and car[1].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].on_the_road and car[2].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[2].on_the_road and car[2].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
</queries>
</nta>
}</declaration>
<template>
<name x="5" y="5">Environment</name>
<declaration>clock x; // in 1/scale seconds</declaration>
<location id="id0" x="-161" y="0">
<name x="-178" y="-34">I</name>
<urgent/>
</location>
<location id="id1" x="-17" y="0">
<name x="-42" y="-34">s0</name>
<label kind="invariant" x="-34" y="17">x&lt;=S</label>
</location>
<init ref="id0"/>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-238" y="-204">x&lt;S and x_A&lt;ctr_freq[0] and x_B&lt;ctr_freq[1] and x_C&gt;=ctr_freq[2]</label>
<label kind="synchronisation" x="-25" y="-187">k!</label>
<nail x="-348" y="-187"/>
<nail x="280" y="-187"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-187" y="-161">x&lt;S and x_A &lt; ctr_freq[0] and x_B&gt;=ctr_freq[1]</label>
<label kind="synchronisation" x="-25" y="-144">k!</label>
<nail x="-272" y="-144"/>
<nail x="212" y="-144"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-110" y="-119">x&lt;S and x_A&gt;=ctr_freq[0]</label>
<label kind="synchronisation" x="-25" y="-102">k!</label>
<nail x="-195" y="-102"/>
<nail x="144" y="-102"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
<label kind="guard" x="-42" y="-76">x&gt;=S</label>
<label kind="synchronisation" x="17" y="-59">k!</label>
<label kind="assignment" x="-76" y="-59">x=0,update()</label>
<nail x="-119" y="-59"/>
<nail x="76" y="-59"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id1"/>
<label kind="assignment" x="-119" y="0">update()</label>
</transition>
</template>
<template>
<name>ControllerA</name>
<parameter>int[0,nb_car-1] id</parameter>
<location id="id2" x="-289" y="-85">
<name x="-306" y="-119">I</name>
<urgent/>
</location>
<location id="id3" x="161" y="-85">
<name x="136" y="-110">s1</name>
<label kind="invariant" x="102" y="-68">x_A&lt;=max_com_delay[id]</label>
</location>
<location id="id4" x="-102" y="-85">
<name x="-127" y="-110">s0</name>
<label kind="invariant" x="-153" y="-68">x_A&lt;=ctr_freq[id]</label>
</location>
<init ref="id2"/>
<transition>
<source ref="id2"/>
<target ref="id4"/>
<label kind="assignment" x="-263" y="-85">x_A=init_clock[id]</label>
</transition>
<transition>
<source ref="id3"/>
<target ref="id4"/>
<label kind="guard" x="-42" y="-102">x_A&gt;=min_com_delay[id]</label>
<label kind="assignment" x="-25" y="-85">broadcasting(id)</label>
</transition>
<transition>
<source ref="id4"/>
<target ref="id3"/>
<label kind="guard" x="-25" y="-178">x_A&gt;=ctr_freq[id]</label>
<label kind="synchronisation" x="25" y="-161">k?</label>
<label kind="assignment" x="-34" y="-144">x_A=0, controller(id)</label>
<nail x="-102" y="-145"/>
<nail x="161" y="-145"/>
</transition>
</template>
<template>
<name>ControllerB</name>
<parameter>int[0,nb_car-1] id</parameter>
<location id="id5" x="-289" y="-85">
<name x="-299" y="-119">I</name>
<urgent/>
</location>
<location id="id6" x="161" y="-85">
<name x="136" y="-110">s1</name>
<label kind="invariant" x="102" y="-68">x_B&lt;=max_com_delay[id]</label>
</location>
<location id="id7" x="-102" y="-85">
<name x="-127" y="-110">s0</name>
<label kind="invariant" x="-153" y="-68">x_B&lt;=ctr_freq[id]</label>
</location>
<init ref="id5"/>
<transition>
<source ref="id5"/>
<target ref="id7"/>
<label kind="assignment" x="-263" y="-85">x_B=init_clock[id]</label>
</transition>
<transition>
<source ref="id6"/>
<target ref="id7"/>
<label kind="guard" x="-42" y="-102">x_B&gt;=min_com_delay[id]</label>
<label kind="assignment" x="-25" y="-85">broadcasting(id)</label>
</transition>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="-25" y="-178">x_B&gt;=ctr_freq[id]</label>
<label kind="synchronisation" x="25" y="-161">k?</label>
<label kind="assignment" x="-34" y="-144">x_B=0, controller(id)</label>
<nail x="-102" y="-145"/>
<nail x="161" y="-145"/>
</transition>
</template>
<template>
<name>ControllerC</name>
<parameter>int[0,nb_car-1] id</parameter>
<location id="id8" x="-289" y="-85">
<name x="-299" y="-119">I</name>
<urgent/>
</location>
<location id="id9" x="161" y="-85">
<name x="136" y="-110">s1</name>
<label kind="invariant" x="102" y="-68">x_C&lt;=max_com_delay[id]</label>
</location>
<location id="id10" x="-102" y="-85">
<name x="-127" y="-110">s0</name>
<label kind="invariant" x="-153" y="-68">x_C&lt;=ctr_freq[id]</label>
</location>
<init ref="id8"/>
<transition>
<source ref="id8"/>
<target ref="id10"/>
<label kind="assignment" x="-263" y="-85">x_C=init_clock[id]</label>
</transition>
<transition>
<source ref="id9"/>
<target ref="id10"/>
<label kind="guard" x="-42" y="-102">x_C&gt;=min_com_delay[id]</label>
<label kind="assignment" x="-25" y="-85">broadcasting(id)</label>
</transition>
<transition>
<source ref="id10"/>
<target ref="id9"/>
<label kind="guard" x="-25" y="-178">x_C&gt;=ctr_freq[id]</label>
<label kind="synchronisation" x="25" y="-161">k?</label>
<label kind="assignment" x="-34" y="-144">x_C=0, controller(id)</label>
<nail x="-102" y="-145"/>
<nail x="161" y="-145"/>
</transition>
</template>
<system>// Place template instantiations here.
Env = Environment();
CtrA = ControllerA(0);
CtrB = ControllerB(1);
CtrC = ControllerC(2);
// List one or more processes to be composed into a system.
system Env, CtrA, CtrB, CtrC;
</system>
<queries>
<query>
<formula>E&lt;&gt; car[0].posX == LengthX and car[0].posX &gt; car[1].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].posX == LengthX and car[1].posX &gt; car[0].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].posX == LengthX and car[0].posX &gt; car[2].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].posX == LengthX and car[2].posX &gt; car[0].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].posX == LengthX and car[1].posX &gt; car[2].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].posX == LengthX and car[2].posX &gt; car[1].posX
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and nb_updates+1 &gt;= 146
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and nb_updates+1 &gt;= 146
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[1].on_the_road and nb_updates+1 &gt;= 144
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].on_the_road and nb_updates+1 &gt;= 144
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[2].on_the_road and nb_updates+1 &gt;= 132
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].on_the_road and nb_updates+1 &gt;= 132
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and car[1].on_the_road and time_to_collision(0,1) &lt;=95
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and car[1].on_the_road and time_to_collision(0,1) &lt;=95
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and car[2].on_the_road and time_to_collision(0,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and car[2].on_the_road and time_to_collision(0,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].on_the_road and car[2].on_the_road and time_to_collision(1,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[1].on_the_road and car[2].on_the_road and time_to_collision(1,2) &lt;=10000
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[0].on_the_road and car[0].acceleration &lt;= -2
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[0].on_the_road and car[0].acceleration &lt;= -2
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[1].on_the_road and car[1].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[1].on_the_road and car[1].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; car[2].on_the_road and car[2].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
<query>
<formula>A&lt;&gt; car[2].on_the_road and car[2].acceleration &lt;= 3
</formula>
<comment>
</comment>
</query>
</queries>
</nta>
......