[Tinyos-devel] Tossim - node receives packet althought sending other

Lumir Honus foldus at gmail.com
Thu Feb 12 08:05:47 PST 2009


I'm sending a patch, I think it fix the problem. Node is now not able
to receive packet while sending.
I don't know whether is possible to send attachments directly to
mailing list, so I dump patch also here.

-----------------------------------------

*** /opt/tinyos-2.1.0/tos/lib/tossim/CpmModelC.nc	2009-02-12
16:54:15.000000000 +0100
--- Desktop/cvstos/tinyos-2.x/tos/lib/tossim/CpmModelC.nc	2007-09-04
19:19:22.000000000 +0200
***************
*** 50,56 ****
    message_t* outgoing; // If I'm sending, this is my outgoing packet
    bool requestAck;
    bool receiving = 0;  // Whether or not I think I'm receiving a packet
-   bool sending = 0;    // Whether or not I think I'm sending a packet
    struct receive_message;
    typedef struct receive_message receive_message_t;

--- 50,55 ----
***************
*** 72,78 ****
    receive_message_t* allocate_receive_message();
    void free_receive_message(receive_message_t* msg);
    sim_event_t* allocate_receive_event(sim_time_t t, receive_message_t* m);
-   sim_event_t* allocate_sending_finished_event(sim_time_t endTime);

    bool shouldReceive(double SNR);
    bool checkReceive(receive_message_t* msg);
--- 71,76 ----
***************
*** 383,391 ****
      if (!sim_mote_is_on(sim_node())) {
        dbg("CpmModelC", "Lost packet from %i due to %i being off\n",
source, sim_node());
        rcv->lost = 1;
-     }else if (sending){
-       dbg("CpmModelC", "Node can not receive it sends another packet.\n");
-       rcv->lost = 1;
      }
      else if (!shouldReceive(power - noiseStr)) {
        dbg("CpmModelC,SNRLoss", "Lost packet from %i to %i due to SNR
being too low (%i)\n", source, sim_node(), (int)(power - noiseStr));
--- 381,386 ----
***************
*** 414,424 ****
      sim_queue_insert(evt);

    }
-
-   // Node finished sending packet
-   void sim_sending_finished_handle(sim_event_t* evt) {
-       sending = 0;
-   }

    void sim_gain_put(int dest, message_t* msg, sim_time_t endTime,
bool receive, double power, double reversePower) {
      int prevNode = sim_node();
--- 409,414 ----
***************
*** 430,443 ****

    command void Model.putOnAirTo(int dest, message_t* msg, bool ack,
sim_time_t endTime, double power, double reversePower) {
      gain_entry_t* neighborEntry = sim_gain_first(sim_node());
-     sim_event_t* evt;
      requestAck = ack;
      outgoing = msg;
-     // Node is busy until does not send the whole packet
-     evt = allocate_sending_finished_event(endTime);
-     sim_queue_insert(evt);
-     sending = 1;
-
      dbg("CpmModelC", "Node %i transmitting to %i, finishes at
%llu.\n", sim_node(), dest, endTime);

      while (neighborEntry != NULL) {
--- 420,427 ----
***************
*** 464,479 ****
     return evt;
   }

-  sim_event_t* allocate_sending_finished_event(sim_time_t endTime)
-  {
-    sim_event_t* evt = (sim_event_t*)malloc(sizeof(sim_event_t));
-    evt->mote = sim_node();
-    evt->time = endTime;
-    evt->handle = sim_sending_finished_handle;
-    evt->cleanup = sim_queue_cleanup_event;
-    return evt;
-  }
-
   receive_message_t* allocate_receive_message() {
     return (receive_message_t*)malloc(sizeof(receive_message_t));
   }
--- 448,453 ----


-- 
---------------------------------------------------------------------
S pozdravem
        Lumir Honus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CpmModelPatch.patch
Type: text/x-diff
Size: 2964 bytes
Desc: not available
Url : https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20090212/ea7c61fb/attachment.patch 


More information about the Tinyos-devel mailing list