Most TOS networks fit your description of "self-organizing with no central node", aside from having a basestation to collect and forward the results...
For Q1, if your "different functions" are meant to be completely independent you should probably use some kind of message queuing system. There is a QueuedSend impl in the T1 lib directory, but I have no experience with it. The easier method is to use a global busy flag on the send channel, then it's a matter of details if you use separate message buffers. For Q2...if I understand the question...a message that is being received will run to completion before any attempt to send is made. The backoff must expire before a new sample of the medium -- to see if it is "free" -- is done. However there is no real guarantee of the order of execution in callbacks. Are you seeing the "reversed" order of done and receive in simulation or on a real system? And how do you distinguish the order? For the rest of the confusion, we'd have to see your code... MS Victor Cionca wrote: > Hello everyone! > > I am new to this list and only about two weeks old as tiny os user. > > I've been trying to implement a self-organizing application where every > node chooses a number from 1 on. I want to achieve distributed > behaviour, so no central node. In theory it is a very easy algorithm, > which relies on ordering introduced by CSMA. > In practice thinks are different and the algorithm doesn't work. Even > worse, it works in TOSSIM perfectly. I therefore have some questions > about "best-practices" in TinyOS programming. > > First, what do I do if I send packets from different functions in the > component: do I use a global message buffer, as in the tutorial, or do I > create a buffer in each function that sends? The fact is that the > behaviour in the two cases is different. > > Second: in CSMA only one node will send while others listen because of > the initial back-off. But then, as soon as the medium is free or the > back-off expires they will send. My question is, is there a way to tell > what happens first? Do they first receive the packet blocking the medium > or they first send. Because from what I have seen in my application, > they first receive the sendDone event then the receive event. Is there a > way to control this? > > I'm pretty confused. I am working with the tmotes. When nodes settle on > a number they display it on the leds. I use the BaseStation application > to sniff the packets. I include a counter in the packets to see what is > going on. There seem to be packets lost. Also, in some occasions one of > the motes has the number set but doesn't display it on the leds, > although they are both in an atomic block. > > What could be the problem? > > Best regards, > Victor Cionca > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help -- Platform: WinXP/Cygwin TinyOS version: 1.x, Boomerang Programmer: MIB510 Device(s): Mica2, MicaZ, Tmote Sensor board: homebrew _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
