Simplified the test code; made the rime_collect and rime_collect_sky tests the same.

This commit is contained in:
adamdunkels 2011-01-10 15:05:52 +00:00
parent 5bbe113e5b
commit 928cb1fc84
2 changed files with 123 additions and 190 deletions

View file

@ -16,7 +16,7 @@
<motedelay_us>10000000</motedelay_us> <motedelay_us>10000000</motedelay_us>
<radiomedium> <radiomedium>
se.sics.cooja.radiomediums.UDGM se.sics.cooja.radiomediums.UDGM
<transmitting_range>67.0</transmitting_range> <transmitting_range>80.0</transmitting_range>
<interference_range>0.0</interference_range> <interference_range>0.0</interference_range>
<success_ratio_tx>1.0</success_ratio_tx> <success_ratio_tx>1.0</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx> <success_ratio_rx>1.0</success_ratio_rx>
@ -26,7 +26,7 @@
</events> </events>
<motetype> <motetype>
se.sics.cooja.contikimote.ContikiMoteType se.sics.cooja.contikimote.ContikiMoteType
<identifier>mtype374</identifier> <identifier>mtype949</identifier>
<description>Contiki Mote Type #1</description> <description>Contiki Mote Type #1</description>
<contikiapp>[CONTIKI_DIR]/examples/rime/example-collect.c</contikiapp> <contikiapp>[CONTIKI_DIR]/examples/rime/example-collect.c</contikiapp>
<commands>make example-collect.cooja TARGET=cooja</commands> <commands>make example-collect.cooja TARGET=cooja</commands>
@ -59,7 +59,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>1</id> <id>1</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -72,7 +72,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>2</id> <id>2</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -85,7 +85,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>3</id> <id>3</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -98,7 +98,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>4</id> <id>4</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -111,7 +111,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>5</id> <id>5</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -124,7 +124,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>6</id> <id>6</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -137,7 +137,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>7</id> <id>7</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -150,7 +150,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>8</id> <id>8</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -163,7 +163,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>9</id> <id>9</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -176,7 +176,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>10</id> <id>10</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -189,7 +189,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>11</id> <id>11</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -202,7 +202,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>12</id> <id>12</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -215,7 +215,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>13</id> <id>13</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -228,7 +228,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>14</id> <id>14</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -241,7 +241,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>15</id> <id>15</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -254,7 +254,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>16</id> <id>16</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -267,7 +267,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>17</id> <id>17</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -280,7 +280,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>18</id> <id>18</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -293,7 +293,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>19</id> <id>19</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -306,7 +306,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>20</id> <id>20</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -319,7 +319,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>21</id> <id>21</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -332,7 +332,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>22</id> <id>22</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -345,7 +345,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>23</id> <id>23</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -358,7 +358,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>24</id> <id>24</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -371,7 +371,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>25</id> <id>25</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -384,7 +384,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>26</id> <id>26</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -397,7 +397,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>27</id> <id>27</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -410,7 +410,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>28</id> <id>28</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -423,7 +423,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>29</id> <id>29</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -436,7 +436,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>30</id> <id>30</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -449,7 +449,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>31</id> <id>31</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -462,7 +462,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>32</id> <id>32</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -475,7 +475,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>33</id> <id>33</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -488,7 +488,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>34</id> <id>34</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -501,7 +501,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>35</id> <id>35</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -514,7 +514,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>36</id> <id>36</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -527,7 +527,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>37</id> <id>37</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -540,7 +540,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>38</id> <id>38</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -553,7 +553,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>39</id> <id>39</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -566,7 +566,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>40</id> <id>40</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -579,7 +579,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>41</id> <id>41</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -592,7 +592,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>42</id> <id>42</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -605,7 +605,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>43</id> <id>43</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -618,7 +618,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>44</id> <id>44</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -631,7 +631,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>45</id> <id>45</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -644,7 +644,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>46</id> <id>46</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -657,7 +657,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>47</id> <id>47</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -670,7 +670,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>48</id> <id>48</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -683,7 +683,7 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>49</id> <id>49</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
<mote> <mote>
<interface_config> <interface_config>
@ -696,13 +696,13 @@
se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>50</id> <id>50</id>
</interface_config> </interface_config>
<motetype_identifier>mtype374</motetype_identifier> <motetype_identifier>mtype949</motetype_identifier>
</mote> </mote>
</simulation> </simulation>
<plugin> <plugin>
se.sics.cooja.plugins.SimControl se.sics.cooja.plugins.SimControl
<width>262</width> <width>262</width>
<z>3</z> <z>1</z>
<height>185</height> <height>185</height>
<location_x>0</location_x> <location_x>0</location_x>
<location_y>0</location_y> <location_y>0</location_y>
@ -715,7 +715,7 @@
<viewport>1.283542488892569 0.0 0.0 1.283542488892569 56.0530822138472 6.888296017222324</viewport> <viewport>1.283542488892569 0.0 0.0 1.283542488892569 56.0530822138472 6.888296017222324</viewport>
</plugin_config> </plugin_config>
<width>496</width> <width>496</width>
<z>0</z> <z>3</z>
<height>198</height> <height>198</height>
<location_x>1</location_x> <location_x>1</location_x>
<location_y>184</location_y> <location_y>184</location_y>
@ -723,10 +723,10 @@
<plugin> <plugin>
se.sics.cooja.plugins.LogListener se.sics.cooja.plugins.LogListener
<plugin_config> <plugin_config>
<filter /> <filter>ID:1</filter>
</plugin_config> </plugin_config>
<width>497</width> <width>933</width>
<z>1</z> <z>2</z>
<height>333</height> <height>333</height>
<location_x>0</location_x> <location_x>0</location_x>
<location_y>381</location_y> <location_y>381</location_y>
@ -752,7 +752,6 @@ function print_stats() {
/* Init */ /* Init */
sink = 0; sink = 0;
booted = new Array();
hops = new Array(); hops = new Array();
dups = new Array(); dups = new Array();
received = new Array(); received = new Array();
@ -760,31 +759,22 @@ received = new Array();
doubleFormat = new java.text.DecimalFormat("0.00"); doubleFormat = new java.text.DecimalFormat("0.00");
integerFormat = new java.text.DecimalFormat("00"); integerFormat = new java.text.DecimalFormat("00");
for(i = 1; i &lt;= num_nodes; i++) { for(i = 1; i &lt;= num_nodes; i++) {
booted[i] = false;
received[i] = "__________"; received[i] = "__________";
hops[i] = received[i]; hops[i] = received[i];
} }
/* Wait until all nodes have started */
log.log("Simulation has " + num_nodes + " nodes\n"); log.log("Simulation has " + num_nodes + " nodes\n");
for(i = 1; i &lt;= num_nodes; i++) {
YIELD_THEN_WAIT_UNTIL(msg.startsWith('Starting'));
/* log.log("Node " + id + " booted\n");*/
}
/* Create sink */
log.log("All nodes booted, sink is node 1\n\n");
sink = 1;
mote.getInterfaces().getButton().clickButton();
while(true) { while(true) {
YIELD(); YIELD();
log.log(time + " " + id + " " + msg + "\n");
/* Count sensor data packets */ /* Count sensor data packets */
if(msg.startsWith("Sink got message")) { if(msg.startsWith("Sink got message")) {
node_text = msg.split(" ")[4]; node_text = msg.split(" ")[4];
seqno_text = msg.split(" ")[6]; seqno_text = msg.split(" ")[6];
hops_text = msg.split(" ")[8]; hops_text = msg.split(" ")[8];
if(node_text) { if(node_text) {
source = parseInt(node_text); source = parseInt(node_text);
seqno = parseInt(seqno_text); seqno = parseInt(seqno_text);
@ -809,14 +799,12 @@ while(true) {
/* Signal OK if all nodes have reported 10 messages. */ /* Signal OK if all nodes have reported 10 messages. */
num_reported = 0; num_reported = 0;
for(i = 1; i &lt;= num_nodes; i++) { for(i = 1; i &lt;= num_nodes; i++) {
if(i != sink) {
if(!isNaN(received[i])) { if(!isNaN(received[i])) {
num_reported++; num_reported++;
} }
} }
}
if(num_reported == num_nodes - 1) { if(num_reported == num_nodes) {
print_stats(); print_stats();
log.testOK(); log.testOK();
} }
@ -824,7 +812,7 @@ while(true) {
<active>true</active> <active>true</active>
</plugin_config> </plugin_config>
<width>676</width> <width>676</width>
<z>2</z> <z>0</z>
<height>714</height> <height>714</height>
<location_x>497</location_x> <location_x>497</location_x>
<location_y>0</location_y> <location_y>0</location_y>

View file

@ -356,90 +356,42 @@ make example-collect.sky TARGET=sky</commands>
<plugin> <plugin>
se.sics.cooja.plugins.ScriptRunner se.sics.cooja.plugins.ScriptRunner
<plugin_config> <plugin_config>
<script>TIMEOUT(300000, log.log("Timeout\n")); <script>TIMEOUT(600000);
function num_nodes = mote.getSimulation().getMotesCount();
print_stats()
{ function print_stats() {
log.log("Received " + total_received + " messages, " + log.log("Received:\n");
(total_received / nrNodes) + " messages/node, " + for(i = 1; i &lt;= num_nodes; i++) {
total_lost + " lost, " + log.log("Node " + i + " ");
(total_lost / nrNodes) + " lost/node, " + if(i == sink) {
total_dups + " dups, " + log.log("sink\n");
(total_dups / nrNodes) + " dups/node, " + } else {
(total_hops / total_received) + " hops/message\n"); log.log("received: " + received[i] + " hops: " + hops[i] + "\n");
log.log("Seqnos: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(seqnos[i] + " ");
} }
log.log("\n");
log.log("Lost: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(lost[i] + " ");
} }
log.log("\n");
log.log("Dups: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(dups[i] + " ");
}
log.log("\n");
log.log("Hops: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(hops[i] + " ");
}
log.log("\n");
log.log("Received: ");
for(i = 1; i &lt;= nrNodes; i++) {
log.log(count[i] + " ");
}
log.log("\n");
} }
/* Conf. */ /* Init */
booted = new Array(); sink = 0;
count = new Array();
hops = new Array(); hops = new Array();
seqnos = new Array();
lost = new Array();
dups = new Array(); dups = new Array();
nrNodes = 20; received = new Array();
total_received = 0;
total_lost = 0; doubleFormat = new java.text.DecimalFormat("0.00");
total_hops = 0; integerFormat = new java.text.DecimalFormat("00");
total_dups = 0; for(i = 1; i &lt;= num_nodes; i++) {
nodes_starting = true; received[i] = "__________";
for(i = 1; i &lt;= nrNodes; i++) { hops[i] = received[i];
booted[i] = false;
count[i] = 0;
hops[i] = 0;
seqnos[i] = -1;
lost[i] = 0;
dups[i] = 0;
} }
/* Wait until all nodes have started */ log.log("Simulation has " + num_nodes + " nodes\n");
while(nodes_starting) {
YIELD_THEN_WAIT_UNTIL(msg.startsWith('Starting'));
log.log("Node " + id + " booted\n");
booted[id] = true;
for(i = 1; i &lt;= nrNodes; i++) {
if(!booted[i]) {
break;
}
if(i == nrNodes) {
nodes_starting = false;
}
}
}
log.log("All nodes booted\n");
while(true) { while(true) {
YIELD(); YIELD();
log.log(time + " " + id + " "+ msg + "\n");
/* Count sensor data packets */ /* Count sensor data packets */
if(msg.startsWith("Sink")) { if(msg.startsWith("Sink got message")) {
node_text = msg.split(" ")[4]; node_text = msg.split(" ")[4];
seqno_text = msg.split(" ")[6]; seqno_text = msg.split(" ")[6];
hops_text = msg.split(" ")[8]; hops_text = msg.split(" ")[8];
@ -447,43 +399,36 @@ while(true) {
source = parseInt(node_text); source = parseInt(node_text);
seqno = parseInt(seqno_text); seqno = parseInt(seqno_text);
hop = parseInt(hops_text); hop = parseInt(hops_text);
count[source]++; dups = received[source].substr(seqno, 1);
hops[source] = hop; if(dups == "_") {
seqno_gap = seqno - seqnos[source]; dups = 1;
seqnos[source] = seqno; } else if(dups &lt; 9) {
dups++;
total_received++;
total_hops += hop;
if(seqno_gap == 2) {
total_lost += seqno_gap - 1;
lost[source] += seqno_gap - 1;
} else if(seqno_gap == 0) {
total_dups += 1;
dups[source] += 1;
} }
received[source] = received[source].substr(0, seqno) + dups +
received[source].substr(seqno + 1, 10 - seqno);
if(hop &gt; 9) {
hop = "+";
} }
/* Fail if the sink has received more than 10 messages from any node. */ hops[source] = hops[source].substr(0, seqno) + hop +
for(i = 1; i &lt;= nrNodes; i++) { hops[source].substr(seqno + 1, 10 - seqno);
if(count[i] &gt; 10) {
print_stats(); print_stats();
log.testFailed(); /* We are done! */ }
}
/* Signal OK if all nodes have reported 10 messages. */
num_reported = 0;
for(i = 1; i &lt;= num_nodes; i++) {
if(!isNaN(received[i])) {
num_reported++;
} }
} }
/* Wait until the sink have received at least two messages from every node */ if(num_reported == num_nodes) {
for(i = 1; i &lt;= nrNodes; i++) {
if(count[i] &lt; 2) {
break;
}
if(i == nrNodes) {
print_stats(); print_stats();
log.testOK(); log.testOK();
} }
} }</script>
print_stats();
}
}</script>
<active>true</active> <active>true</active>
</plugin_config> </plugin_config>
<width>600</width> <width>600</width>