[Ns-developers] spectrum modeling and wifi device

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Tue Feb 24 07:10:19 PST 2009


hi nicola,

On Tue, 2009-02-24 at 15:37 +0100, Nicola Baldo wrote:

> I am trying to add a new object between the phy and the channel for the 
> purpose of modeling the usage of the radio spectrum by wireless devices.

What do you mean exactly by this ?

> Looking at the code for the wifi device in the latest ns-3-dev, I see 
> that YansWifiPhy and YansChannel depend on each other, since:
> 
> a) YansWifiPhy owns a pointer to YansWifiChannel, which is used to call 
> YansWifiChannel::Send()
> 
> b) YansWifiChannel keeps a list of pointers to all attached YansWifiPhy 
> instances, which is used to call YansWifiPhy::StartReceivePacket() and 
> YansWifiPhy::GetDevice ()->GetObject<NetDevice>()
> 
> 
> I was planning to remove the dependency between YansWifiPhy and 

Comments below on the how:

> YansChannel by doing the following:
> 
> 
> 1) defining the following callbacks:
> 
> typedef Callback(Ptr<Packet>, double, WifiMode, WifiPreamble) 
> StartReceiveCallback;
> 
> typedef Callback(Ptr<Packet>, double, WifiMode, WifiPreamble) 
> StartSendCallback;
> 
> 
> 2) changing YansWifiChannel::Add() to the following:
> 
> YansWifiChannel::Add(Ptr<NetDevice>,  StartReceiveCallback)
> 
> so that the channel can keep only a list of devices and callbacks which 
> are to be called for the delivery of packets;
> 
> 
> 3)  replacing  YansWifiPhy::SetChannel() with the following method:
> 
> YansWifiPhy::SetStartSendCallback(StartSendCallback)

How will you make sure that you don't send back its packet to the
sending phy ? Do you intend to change the signature of ::Send and
replace the Ptr<YansWifiPhy> with a Ptr<NetDevice> ?

> What do you think of this approach? Would you accept a patch with these 
> changes?

I would be fine with this if it _really_ helps you but one thing that I
would like to eventually support in this part of the code is
omnidirectional antennas. My feeling is that, eventually, this will
require us to push a bunch of extra pointers in YansWifiChannel::Add (a
pointer to the tx and the rx antenna associated to a
receiver/transmitter) and keep track of them in YansWifiChannel which
seems really wasteful since all this information will be already stored
in YansWifiPhy so, why not just keep the pointer to YansWifiPhy directly
and live with the ugly and low-tech but fairly simple circular
dependency we have for now ?

regards,
Mathieu



More information about the Ns-developers mailing list