[Ns-developers] spectrum modeling and wifi device
Nicola Baldo
nbaldo at cttc.es
Tue Feb 24 08:53:19 PST 2009
Hi Mathieu,
Mathieu Lacage 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 ?
>
I mean modeling the power spectral density of transmissions.
The goal is to provide support for stuff such as adjacent channel
interference, inter-technology interference, and cognitive radio/dynamic
spectrum access scenarios. Something of this kind is implemented in
ns2-miracle (http://www.dei.unipd.it/~baldo/mypapers/wns2-2008.pdf), and
here at CTTC we're interested in doing something similar for ns3.
>> 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> ?
Good point. Now that you suggested it ;-) I would suggest to change the
signature of the StartSendCallback to
typedef Callback(Ptr<Packet>, double, WifiMode, WifiPreamble)
StartSendCallback;
as for replacing Ptr<YansWifiPhy> with Ptr<NetDevice>, I like this
replacement because it is more generic, but it is not strictly
necessary, I can live without it.
>
>> 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
Can we use Packet Tags for this purpose?
> 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 ?
I agree that simple is better if it is enough for one's purposes. But I
want to add the spectrum modeling functionality while at the same time
while still making it possible to use the wifi device in the current
way. I just though that the best way to do this was to implement part of
the spectrum modeling functionality in a new per-device object to be
attached below YansWifiPhy. Comparing the ns3 wifi device with real
devices, it is like YansWifiPhy is the baseband chipset, and the new
object is the RF chipset. I don't see how to insert this new RF object
with the current dependency between YansWifiPhy and YansWifiChannel.
Thank you for your time & best regards,
Nicola
More information about the Ns-developers
mailing list