UniTO/anno2/YearI/SecondSem/VPC/labs/uppaal/Modello-C-2.xml

246 lines
7.3 KiB
XML
Raw Normal View History

2018-11-22 13:09:11 +01:00
<?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>// Place global declarations here.
clock time;
bool next=0;
bool ack=0;
bool frame=0;
urgent chan ML;
urgent chan LM;
urgent chan LR;
urgent chan RL;</declaration>
<template>
<name x="5" y="5">Sender</name>
<declaration>clock sc;
clock fc;
clock x0; //timer
clock x1; //timer</declaration>
<location id="id0" x="560" y="110">
<name x="535" y="60">lostPacket</name>
<label kind="invariant" x="543" y="76">sc &lt;= 2</label>
</location>
<location id="id1" x="229" y="195">
<name x="127" y="187">receivedACK</name>
<label kind="invariant" x="169" y="204">sc&lt;=4</label>
</location>
<location id="id2" x="416" y="195">
<name x="433" y="187">waitACK</name>
<label kind="invariant" x="433" y="204">x0 &lt;= 50</label>
</location>
<location id="id3" x="416" y="26">
<name x="433" y="17">canSend</name>
</location>
<location id="id4" x="229" y="26">
<name x="135" y="17">waitPacket</name>
<label kind="invariant" x="212" y="-8">sc&lt;=5</label>
</location>
<init ref="id4"/>
<transition>
<source ref="id1"/>
<target ref="id0"/>
<label kind="guard" x="356" y="263">ack != next</label>
<label kind="assignment" x="373" y="280">sc := 0</label>
<nail x="229" y="280"/>
<nail x="560" y="280"/>
</transition>
<transition>
<source ref="id2"/>
<target ref="id0"/>
<label kind="guard" x="450" y="127">x0 == 50</label>
<label kind="assignment" x="450" y="144">sc:=0</label>
</transition>
<transition>
<source ref="id0"/>
<target ref="id3"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id4"/>
<label kind="guard" x="85" y="110">sc&gt;=2 &amp;&amp; ack == next</label>
<label kind="assignment" x="237" y="102">sc:=0,
next := !next</label>
</transition>
<transition>
<source ref="id2"/>
<target ref="id1"/>
<label kind="synchronisation" x="297" y="178">LM!</label>
<label kind="assignment" x="288" y="195">sc:=0</label>
</transition>
<transition>
<source ref="id3"/>
<target ref="id2"/>
<label kind="synchronisation" x="382" y="76">ML!</label>
<label kind="assignment" x="373" y="102">x0:=0,
fc:=0</label>
</transition>
<transition>
<source ref="id4"/>
<target ref="id3"/>
<label kind="guard" x="305" y="26">sc&gt;=2</label>
<label kind="assignment" x="280" y="9">frame := next</label>
</transition>
</template>
<template>
<name>Receiver</name>
<declaration>clock rc;
bool correctFrame=0;</declaration>
<location id="id5" x="-32869" y="-5049">
<name x="-32879" y="-5083">dupPacket</name>
<label kind="invariant" x="-32852" y="-5058">rc &lt; 5</label>
</location>
<location id="id6" x="-32997" y="-5177">
<name x="-33065" y="-5185">canACK</name>
</location>
<location id="id7" x="-32997" y="-4914">
<name x="-33091" y="-4922">donePacket</name>
<label kind="invariant" x="-33014" y="-4897">rc&lt;=3</label>
</location>
<location id="id8" x="-32717" y="-4914">
<name x="-32700" y="-4922">receivedPacket</name>
<label kind="invariant" x="-32734" y="-4897">rc&lt;=4</label>
</location>
<location id="id9" x="-32716" y="-5176">
<name x="-32699" y="-5184">waitPacket</name>
</location>
<init ref="id9"/>
<transition>
<source ref="id5"/>
<target ref="id6"/>
<label kind="guard" x="-32946" y="-5142">rc &gt;= 2</label>
<label kind="assignment" x="-32929" y="-5126">ack := !correctFrame</label>
</transition>
<transition>
<source ref="id8"/>
<target ref="id5"/>
<label kind="guard" x="-32971" y="-5006">frame != correctFrame &amp;&amp; rc &gt;= 2</label>
<label kind="assignment" x="-32852" y="-4990">rc := 0</label>
</transition>
<transition>
<source ref="id6"/>
<target ref="id9"/>
<label kind="synchronisation" x="-32869" y="-5194">RL!</label>
</transition>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="-33048" y="-5049">rc&gt;=2</label>
<label kind="assignment" x="-33133" y="-5083">ack := correctFrame,
correctFrame := !correctFrame</label>
</transition>
<transition>
<source ref="id9"/>
<target ref="id8"/>
<label kind="synchronisation" x="-32708" y="-5066">LR!</label>
<label kind="assignment" x="-32708" y="-5049">rc:=0</label>
</transition>
<transition>
<source ref="id8"/>
<target ref="id7"/>
<label kind="guard" x="-32946" y="-4913">rc&gt;=2 &amp;&amp; frame == correctFrame</label>
<label kind="assignment" x="-32869" y="-4931">rc:=0</label>
</transition>
</template>
<template>
<name>Link</name>
<declaration>clock lc;</declaration>
<location id="id10" x="-34" y="-238">
<name x="-44" y="-272">lostPacket</name>
</location>
<location id="id11" x="-161" y="-8">
<name x="-238" y="-17">canSend</name>
</location>
<location id="id12" x="-161" y="-178">
<name x="-280" y="-187">receivedPacket</name>
<label kind="invariant" x="-178" y="-212">lc&lt;8</label>
</location>
<location id="id13" x="93" y="-8">
<name x="110" y="-17">canACK</name>
</location>
<location id="id14" x="93" y="-178">
<name x="110" y="-187">receivedACK</name>
<label kind="invariant" x="76" y="-212">lc&lt;8</label>
</location>
<location id="id15" x="-34" y="-93">
</location>
<init ref="id15"/>
<transition>
<source ref="id10"/>
<target ref="id15"/>
</transition>
<transition>
<source ref="id14"/>
<target ref="id10"/>
</transition>
<transition>
<source ref="id12"/>
<target ref="id10"/>
</transition>
<transition>
<source ref="id11"/>
<target ref="id15"/>
<label kind="synchronisation" x="-102" y="-51">LR?</label>
</transition>
<transition>
<source ref="id12"/>
<target ref="id11"/>
<label kind="guard" x="-204" y="-110">lc&gt;=6</label>
</transition>
<transition>
<source ref="id15"/>
<target ref="id12"/>
<label kind="synchronisation" x="-102" y="-153">ML?</label>
<label kind="assignment" x="-110" y="-119">lc:=0</label>
</transition>
<transition>
<source ref="id13"/>
<target ref="id15"/>
<label kind="synchronisation" x="0" y="-51">LM?</label>
</transition>
<transition>
<source ref="id14"/>
<target ref="id13"/>
<label kind="guard" x="102" y="-102">lc&gt;=6</label>
</transition>
<transition>
<source ref="id15"/>
<target ref="id14"/>
<label kind="synchronisation" x="8" y="-153">RL?</label>
<label kind="assignment" x="8" y="-119">lc:=0</label>
</transition>
</template>
<system>sender = Sender();
receiver = Receiver();
link = Link();
system sender, receiver, link;</system>
<queries>
<query>
<formula>A[] (not deadlock)
</formula>
<comment>
</comment>
</query>
<query>
<formula>sender.waitACK --&gt; (sender.receivedACK)
</formula>
<comment>
</comment>
</query>
<query>
<formula>E&lt;&gt; (sender.receivedACK &amp;&amp; ack == next )
</formula>
<comment>
</comment>
</query>
<query>
<formula>link.lostPacket --&gt; (sender.canSend || receiver.canACK)
</formula>
<comment>
</comment>
</query>
</queries>
</nta>