<?xml version='1.0' encoding='UTF-8'?>
<simconf version="2022112801">
  <simulation>
    <title>First DODAG: selected next hop and packet proof</title>
    <randomseed>1</randomseed>
    <motedelay_us>1000000</motedelay_us>
    <radiomedium>
      org.contikios.cooja.radiomediums.UDGM
      <transmitting_range>50.0</transmitting_range>
      <interference_range>50.0</interference_range>
      <success_ratio_tx>1.0</success_ratio_tx>
      <success_ratio_rx>1.0</success_ratio_rx>
    </radiomedium>
    <events>
      <logoutput>40000</logoutput>
    </events>
    <motetype>
      org.contikios.cooja.contikimote.ContikiMoteType
      <description>Root 1</description>
      <source>[CONFIG_DIR]/firmware/udp-server.c</source>
      <commands>make TARGET=cooja clean
make -j4 udp-server.cooja TARGET=cooja</commands>
      <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="0" y="0" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>1</id>
        </interface_config>
      </mote>
    </motetype>
    <motetype>
      org.contikios.cooja.contikimote.ContikiMoteType
      <description>Clients 2-6</description>
      <source>[CONFIG_DIR]/firmware/udp-client.c</source>
      <commands>make TARGET=cooja clean
make -j4 udp-client.cooja TARGET=cooja</commands>
      <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="-30" y="25" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>2</id>
        </interface_config>
      </mote>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="30" y="25" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>3</id>
        </interface_config>
      </mote>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="-60" y="55" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>4</id>
        </interface_config>
      </mote>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="0" y="55" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>5</id>
        </interface_config>
      </mote>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="60" y="55" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>6</id>
        </interface_config>
      </mote>
    </motetype>
  </simulation>
  <plugin>org.contikios.cooja.plugins.Visualizer<plugin_config>
      <skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
      <skin>org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin</skin>
      <skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
      <skin>org.contikios.cooja.plugins.skins.GridVisualizerSkin</skin>
      <viewport>4.0 0.0 0.0 4.0 490.0 80.0</viewport>
      <moterelations />
    </plugin_config>
    <bounds x="0" y="0" width="1000" height="475" z="1" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.LogListener<plugin_config>
      <filter>Received request|Received response|#L</filter>
      <formatted_time />
      <coloring />
    </plugin_config>
    <bounds x="0" y="480" width="1580" height="430" z="0" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.Notes<plugin_config>
      <notes>Seed 1. UDGM 50 m transmit / 100 m interference.
Root 1; 4 and 6 require a relay. Duration 90 s.
Script runs ip-addr, routes, rpl-status and ping.
Compare the default route with real packet replies.
README preserves the prefix and traceroute worksheets.</notes>
      <decorations>true</decorations>
    </plugin_config>
    <bounds x="1005" y="0" width="575" height="215" z="3" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.ScriptRunner<plugin_config>
      <script>sources={}; replies={}; sent=0; received=0; parents={}; measurements={};
TIMEOUT(90000, log.log("SUMMARY duration_us="+sim.getSimulationTime()+" sent="+sent+" root_received="+received+" clients="+Object.keys(sources).length+" reply_clients="+Object.keys(replies).length+" parents="+JSON.stringify(parents)+" measurements="+JSON.stringify(measurements)+"\n"); if(Object.keys(sources).length==5 &amp;&amp; Object.keys(replies).length==5 &amp;&amp; measurements.neighborPing &amp;&amp; measurements.rootPing &amp;&amp; measurements.timeout &amp;&amp; measurements.route) log.testOK(); else log.testFailed());
GENERATE_MSG(60000, "EVENT addresses");
GENERATE_MSG(61000, "EVENT leaf-routes");
GENERATE_MSG(62000, "EVENT root-routes");
GENERATE_MSG(63000, "EVENT neighbors");
GENERATE_MSG(64000, "EVENT status");
GENERATE_MSG(65000, "EVENT next-hop-ping");
GENERATE_MSG(70000, "EVENT root-ping");
GENERATE_MSG(76000, "EVENT unreachable");
while(true) {
 YIELD(); msg=String(msg); log.log(time+" ID:"+id+" "+msg+"\n");
 if(msg.indexOf("Sending request")&gt;=0) sent++;
 if(id==1 &amp;&amp; msg.indexOf("Received request")&gt;=0) { received++; sources[msg.split(" from ")[1]]=true; }
 if(id!=1 &amp;&amp; msg.indexOf("Received response")&gt;=0) replies[id]=true;
 var match=msg.match(/#L (\d+) 1/); if(match) parents[id]=Number(match[1]);
 if(msg=="EVENT addresses") { write(sim.getMoteWithID(4),"ip-addr"); }
 if(msg=="EVENT leaf-routes") { write(sim.getMoteWithID(4),"routes"); }
 if(msg=="EVENT root-routes") { write(sim.getMoteWithID(1),"routes"); }
 if(msg=="EVENT neighbors") { write(sim.getMoteWithID(4),"rpl-nbr"); }
 if(msg=="EVENT status") { write(sim.getMoteWithID(4),"rpl-status"); }
 if(msg=="EVENT next-hop-ping") { write(sim.getMoteWithID(4),"ping fe80::202:2:2:2"); }
 if(msg=="EVENT root-ping") { write(sim.getMoteWithID(4),"ping fd00::201:1:1:1"); }
 if(msg=="EVENT unreachable") { write(sim.getMoteWithID(4),"ping fd00::299:99:99:99"); }
if(id==4 &amp;&amp; msg.indexOf("Received ping reply from fe80::202")&gt;=0) measurements.neighborPing=time; if(id==4 &amp;&amp; msg.indexOf("Received ping reply from fd00::201")&gt;=0) measurements.rootPing=time; if(id==4 &amp;&amp; msg=="Timeout") measurements.timeout=time; if(id==4 &amp;&amp; msg.indexOf("-- fe80::202:2:2:2 (lifetime")&gt;=0) measurements.route=true;
}
</script>
      <active>true</active>
    </plugin_config>
    <bounds x="1005" y="220" width="575" height="255" z="4" />
  </plugin>
</simconf>