From 29ec3b02f5439b9766022462e7aa5b80a0b3aa56 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Sat, 7 Feb 2009 16:18:25 +0000 Subject: [PATCH] A nightly test of the Rime collect protocol on the sky platform --- .../cooja/contiki_tests/rime_collect_sky.csc | 336 ++++++++++++++++++ .../cooja/contiki_tests/rime_collect_sky.info | 1 + tools/cooja/contiki_tests/rime_collect_sky.js | 128 +++++++ 3 files changed, 465 insertions(+) create mode 100644 tools/cooja/contiki_tests/rime_collect_sky.csc create mode 100644 tools/cooja/contiki_tests/rime_collect_sky.info create mode 100644 tools/cooja/contiki_tests/rime_collect_sky.js diff --git a/tools/cooja/contiki_tests/rime_collect_sky.csc b/tools/cooja/contiki_tests/rime_collect_sky.csc new file mode 100644 index 000000000..b9db69f0f --- /dev/null +++ b/tools/cooja/contiki_tests/rime_collect_sky.csc @@ -0,0 +1,336 @@ + + + + My simulation + 0 + 1 + 123456 + 1000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + se.sics.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + ../../../examples/rime/example-collect.c + make example-collect.sky TARGET=sky + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 87.29845932913939 + 60.286214311723164 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 94.30809966340686 + 22.50388779326399 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 2 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 82.40423567500785 + 39.56979106929553 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 3 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 26.185019854469438 + 4.800834369523899 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 4 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 1.9530156130507015 + 78.3175061800706 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 5 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 48.35216700543414 + 80.36988713780997 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 6 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 24.825985087266833 + 74.27809432062487 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 7 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 8.356165164293616 + 94.33967355724187 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 8 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 45.11740613004886 + 31.7059041432301 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 9 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 68.9908548386292 + 55.01991960639596 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 10 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 13.181122543889046 + 55.9636533130127 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 11 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 2.1749985906538427 + 78.39666095789707 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 12 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 37.79795217518357 + 7.164284163506062 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 13 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 64.4595177394984 + 72.115414337433 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 14 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 81.85663737096085 + 89.31412706434035 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 15 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 44.74952276297882 + 18.78566116347574 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 16 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 96.11333426285873 + 90.64560410751824 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 17 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 21.651464136783527 + 7.1381043251259495 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 18 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 83.6006916200628 + 26.97170140682981 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 19 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 1.3446070721664705 + 7.340373220385176 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 20 + + + + + se.sics.cooja.plugins.SimControl + 223 + 4 + 227 + 0 + 0 + false + + + se.sics.cooja.plugins.VisState + 300 + 3 + 300 + 390 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 690 + 2 + 207 + 0 + 439 + false + + + diff --git a/tools/cooja/contiki_tests/rime_collect_sky.info b/tools/cooja/contiki_tests/rime_collect_sky.info new file mode 100644 index 000000000..2a4ec514f --- /dev/null +++ b/tools/cooja/contiki_tests/rime_collect_sky.info @@ -0,0 +1 @@ +Tests the Rime collect primitive on the sky platform, uses the code in examples/rime/example-collect.c diff --git a/tools/cooja/contiki_tests/rime_collect_sky.js b/tools/cooja/contiki_tests/rime_collect_sky.js new file mode 100644 index 000000000..18ba7fc3e --- /dev/null +++ b/tools/cooja/contiki_tests/rime_collect_sky.js @@ -0,0 +1,128 @@ +TIMEOUT(300000, log.log("Timeout\n")); + +function +print_stats() +{ + log.log("Received " + total_received + " messages, " + + (total_received / nrNodes) + " messages/node, " + + total_lost + " lost, " + + (total_lost / nrNodes) + " lost/node, " + + total_dups + " dups, " + + (total_dups / nrNodes) + " dups/node, " + + (total_hops / total_received) + " hops/message\n"); + log.log("Received: "); + for(i = 1; i <= nrNodes; i++) { + log.log(count[i] + " "); + } + log.log("\n"); + log.log("Hops: "); + for(i = 1; i <= nrNodes; i++) { + log.log(hops[i] + " "); + } + log.log("\n"); + log.log("Seqnos: "); + for(i = 1; i <= nrNodes; i++) { + log.log(seqnos[i] + " "); + } + log.log("\n"); + log.log("Lost: "); + for(i = 1; i <= nrNodes; i++) { + log.log(lost[i] + " "); + } + log.log("\n"); + log.log("Dups: "); + for(i = 1; i <= nrNodes; i++) { + log.log(dups[i] + " "); + } + log.log("\n"); +} + +/* Conf. */ +booted = new Array(); +count = new Array(); +hops = new Array(); +seqnos = new Array(); +lost = new Array(); +dups = new Array(); +nrNodes = 20; +total_received = 0; +total_lost = 0; +total_hops = 0; +total_dups = 0; +nodes_starting = true; +for(i = 1; i <= nrNodes; 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 */ +while(nodes_starting) { + YIELD_THEN_WAIT_UNTIL(msg.startsWith('Starting')); + + log.log("Node " + id + " booted\n"); + booted[id] = true; + + for(i = 1; i <= nrNodes; i++) { + if(!booted[i]) { + break; + } + if(i == nrNodes) { + nodes_starting = false; + } + } +} + +/* Create sink */ +log.log("All nodes booted, creating sink at node " + id + "\n"); +mote.getInterfaces().getButton().clickButton() + +while(true) { + YIELD(); + + /* Count sensor data packets */ + node_text = msg.split(" ")[4]; + seqno_text = msg.split(" ")[6]; + hops_text = msg.split(" ")[8]; + if(node_text) { + source = parseInt(node_text); + seqno = parseInt(seqno_text); + hop = parseInt(hops_text); + count[source]++; + hops[source] = hop; + seqno_gap = seqno - seqnos[source]; + seqnos[source] = seqno; + + 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; + } + } + /* Fail if the sink has received more than 10 messages from any node. */ + for(i = 1; i <= nrNodes; i++) { + if(count[i] > 10) { + print_stats(); + log.testFailed(); /* We are done! */ + } + } + + /* Wait until the sink have received at least two messages from every node */ + for(i = 1; i <= nrNodes; i++) { + if(count[i] < 2) { + break; + } + if(i == nrNodes) { + print_stats(); + log.testOK(); + } + } +}