Hi oudidi, please check the following lines:

inline void
Mac802_11::transmit(Packet *p, double timeout)
{
tx_active_ = 1;
int nid = netif_->node()->nodeid();
double now = Scheduler::instance().clock();
  
if (nid == my_nid && now >= my_time_start && now < my_time_end) {
mhSend_.start(timeout);
return;
}

//... original code below
}

void
Mac802_11::recv(Packet *p, Handler *h)
{
int nid = netif_->node()->nodeid();
double now = Scheduler::instance().clock();

if (nid == my_nid && now >= my_time_start && now < my_time_end) {
struct hdr_cmn *hdr = HDR_CMN(p);
hdr->error() = 1;
}

//... original code below
}

hi
 
I have the same problem .
Please can you give the change you did In mac/mac-802_11.cc
 
thanks in advance

De : realoneone <[email protected]>
À : [email protected]
Envoyé le : Jeudi, 30 Avril 2009, 1h51mn 08s
Objet : Re: [ns] How to shut down a mobile node


Hi there,

Though I had problems by just using "on/off" command of the mobile nodes, I 
finally used a tricky way to "shut down" some nodes at certain time:

In mac/mac-802_11.cc, I added a few lines in the beginning of transmit() and 
recv(), which stop transmitting/receiving the packet depending on the clock 
time and the id of the node which is calling this function.

Though I have to re-make ns2, it does works fine for me.

Hope it helps.

Ryan


穿越地震带 纪念汶川地震一周年

Reply via email to