<?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_1.dtd'><nta><declaration>chan approach, leave, up, down;</declaration><template><name x="0" y="8">Train</name><declaration>clock x;</declaration><location id="id0" x="384" y="384"><name x="352" y="400">At_crossing</name><label kind="invariant" x="408" y="376">x &lt;= 60</label></location><location id="id1" x="384" y="160"><name x="376" y="120">Nearby</name><label kind="invariant" x="416" y="152">x &lt;= 60</label></location><location id="id2" x="160" y="160"><name x="144" y="120">Far</name></location><location id="id3" x="160" y="384"><name x="128" y="400">Passed</name><label kind="invariant" x="96" y="376">x &lt;= 60</label></location><init ref="id2"/><transition><source ref="id2"/><target ref="id1"/><label kind="synchronisation" x="224" y="136">approach!</label><label kind="assignment" x="224" y="168">x := 0</label></transition><transition><source ref="id1"/><target ref="id0"/><label kind="guard" x="400" y="272">x &gt; 16</label></transition><transition><source ref="id0"/><target ref="id3"/></transition><transition><source ref="id3"/><target ref="id2"/><label kind="synchronisation" x="104" y="256">leave!</label><label kind="assignment" x="100" y="272">x:=0</label></transition></template><template><name x="5" y="5">Barrier</name><declaration>clock y;</declaration><location id="id4" x="128" y="160"><name x="104" y="120">Open</name></location><location id="id5" x="352" y="160"><name x="304" y="120">Closing</name><label kind="invariant" x="376" y="160">y &lt;= 15</label></location><location id="id6" x="352" y="384"><name x="336" y="408">Closed</name></location><location id="id7" x="128" y="384"><name x="64" y="408">Opening</name><label kind="invariant" x="32" y="376">y &lt;= 20</label></location><init ref="id4"/><transition><source ref="id7"/><target ref="id5"/><label kind="synchronisation" x="248" y="304">down?</label><label kind="assignment" x="248" y="320">y:=0</label><nail x="248" y="304"/></transition><transition><source ref="id5"/><target ref="id7"/><label kind="synchronisation" x="180" y="257">up?</label><label kind="assignment" x="180" y="272">y:=0</label><nail x="208" y="280"/></transition><transition><source ref="id7"/><target ref="id7"/><label kind="synchronisation" x="144" y="440">up?</label><nail x="120" y="448"/><nail x="152" y="440"/></transition><transition><source ref="id6"/><target ref="id6"/><label kind="synchronisation" x="408" y="368">down?</label><nail x="408" y="360"/><nail x="408" y="400"/></transition><transition><source ref="id5"/><target ref="id5"/><label kind="synchronisation" x="424" y="128">down?</label><nail x="416" y="128"/><nail x="416" y="160"/></transition><transition><source ref="id4"/><target ref="id4"/><label kind="synchronisation" x="32" y="144">up?</label><nail x="64" y="160"/><nail x="64" y="128"/></transition><transition><source ref="id4"/><target ref="id5"/><label kind="synchronisation" x="184" y="136">down?</label><label kind="assignment" x="184" y="168">y := 0</label></transition><transition><source ref="id5"/><target ref="id6"/></transition><transition><source ref="id6"/><target ref="id7"/><label kind="synchronisation" x="208" y="360">up?</label><label kind="assignment" x="208" y="400">y := 0</label></transition><transition><source ref="id7"/><target ref="id4"/><label kind="guard" x="56" y="240">y &gt; 10</label></transition></template><template><name x="5" y="5">Controller</name><declaration>clock z;
int trains = 0;</declaration><location id="id8" x="512" y="320"><name x="528" y="312">close_barrier</name><label kind="invariant" x="528" y="296">z &lt;= 1</label></location><location id="id9" x="96" y="320"><name x="8" y="328">open_barrier</name><label kind="invariant" x="8" y="312">z &lt;= 1</label></location><location id="id10" x="288" y="128"><name x="272" y="96">Rest</name></location><init ref="id10"/><transition><source ref="id9"/><target ref="id10"/><label kind="guard" x="168" y="200">trains&gt;0</label></transition><transition><source ref="id8"/><target ref="id8"/><label kind="synchronisation" x="552" y="344">approach?</label><label kind="assignment" x="552" y="360">trains++</label><nail x="528" y="384"/><nail x="544" y="368"/></transition><transition><source ref="id8"/><target ref="id8"/><label kind="synchronisation" x="432" y="376">leave?</label><label kind="assignment" x="432" y="392">trains--</label><nail x="448" y="360"/><nail x="472" y="376"/></transition><transition><source ref="id9"/><target ref="id9"/><label kind="synchronisation" x="104" y="392">leave?</label><label kind="assignment" x="104" y="408">trains--</label><nail x="160" y="352"/><nail x="144" y="392"/></transition><transition><source ref="id9"/><target ref="id8"/><label kind="synchronisation" x="200" y="296">approach?</label><label kind="assignment" x="200" y="320">trains++</label></transition><transition><source ref="id10"/><target ref="id9"/><label kind="synchronisation" x="96" y="160">leave?</label><label kind="assignment" x="96" y="184">z := 0,
trains--</label><nail x="160" y="192"/></transition><transition><source ref="id9"/><target ref="id10"/><label kind="guard" x="200" y="240">trains==0</label><label kind="synchronisation" x="200" y="256">up!</label><nail x="224" y="224"/></transition><transition><source ref="id10"/><target ref="id8"/><label kind="synchronisation" x="432" y="144">approach?</label><label kind="assignment" x="432" y="160">z := 0, trains++</label><nail x="416" y="160"/></transition><transition><source ref="id8"/><target ref="id10"/><label kind="guard" x="328" y="240">z == 1</label><label kind="synchronisation" x="336" y="256">down!</label><nail x="352" y="224"/></transition></template><system>Train1 = Train();
Train2 = Train();

system Train1, Train2, Barrier, Controller;</system></nta>