Mojtaba,

If you are sending messages to AM_BROADCAST_ADDR, then there are no acks, so sendDone should be fired as soon as the radio successfully sends the packet. If sendDone isn't firing then this must mean the radio isn't able to send the packet. The only reason that I can think of that could cause TOSSIM to fail sending a packet is if CCA always thinks that there is a packet being transmitted.

I would recommend you closely follow the .py example file given in:

http://docs.tinyos.net/index.php/TOSSIM#Configuring_a_Network

Especially the part that deals with the Noise Model. I seem to remember having problems with my applications when i tried to skip using the noise model. This may be what is causing your problems. I'm not very familiar with TOSSIM, but i believe it uses the noise model to run the CCA check. If no model is created, then i'm not sure how it determines what energy level the simulated radio is sensing during CCA, and what threshold it would use in that case.

Let me know if this solves your problem.

-Paul

mojtaba raznahan wrote:
Paul,

Really thanks for your responses.I changed the boot times to 1000,each node is booted at 1000. And Node 1 is a sender and every 2000MilliSec sends a packet to "AM_BROADCAST_ADDR" (I also changed it to the numbers ,like 2 or 0).But still does'nt worked.In the first time AMSend.send returns a SUCCESS But the AMSend.sendDone event is not signaled to change the busy flag for later sends.I also chanaged the busy flag to false but next time AMSend.send doesn't return SUCCESS .
Paul, should i active the ACK manually ? Or It's Automatically?

*for i in range(0, 3):
  m = t.getNode(i);
  m.bootAtTime(1000);*


This is the Timer.fired event :

*ent void Timer.fired()
{

 counter++;

 dbg("Base","Timer fired at %s .\n",sim_time_string());
if(!busy)
      {
RbsMsg *data = call Packet.getPayload(&pkt,sizeof(RbsMsg)); data->count = counter; dbg("Base","data in the packet is : %hhu.\n",data->count); flag = call AMSend.send(2,&pkt,sizeof(RbsMsg)); if( flag == SUCCESS)
           {
             dbg("Base","Packet sent %hhu.\n",data->count);
             busy = TRUE;
             counter++;
}
    else
       dbg("Base","was not SUCCESSFULL %S.\n",sim_time_string());
} else
   dbg("Control", "the busy flag is true.\n",sim_time_string());
       *
************
And this is my message struct :

*enum {

  TIMER_DELAY = 2000,
  AM_Rbs = 6
};
typedef nx_struct RbsMsg
{

  nx_uint8_t count;

} RbsMsg;
#endif
 *

On Sat, Nov 14, 2009 at 9:51 PM, Paul Johnson <[email protected] <mailto:[email protected]>> wrote:

    Mojtaba,

    Which node is 1 sending to and when???  I see that the node boot
    times are pretty far spaced apart.  It could be that if you're
    sending from 1 to 2, node 2 is not booted up when node 1 sends,
    thus, it will never receive an ACK and sendDone will never be called.

    -Paul


    mojtaba raznahan wrote:
    Hi Paul,

    Thank you very much for answer.
    I checked out this problem,but still doen't work!!
    This is my simulation code and node 1 is the sender node  :(Is it
    correct ?)

    #! /usr/bin/python

    import TOSSIM
    import sys
    import random

    from TOSSIM import *

    t = TOSSIM.Tossim([])
    r = t.radio();

    for i in range(0, 3):
      m = t.getNode(i);
      m.bootAtTime(5000003 * i + 1);

    r.add(1,0,-50.0);
    r.add(0,1,-50.0);
    r.add(1,2,-50.0);
    r.add(2,1,-50.0);
    r.add(2,0,-50.0);
    r.add(0,2,-50.0);



    t.addChannel("Boot",sys.stdout);
    t.addChannel("Base",sys.stdout);
    t.addChannel("Receive",sys.stdout);
    t.addChannel("Control",sys.stdout);

    for i in range(0, 1000):
      t.runNextEvent();

    sincerley,
    Mojtaba


    On Sat, Nov 14, 2009 at 8:11 PM, Paul Johnson <[email protected]
    <mailto:[email protected]>> wrote:

        Mojtaba,

        Make sure when you are setting up your links in the
        simulation you set up BOTH directions of the link.  For
        example if you're trying to send something from node 1 to
        node 2, you need to define the gain for link 1->2 and from
        2->1.  Otherwise, 1 will be able to send to 2, but 2 will
        never respond with an ACK.

        -Paul

        mojtaba raznahan wrote:

        Really need your helps...

        Can't anybody help me ??

        Does it related to simulation section ??





        On Tue, Nov 10, 2009 at 10:09 PM, mojtaba raznahan
        <[email protected]
        <mailto:[email protected]>> wrote:

            I'm still bickering with this issue...some help plz


            On Tue, Nov 10, 2009 at 7:44 PM, mojtaba raznahan
            <[email protected]
            <mailto:[email protected]>> wrote:

                How can i make sure that the message ACK is active
                or not ? I have not worked with ACK yet


                On Tue, Nov 10, 2009 at 7:26 PM, Ricardo .
                <[email protected]
                <mailto:[email protected]>> wrote:

                    I read one of the threads that the cause of the
                    issue might be the ACK messages.  ACK will
                    arrive at the event will never be signaled.  If
                    the message ACK is active and no ACK is received
sendDone is not signaled.

                    On Tue, Nov 10, 2009 at 3:37 PM, mojtaba
                    raznahan <[email protected]
                    <mailto:[email protected]>> wrote:

                        Hi Ricardo,

                        Thanks for reply. I wrote a dbg statement in
                        first of sendDone event but ...the sendDone
                        event is not signaled at all!


                        event void AMSend.sendDone(message_t*
                        bufPtr, error_t error)
                        {
                           * dbg("Base","sendDone %s
                        .\n",sim_time_string());*

                            if (&pkt == bufPtr) {
                              busy = FALSE;
                            }

                        }

                        There isn'nt any statement to print while
                        simulating!!!!

                        Really confused! What's your idea ??
                        Does it related to Radio configuration of
                        simulation code ?(python code ?)




                        On Tue, Nov 10, 2009 at 6:43 PM, Ricardo .
                        <[email protected]
                        <mailto:[email protected]>> wrote:

                            Try print the value of error_t error in
                            sendDone event

                            On Mon, Nov 9, 2009 at 3:53 PM, mojtaba
                            raznahan <[email protected]
                            <mailto:[email protected]>> wrote:

                                Hi,

                                Im writing a simple application to
                                test send and receive of motes
                                .AMSend.send command works but
                                AMSend.sendDone event isn't signaled
                                after sending so the busy flag
                                does'nt change to false. and in the
                                next time the AMSend.send command
                                does not return SUCCESS .
                                this is my code :

                                event void Boot.booted() {
                                dbg("Boot","Booted at time %s
                                .\n",sim_time_string());
                                call AMControl.start();
                                }

                                event void
                                AMControl.startDone(error_t err)
                                {
                                dbg("Control","AMControl started %s
                                .\n",sim_time_string());
                                  if(err == SUCCESS) {
                                   if(TOS_NODE_ID == 1 ) {
                                    dbg("Base","This is the base
                                station...ready for sending packets
                                %s.\n",sim_time_string());
                                    call
                                Timer.startPeriodic(TIMER_DELAY);
                                    }
                                }
                                  else
                                   call AMControl.start();
                                }

                                event void
                                AMControl.stopDone(error_t err)
                                {
}

                                event void Timer.fired()
                                {

                                   if(!busy)
                                      {
RbsMsg* data = (RbsMsg*)
                                ( call
                                Packet.getPayload(&pkt,sizeof(RbsMsg)));
                                          data->count = counter;
                                           if( call
                                
AMSend.send(AM_BROADCAST_ADDR,&pkt,sizeof(RbsMsg))
                                == SUCCESS)
                                           {
                                             dbg("Base","Packet sent
                                %s.\n",sim_time_string());
                                             busy= TRUE;
                                             counter++;
                                            }
                                    else
                                       dbg("Base","was not
                                SUCCESSFULL %s .\n",sim_time_string());
}

                                }

                                --------------------
                                event void
                                AMSend.sendDone(message_t* bufPtr,
                                error_t error)
                                {
if (&pkt == bufPtr) {
                                      busy = FALSE;
                                      dbg("Base","send Done %s
                                .\n",sim_time_string());
                                    }

                                }

                                and this is my simulation code with
                                python :

                                #! /usr/bin/python

                                import sys
                                import random
                                from TOSSIM import *
                                t = Tossim([])
                                r = t.radio();

                                for i in range (0, 3):
                                 m = t.getNode(i);
                                 m.bootAtTime(1000 * i+ 1);

                                r.add(1, 0, -54.0);
                                r.add(1, 2, -54.0);
                                r.add(0, 2, -20.0);
                                r.add(2, 0, -20.0);

t.addChannel("Boot",sys.stdout);
                                t.addChannel("Base",sys.stdout);
                                t.addChannel("Receive",sys.stdout);
                                t.addChannel("Control",sys.stdout);

                                for i in range(0, 20000):
                                  t.runNextEvent();


                                Would you help me please? i really
                                need your helps.

                                Regards,
-- Mojtaba Raznahan
                                BS of Computer engineering
                                TMU university
                                www.raznahan.com
                                <http://www.raznahan.com>

                                _______________________________________________
                                Tinyos-help mailing list
                                [email protected]
                                <mailto:[email protected]>
                                
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help





-- Mojtaba Raznahan
                        BS of Computer engineering
                        TMU university
                        www.raznahan.com <http://www.raznahan.com>



                    _______________________________________________
                    Tinyos-help mailing list
                    [email protected]
                    <mailto:[email protected]>
                    
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




-- Mojtaba Raznahan
                BS of Computer engineering
                TMU university
                www.raznahan.com <http://www.raznahan.com>




-- Mojtaba Raznahan
            BS of Computer engineering
            TMU university
            www.raznahan.com <http://www.raznahan.com>




-- Mojtaba Raznahan
        BS of Computer engineering
        TMU university
        www.raznahan.com <http://www.raznahan.com>
        ------------------------------------------------------------------------
        _______________________________________________ Tinyos-help
        mailing list [email protected]
        <mailto:[email protected]>
        https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




-- Mojtaba Raznahan
    BS of Computer engineering
    TMU university
    www.raznahan.com <http://www.raznahan.com>




--
Mojtaba Raznahan
BS of Computer engineering
TMU university
www.raznahan.com <http://www.raznahan.com>

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to