From ab388c2068a318b5241c639d958688afe3c9beb6 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 5 Nov 2008 19:22:18 +0000 Subject: [PATCH] added sky collect test --- tools/cooja/contiki_tests/sky_collect.csc | 154 +++++++++++++++++++++ tools/cooja/contiki_tests/sky_collect.info | 1 + tools/cooja/contiki_tests/sky_collect.js | 42 ++++++ 3 files changed, 197 insertions(+) create mode 100644 tools/cooja/contiki_tests/sky_collect.csc create mode 100644 tools/cooja/contiki_tests/sky_collect.info create mode 100644 tools/cooja/contiki_tests/sky_collect.js diff --git a/tools/cooja/contiki_tests/sky_collect.csc b/tools/cooja/contiki_tests/sky_collect.csc new file mode 100644 index 000000000..792e11b80 --- /dev/null +++ b/tools/cooja/contiki_tests/sky_collect.csc @@ -0,0 +1,154 @@ + + + + My simulation + 0 + 1 + 123456 + 10000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + se.sics.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + ../../../examples/sky/sky-collect.c + make sky-collect.sky TARGET=sky + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 29.17421996892351 + 104.77909205535983 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 59.38068944364397 + 97.64274390719908 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 2 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 4.709236350803614 + 36.140965282433676 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 3 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 12.959353575718179 + 43.874396471224806 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 4 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 4.405437081821395 + 74.51872257012788 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 5 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 20.032542580805657 + 38.81348491507741 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 6 + + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 44.10978600980437 + 49.73908473744734 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 7 + + + + + se.sics.cooja.plugins.SimControl + 265 + 1 + 200 + 0 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 1168 + 3 + 209 + 0 + 621 + false + + + se.sics.cooja.radiomediums.UDGM$VisUDGM + 300 + 2 + 300 + 864 + 0 + false + + + diff --git a/tools/cooja/contiki_tests/sky_collect.info b/tools/cooja/contiki_tests/sky_collect.info new file mode 100644 index 000000000..d3d9c553a --- /dev/null +++ b/tools/cooja/contiki_tests/sky_collect.info @@ -0,0 +1 @@ +Sky-collect running on 7 Sky nodes. Test waits until sensor data has been received from every node at least 5 times. diff --git a/tools/cooja/contiki_tests/sky_collect.js b/tools/cooja/contiki_tests/sky_collect.js new file mode 100644 index 000000000..1a303ea4e --- /dev/null +++ b/tools/cooja/contiki_tests/sky_collect.js @@ -0,0 +1,42 @@ +/* Wait until all nodes have booted */ +if (msg.startsWith('Starting')) { + log.log("Node " + id + " booted\n"); + global.put("boot_" + id, true); +} +for (i = 1; i <= 7; i++) { + result = global.get("boot_" + i); + if (result == null || result == false) { + /*log.log("Node " + i + " did not yet boot\n");*/ + return; + } +} + +/* Create sink */ +result = global.get("created_sink"); +if (result == null || result == false) { + log.log("All nodes booted, creating sink at node " + id + "\n"); + mote.getInterfaces().getButton().clickButton() + global.put("created_sink", true); + return; +} + +/* Log incoming sensor data */ +source = msg.split(" ")[0]; +count = global.get("count_" + source); +log.log("Got data from node " + source + "\n"); +if (count == null) { + count = 0; +} +count++; +global.put("count_" + source, count); + +/* Wait until we have received data from all nodes */ +for (i = 1; i <= 7; i++) { + result = global.get("count_" + i); + if (result < 5) { + /*log.log("Node " + i + " only sent " + result + " messages yet\n");*/ + return; + } +} + +log.testOK(); /* We are done! */ \ No newline at end of file