ACKs are not default behavior in T1, but you apparently have them
enabled if you are getting a variety of values in the message.ack field.
Also the low-level MAC code in the radio stack _should_ take care of
collision backoffs.

I forget the original problem, but how does "sending_flag" get reset?
and I would put the resend in a task and post it from the fired.

MS


moadsofiane wrote:
> Hi Michael,
> The ack field is enables by default in T1. In my simulation, there are 
> situations where ACK==1, which means packet send successfully and there are 
> cases where ACK==0 means packets are lost. I am in this previous case 
> (ACK==0). I am waiting for random time in order to avoid that two nodes try 
> to resend the packet in the same time(to avoid collisions).
> Yes for Resend_Packet_again_Timer.fired() ,it has another send like:
> 
> 
> event result_t Resend_Packet_again_Timer.fired(){     
> result_t retval;
> dbg(DBG_USR1,"Resending packet");
> Resend_packet.data[0]=0;//message type
> Resend_packet.data[1]=TOS_LOCAL_ADDRESS;//node ID source
> if(sending_flag==0){
>       retval=call SendBootMsg.send(TOS_BCAST_ADDR,sizeof(struct 
> SimpleMsg),&Resend_packet);// rebrodcast the message again. 
>       
>       if (retval!=SUCCESS) {
>               dbg(DBG_USR1,"Resend boot message not queed \n");
>               sending_flag=1;
>                               }
>                               else{
>                                       dbg(DBG_USR1,"Resend boot message queed 
> \n\n");
>                                       }
>                       }
> 
>       return SUCCESS;
>       }
> 
> 
> Please, what is the problem? 
> Best regards,
> Sofiane 
> 
> 
> 
>> Message du 31/08/09 à 19h53
>> De : "Michael Schippling" <sc...@santafe.edu>
>> A : moadsofi...@voila.fr
>> Copie à : tinyos-help@millennium.berkeley.edu
>> Objet : Re: [Tinyos-help] Retransmission of the packet lost
>>
>>
>> Presumably Resend_Packet_again_Timer.fired() does another send?
>> Why are you waiting instead of just posting a new send()? And are
>> you sure you have enabled ACKS?
>>
>> Anyway, I'd go look at how you pass the message contents to the
>> resend. It looks like you use "buffer" for something but it points
>> to the sendDone() msg which may not be valid after Done returns.
>>
>> MS
>>
>> moadsofiane wrote:
>>> Hi,
>>> I am checking whether there are packets lost with ack field in the message 
>>> of sendDone event. My aim is to retransmit the packet in case of fails 
>>> (means the node don't receive an ack). To do this, I try to send the packet 
>>> lost after a random time. The problem of this is that the packet 
>>> retransmitted still not received. I do the retransmission several times  
>>> but it still not successfully received. I don't know why it is not 
>>> received. I would like to know how to retransmit the packet that it is not 
>>> successfully received. 
>>> The code of retransmission that I do in sendDone event is as follow:
>>>
>>> event result_t SendBootMsg.sendDone( TOS_MsgPtr pmsg, result_t success ) {
>>> TOS_MsgPtr buffer;
>>> double random;
>>> buffer=pmsg;
>>>
>>> if(pmsg->ack==1){                                                           
>>>  dbg(DBG_USR2," Ack=1. No collision\n");                                    
>>>                         
>>> }else{
>>> dbg(DBG_USR2,"Ack=0.Collision\n");
>>> stat_helo_lost++;
>>> random=((call Random.rand())*1.0 /((uint16_t)- 1));//between 0 an 1
>>> //dbg(DBG_USR1,"random=%f\n",random);
>>> call Resend_Packet_again_Timer.start(TIMER_ONE_SHOT,random*100*1024);// try 
>>> to send it again 
>>>
>>> }//ack
>>> }//sendDone
>>> Thank you for your answer,
>>> Best regards,
>>> sofiane 
>>>
>>> ____________________________________________________
>>>
>>> Envie de partager vos photos de vacances ? Voila vous offre 1 Go d’espace 
>>> de stockage sur http://macle.voila.fr 
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> Tinyos-help@millennium.berkeley.edu
>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>
> 
> ____________________________________________________
> 
> Envie de partager vos photos de vacances ? Voila vous offre 1 Go d’espace de 
> stockage sur http://macle.voila.fr 
> 
> 
> 
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to