<?xml version="1.0" encoding="UTF-8"?>
<net name="SyncMtrs" type="iopt-flow">
  <component id="c1" class="timers/SysTime.xml" x="630" y="260" width="110" height="60" rot="0" implementation="iopt-flow" target="external">
    <name off_x="-55" off_y="-35" text="SystemTime0"/>
    <source_model file="files/SysTime.xml"/>
    <input id="c1.Upd" name="Upd" type="event" off_x="-55" off_y="-10" microstep="1" nano-step="0"/>
    <output id="c1.Sec" name="Sec" off_x="55" off_y="-10" type="range" min="0" max="2147483647" microstep="1" nano-step="1"/>
    <output id="c1.uSec" name="uSec" off_x="55" off_y="10" type="range" min="0" max="999999" microstep="1" nano-step="1"/>
  </component>
  <place id="p001" x="460" y="40" init_marking="1">
    <name off_x="-10" off_y="-10" text="PStart"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <transition id="t002" x="460" y="130" priority="0" microstep="0">
    <name off_x="-10" off_y="-10" text="TSync"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <place id="p003" x="460" y="260" init_marking="0">
    <name off_x="-10" off_y="-10" text="PWait2"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <arc id="a004" type="normal" source="p001" target="t002"/>
  <arc id="a005" type="normal" source="t002" target="p003"/>
  <arc id="a015" type="read" source="t002" target="c007.SyncPos"/>
  <arc id="a016" type="read" source="t002" target="c008.SyncPos"/>
  <arc id="a017" type="read" source="t002" target="c009.SyncPos"/>
  <signal id="Speed" x="75" y="65" mode="input" type="range" min="0" max="3000" frac="0" value="0" dynamic="none" microstep="0" nano-step="0"/>
  <signal id="MasterRefPos" x="295" y="75" mode="internal" type="boolean" min="0" max="1" microstep="0" nano-step="1"/>
  <operation id="o021" x="185" y="75" rot="0" shape="arrow" size="24">
    <name off_x="-19" off_y="-24" text="o021"/>
    <input off_x="-24" off_y="-8" name="Speed" id="o021.Speed" type="range" min="0" max="3000" dynamic="all" frac="0"/>
    <input off_x="-24" off_y="8" name="RefPos" id="o021.RefPos" type="boolean" min="0" max="1" dynamic="all"/>
    <output off_x="24" off_y="0" name="out" id="o021.out" type="range" min="0" max="3000" dynamic="type" frac="0" microstep="0" nano-step="1">
      <expression>
        <operand type="sub-expression">
          <operand type="signal" idRef="RefPos" delay="1"/>
          <operator type="add"/>
          <operand type="signal" idRef="Speed"/>
          <operator type="mul"/>
          <operand type="literal" value="3600"/>
          <operator type="div"/>
          <operand type="sub-expression">
            <operand type="literal" value="60"/>
            <operator type="mul"/>
            <operand type="literal" value="1000"/>
          </operand>
        </operand>
        <operator type="mod"/>
        <operand type="literal" value="3600"/>
        <text>(RefPos[-1] + Speed * 3600 / (60 * 1000)) MOD 3600</text>
      </expression>
    </output>
    <comment text="Convert RPM to 1ms displacement" off_x="0" off_y="20"/>
  </operation>
  <arc id="a022" type="read" source="Speed" target="o021.Speed"/>
  <arc id="a023" type="read" source="o021.out" target="MasterRefPos"/>
  <arc id="a024" type="read" source="MasterRefPos" target="o021.RefPos" view="symbolic"/>
  <arc id="a025" type="read" source="Speed" target="c007.Speed" view="symbolic"/>
  <arc id="a026" type="read" source="Speed" target="c008.Speed" view="symbolic"/>
  <arc id="a027" type="read" source="Speed" target="c009.Speed" view="symbolic"/>
  <arc id="a028" type="read" source="MasterRefPos" target="c007.Pos" view="symbolic"/>
  <arc id="a029" type="read" source="MasterRefPos" target="c008.Pos" view="symbolic"/>
  <arc id="a030" type="read" source="MasterRefPos" target="c009.Pos" view="symbolic"/>
  <transition id="t039" x="460" y="500" priority="0">
    <name off_x="-10" off_y="-10" text="TAllDone"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <place id="p042" x="460" y="580" init_marking="0">
    <name off_x="-10" off_y="-10" text="PAllDone"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <arc id="a043" type="normal" source="t039" target="p042"/>
  <place id="p044" x="395" y="260" init_marking="0">
    <name off_x="-10" off_y="-10" text="PWait1"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <place id="p045" x="525" y="260" init_marking="0">
    <name off_x="-10" off_y="-10" text="PWait3"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <arc id="a046" type="normal" source="t002" target="p044"/>
  <arc id="a047" type="normal" source="t002" target="p045"/>
  <transition id="t048" x="395" y="350" priority="0">
    <name off_x="-10" off_y="-10" text="TAck1"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <transition id="t049" x="460" y="340" priority="0">
    <name off_x="-10" off_y="-10" text="TAck2"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <transition id="t050" x="525" y="330" priority="0">
    <name off_x="-10" off_y="-10" text="TAck3"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <place id="p051" x="395" y="420" init_marking="0">
    <name off_x="-10" off_y="-10" text="PDone1"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <place id="p052" x="525" y="420" init_marking="0">
    <name off_x="-10" off_y="-10" text="PDone3"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <place id="p053" x="460" y="420" init_marking="0">
    <name off_x="-10" off_y="-10" text="PDone2"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <arc id="a054" type="normal" source="p044" target="t048"/>
  <arc id="a055" type="normal" source="p003" target="t049"/>
  <arc id="a056" type="normal" source="p045" target="t050"/>
  <arc id="a057" type="read" source="c007.Ack" target="t048" view="symbolic"/>
  <arc id="a058" type="read" source="c008.Ack" target="t049" view="symbolic"/>
  <arc id="a059" type="read" source="c009.Ack" target="t050" view="symbolic"/>
  <arc id="a060" type="normal" source="t048" target="p051"/>
  <arc id="a061" type="normal" source="t049" target="p053"/>
  <arc id="a062" type="normal" source="t050" target="p052"/>
  <arc id="a063" type="normal" source="p051" target="t039"/>
  <arc id="a064" type="normal" source="p053" target="t039"/>
  <arc id="a065" type="normal" source="p052" target="t039"/>
  <transition id="t066" x="300" y="305" priority="0">
    <name off_x="-10" off_y="-10" text="TRepeat"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <arc id="a068" type="normal" source="p042" target="t066" c2_x="0" c2_y="105" c1_x="0" c1_y="0"/>
  <arc id="a069" type="normal" source="t066" target="p001" c2_x="-95" c2_y="55" c1_x="0" c1_y="0"/>
  <operation id="o071" x="55" y="325" constant="5000" rot="0" shape="rect" size="20" locked="true">
    <name off_x="-15" off_y="-5" text="5000"/>
    <output off_x="20" off_y="0" name="K" id="o071.K" type="range" min="5000" max="5000" dynamic="none">
      <expression>
        <text>5000</text>
        <operand type="literal" value="5000"/>
      </expression>
    </output>
  </operation>
  <component id="c074" class="local/ClkDiv.xml" x="200" y="315" width="110" height="60" rot="0" implementation="iopt-flow" target="default">
    <name off_x="-55" off_y="-35" text="ClkDiv_5Sec"/>
    <source_model file="files/ClkDiv.xml"/>
    <input id="c074.ClkIn" name="ClkIn" type="event" off_x="-55" off_y="-10"/>
    <input id="c074.Div" name="Div" off_x="-55" off_y="10" type="range" min="1" max="32767"/>
    <output id="c074.ClkOut" name="ClkOut" type="event" off_x="55" off_y="-10"/>
  </component>
  <arc id="a075" type="read" source="c074.ClkOut" target="t066"/>
  <arc id="a076" type="read" source="o071.K" target="c074.Div"/>
  <operation id="o077" x="105" y="305" constant="1" rot="0" shape="rect" size="20" locked="true">
    <name off_x="-15" off_y="-5" text="1"/>
    <output off_x="20" off_y="0" name="K" id="o077.K" type="event" min="0" max="1" dynamic="none" frac="0">
      <expression>
        <text>1</text>
        <operand type="literal" value="1"/>
      </expression>
    </output>
  </operation>
  <arc id="a078" type="read" source="o077.K" target="c074.ClkIn"/>
  <component id="c007" class="local/MtrCtrl.xml" x="960" y="90" width="140" height="120" rot="0" implementation="iopt-flow" target="distributed" res_location="node1">
    <name off_x="-70" off_y="-65" text="Mtr1"/>
    <source_model file="files/MtrCtrl.xml"/>
    <input id="c007.SyncPos" name="SyncPos" type="event" off_x="-70" off_y="-40"/>
    <input id="c007.Pos" name="Pos" off_x="-70" off_y="-20" type="range" min="0" max="3599"/>
    <input id="c007.Speed" name="Speed" off_x="-70" off_y="0" type="boolean"/>
    <input id="c007.Sec" name="Sec" off_x="-70" off_y="20" type="range" min="0" max="2147483647"/>
    <input id="c007.uSec" name="uSec" off_x="-70" off_y="40" type="range" min="0" max="999999"/>
    <output id="c007.Ack" name="Ack" type="event" off_x="70" off_y="-40"/>
    <output id="c007.RefPos" name="RefPos" off_x="70" off_y="-20" type="range" min="0" max="3599"/>
  </component>
  <component id="c008" class="local/MtrCtrl.xml" x="960" y="230" width="140" height="120" rot="0" implementation="iopt-flow" target="distributed" res_location="node2">
    <name off_x="-70" off_y="-65" text="Mtr2"/>
    <source_model file="files/MtrCtrl.xml"/>
    <input id="c008.SyncPos" name="SyncPos" type="event" off_x="-70" off_y="-40"/>
    <input id="c008.Pos" name="Pos" off_x="-70" off_y="-20" type="range" min="0" max="3599"/>
    <input id="c008.Speed" name="Speed" off_x="-70" off_y="0" type="boolean"/>
    <input id="c008.Sec" name="Sec" off_x="-70" off_y="20" type="range" min="0" max="2147483647"/>
    <input id="c008.uSec" name="uSec" off_x="-70" off_y="40" type="range" min="0" max="999999"/>
    <output id="c008.Ack" name="Ack" type="event" off_x="70" off_y="-40"/>
    <output id="c008.RefPos" name="RefPos" off_x="70" off_y="-20" type="range" min="0" max="3599"/>
  </component>
  <component id="c009" class="local/MtrCtrl.xml" x="960" y="365" width="140" height="120" rot="0" implementation="iopt-flow" target="distributed" res_location="node3">
    <name off_x="-70" off_y="-65" text="Mtr3"/>
    <source_model file="files/MtrCtrl.xml"/>
    <input id="c009.SyncPos" name="SyncPos" type="event" off_x="-70" off_y="-40"/>
    <input id="c009.Pos" name="Pos" off_x="-70" off_y="-20" type="range" min="0" max="3599"/>
    <input id="c009.Speed" name="Speed" off_x="-70" off_y="0" type="boolean"/>
    <input id="c009.Sec" name="Sec" off_x="-70" off_y="20" type="range" min="0" max="2147483647"/>
    <input id="c009.uSec" name="uSec" off_x="-70" off_y="40" type="range" min="0" max="999999"/>
    <output id="c009.Ack" name="Ack" type="event" off_x="70" off_y="-40"/>
    <output id="c009.RefPos" name="RefPos" off_x="70" off_y="-20" type="range" min="0" max="3599"/>
  </component>
  <arc id="a034" type="read" source="t002" target="c1.Upd"/>
  <arc id="a035" type="read" source="c1.Sec" target="c007.Sec"/>
  <arc id="a036" type="read" source="c1.uSec" target="c007.uSec"/>
  <arc id="a037" type="read" source="c1.uSec" target="c009.uSec"/>
  <arc id="a038" type="read" source="c1.uSec" target="c008.uSec"/>
  <arc id="a039" type="read" source="c1.Sec" target="c008.Sec"/>
  <arc id="a040" type="read" source="c1.Sec" target="c009.Sec"/>
</net>
