[Ns-developers] [ns 2.33] bug in WirelessChannel::sendUp()

antoine.trux@nokia.com antoine.trux at nokia.com
Tue Jun 17 05:27:32 PDT 2008


Hi,

In a mobile network, when a node sends a packet, in order to speed up
computation NS-2 first restricts the set of potential receivers to those
nodes that lie within a certain radius. This is done in
mac/channel.cc::WirelessChannel::sendUp():

	void
	WirelessChannel::sendUp(Packet* p, Phy *tifp)
	{
	[...]
			 affectedNodes = getAffectedNodes(mtnode,
distCST_ + /* safety */ 5, &numAffectedNodes);

"CST" in `distCST_' means "Carrier-Sense Threshold", and `distCST_' is
indeed computed as follows, in
mac/channel.cc::WirelessChannel::calcHighestAntennaZ():

	void
	WirelessChannel::calcHighestAntennaZ(Phy *tifp)
	{
	[...]
	    	   WirelessPhyExt *wifp = (WirelessPhyExt *)tifp;
	    	   distCST_ = wifp->getDist(wifp->getCSThresh(),
wifp->getPt(), 1.0, 1.0, 
				   highestZ , highestZ, wifp->getL(),
				   wifp->getLambda());

As far as my colleagues and I know, the carrier-sense threshold is used
when sending (the medium should be idle before a node can transmit a
frame), not for deciding the success or failure of the reception of a
frame. So, the above code is wrong.

Antoine Trux
Nokia Research Center



More information about the Ns-developers mailing list