[Tinyos-2-commits] CVS: tinyos-2.x/doc/html/tutorial lesson11.html,
1.9, 1.10
Phil Levis
scipio at users.sourceforge.net
Fri Apr 20 14:41:37 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/doc/html/tutorial
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv12064/tutorial
Modified Files:
lesson11.html
Log Message:
Lesson 11.
Index: lesson11.html
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/doc/html/tutorial/lesson11.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** lesson11.html 20 Apr 2007 18:58:29 -0000 1.9
--- lesson11.html 20 Apr 2007 21:41:34 -0000 1.10
***************
*** 8,12 ****
<div class="title">Lesson 11: Simulation with TOSSIM</div>
! <div class="subtitle">Last Modified: 18 May 2006</div>
<p>This lesson introduces the TOSSIM simulator. You will become
--- 8,12 ----
<div class="title">Lesson 11: Simulation with TOSSIM</div>
! <div class="subtitle">Last Modified: 20 April 2007</div>
<p>This lesson introduces the TOSSIM simulator. You will become
***************
*** 84,88 ****
-
<p>Currently, the only platform TOSSIM supports is the
micaz. You should see output similar to this:</p>
--- 84,87 ----
***************
*** 105,109 ****
addresses some of the common causes and gives possible solutions.</p>
! <A name="#compiling"></A>
--- 104,109 ----
addresses some of the common causes and gives possible solutions.</p>
!
! <A name="#compiling"></A>
***************
*** 250,257 ****
>>> m = t.getNode(32);
>>> m.bootAtTime(45654);
! >>> t.runNextEVent()
1
</pre>
<p>Instead of using raw simulation ticks, you can also use the
call <code>ticksPerSecond()</code>. However, you want to be careful
--- 250,264 ----
>>> m = t.getNode(32);
>>> m.bootAtTime(45654);
! >>> t.runNextEvent()
1
</pre>
+ <p><b>Segmentation faults:</b>If trying to do this causes TOSSIM
+ to throw a segmentation violation (segfault), then chances are
+ you are using a version of gcc that does not work well with the
+ dynamic linking that TOSSIM is doing. In particular, it has been
+ verified to work properly with 4.0.2 and 3.6, but some people
+ have encountered problems with gcc 4.1.1.</p>
+
<p>Instead of using raw simulation ticks, you can also use the
call <code>ticksPerSecond()</code>. However, you want to be careful
***************
*** 590,598 ****
! <p>CPM can use a good deal of RAM: using the entire meyer-heavy trace as
! input has a cost of approximately 10MB. You can reduce this overhead
! by using a shorter trace; this will of course reduce simulation fidelity.</p>
!
! <p>The Radio object only deals with physical layer
propagation. The MAC object deals with the data link layer,
packet lengths, and radio bandwidth. The default TOSSIM MAC
--- 597,608 ----
! <p>CPM can use a good deal of RAM: using the entire meyer-heavy
! trace as input has a cost of approximately 10MB per node. You
! can reduce this overhead by using a shorter trace; this will of
! course reduce simulation fidelity. Future versions of TOSSIM
! will reduce this greatly through optimization.</p>
!
! <p>You can also use
! <p>The Radio object only deals with physical layer
propagation. The MAC object deals with the data link layer,
packet lengths, and radio bandwidth. The default TOSSIM MAC
***************
*** 719,722 ****
--- 729,733 ----
for i in range(1, 4):
+ print "Creating noise model for ",i;
t.getNode(i).createNoiseModel()
***************
*** 831,835 ****
<pre>
! f = open("mirage-1.txt", "r")
lines = f.readlines()
--- 842,846 ----
<pre>
! f = open("15-15-tight-mica2-grid.txt", "r")
lines = f.readlines()
***************
*** 865,869 ****
these configuration files can generate multiple different
network topologies. Network topology files generated from the
! tool follow the same format as <code>mirage-1.txt</code>.</p>
<h1>Variables</h1>
--- 876,882 ----
these configuration files can generate multiple different
network topologies. Network topology files generated from the
! tool follow the same format as <code>15-15-tight-mica2-grid.txt</code>.
! If you have topologies measured from real networks, we would love
! to include them in the TOSSIM distribution.</p>
<h1>Variables</h1>
***************
*** 975,991 ****
if (s[0] == "gain"):
r.add(int(s[1]), int(s[2]), float(s[3]))
! elif (s[0] == "noise"):
! r.setNoise(int(s[1]), float(s[2]), float(s[3]))
for i in range (0, 4):
! m = t.getNode(i)
! m.bootAtTime(randint(1000, 2000) * 1000000)
m = t.getNode(0)
v = m.getVariable("RadioCountToLedsC.counter")
while (v.getData() < 10):
t.runNextEvent()
</pre>
--- 988,1014 ----
if (s[0] == "gain"):
r.add(int(s[1]), int(s[2]), float(s[3]))
!
! noise = open("meyer-heavy.txt", "r")
! lines = noise.readlines()
! for line in lines:
! str = line.strip()
! if (str != ""):
! val = int(str)
! for i in range(0, 4):
! t.getNode(i).addNoiseTraceReading(val)
for i in range (0, 4):
! t.getNode(i).createNoiseModel()
! t.getNode(i).bootAtTime(i * 2351217 + 23542399)
m = t.getNode(0)
v = m.getVariable("RadioCountToLedsC.counter")
+
+
while (v.getData() < 10):
t.runNextEvent()
+ print "Counter variable at node 0 reached 10."
</pre>
***************
*** 1150,1155 ****
if (s[0] == "gain"):
r.add(int(s[1]), int(s[2]), float(s[3]))
! elif (s[0] == "noise"):
! r.setNoise(int(s[1]), float(s[2]), float(s[3]))
for i in range(0, 60):
--- 1173,1188 ----
if (s[0] == "gain"):
r.add(int(s[1]), int(s[2]), float(s[3]))
!
! noise = open("meyer-heavy.txt", "r")
! lines = noise.readlines()
! for line in lines:
! str = line.strip()
! if (str != ""):
! val = int(str)
! for i in range(0, 4):
! t.getNode(i).addNoiseTraceReading(val)
!
! for i in range (0, 4):
! t.getNode(i).createNoiseModel()
for i in range(0, 60):
***************
*** 1206,1210 ****
<p>Usually, the C++ and Python versions of a program look pretty
! similar. For example:</p>
<table WIDTH=800>
--- 1239,1244 ----
<p>Usually, the C++ and Python versions of a program look pretty
! similar. For example (note that this program will use a lot of RAM
! and take a long time to start due to its noise models):</p>
<table WIDTH=800>
***************
*** 1217,1220 ****
--- 1251,1255 ----
import TOSSIM
import sys
+ import random
from RadioCountMsg import *
***************
*** 1226,1236 ****
m = t.getNode(i);
m.bootAtTime(5000003 * i + 1);
! r.setNoise(i, -99.0, 3.0);
for j in range (0, 2):
if (j != i):
r.add(i, j, -50.0);
!
!
for i in range(0, 1000000):
--- 1261,1273 ----
m = t.getNode(i);
m.bootAtTime(5000003 * i + 1);
!
for j in range (0, 2):
if (j != i):
r.add(i, j, -50.0);
! # Create random noise stream
! for j in range (0, 500):
! m.addNoiseTraceReading(int(random.random() * 20) - 70);
! m.createNoiseModel()
for i in range(0, 1000000):
***************
*** 1241,1245 ****
<PRE>
#include <tossim.h>
!
--- 1278,1282 ----
<PRE>
#include <tossim.h>
! #include <stdlib.h>
***************
*** 1251,1255 ****
Mote* m = t->getNode(i);
m->bootAtTime(5000003 * i + 1);
- r->setNoise(i, -99.0, 3);
for (int j = 0; j < 2; j++) {
if (i != j) {
--- 1288,1291 ----
***************
*** 1257,1262 ****
--- 1293,1303 ----
}
}
+ for (int j = 0; i < 500; j++) {
+ m->addNoiseTraceReading((char)(drand48() * 20) - 70);
+ }
+ m->createNoiseModel();
}
+
for (int i = 0; i < 1000000; i++) {
t->runNextEvent();
***************
*** 1353,1358 ****
<pre>
! (gdb) watch UscGainInterferenceModelC$receiving[23]
! Hardware watchpoint 2: UscGainInterferenceModelC$receiving[23]
</pre>
--- 1394,1399 ----
<pre>
! (gdb) watch CpmModelC$receiving[23]
! Hardware watchpoint 2: CpmModelC$receiving[23]
</pre>
More information about the Tinyos-2-commits
mailing list