12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5. <strong>The</strong> radio if asleep should be woken up when MAC receives a packet to tra<strong>ns</strong>mit. Similarly, a sleeping radio needsto be woken up to receive beaco<strong>ns</strong> whenever they are expected to arrive. If radio shutdown is activ<strong>at</strong>ed, the radioneeds to be put to sleep after tra<strong>ns</strong>mission of a packet. Mac802_15_4::recv() does this by calling functio<strong>ns</strong>Phy802_15_4::wakeupNode() <strong>and</strong> Phy802_15_4::putNodeToSleep(), which decrement energy spent sleeping.Files affected: ./wpan/p802_15_4mac.cc6. After every beacon reception, the node can shut itself down if it doesn’t have a packet pending to be tra<strong>ns</strong>mitted when radioshutdown has been activ<strong>at</strong>ed. This is done by Mac802_15_4::recvBeacon()by calling Phy802_15_4::putNodeToSleep().Files affected: ./wpan/p802_15_4mac.cc7. If the node is being put to sleep when not in use, the sleep-to-idle tra<strong>ns</strong>ition needs to be accounted for. This is done inCsmaCA802_15_4::start(). <strong>The</strong> backoff time for the first backoff stage is calcul<strong>at</strong>ed as wtime=MAX(wtime,ceil(phy→T_tra<strong>ns</strong>ition_locFiles affected: ./wpan/p802_15_4csmaca.cc23.2 Other changes1. After backing off macMaxCSMABackoffs <strong>and</strong> being unable to tra<strong>ns</strong>mit a packet, the MAC has to report a channel accessfailure. <strong>The</strong> older implement<strong>at</strong>ion kept <strong>at</strong>tempting to tra<strong>ns</strong>mit the packet indefinitely, i<strong>ns</strong>tead of reporting channel accessfailure. This has been fixed in the Mac802_15_4::mcps_d<strong>at</strong>a_request() function. Also the node is put to sleep (if needbe) <strong>at</strong> this stage.Files affected: ./wpan/p802_15_4mac.cc2. A new co<strong>ns</strong>tant called aCCATime has been added, which indic<strong>at</strong>es the CCA dur<strong>at</strong>ion in symbol periods.Files affected: ./wpan/p802_15_4co<strong>ns</strong>t.h3. CCA dur<strong>at</strong>ion has been specified to be 8 symbol dur<strong>at</strong>io<strong>ns</strong>. In the older implement<strong>at</strong>ion, CCA was being done right<strong>at</strong> the end of the 8th symbol dur<strong>at</strong>ion to determine channel idleness. As a result, if the channel is busy for the first 8symbol dur<strong>at</strong>io<strong>ns</strong> <strong>and</strong> goes idle after th<strong>at</strong> (which is likely), the implement<strong>at</strong>ion would indic<strong>at</strong>e channel idle while inreality it shouldn’t. This has been fixed by doing the CCA <strong>at</strong> the end of the 4th symbol dur<strong>at</strong>ion, but reporting channelst<strong>at</strong>us <strong>at</strong> the 8th. For this purpose, a new timer CCAReportH has been added which on expiry calls CCAReportH<strong>and</strong>lerth<strong>at</strong> does the reporting. Files affected: ./wpan/p802_15_4phy.cc, ./wpan/p802_15_4phy.h4. <strong>The</strong> Phy802_15_4::PD_DATA_indic<strong>at</strong>ion() function calls WirelessChannel::sendUp() to check if the packet has beenreceived correctly <strong>and</strong> to decrement the energy co<strong>ns</strong>umed in the packet reception. <strong>The</strong> SendUp() function is alreadybeing called by recv() <strong>and</strong> calling it a second time causes energy to be decremented twice. This bug has been fixed inPhy802_15_4::PD_DATA_indic<strong>at</strong>ion().Files affected: ./wpan/p802_15_4phy.cc5. Phy802_15_4::recv() function th<strong>at</strong> receives packets from the channel checks if the packet has been received correctlyusing WirelessPhy::sendUp(), failing which the packet is freed. sendUp() retur<strong>ns</strong> a 0 either when the node is asleepor when the packets received power is less than the CS threshold. In the former case, the variables rxTotPower <strong>and</strong>rxTotNum need to be upd<strong>at</strong>ed for CS purposes before dropping the packet, while in the l<strong>at</strong>ter case the packet simplyneeds to be dropped. Zheng’s implement<strong>at</strong>ion was dropping all packets without upd<strong>at</strong>ing the variables. This has beenfixed in Phy802_15_4::recv().Files affected: ./wpan/p802_15_4phy.cc6. <strong>The</strong> receiver has to be turned on for the carrier se<strong>ns</strong>ing oper<strong>at</strong>ion <strong>and</strong> therefore receive power P r is co<strong>ns</strong>umed duringthis period. <strong>The</strong> earlier implement<strong>at</strong>ion did not decrement receive energy due to carrier se<strong>ns</strong>ing. This has been addedin function Phy802_15_4::CarrierSe<strong>ns</strong>er(). Also, energy is spent during the tx-rx turnaround. This has been accountedfor as well.Files affected: ./wpan/p802_15_4phy.cc213

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!