<?xml version="1.0" encoding="UTF-8"?>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Small XML example						   -->
<!-- 								   -->
<!-- Constructed to have conflicting synchronization               -->
<!-- 								   -->
<!-- Synopsis:							   -->
<!--  hierarchical uppaal					   -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- @TABLE OF CONTENTS:		 [TOCD: 15:23 09 Apr 2001] -->
<!--								   -->
<!--  [1] TOPMOST COMPONENT					   -->
<!--  [2] SUBCOMPONENT (AND)					   -->
<!--  [3] SUB-SUB component 1. (send part)			   -->
<!--  [4] SUB-SUB component 2. (receive part)			   -->
<!--  [5] Sync Dummy (that can receive a in parallel)		   -->
<!--  [6] SYSTEM						   -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	   -->
<!-- @FILE:    conflict.xml   		   		           -->
<!-- @PLACE:   BRICS AArhus; host:harald			   -->
<!-- @FORMAT:  XML						   -->
<!-- @AUTHOR:  M. Oliver M'o'ller     <omoeller@brics.dk>	   -->
<!-- @BEGUN:   Mon Apr  9 14:50:08 2001				   -->
<!-- @VERSION: Mon Apr  9 15:23:14 2001				   -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<!DOCTYPE hta  SYSTEM "http://www.brics.dk/~omoeller/hta/xml/huppaal-0.6.dtd">
<hta>
  <declaration>
int    flag;
int    test;
clock  x;

urgent chan aa; // just testing
 //urgent chan a; // just testing

chan a;

  </declaration>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<!-- [1] TOPMOST COMPONENT					       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->

<template type="XOR" >
      <name x="0" y="16">Main</name>
      <parameter x="125" y="16"></parameter>
    <!-- local variables -->
      <declaration></declaration>
    <!-- declare the entries/exits -->
      <entry id="Main-entry" x="0" y="0" >
           <name x="0" y="16">entry</name>
           <connection>
                <target ref="Main-initial" />
           </connection>
      </entry>
    <!-- declare the locations -->
    <location id="Main-initial" x="1632" y="280">
      <name x="1622" y="250">s1</name>
      <label kind="invariant" x="1622" y="295" />
    </location>
    <!-- non-atomic locations (components) -->
    <component instantiates="Sub" id="sub-instantiation" >
        <name x="1622" y="250">subComponent</name>
        <label kind="invariant"></label>
    </component>
    <!-- declare the transitions                     -->
    <transition>
      <source ref="Main-initial" />
      <target ref="sub-instantiation"
              entryref="Sub-entry-1" />
       <label kind="guard"  x="1316" y="1594"></label>
       <label kind="synchronisation"  x="1392" y="1600" />
       <label kind="assignment"  x="1312" y="1600">flag := 0</label>
    </transition>
    <!-- transition FROM the composite state --> 
    <transition>
       <source ref="sub-instantiation"
               exitref="Sub-exit-1" />
       <target ref="Main-initial" />
                <label kind="guard" ></label>
                <label kind="synchronisation">a!</label>
    </transition>

</template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<!-- [2] SUBCOMPONENT (AND)					       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->

<template type="AND" >
      <name x="0" y="16">Sub</name>
      <parameter x="125" y="16"></parameter>
    <!-- local variables -->
      <declaration></declaration>
    <!-- declare the entries -->
      <entry id="Sub-entry-1" x="0" y="0" >
           <name x="0" y="16">Sub-entry-1</name>
           <connection>
              <target ref="Sub-fork-1" />
              <label kind="guard" >test == 0</label> 
              <label kind="assignment" >test := 0</label>       
            </connection>
      </entry>
    <!-- declare the forks -->
    <fork id="Sub-fork-1"
          x="0" y="16">
          <name>Sub-fork-1</name>
           <connection>
                <target ref="P-instantiation-1" entryref="P-entry-1" />
           </connection>
           <connection>
                <target ref="Q-instantiation-2" entryref="Q-entry-1" />
           </connection>
    </fork>
    <!-- declare the exits -->
    <exit id="Sub-exit-1" x="0" y="0" >
           <name x="0" y="16">Sub-exit-1</name>
           <connection>
              <source ref="Sub-join-1" />
           </connection>
     </exit>
    <!-- declare the joins -->
    <join id="Sub-join-1"
            x="0" y="16">
          <name>Sub-join-1</name>
           <connection>
               <source ref="P-instantiation-1"
                       exitref="P-exit-1" />
           </connection>
           <connection>
               <source ref="Q-instantiation-2"
                       exitref="P-exit-1" />
           </connection>
    </join>
    <!-- declare the locations: None -->
    <!-- non-atomic locations (components) -->
    <component instantiates="P" id="P-instantiation-1" >
        <name x="1622" y="250">parallel-P-1</name>
        <label kind="invariant">x &lt; 1000</label>
    </component>
    <component instantiates="Q" id="Q-instantiation-2" >
        <name x="1622" y="250">parallel-Q-2</name>
    </component>
    <!-- declare the transitions: none -->
</template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<!-- [3] SUB-SUB component 1. (send part)			       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<template type="XOR" >
      <name x="0" y="16">P</name>
      <parameter x="125" y="16"></parameter>
    <!-- local variables -->
      <declaration></declaration>
    <!-- declare the entries/exits -->
      <entry id="P-entry-1" x="0" y="0" >
           <name x="0" y="16">entry</name>
           <connection>
               <target ref="P-s1" />
           </connection>
      </entry>
      <exit id="P-exit-1" x="0" y="0" type="default-exit">
           <name x="0" y="16">entry</name>
           <!-- exit connection -->
           <connection>
                <source ref="P-s2" />
                <label kind="guard"  x="1316" y="1594" />
           </connection>
           <!-- additional connection to test growth of joins 
           <connection>
                <source ref="P-s1" />
                <label kind="guard"  x="1316" y="1594" />
           </connection>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
      </exit>
    <!-- declare the locations -->
    <location id="P-s1" x="1632" y="280">
      <name x="1622" y="250">s1</name>
      <label kind="invariant" x="1622" y="295" />
    </location>
    <location id="P-s2" x="1328" y="280">
      <name x="1318" y="250">s2</name>
      <label kind="invariant" x="1318" y="296" />
    </location>
    <!-- declare the transitions -->
    <transition>
      <source ref="P-s1" />
      <target ref="P-s2" />
      <label kind="guard"  x="1316" y="1594"></label> 
      <label kind="synchronisation"  x="1392" y="1600" >a!</label>
      <label kind="assignment"  x="1312" y="1600">flag := flag+1</label>
    </transition>
</template>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<!-- [4] SUB-SUB component 2. (receive part)			       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<template type="XOR" >
      <name x="0" y="16">Q</name>
      <parameter x="125" y="16"></parameter>
    <!-- local variables -->
      <declaration></declaration>
    <!-- declare the entries/exits -->
      <entry id="Q-entry-1" x="0" y="0" >
           <name x="0" y="16">entry</name>
           <connection>
               <target ref="Q-s1" />
           </connection>
      </entry>
      <exit id="Q-exit-1" x="0" y="0" type="default-exit">
      </exit>
    <!-- declare the locations -->
    <location id="Q-s1" x="1632" y="280">
      <name x="1622" y="250">s1</name>
      <label kind="invariant" x="1622" y="295" />
    </location>
    <location id="Q-s2" x="1328" y="280">
      <name x="1318" y="250">s2</name>
      <label kind="invariant" x="1318" y="296" />
    </location>
    <!-- declare the transitions -->
    <transition>
      <source ref="Q-s1" />
      <target ref="Q-s2" />
      <label kind="guard"  x="1316" y="1594"></label>
      <label kind="synchronisation"  x="1392" y="1600" >a?</label>
      <label kind="assignment"  x="1312" y="1600">flag := flag+1</label>
    </transition>
</template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<!-- [5] Sync Dummy (that can receive a in parallel)		       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->

<template type="XOR" >
      <name x="0" y="16">SyncDummy</name>
      <parameter x="125" y="16"></parameter>
    <!-- local variables -->
      <declaration></declaration>
    <!-- declare the entries/exits -->
      <entry id="SyncDummy-entry-1" x="0" y="0" >
           <name x="0" y="16">entry</name>
           <connection>
               <target ref="SyncDummy-s1" />
           </connection>
      </entry>
    <!-- declare the locations -->
    <location id="SyncDummy-s1" x="1632" y="280">
      <name x="1622" y="250">s1</name>
      <label kind="invariant" x="1622" y="295" />
    </location>
    <location id="SyncDummy-s2" x="1328" y="280">
      <name x="1318" y="250">s2</name>
      <label kind="invariant" x="1318" y="296" />
    </location>
    <!-- declare the transitions -->
    <transition>
      <source ref="SyncDummy-s1" />
      <target ref="SyncDummy-s2" />
      <label kind="guard"  x="1316" y="1594"></label>
      <label kind="synchronisation"  x="1392" y="1600" >a?</label>
      <label kind="assignment"  x="1312" y="1600">flag := flag+1</label>
    </transition>
</template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<!-- [6] SYSTEM							       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      -->
<instantiation>
  main := Main();
  syncDummy := SyncDummy();
 </instantiation>
 <system>system main, syncDummy;
 </system>
 <!-- declare the init points -->
 <globalinit instantiationname="main" ref="Main-entry" />
 <globalinit instantiationname="syncDummy" ref="SyncDummy-entry-1" />

</hta>

