X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=apps%2Ftests%2FTestMultihopLqi%2Fscript.py;fp=apps%2Ftests%2FTestMultihopLqi%2Fscript.py;h=221ab9454de90b69e19d3cd1ad0916513bf2d0e6;hb=4ebceb54314f65e013c41052fcb124c3b6eaafa5;hp=0000000000000000000000000000000000000000;hpb=3dfd84980f041b3aa473f75ffdfe16ac74e950c8;p=tinyos-2.x.git diff --git a/apps/tests/TestMultihopLqi/script.py b/apps/tests/TestMultihopLqi/script.py new file mode 100644 index 00000000..221ab945 --- /dev/null +++ b/apps/tests/TestMultihopLqi/script.py @@ -0,0 +1,56 @@ +from TOSSIM import * +import sys +import time +import random + +t = Tossim([]) +r = t.radio() + +#t.addChannel("HASH", sys.stdout) +#t.addChannel("Insert", sys.stdout) +#t.addChannel("RadioCountToLedsC", sys.stdout) +#t.addChannel("CpmModelC", sys.stdout) +#t.addChannel("Gain", sys.stdout) +#t.addChannel("AM", sys.stdout) +#t.addChannel("LQI", sys.stdout) +t.addChannel("LQIRoute", sys.stdout) +t.addChannel("LQIDeliver", sys.stdout) +#t.addChannel("LQIRoute", sys.stdout) + +start = time.time(); +noise = open("meyer-short.txt", "r") +lines = noise.readlines() +for line in lines: + str = line.strip() + if (str != ""): + val = int(str) + for i in range(0, 7): + t.getNode(i).addNoiseTraceReading(val) +# print "adding ", int(str) +end = time.time(); +duration = end - start; +print "time: ", duration; + +f = open("topo.txt", "r") + +lines = f.readlines() +for line in lines: + s = line.split() + if (len(s) > 0): + if (s[0] == "gain" and int(s[1]) < 8 and int(s[2]) < 8): + r.add(int(s[1]), int(s[2]), float(s[3])) + + +start = time.time(); +for i in range(0, 7): + t.getNode(i).createNoiseModel(); + t.getNode(i).bootAtTime(random.random() * 10000000 + 20000000); + +duration = end - start; +print "time: ", duration; + +#for i in range(0, 196607): +# print m1.generateNoise(i) + +for i in range(0, 1000000): + t.runNextEvent();