X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=doc%2Fhtml%2Ftutorial%2Flesson11.html;h=c892545705f740cf7d3b62aa7d467ee5c3527a84;hb=fe6dea63c85c083e893dccf388735a52d7405de6;hp=a495f6a6efe3a46efc12b718e6605184ceac6b42;hpb=c169b622c8d9cd192c6ba8e53a92b0d6e35ff387;p=tinyos-2.x.git diff --git a/doc/html/tutorial/lesson11.html b/doc/html/tutorial/lesson11.html index a495f6a6..c8925457 100644 --- a/doc/html/tutorial/lesson11.html +++ b/doc/html/tutorial/lesson11.html @@ -523,32 +523,76 @@ DEBUG (32): Application booted a third time.
gain(src, dest)
: Return the gain value of the
link from src to dest.remove(src, dest)
: Remove the link from
- src to dest.threshold()
: Return the CCA threshold.setThreshold(val)
: Set the CCA threshold value in
+ dBm. The default is -72dbM.setNoise(node, mean, variance)
: Set the noise
- floor at node to be a gaussian distribution with
- mean and variance.The default values for TOSSIM's radio model are based on the CC2420 radio, + used in the micaZ, telos family, and imote2. It uses an SNR curve derived + from experimental data collected using two micaZ nodes, RF shielding, and + a variable attenuator.
+ +In addition to the radio propagation above, TOSSIM + also simulates the RF noise and interference a node hears, both from other + nodes as well as outside sources. It uses the Closest Pattern Matching (CPM) + algorithm. CPM takes a noise trace as input and generates a statistical model + from it. This model can capture bursts of interference and other correlated + phenomena, such that it greatly improves the quality of the RF simulation. + It is not perfect (there are several things it does not handle, such as + correlated interference at nodes that are close to one another), but + it is much better than traditional, independent packet loss models. For + more details, please refer to the paper "Improving Wireless Simulation through + Noise Modeling," by Lee et al.
+ -sensitivity()
: Return the receive sensitivity of
- the nodes.To configure CPM, you need to feed it a noise trace. You accomplish this + by calling addNoiseTraceReading on a Mote object. Once you + have fed the entire noise trace, you must call createNoiseModel + on the node. The directory tos/lib/tossim/noise contains + sample noise traces, which are a series of noise readings, one per line. + For example, these are the first 10 lines of meyer-heavy.txt, + which is a noise trace taken from Meyer Library at Stanford University:
-setSensitivity(val)
: Set the receive sensitivity
- of nodes to be val. The sensitivity is how much
- stronger a signal must be for it to be received
- uncorrupted. E.g., a sensitivity of 3.0 (the default value)
- means that a packet must be 3dBm greater than the sum of
- noise and concurrent transmissions for it to be received
- uncorrupted.+-97 +-98 +-98 +-86 +-90 +-91 +-87 +-87 +-98 +-98 +-
threshold()
: Return the CCA threshold.As you can see, the hardware noise floor is around -98 dBm, + but there are spikes of interference around -86dBm and -87dBm.
-setThreshold(val)
: Set the CCA threshold value in
- dBm.The default is -95.This piece of code will give a node a noise model from a noise trace + file. It works for nodes 0-7: you can change the range appropriately:
++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, 7): + t.getNode(i).addNoiseTraceReading(val) + +for i in range(0, 7): + t.getNode(i).createNoiseModel()+ + +
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.
+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 @@ -664,14 +708,22 @@ for line in lines: t.addChannel("RadioCountToLedsC", sys.stdout) t.addChannel("Boot", sys.stdout) +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(1, 4): + t.getNode(i).addNoiseTraceReading(val) + +for i in range(1, 4): + t.getNode(i).createNoiseModel() + t.getNode(1).bootAtTime(100001); t.getNode(2).bootAtTime(800008); t.getNode(3).bootAtTime(1800009); -r.setNoise(1, -100.0, 5.0) -r.setNoise(2, -100.0, 5.0) -r.setNoise(3, -100.0, 5.0) - for i in range(0, 100): t.runNextEvent() @@ -713,10 +765,9 @@ DEBUG (3): RadioCountToLedsC: packet sent. DEBUG (1): Received packet of length 2. -
If you set the noise to be 30 plus or minus 5 dBm instead - of 80 plus or minus 5 dBm, then nodes will never transmit, as - the default CCA threshold is -95 dBm. You'll see something - like this:
+If you set node's clear channel assessment to be at -110dBm, + then nodes will never transmit, as noise and interference never + drop this low. You'll see something like this:
1 2 -54.0 2 1 -55.0 @@ -769,14 +820,11 @@ while (time + 50000000000 > t.time()): file format is-noise n avg std gain src dest g- where each statement is on a separate line. The noise - statement defines the noise observed at node n with - an average of avg and a standard deviation of - std. The gain statement defines a propagation + where each statement is on a separate line. + The gain statement defines a propagation gain g when src transmits to dest. This is a snippet of python code that will parse this file format: @@ -790,8 +838,6 @@ for line in lines: if (len(s) > 0): 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]))
TOSSIM has a tool for the second option of generating a