Merge branch 'rplfix'

This commit is contained in:
giomba 2019-12-15 10:59:42 +01:00
commit f7c4fa5e91
10 changed files with 1486 additions and 46 deletions

View File

@ -8,7 +8,6 @@
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>TheMatrix</title>
<speedlimit>1.0</speedlimit>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
@ -65,8 +64,8 @@
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>9.068528825751553</x>
<y>37.67859304913931</y>
<x>86.13444974265813</x>
<y>69.90280107817652</y>
<z>0.0</z>
</interface_config>
<interface_config>
@ -83,8 +82,8 @@
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>80.79035680654219</x>
<y>30.703106284953506</y>
<x>51.52627033556432</x>
<y>156.50687058384247</y>
<z>0.0</z>
</interface_config>
<interface_config>
@ -101,8 +100,8 @@
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>9.77736656046293</x>
<y>49.8308642040235</y>
<x>135.46626460917662</x>
<y>175.0121677245167</y>
<z>0.0</z>
</interface_config>
<interface_config>
@ -119,8 +118,8 @@
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>45.26921395736429</x>
<y>45.67070621929374</y>
<x>42.826166715568235</x>
<y>131.42320868067324</y>
<z>0.0</z>
</interface_config>
<interface_config>
@ -137,8 +136,8 @@
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>18.46200164044397</x>
<y>1.1473676044364778</y>
<x>187.05667809684172</x>
<y>169.3188559183185</y>
<z>0.0</z>
</interface_config>
<interface_config>
@ -155,8 +154,8 @@
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>75.51657406123633</x>
<y>60.87695540301412</y>
<x>32.82891907363539</x>
<y>15.516635561430592</y>
<z>0.0</z>
</interface_config>
<interface_config>
@ -169,14 +168,464 @@
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>53.227886077285106</x>
<y>56.65074004214692</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>7</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>9.478776977357972</x>
<y>141.6872676748177</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>8</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>121.3216653175472</x>
<y>79.12780506658024</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>9</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>140.4274166445628</x>
<y>48.19411557315654</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>10</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>141.8774935790525</x>
<y>118.01947990974314</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>11</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>167.54133708401406</x>
<y>141.62452988655903</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>12</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>182.19925638559323</x>
<y>45.94414109294538</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>13</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>94.23114956779912</x>
<y>7.372914932476138</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>14</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>28.4351017753266</x>
<y>54.086725788078674</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>15</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>194.99716411863673</x>
<y>74.93216287863017</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>16</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>34.692590848066104</x>
<y>97.96844103802013</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>17</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>12.575336165029904</x>
<y>17.556879953372338</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>18</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>188.5841996502633</x>
<y>116.89735135147325</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>19</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>133.43709588605824</x>
<y>38.25370176148881</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>20</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>78.76068226918665</x>
<y>28.22809372316739</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>21</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>150.08742374085077</x>
<y>70.09703322226797</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>22</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>48.63056610039707</x>
<y>36.08069318062117</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>23</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>95.60417975572267</x>
<y>155.21342903799032</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>24</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>1.4443131618000926</x>
<y>22.60341764850282</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>25</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>145.97717601565432</x>
<y>28.754329514574174</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>26</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>107.17179210686996</x>
<y>41.995577152348964</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>27</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>79.75285371214716</x>
<y>141.10964790096108</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>28</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>10.011740148116122</x>
<y>5.5755307926002695</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>29</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>16.516397756095703</x>
<y>100.66328458096703</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>30</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>103.78274003802443</x>
<y>83.492664972201</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>31</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
</simulation>
<plugin>
org.contikios.cooja.plugins.SimControl
<width>280</width>
<z>0</z>
<z>1</z>
<height>160</height>
<location_x>681</location_x>
<location_y>643</location_y>
<location_x>4</location_x>
<location_y>651</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Visualizer
@ -186,11 +635,11 @@
<skin>org.contikios.cooja.plugins.skins.GridVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.TrafficVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<viewport>8.441705440311774 0.0 0.0 8.441705440311774 -46.28112185124378 27.204467518174773</viewport>
<viewport>4.363597628395609 0.0 0.0 4.363597628395609 -112.84186218972216 -81.59855112545544</viewport>
</plugin_config>
<width>678</width>
<z>3</z>
<height>633</height>
<width>667</width>
<z>2</z>
<height>644</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
@ -201,11 +650,11 @@
<formatted_time />
<coloring />
</plugin_config>
<width>1039</width>
<z>1</z>
<height>475</height>
<location_x>681</location_x>
<location_y>160</location_y>
<width>1041</width>
<z>5</z>
<height>460</height>
<location_x>679</location_x>
<location_y>2</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.TimeLine
@ -216,41 +665,89 @@
<mote>3</mote>
<mote>4</mote>
<mote>5</mote>
<mote>6</mote>
<mote>7</mote>
<mote>8</mote>
<mote>9</mote>
<mote>10</mote>
<mote>11</mote>
<mote>12</mote>
<mote>13</mote>
<mote>14</mote>
<mote>15</mote>
<mote>16</mote>
<mote>17</mote>
<mote>18</mote>
<mote>19</mote>
<mote>20</mote>
<mote>21</mote>
<mote>22</mote>
<mote>23</mote>
<mote>24</mote>
<mote>25</mote>
<mote>26</mote>
<mote>27</mote>
<mote>28</mote>
<mote>29</mote>
<mote>30</mote>
<showRadioRXTX />
<showRadioHW />
<showLEDs />
<zoomfactor>500.0</zoomfactor>
</plugin_config>
<width>1720</width>
<z>5</z>
<z>6</z>
<height>166</height>
<location_x>0</location_x>
<location_y>818</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Notes
<plugin_config>
<notes>Enter notes here</notes>
<decorations>true</decorations>
</plugin_config>
<width>1040</width>
<z>4</z>
<height>160</height>
<location_x>680</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.serialsocket.SerialSocketServer
<mote_arg>0</mote_arg>
<plugin_config>
<port>60001</port>
<bound>true</bound>
<bound>false</bound>
</plugin_config>
<width>362</width>
<z>2</z>
<z>3</z>
<height>116</height>
<location_x>992</location_x>
<location_y>662</location_y>
<location_x>287</location_x>
<location_y>698</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.RadioLogger
<plugin_config>
<split>213</split>
<formatted_time />
<showdups>false</showdups>
<hidenodests>false</hidenodests>
</plugin_config>
<width>1052</width>
<z>4</z>
<height>357</height>
<location_x>667</location_x>
<location_y>462</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.ScriptRunner
<plugin_config>
<script>TIMEOUT(200000, log.log("TIMEOUT"));
YIELD();
WAIT_UNTIL(id == 1 &amp;&amp; msg.equals("detected 30"));
// log.log("[ANAWS] ROUTE-DISCOVERY AT " + String(time) + "\n");
log.log("[ANAWS] ALL-ROUTE-DISCOVERY " + sim.getSimulationTime() + " [us]\n");
log.testOK();</script>
<active>false</active>
</plugin_config>
<width>600</width>
<z>0</z>
<height>700</height>
<location_x>176</location_x>
<location_y>121</location_y>
</plugin>
</simconf>

753
cooja/simulation-prng.csc Normal file
View File

@ -0,0 +1,753 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
<project EXPORT="discard">[APPS_DIR]/avrora</project>
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
<project EXPORT="discard">[APPS_DIR]/collect-view</project>
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>My simulation</title>
<randomseed>generated</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
org.contikios.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>100.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.mspmote.Z1MoteType
<identifier>z11</identifier>
<description>border router</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.c</source>
<commands EXPORT="discard">make border-router.z1 TARGET=z1</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.z1</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspClock</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspMoteID</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspButton</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.Msp802154Radio</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspDefaultSerial</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspLED</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
</motetype>
<motetype>
org.contikios.cooja.mspmote.Z1MoteType
<identifier>z12</identifier>
<description>oracle</description>
<source EXPORT="discard">[CONFIG_DIR]/../oracle/main.c</source>
<commands EXPORT="discard">make main.z1 TARGET=z1</commands>
<firmware EXPORT="copy">[CONFIG_DIR]/../oracle/main.z1</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspClock</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspMoteID</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspButton</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.Msp802154Radio</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspDefaultSerial</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspLED</moteinterface>
<moteinterface>org.contikios.cooja.mspmote.interfaces.MspDebugOutput</moteinterface>
</motetype>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>2.8401240027287944</x>
<y>20.180398464401506</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>1</id>
</interface_config>
<motetype_identifier>z11</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>62.70457624916895</x>
<y>5.461823348621493</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>2</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-42.50529195002628</x>
<y>95.99347517915606</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>3</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-64.0342030412418</x>
<y>-76.45182374542104</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>4</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>26.546391605398625</x>
<y>-59.30002353310728</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>5</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-84.85459248648142</x>
<y>98.55316515771543</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>6</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>73.08943636820524</x>
<y>-36.58257187319245</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>7</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-98.8057360093751</x>
<y>-73.06961837300403</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>8</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>23.471662544709446</x>
<y>53.225517361008684</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>9</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-13.565530041615915</x>
<y>-80.11928625014107</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>10</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-34.51438626745433</x>
<y>-81.09816665820632</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>11</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>71.70626744929694</x>
<y>-46.85016956041235</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>12</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-41.520309705555846</x>
<y>71.44077281376488</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>13</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>43.08727383704024</x>
<y>69.28339212423197</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>14</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>1.1574329431798276</x>
<y>-10.80591664080768</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>15</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>86.63895925194797</x>
<y>16.352747256872362</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>16</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>70.93169772866406</x>
<y>20.543994795105263</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>17</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>39.091328725160054</x>
<y>55.941084547841</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>18</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>16.453276006224286</x>
<y>-59.66650954910484</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>19</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-4.390747291039673</x>
<y>87.26687348716987</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>20</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-91.67228068349867</x>
<y>-31.508149118910467</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>21</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>53.98786953015234</x>
<y>-66.86616338929652</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>22</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>30.80831962466192</x>
<y>51.80268003334382</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>23</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>81.0646699044992</x>
<y>-79.55330040239726</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>24</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-29.078011851630833</x>
<y>53.4674864072434</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>25</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-18.275675734835886</x>
<y>30.46886342152942</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>26</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>81.7369940927974</x>
<y>33.90815409313575</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>27</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>30.75563686385422</x>
<y>55.40035529973554</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>28</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-38.71906313508564</x>
<y>88.66374116285508</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>29</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>16.30310917244114</x>
<y>14.567282002160084</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>30</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>-7.756304235356026</x>
<y>39.799774604890644</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspClock
<deviation>1.0</deviation>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>31</id>
</interface_config>
<motetype_identifier>z12</motetype_identifier>
</mote>
</simulation>
<plugin>
org.contikios.cooja.plugins.SimControl
<width>280</width>
<z>3</z>
<height>160</height>
<location_x>11</location_x>
<location_y>627</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Visualizer
<plugin_config>
<moterelations>true</moterelations>
<skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.GridVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.TrafficVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<viewport>2.631613289609486 0.0 0.0 2.631613289609486 346.00912570327847 269.9189081106048</viewport>
</plugin_config>
<width>672</width>
<z>1</z>
<height>609</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.LogListener
<plugin_config>
<filter />
<formatted_time />
<coloring />
</plugin_config>
<width>1040</width>
<z>4</z>
<height>436</height>
<location_x>677</location_x>
<location_y>374</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.TimeLine
<plugin_config>
<mote>0</mote>
<mote>1</mote>
<mote>2</mote>
<mote>3</mote>
<mote>4</mote>
<mote>5</mote>
<mote>6</mote>
<mote>7</mote>
<mote>8</mote>
<mote>9</mote>
<mote>10</mote>
<mote>11</mote>
<mote>12</mote>
<mote>13</mote>
<mote>14</mote>
<mote>15</mote>
<mote>16</mote>
<mote>17</mote>
<mote>18</mote>
<mote>19</mote>
<mote>20</mote>
<mote>21</mote>
<mote>22</mote>
<mote>23</mote>
<mote>24</mote>
<mote>25</mote>
<mote>26</mote>
<mote>27</mote>
<mote>28</mote>
<mote>29</mote>
<mote>30</mote>
<showRadioRXTX />
<showRadioHW />
<showLEDs />
<zoomfactor>500.0</zoomfactor>
</plugin_config>
<width>1720</width>
<z>6</z>
<height>166</height>
<location_x>0</location_x>
<location_y>818</location_y>
</plugin>
<plugin>
org.contikios.cooja.serialsocket.SerialSocketServer
<mote_arg>0</mote_arg>
<plugin_config>
<port>60001</port>
<bound>false</bound>
</plugin_config>
<width>362</width>
<z>2</z>
<height>116</height>
<location_x>301</location_x>
<location_y>654</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.RadioLogger
<plugin_config>
<split>150</split>
<formatted_time />
<showdups>false</showdups>
<hidenodests>false</hidenodests>
</plugin_config>
<width>1037</width>
<z>5</z>
<height>366</height>
<location_x>677</location_x>
<location_y>3</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.ScriptRunner
<plugin_config>
<script>TIMEOUT(3600000, log.log("TIMEOUT")); // that is 60 minutes
YIELD();
WAIT_UNTIL(id == 1 &amp;&amp; msg.equals("detected 30"));
// log.log("[ANAWS] ROUTE-DISCOVERY AT " + String(time) + "\n");
log.log("ALL-ROUTE-DISCOVERY " + sim.getSimulationTime() + " [us]\n");
log.testOK();</script>
<active>false</active>
</plugin_config>
<width>600</width>
<z>0</z>
<height>700</height>
<location_x>958</location_x>
<location_y>39</location_y>
</plugin>
</simconf>

View File

@ -22,7 +22,7 @@ void res_get_handler(void* request, void* response, uint8_t* buffer, uint16_t pr
void res_periodic_handler();
/* declare resource and set handlers */
PERIODIC_RESOURCE(myresource, "title=\"An observable resource\";rt=\"some descriptive text\";obs", res_get_handler, NULL, NULL, NULL, 10 * CLOCK_SECOND, res_periodic_handler);
PERIODIC_RESOURCE(myresource, "title=\"An observable resource\";rt=\"some descriptive text\";obs", res_get_handler, NULL, NULL, NULL, 60 * CLOCK_SECOND, res_periodic_handler);
void res_periodic_handler() {
/* sample some sensor */

View File

@ -1,9 +1,10 @@
/* reduce RAM consumption */
#ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_
#undef REST_MAX_CHUNK_SIZE // Set the max response payload before fragmentation
/* Set the max response payload before fragmentation */
#undef REST_MAX_CHUNK_SIZE
#define REST_MAX_CHUNK_SIZE 64
<<<<<<< HEAD
#undef COAP_MAX_OPEN_TRANSACTIONS // Set the max number of concurrent transactions
#define COAP_MAX_OPEN_TRANSACTIONS 4
#undef NBR_TABLE_CONF_MAX_NEIGHBORS // Set the max number of entries in neighbors table
@ -21,5 +22,34 @@
#undef RPL_CONF_DIO_INTERVAL_DOUBLINGS
#define RPL_CONF_DIO_INTERVAL_DOUBLINGS 25
=======
/* Set the max number of concurrent transactions */
#undef COAP_MAX_OPEN_TRANSACTIONS
#define COAP_MAX_OPEN_TRANSACTIONS 2
/* Set the max number of entries in neighbors table */
#undef NBR_TABLE_CONF_MAX_NEIGHBORS
#define NBR_TABLE_CONF_MAX_NEIGHBORS 10
/*Set the max number of routes handled by the node */
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 32
/* Set the amount of memory reserved to the uIP packet buffer */
#undef UIP_CONF_BUFFER_SIZE
#define UIP_CONF_BUFFER_SIZE 192
/* RPL specific tuning parameters */
#undef RPL_CONF_DIO_REDUNDANCY
#define RPL_CONF_DIO_REDUNDANCY 10
#undef RPL_CONF_INTERVAL_MIN
#define RPL_CONF_INTERVAL_MIN 3
#undef RPL_CONF_DIO_INTERVAL_DOUBLINGS
#define RPL_CONF_DIO_INTERVAL_DOUBLINGS 8
>>>>>>> rplfix
#endif

4
simulation/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
results/
env/
*.csv

5
simulation/drawplot.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
python pretty.py | sort -n > pretty.csv
python plot.py

41
simulation/main.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
REPOSITORY=$(pwd)
CONTIKI=/home/giomba/workspace/uni/contiki/
SIMULATION=/home/giomba/workspace/uni/anaws-proj/cooja/simulation-prng.csc
REPEAT=20
# Setup environment
mkdir -p "$REPOSITORY/simulation/results"
# Setup simulation parameters
for KAPPA in 5; do
for I_MIN in 20 18 16; do
I_MAX=$((22 - I_MIN)) # 22 =~ 70 minutes
for PROJECTCONF in "$REPOSITORY/oracle/project-conf.h" "$CONTIKI/examples/ipv6/rpl-border-router/project-conf.h"; do
sed -i "s/^\#define RPL_CONF_DIO_REDUNDANCY *[0-9]*$/\#define RPL_CONF_DIO_REDUNDANCY $KAPPA/g" "$PROJECTCONF"
sed -i "s/^\#define RPL_CONF_INTERVAL_MIN *[0-9]*$/\#define RPL_CONF_INTERVAL_MIN $I_MIN/g" "$PROJECTCONF"
sed -i "s/^\#define RPL_CONF_DIO_INTERVAL_DOUBLINGS *[0-9]*$/\#define RPL_CONF_DIO_INTERVAL_DOUBLINGS $I_MAX/g" "$PROJECTCONF"
done
# Run simulation
for (( i = 0; i<=$REPEAT; i++ )); do
cd "$CONTIKI/tools/cooja"
ant run_nogui -Dargs="$SIMULATION" &
cd "$CONTIKI/examples/ipv6/rpl-border-router"
RESULT=""
while [ -z $RESULT ]; do # wait for cooja border router server
sleep 1
RESULT=$(ss -tlnp | awk '{print $4}' | grep 60001)
done
make connect-router-cooja PREFIX="2001:470:c844:32::1/64" # this will terminate as soon as simulation ends
UNIXTIMESTAMP=$(date +%s)
echo -e "REPEAT\t$i\nKAPPA\t$KAPPA\nI_MIN\t$I_MIN\nI_MAX\t$I_MAX\n" | cat - "$CONTIKI/tools/cooja/build/COOJA.testlog" > "$REPOSITORY/simulation/results/$UNIXTIMESTAMP"
done
done
done

37
simulation/plot.py Normal file
View File

@ -0,0 +1,37 @@
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as numpy
import pandas as pd
def getcolor(n):
return ['#aa0000', '#00aa00', '#0000aa', '#aaaa00', '#aa00aa'][int((i - 12) / 2)]
df = pd.read_csv('pretty.csv', delimiter='\s', engine='python')
x = df['k'].unique()
for i in df['i_min'].unique():
rows = df.loc[df['i_min'] == i]
plt.errorbar(
x,
rows['mean'],
yerr=rows['ci'],
marker='.',
capsize=4,
ms=3,
mec='r',
mfc='r',
linestyle='-',
linewidth=1,
color=getcolor(i),
ecolor='red'
)
handles = []
for i in df['i_min'].unique():
handles.append(mpatches.Patch(color=getcolor(i), label='Imin = ' + str(i)))
plt.legend(handles=handles)
plt.show()

63
simulation/pretty.py Normal file
View File

@ -0,0 +1,63 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import csv
import os
import re
import statistics
### PARAMETERS ###
RESULTSDIR='results/'
### FUNCTIONS ###
def compute_confidence_interval(samples): # 95%
stdev = statistics.stdev(samples)
ci = 1.96 * stdev / np.sqrt(len(samples))
return ci
### GLOBAL VARIABLES ###
all_route_discovery = dict()
### MAIN ###
for filename in os.listdir(RESULTSDIR):
df = pd.read_csv(RESULTSDIR + '/' + filename,
delimiter='\s|\t',
index_col=0,
nrows=4,
engine='python',
header=None).T
kappa = int(df['KAPPA'].to_string().split()[1])
i_min = int(df['I_MIN'].to_string().split()[1])
key = str(kappa) + ':' + str(i_min)
if (not key in all_route_discovery):
all_route_discovery[key] = { 'samples': [], 'k': kappa, 'i_min': i_min, 'count': 0 }
all_route_discovery[key]['count'] += 1
with open(RESULTSDIR + '/' + filename) as file:
for line in file:
if (re.match('ALL-ROUTE-DISCOVERY', line)):
t = int(line.split()[1]) / (10**6)
all_route_discovery[key]['samples'].append(t)
break
# now, for every k, i_min, i_max
# all_route_discovery contains an array with all samples of the measured value
print('k i_min count mean ci')
for simulation in all_route_discovery:
all_route_discovery[simulation]['mean'] = np.mean(all_route_discovery[simulation]['samples'])
all_route_discovery[simulation]['ci'] = compute_confidence_interval(all_route_discovery[simulation]['samples'])
print(
all_route_discovery[simulation]['k'],
all_route_discovery[simulation]['i_min'],
all_route_discovery[simulation]['count'],
all_route_discovery[simulation]['mean'],
all_route_discovery[simulation]['ci']
)
exit(0)

View File

@ -0,0 +1,10 @@
cycler==0.10.0
kiwisolver==1.1.0
matplotlib==3.1.2
numpy==1.17.4
pandas==0.25.3
pkg-resources==0.0.0
pyparsing==2.4.5
python-dateutil==2.8.1
pytz==2019.3
six==1.13.0