Hi Phil, tanks for you help, you really help me but I still don't understand
one thing.
I have done some tests with TrickleTimer. Now I understand why the generated
value is inside the range [period/2, period].
In my test the value generate plus time (time += rval) was always very close to
period/2, I will put here my debug
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4637095
Trickles.time:4637095 TIME:0:58:35.625000014
DEBUG (0): Trickles.period:1000 Trickles.period/2:500 time:753
Trickles.time:753 TIME:0:58:35.625000014
DEBUG (0): Trickles.period:1000 Trickles.period/2:500 time:729
Trickles.time:729 TIME:0:58:35.625000014
DEBUG (0): Trickles.period:2000 Trickles.period/2:1000 time:1922
Trickles.time:2217 TIME:0:58:36.336914076
DEBUG (0): Trickles.period:4000 Trickles.period/2:2000 time:3911
Trickles.time:4037 TIME:0:58:38.501953139
DEBUG (0): Trickles.period:8000 Trickles.period/2:4000 time:6917
Trickles.time:7102 TIME:0:58:42.444335951
DEBUG (0): Trickles.period:16000 Trickles.period/2:8000 time:15623
Trickles.time:16898 TIME:0:58:49.379882826
DEBUG (0): Trickles.period:32000 Trickles.period/2:16000 time:19699
Trickles.time:20460 TIME:0:59:5.881835951
DEBUG (0): Trickles.period:64000 Trickles.period/2:32000 time:63583
Trickles.time:76652 TIME:0:59:25.862304701
DEBUG (0): Trickles.period:128000 Trickles.period/2:64000 time:86145
Trickles.time:88098 TIME:1:0:40.717773451
DEBUG (0): Trickles.period:256000 Trickles.period/2:128000 time:140728
Trickles.time:185655 TIME:1:2:6.750976576
DEBUG (0): Trickles.period:512000 Trickles.period/2:256000 time:306218
Trickles.time:427634 TIME:1:5:8.054687514
DEBUG (0): Trickles.period:1024000 Trickles.period/2:512000 time:564245
Trickles.time:782315 TIME:1:12:5.666015639
DEBUG (0): Trickles.period:2048000 Trickles.period/2:1024000 time:1068193
Trickles.time:1552524 TIME:1:24:49.645507826
DEBUG (0): Trickles.period:4096000 Trickles.period/2:2048000 time:2160894
Trickles.time:3189853 TIME:1:50:5.782226576
DEBUG (0): Trickles.period:8192000 Trickles.period/2:4096000 time:4256738
Trickles.time:6290148 TIME:2:42:0.873046889
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4662936
Trickles.time:8794806 TIME:4:24:23.595703139
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4626593
Trickles.time:9204233 TIME:6:47:32.273437514
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4676150
Trickles.time:9290133 TIME:9:17:20.778320326
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4657732
Trickles.time:9222158 TIME:11:48:33.173828139
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4644432
Trickles.time:9227276 TIME:14:18:39.187500014
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4663477
Trickles.time:9259621 TIME:16:48:50.199218764
DEBUG (0): Trickles.period:9024000 Trickles.period/2:4512000 time:4681319
Trickles.time:9258418 TIME:19:19:32.797851576
The time is the time += rval.
Looking to the results, the value time is always inside the interval
[Trickles.period/2 .. Trickles.period] but in most cases is very near the value
Trickles.period/2, is this some characteristic of algorithm or are something to
escape me? Why this time can't be more close to the value Trickles.period?
Again tanks lot for your help
Without more, my compliments Miguel Torres
On Jan 29, 2007, at 3:39 PM, migueltsilva wrote:
> I'm constructing a tree with the Dissemination and TrickleTimer
> code, using rssi to control them.
> I already create several network topology to test application,
> however it would be nice to obtain the values of gain that I define
> in the files, because I can't use rssi in tossim. One solution was
> to define several rssi random inside some interval, but I want to
> test fixed network, so this solution was not perfect. Please can
> anybody help me how to access the values of gain?
>
> Another question is relatively to the TrickeTimer. In the function
> generateTime, the value of the rval always varies between
> [0...period] ?
> So if I want to give some priority using value rssi, can I define
> the value of rval (with a relation of rssi) smaller to execute
> dissemination quicker? and if want dissemination slower, can I
> define the value of rval bigger ?. Is this correct?
>
> If anyone can help me I would be greatful,
> without more, my compliments Miguel Torres
TOSSIM does not provide function to access the RSSI readings because
there's no platform-independent way to do this, and I didn't want to
promote the idea of writing code for TOSSIM which can't run on real
motes.
the core code for generateTim():
trickles[id].time = trickles[id].remainder;
time = trickles[id].period;
// Time = period/2 (period = 2^scale)
time = time << (scale - 1);
rval = call Random.rand16() % (trickles[id].period << (scale - 1));
// time += a random value in the range of [0, scale/2)
time += rval;
trickles[id].remainder = (trickles[id].period << scale) - time;
trickles[id].time += time;
It therefore generates a value in the range of [period/2,period)
Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help