<?xml version="1.0" ?><!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.0//EN' 'http://www.docs.uu.se/docs/rtmv/uppaal/xml/flat-1_0.dtd'><nta><declaration>//Insert declarations of global clocks, variables, constants and channels.



const int rho=400;         // must be &gt;  0 
const int rhoPrime=600;    // must be &gt;= rho       

const int alpha1=50;       // must be &lt;  rho
const int alpha2=50;       // must be &lt;  rho-alpha1
const int beta=10;         // must be &lt;  rho-alpha1-alpha2

const int eps=50;          // must be &lt;= (rho-beta-alpha1-alpha2)/4     
const int kappa=90;        // must be &lt;= rho-beta-alpha1-alpha2-4eps  


const int E=0;
const int A=1;
const int Cr=2;

int[0,2] Track=E, T_P=E, Sensor_Track=E, Next_Sensor_Track=E;

const int O:=90;
const int Somewhere:=45;
const int Cl:=0;

int[0,90] g=O, Ctrl_g=O, Act_g;

clock x,y,z,c,d,a,b,s;

chan step,sens,act,plant;</declaration><template><name x="5" y="5">A_IN</name><declaration>//Insert local declarations of clocks, variables and constants.
</declaration><location id="id0" x="-320" y="-256"><committed/></location><location id="id1" x="120" y="-56"><committed/></location><location id="id2" x="32" y="-56"><committed/></location><location id="id3" x="-128" y="-56"><committed/></location><location id="id4" x="-48" y="-256"><committed/></location><location id="id5" x="120" y="-136"><label kind="invariant" x="112" y="-176">d&lt;=rhoPrime</label></location><location id="id6" x="120" y="32"><committed/></location><location id="id7" x="-128" y="-136"></location><location id="id8" x="-128" y="32"><committed/></location><location id="id9" x="32" y="32"></location><location id="id10" x="32" y="-136"><committed/></location><location id="id11" x="32" y="-256"><label kind="invariant" x="48" y="-272">d&lt;=rhoPrime</label></location><location id="id12" x="-128" y="-256"><committed/></location><location id="id13" x="-232" y="-256"></location><location id="id14" x="-408" y="-256"><committed/></location><init ref="id14"/><transition><source ref="id0"/><target ref="id13"/><label kind="synchronisation" x="-296" y="-256">sens!</label></transition><transition><source ref="id14"/><target ref="id0"/><label kind="synchronisation" x="-384" y="-256">step!</label><label kind="assignment" x="-392" y="-296">Track:=E,
d:=0</label></transition><transition><source ref="id3"/><target ref="id7"/><label kind="synchronisation" x="-188" y="-111">sens!</label></transition><transition><source ref="id8"/><target ref="id3"/><label kind="synchronisation" x="-188" y="-27">step!</label></transition><transition><source ref="id1"/><target ref="id5"/><label kind="synchronisation" x="128" y="-104">sens!</label></transition><transition><source ref="id6"/><target ref="id1"/><label kind="synchronisation" x="128" y="-24">step!</label></transition><transition><source ref="id2"/><target ref="id9"/><label kind="synchronisation" x="-8" y="-32">sens!</label></transition><transition><source ref="id10"/><target ref="id2"/><label kind="synchronisation" x="-8" y="-112">step!</label></transition><transition><source ref="id4"/><target ref="id11"/><label kind="synchronisation" x="-24" y="-280">sens!</label></transition><transition><source ref="id12"/><target ref="id4"/><label kind="synchronisation" x="-104" y="-280">step!</label></transition><transition><source ref="id5"/><target ref="id10"/><label kind="guard" x="72" y="-160">d&gt;0</label><label kind="assignment" x="72" y="-136">Track:=Cr,
d:=0</label></transition><transition><source ref="id9"/><target ref="id6"/><label kind="guard" x="72" y="-8">d&gt;0</label><label kind="assignment" x="72" y="8">Track:=A, 

d:=0</label></transition><transition><source ref="id7"/><target ref="id12"/><label kind="guard" x="-192" y="-200">d&gt;0</label><label kind="assignment" x="-192" y="-184">Track:=A,  d:=0</label></transition><transition><source ref="id9"/><target ref="id8"/><label kind="guard" x="-104" y="8">d&gt;0</label><label kind="assignment" x="-112" y="40">Track:=E, 
d:=0</label></transition><transition><source ref="id11"/><target ref="id10"/><label kind="guard" x="-28" y="-226">d&gt;= rho</label><label kind="assignment" x="40" y="-224">Track:=Cr,
d:=0</label></transition><transition><source ref="id13"/><target ref="id12"/><label kind="guard" x="-216" y="-296">d&gt;0</label><label kind="assignment" x="-216" y="-280">Track:=A, 

d:=0</label></transition></template><template><name>A_OUT</name><location id="id15" x="-200" y="128"><label kind="invariant" x="-210" y="143">z&lt;=eps</label></location><location id="id16" x="-368" y="128"><label kind="invariant" x="-378" y="143">z&lt;=eps</label></location><location id="id17" x="-424" y="64"><committed/></location><location id="id18" x="-424" y="-80"><label kind="invariant" x="-488" y="-72">z&lt;=eps</label></location><location id="id19" x="-200" y="-32"><label kind="invariant" x="-192" y="-16">z&lt;=eps</label></location><location id="id20" x="-312" y="-80"><label kind="invariant" x="-296" y="-96">z&lt;=eps</label></location><location id="id21" x="-256" y="-136"><label kind="invariant" x="-266" y="-121">z&lt;=eps</label></location><location id="id22" x="-200" y="-192"><committed/></location><location id="id23" x="-200" y="-320"><label kind="invariant" x="-192" y="-304">z&lt;=eps</label></location><location id="id24" x="-368" y="-320"><label kind="invariant" x="-400" y="-304">z&lt;=eps</label></location><location id="id25" x="-424" y="-384"><committed/></location><init ref="id25"/><transition><source ref="id15"/><target ref="id25"/><label kind="guard" x="-56" y="-112">T_P==E</label><label kind="assignment" x="-56" y="-88">y:=0,z:=0,Ctrl_g:=O</label><nail x="-64" y="128"/><nail x="-64" y="-416"/><nail x="-400" y="-416"/></transition><transition><source ref="id15"/><target ref="id17"/><label kind="guard" x="-320" y="48">T_P!=E</label><label kind="assignment" x="-320" y="64">z:=0</label><nail x="-256" y="64"/></transition><transition><source ref="id16"/><target ref="id15"/><label kind="guard" x="-328" y="104">x&gt;0 &amp;&amp; z&gt;0</label><label kind="assignment" x="-344" y="128">T_P:=Sensor_Track</label></transition><transition><source ref="id17"/><target ref="id16"/><label kind="synchronisation" x="-392" y="80">act!</label></transition><transition><source ref="id18"/><target ref="id17"/><label kind="guard" x="-480" y="-32">T_P!=E</label><label kind="assignment" x="-568" y="0">y:=0,z:=0,Ctrl_g:=Cl</label></transition><transition><source ref="id20"/><target ref="id18"/><label kind="guard" x="-392" y="-72">T_P==E</label><nail x="-368" y="-72"/></transition><transition><source ref="id18"/><target ref="id25"/><label kind="guard" x="-484" y="-262">T_P==E</label><label kind="assignment" x="-568" y="-232">y:=0,z:=0,Ctrl_g:=O</label></transition><transition><source ref="id20"/><target ref="id18"/><label kind="guard" x="-392" y="-112">y&gt;kappa</label><nail x="-368" y="-88"/></transition><transition><source ref="id19"/><target ref="id22"/><label kind="assignment" x="-192" y="-112">z:=0</label></transition><transition><source ref="id20"/><target ref="id19"/><label kind="guard" x="-312" y="-56">y&lt;=kappa 
&amp;&amp; T_P!=E</label></transition><transition><source ref="id21"/><target ref="id20"/><label kind="guard" x="-304" y="-144">x&gt;0 &amp;&amp; z&gt;0</label><label kind="assignment" x="-408" y="-128">T_P:=Sensor_Track</label></transition><transition><source ref="id22"/><target ref="id21"/><label kind="synchronisation" x="-264" y="-184">act!</label></transition><transition><source ref="id23"/><target ref="id22"/><label kind="guard" x="-260" y="-286">T_P!=E</label><label kind="assignment" x="-192" y="-256">y:=0,z:=0,
Ctrl_g:=O</label></transition><transition><source ref="id23"/><target ref="id25"/><label kind="guard" x="-320" y="-400">T_P==E</label><label kind="assignment" x="-320" y="-384">z:=0</label><nail x="-256" y="-384"/><nail x="-408" y="-384"/></transition><transition><source ref="id24"/><target ref="id23"/><label kind="guard" x="-344" y="-344">x&gt;0 &amp;&amp; z&gt;0</label><label kind="assignment" x="-344" y="-320">T_P:=Sensor_Track</label></transition><transition><source ref="id25"/><target ref="id24"/><label kind="synchronisation" x="-392" y="-368">act!</label></transition></template><template><name>CD_S</name><location id="id26" x="-48" y="-368"><name x="-58" y="-398">q_bad</name></location><location id="id27" x="-240" y="-368"></location><location id="id28" x="-432" y="-368"></location><init ref="id28"/><transition><source ref="id27"/><target ref="id28"/><label kind="guard" x="-376" y="-288">g==Cl
&amp;&amp; c==0</label><label kind="synchronisation" x="-376" y="-304">step?</label><nail x="-304" y="-288"/><nail x="-384" y="-288"/></transition><transition><source ref="id27"/><target ref="id26"/><label kind="guard" x="-216" y="-368">Track==Cr &amp;&amp; g!=Cl
&amp;&amp; c&gt;0</label></transition><transition><source ref="id27"/><target ref="id27"/><label kind="guard" x="-280" y="-480">Track==Cr &amp;&amp; g!=Cl
&amp;&amp; c==0</label><label kind="synchronisation" x="-264" y="-448">step?</label><nail x="-232" y="-376"/><nail x="-192" y="-448"/><nail x="-288" y="-448"/></transition><transition><source ref="id27"/><target ref="id28"/><label kind="guard" x="-376" y="-352">c==0 &amp;&amp; 
Track!=Cr</label><label kind="synchronisation" x="-376" y="-368">step?</label><nail x="-304" y="-352"/><nail x="-384" y="-352"/></transition><transition><source ref="id28"/><target ref="id27"/><label kind="guard" x="-376" y="-424">Track==Cr 
&amp;&amp; g!=Cl</label><label kind="synchronisation" x="-376" y="-392">step?</label><label kind="assignment" x="-328" y="-392">c:=0</label><nail x="-384" y="-392"/><nail x="-304" y="-392"/></transition><transition><source ref="id28"/><target ref="id28"/><label kind="guard" x="-456" y="-288">g==Cl</label><label kind="synchronisation" x="-448" y="-304">step?</label><nail x="-464" y="-288"/><nail x="-400" y="-288"/></transition><transition><source ref="id28"/><target ref="id28"/><label kind="guard" x="-464" y="-472">Track!=Cr</label><label kind="synchronisation" x="-448" y="-448">step?</label><nail x="-400" y="-448"/><nail x="-464" y="-448"/></transition></template><template><name>Actuator</name><location id="id29" x="-288" y="-448"><committed/></location><location id="id30" x="-416" y="-160"><committed/></location><location id="id31" x="-288" y="-160"><label kind="invariant" x="-264" y="-168">a&lt;=alpha1</label></location><location id="id32" x="-192" y="-256"></location><location id="id33" x="-416" y="-448"><label kind="invariant" x="-504" y="-464">a&lt;=alpha1</label></location><location id="id34" x="-512" y="-352"></location><init ref="id34"/><transition><source ref="id33"/><target ref="id31"/><label kind="guard" x="-408" y="-296">Ctrl_g==O</label><label kind="synchronisation" x="-376" y="-280">act?</label><label kind="assignment" x="-412" y="-304">a:=0</label><nail x="-416" y="-320"/></transition><transition><source ref="id31"/><target ref="id33"/><label kind="guard" x="-360" y="-368">Ctrl_g==Cl</label><label kind="synchronisation" x="-320" y="-344">act?</label><label kind="assignment" x="-412" y="-304">a:=0</label><nail x="-288" y="-288"/></transition><transition><source ref="id31"/><target ref="id31"/><label kind="guard" x="-320" y="-64">Ctrl_g==O</label><label kind="synchronisation" x="-296" y="-88">act?</label><nail x="-312" y="-96"/><nail x="-256" y="-96"/></transition><transition><source ref="id30"/><target ref="id34"/><label kind="synchronisation" x="-448" y="-264">plant!</label></transition><transition><source ref="id29"/><target ref="id32"/><label kind="synchronisation" x="-216" y="-368">plant!</label></transition><transition><source ref="id33"/><target ref="id29"/><label kind="assignment" x="-392" y="-440">Act_g:=Cl</label></transition><transition><source ref="id34"/><target ref="id33"/><label kind="guard" x="-528" y="-424">Ctrl_g==Cl</label><label kind="synchronisation" x="-504" y="-408">act?</label><label kind="assignment" x="-464" y="-400">a:=0</label></transition><transition><source ref="id31"/><target ref="id30"/><label kind="assignment" x="-376" y="-152">Act_g:=O</label></transition><transition><source ref="id32"/><target ref="id31"/><label kind="guard" x="-240" y="-208">Ctrl_g==O</label><label kind="synchronisation" x="-216" y="-224">act?</label><label kind="assignment" x="-256" y="-192">a:=0</label></transition><transition><source ref="id32"/><target ref="id32"/><label kind="guard" x="-120" y="-272">Ctrl_g==Cl</label><label kind="synchronisation" x="-120" y="-256">act?</label><nail x="-128" y="-288"/><nail x="-128" y="-224"/></transition><transition><source ref="id33"/><target ref="id33"/><label kind="guard" x="-440" y="-544">Ctrl_g==Cl</label><label kind="synchronisation" x="-440" y="-528">act?</label><nail x="-384" y="-512"/><nail x="-448" y="-512"/></transition><transition><source ref="id34"/><target ref="id34"/><label kind="guard" x="-656" y="-376">Ctrl_g==O</label><label kind="synchronisation" x="-616" y="-360">act?</label><nail x="-576" y="-384"/><nail x="-576" y="-320"/></transition></template><template><name>Sensor</name><location id="id35" x="-416" y="-544"><label kind="invariant" x="-448" y="-528">s&lt;=beta</label></location><location id="id36" x="-672" y="-544"></location><init ref="id36"/><transition><source ref="id35"/><target ref="id35"/><label kind="synchronisation" x="-312" y="-528">sens?</label><label kind="assignment" x="-312" y="-568">Next_Sensor_Track:=Track,
s:=0</label><nail x="-320" y="-480"/><nail x="-320" y="-608"/></transition><transition><source ref="id35"/><target ref="id36"/><label kind="assignment" x="-664" y="-600">Sensor_Track:=Next_Sensor_Track</label><nail x="-544" y="-576"/></transition><transition><source ref="id36"/><target ref="id35"/><label kind="synchronisation" x="-648" y="-520">sens?</label><label kind="assignment" x="-648" y="-504">Next_Sensor_Track:=Track,
s:=0</label><nail x="-544" y="-512"/></transition></template><template><name>A_IN2</name><location id="id37" x="-512" y="-256"><committed/></location><location id="id38" x="-416" y="-160"><label kind="invariant" x="-504" y="-168">b&lt;=alpha2</label></location><location id="id39" x="-288" y="-160"><committed/></location><location id="id40" x="-192" y="-256"></location><location id="id41" x="-192" y="-352"><committed/></location><location id="id42" x="-288" y="-448"><label kind="invariant" x="-264" y="-464">b&lt;=alpha2</label></location><location id="id43" x="-512" y="-352"></location><location id="id44" x="-416" y="-448"><committed/></location><init ref="id43"/><transition><source ref="id38"/><target ref="id44"/><label kind="guard" x="-408" y="-272">Act_g==Cl</label><label kind="synchronisation" x="-408" y="-256">plant?</label><label kind="assignment" x="-408" y="-240">b:=0</label></transition><transition><source ref="id42"/><target ref="id39"/><label kind="guard" x="-368" y="-344">Act_g==O</label><label kind="synchronisation" x="-336" y="-328">plant?</label><label kind="assignment" x="-328" y="-312">b:=0</label></transition><transition><source ref="id37"/><target ref="id43"/><label kind="synchronisation" x="-504" y="-312">step!</label></transition><transition><source ref="id38"/><target ref="id38"/><label kind="guard" x="-440" y="-88">Act_g==O</label><label kind="synchronisation" x="-440" y="-72">plant?</label><nail x="-448" y="-96"/><nail x="-384" y="-96"/></transition><transition><source ref="id38"/><target ref="id37"/><label kind="assignment" x="-496" y="-208">g:=O</label></transition><transition><source ref="id39"/><target ref="id38"/><label kind="synchronisation" x="-368" y="-184">step!</label></transition><transition><source ref="id40"/><target ref="id39"/><label kind="guard" x="-240" y="-208">Act_g==O</label><label kind="synchronisation" x="-216" y="-224">act?</label><label kind="assignment" x="-256" y="-192">g:=Somewhere,
b:=0</label></transition><transition><source ref="id40"/><target ref="id40"/><label kind="guard" x="-120" y="-272">Act_g==Cl</label><label kind="synchronisation" x="-120" y="-256">plant?</label><nail x="-128" y="-288"/><nail x="-128" y="-224"/></transition><transition><source ref="id41"/><target ref="id40"/><label kind="synchronisation" x="-232" y="-312">step!</label></transition><transition><source ref="id42"/><target ref="id41"/><label kind="assignment" x="-232" y="-416">g:=Cl</label></transition><transition><source ref="id42"/><target ref="id42"/><label kind="guard" x="-312" y="-544">Act_g==Cl</label><label kind="synchronisation" x="-312" y="-528">plant?</label><nail x="-256" y="-512"/><nail x="-320" y="-512"/></transition><transition><source ref="id44"/><target ref="id42"/><label kind="synchronisation" x="-368" y="-440">step!</label></transition><transition><source ref="id43"/><target ref="id43"/><label kind="guard" x="-656" y="-376">Act_g==O</label><label kind="synchronisation" x="-616" y="-360">plant?</label><nail x="-576" y="-384"/><nail x="-576" y="-320"/></transition><transition><source ref="id43"/><target ref="id44"/><label kind="guard" x="-528" y="-464">Act_g==Cl</label><label kind="synchronisation" x="-480" y="-440">plant?</label><label kind="assignment" x="-560" y="-424">g:=Somewhere,
b:=0</label></transition></template><instantiation>//Insert process assignments.
</instantiation><system>//Edit system definition.
system A_IN, A_IN2, Sensor, A_OUT, Actuator, CD_S;</system></nta>