Directional antenna support for Wi-Fi nodes in ns-3.26 ?

764 views
Skip to first unread message

Mahesh

unread,
Jul 27, 2017, 1:13:59 PM7/27/17
to ns-3-users
Hi,

I wanted to know whether ns-3.26 supports directional antennas for Wi-Fi nodes or not ? If not, then how do I go about implementing it for Wi-Fi nodes. 

I came across this post wherein it was not supported for ns-3.24:

Please let me know.

Thanks,
Mahesh

Mahmud Islam

unread,
Jul 27, 2017, 2:06:20 PM7/27/17
to ns-3-...@googlegroups.com
In my best knowledge, there is no directional antenna support for Wi-Fi nodes. But you can create your own by manipulating propagation modeling.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Mahesh

unread,
Jul 27, 2017, 2:14:20 PM7/27/17
to ns-3-...@googlegroups.com
Hi,

Thanks for your reply. How do I go about doing that ? Any references or relevant ns3 source files would help.

Regards,
Mahesh

You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/XQv5MgZCoRc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

Mahmud Islam

unread,
Jul 27, 2017, 2:17:59 PM7/27/17
to ns-3-...@googlegroups.com
There are different propagation modeling.If you manipulate received power rx and it's orientation then definitely you can add directional antenna environment in ns-3 wifi node.There is no direct examples.


Mahesh

unread,
Jul 27, 2017, 2:23:26 PM7/27/17
to ns-3-...@googlegroups.com
Okay. Isn't there any documentation reference or something like that. 

If you can share, it would be helpful for me.

Mahesh

unread,
Jul 30, 2017, 12:23:06 PM7/30/17
to ns-3-users
Hello all,

So I searched extensively for integrating directional antennas with Wi-Fi nodes. I found this link (https://groups.google.com/forum/#!searchin/ns-3-users/directional$20antenna$20wifi|sort:relevance/ns-3-users/x0l7lXJXFZw/ZK656sTurFkJ) which talks about a patch for it. For the current ns-3.26 version, would a similar patch work ? I know the patch in the link was for an old version, it won't work with ns-3.26. 

As Mahmud mentioned, should I manipulate orientation of the propagation model ? I could not find anything related to the orientation of a propagation model.

Any links to it would be highly helpful for me. Do reply.

Thanks,
Mahesh

Mahesh

unread,
Aug 1, 2017, 5:16:34 AM8/1/17
to ns-3-users
Hi all,

Please reply. Kindly let me know whether the patch at this link 


will work for supporting directional antennas in Wi-Fi nodes.

- Regards

Mahesh

unread,
Aug 1, 2017, 12:55:02 PM8/1/17
to ns-3-users
Can someone shed light on this please ?

Konstantinos

unread,
Aug 1, 2017, 2:13:40 PM8/1/17
to ns-3-users
The code you mentioned is for ns-3.16. We are currently at ns-3.26. That's 10 major releases after that.
I can guarantee that the patch will not work.

I would put more effort into looking at the current Antenna module in ns-3.26 which has directional (parabolic) models and the use of the SpectrumPhy Wifi model.

Regards
K

Mahesh

unread,
Aug 1, 2017, 2:23:51 PM8/1/17
to ns-3-users
Hi Konstantinos,

Many thanks for your kind reply. I do realise that the patch won't work but someone here (https://groups.google.com/d/msg/ns-3-users/x0l7lXJXFZw/Ctl0ccLnokgJ) and here (https://groups.google.com/forum/#!searchin/ns-3-users/wifi$20directional$20antenna%7Csort:relevance/ns-3-users/vxhcaNV4qeI/ieNdCdeurYIJ) talk about patching the changes for specific ns-3 versions.

Also, Tom Henderson mentions it here (https://groups.google.com/d/msg/ns-3-users/-qMZAfUDO5w/g1g0enkcCQAJ) for ns-3.25. So my question is - when can the community expect an ns-3 release to have support for directional antennas for Wi-Fi ?

Thanks,
Mahesh
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/XQv5MgZCoRc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/XQv5MgZCoRc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

Konstantinos

unread,
Aug 1, 2017, 2:34:14 PM8/1/17
to ns-3-users
Hi

Both posts you mention are at least one year old (Tom's) or even older.
As Tom mentions, up to ns-3.25, there was no support for SpectrumPhy in WiFi, but as of ns-3.26 there is.
So, you can use the directional antenna in the antenna model as I mentioned in the previous post.

Regards
K

Mahesh

unread,
Aug 2, 2017, 7:57:39 AM8/2/17
to ns-3-users
Hi,

So I am simulating directional antennas directly using Ptr<ParabolicAntennaModel> without using SpectrumWifiPhy and I am aggregating it on top of a Wi-Fi node. But I want to mount 4 antennas on every Wi-Fi node (each having an angle of 90 so that 360 degrees is covered), how do I do that ?

Also, changing the values of Beamwidth and Orientation doesn't have an effect on the throughput or any other metric that I measuring. Where am I going wrong ?

Kindly reply.

Thanks,
Mahesh
hybrid_olsr_directional.cc

Konstantinos

unread,
Aug 2, 2017, 8:27:02 AM8/2/17
to ns-3-users
I haven't used the Antenna model or SpectrumPhy to help you further, but as I mentioned in the previous post, the API method is to 'SetAntenna' and not 'AggregateObject' 

Mahmud Islam

unread,
Aug 2, 2017, 3:52:47 PM8/2/17
to ns-3-...@googlegroups.com
Just one suggestion Before going into throughput; have you found any differences in received packet SNR?
I mean if you use typical node with omni-directional antenna what is the received packet SNR.

In you scenario, you are using Spectrum Channel or Yans WiFi Channel?

Thanks,
M

To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+unsubscribe@googlegroups.com.

Mahesh

unread,
Aug 3, 2017, 2:04:05 AM8/3/17
to ns-3-users
Hi,

When I use the "CalculateSnr" function defined in interference-helper.cc, how do I get the signal and noise interference values to feed into the function ?

I am using the spectrum channel in my code.

Now, my query is as follows:

I am setting the parabolic antenna values by doing
Ptr<ParabolicAntennaModel> parabolicAntenna = CreateObject<ParabolicAntennaModel>();
parabolicAntenna
->SetBeamwidth(60);
parabolicAntenna
->SetOrientation(120);

When I do the following
de_wireless.Get(0)->GetObject<WifiNetDevice>()->GetPhy()->SetAntenna(parabolicAntenna);

I am getting 
error: class ns3::WifiPhy has no member named SetAntenna

GetPhy() should return a reference to class ns3::SpectrumWifiPhy and not class ns3::WifiPhy. Why the error then ?

Also, both SpectrumWifiPhy and SpectrumWifiPhyHelper have SetChannel functions. With which instance should I set the channel ?

Kindly clarify this.

- Mahesh
hybrid_olsr_directional.cc

Rediet

unread,
Aug 3, 2017, 3:05:41 AM8/3/17
to ns-3-users
Hello,

A quick reply concerning the GetPhy part: it is normal that it returns a pointer to WifiPhy (that's the class WifiNetDevice know about). You have to (dynamic) cast it to SpectrumWifiPhy pointer to set antenna.

Rediet
Message has been deleted

Mahesh

unread,
Aug 3, 2017, 6:41:40 AM8/3/17
to ns-3-users
Thanks for your kind response, Rediet. I successfully rectified it.

Now the real issue is this:
What I want to realise is all wireless nodes should have 4 antennas each (each covering 90 degrees to cover the whole 360 degrees). I have successfully installed parabolic antenna on all the wireless nodes. Then, CSMA node will send TCP traffic to each antenna of every wireless node. I need to show that the antennas facing away from the CSMA node receive less traffic. How do I go about doing this ?

There aren't much options to configure in ParabolicAntenna class. Kindly let me know.

Thanks,
Mahesh
hybrid_olsr_directional.cc

Rediet

unread,
Aug 3, 2017, 7:47:08 AM8/3/17
to ns-3-users
MultiModelSpectrumChannel (or SingleModelSpectrumChannel) fetches the transmit antenna configured in the transmitter's SpectrumWifiPhy (by using the SpectrumSignalParameters's txAntenna attribute set by the transmitter) and the receive antenna configured in the registered receiver's SpectrumWifiPhy when evaluating the received power (in StartTx). It does so by invoking GetGainDb method of Antenna class. The direct consequence is that you can only configure one antenna object per SpectrumPhy instance. If you do configure multiple antenna objects, you'll end up having to modify a lot of classes and having to handle CCA state issues in wifi module (is this the same signal sent on another antenna or another one, how can I combine the receive power, etc.).
The best solution, in my opinion, would be to define a new Antenna that looks a lot like ParabolicAntennaModel, but in which you would be able to configure multiple parabolic antennas. The GetGainDb would have to be modified to take this into account. It up to you to decide which attributes you want to add and how you want to configure them...

Also see inline replies to your other unanswered questions (in your previous mail).


Le jeudi 3 août 2017 12:41:40 UTC+2, Mahesh a écrit :
Thanks for your kind response, Rediet. I successfully rectified it.

Now the real issue is this:
What I want to realise is all wireless nodes should have 4 antennas each (each covering 90 degrees to cover the whole 360 degrees). I have successfully installed parabolic antenna on all the wireless nodes. Then, CSMA node will send TCP traffic to each antenna of every wireless node. I need to show that the antennas facing away from the CSMA node receive less traffic. How do I go about doing this ?

There aren't much options to configure in ParabolicAntenna class. Kindly let me know.

Thanks,
Mahesh

On Thursday, 3 August 2017 12:35:41 UTC+5:30, Rediet wrote:
Hello,

A quick reply concerning the GetPhy part: it is normal that it returns a pointer to WifiPhy (that's the class WifiNetDevice know about). You have to (dynamic) cast it to SpectrumWifiPhy pointer to set antenna.

Rediet

Le jeudi 3 août 2017 08:04:05 UTC+2, Mahesh a écrit :
Hi,

When I use the "CalculateSnr" function defined in interference-helper.cc, how do I get the signal and noise interference values to feed into the function ?
[Rediet] You don't have to do it. It's handled by the SpectrumWifiPhy (or parent WifiPhy) internally.

I am using the spectrum channel in my code.

Now, my query is as follows:

I am setting the parabolic antenna values by doing
Ptr<ParabolicAntennaModel> parabolicAntenna = CreateObject<ParabolicAntennaModel>();
parabolicAntenna
->SetBeamwidth(60);
parabolicAntenna
->SetOrientation(120);

When I do the following
de_wireless.Get(0)->GetObject<WifiNetDevice>()->GetPhy()->SetAntenna(parabolicAntenna);

I am getting 
error: class ns3::WifiPhy has no member named SetAntenna

GetPhy() should return a reference to class ns3::SpectrumWifiPhy and not class ns3::WifiPhy. Why the error then ?

Also, both SpectrumWifiPhy and SpectrumWifiPhyHelper have SetChannel functions. With which instance should I set the channel ?
[Rediet] The second is a helper class, it'll create an instance of the first class for you. Since you have 10 Wi-Fi nodes, better use the helper (or you'll have to do all the fine-grained configuration on your own). 

Mahesh

unread,
Aug 3, 2017, 10:17:39 AM8/3/17
to ns-3-users
Thanks for your detailed reply, Rediet. Much appreciated.

So I added MultiModelSpectrumChannel to my code and it worked fine. I hope I don't have to use SpectrumSignalParameters's txAntenna attribute etc. explicitly, hope it's handled internally when I have the MultiModelSpectrumChannel.

A question that comes up then is when I have configured ParabolicAntenna on all the wireless nodes (although only a single antenna) in my previous code, why isn't there any difference in throughput values when I change the Beamwidth and Orientation ?

Secondly, if I am defining a new antenna model (just like Parabolic), then do I create 4 (say) different functions like GetGainDb depending on the orientation I want. Is that enough to handle the complexity of having multiple antennas mounted on a single node ?

Also, how would I distinguish a flow at an antenna level instead of a node level. For example, a node can have multiple interfaces, so how can I associate different antennas to a single node and get statistics for each antenna ?

If you could share your thoughts on the above points, it will be highly helpful for me. There isn't much support for directional antennas in ns-3.26 in this group, so I have a lot of doubts. Looking forward to your kind reply.

Many thanks,
Mahesh

Rediet

unread,
Aug 4, 2017, 3:02:27 AM8/4/17
to ns-3-users
See replies inline.


Le jeudi 3 août 2017 16:17:39 UTC+2, Mahesh a écrit :
Thanks for your detailed reply, Rediet. Much appreciated.

So I added MultiModelSpectrumChannel to my code and it worked fine. I hope I don't have to use SpectrumSignalParameters's txAntenna attribute etc. explicitly, hope it's handled internally when I have the MultiModelSpectrumChannel.
Yes it is handled internally. It's the whole point. 

A question that comes up then is when I have configured ParabolicAntenna on all the wireless nodes (although only a single antenna) in my previous code, why isn't there any difference in throughput values when I change the Beamwidth and Orientation ?
That's quite odd. You can enable logging (or perform a step by step execution in, let's say, Eclipse) to understand why the gain is not impacted by your configuration. You can detail logging in GetGainDb function, because that's where there should be a difference between an omni and a parabolic antenna.

Secondly, if I am defining a new antenna model (just like Parabolic), then do I create 4 (say) different functions like GetGainDb depending on the orientation I want. Is that enough to handle the complexity of having multiple antennas mounted on a single node ?
No, you should only define one GetGaingDb method, since there is only one called by SpectrumChannel. It should rather be the logic inside that method that should reflect the fact that you have multiple antennas. As for your question concerning complexity, read on...

Also, how would I distinguish a flow at an antenna level instead of a node level. For example, a node can have multiple interfaces, so how can I associate different antennas to a single node and get statistics for each antenna ?
If I understood you well, you're trying to set up a NetDevice with multiple antennas, without there being multiple spatial streams (i.e. parallel independent streams) but only one. Therefore the node has only one interface with X front ends, where the sent information is duplicated. That's why an abstraction at antenna level seemed reasonable. For the NetDevice it is as there was only one antenna (or rather it has only one digital processing chain, since the RF abstraction part is handled by Antenna class).
If you want to have statistics per antenna, it's better to call custom tailored private methods within GetGainDb so that you can identify which antenna is concerned here. You can then of course define trace sources or logging to get your stats.
If on the other hand, you're considering one antenna per NetDevice, that's another story... but you should then use classical simulation setup techniques (i.e. you don't need a special antenna class).

Mahesh

unread,
Aug 6, 2017, 8:37:08 AM8/6/17
to ns-3-users
Hi,

For the time being, I am working on having only a single directional antenna per wifi node. I have defined a new antenna class modeled on parabolic antenna. However, the same problem still persists. When I change the orientation and beamwidth of the antenna, I still get the same throughput.

Please let me know where I am going wrong. I have attached the zip of the modular code files.

Thanks,
Mahesh
wifi-spectrum-single-antenna-per-node.zip

Mahesh

unread,
Aug 6, 2017, 8:53:39 AM8/6/17
to ns-3-users
For kind information for all, I used Michael Rademacher's ns-3.26 patch for directional antennas.


Please do reply.

Thanks,
Mahesh

Rediet

unread,
Aug 8, 2017, 2:27:12 AM8/8/17
to ns-3-users
Hello,

I have spotted 2 problems:
  • In MyAntenna, you have defined a new attribute MaxGain instead of MaxAttenuation, but it's not used later on. On the other hand, m_maxAttenuation is used in the evaluation of gainDb. Since this attribute is not defined, it's probable that it's initialized with 0.0; you end up having an isotropic antenna...
  • In your simulation scenario, I'm surprised by the RxGain that you have defined; 88 dB is huge. You might end up seeing no difference at all between the main lobe and notches in the radiation pattern for your MCS...

Rediet

Mahesh

unread,
Aug 9, 2017, 10:27:48 AM8/9/17
to ns-3-users
Thanks Rediet. I have corrected it and now I am getting some sensible output with difference in throughput values. However, I am getting a maximum throughput of only 61 Mbps between nodes 0 and 3 when I have the following parameters for the attached topology:

Beamwidth = 60, Orientation = 90, MaxAttenuation = 10

I wish to ask, since I am using 802.11ac with MCS = 8, Channel Width = 80MHz and Short Guard Enabled = True, why am I getting such a low throughput. Ideally I should be getting around 200 Mbps. Kindly clarify. Also, some values of beamwidth/orientation make the program terminate abruptly. For example, beamwidth = 0. And changing beamwidth between a certain range of values does not affect the throughput at all. For example, when beamwidth = 45 and 90, I get the same values. Why is it so ?

Looking forward to your clarifications.

Thanks,
Mahesh
4_node_sample_topology.png
test_single_directional_antenna.zip

Mahesh

unread,
Aug 10, 2017, 3:26:04 AM8/10/17
to ns-3-users
Rediet,

Also for the implementation of multiple antennas on a single node, you said that the logic inside the GetGainDb method should reflect the fact that I have multiple antennas. How do I go about achieving this ?

What sort of changes should be done so that I have (say) 4 antennas on a single node ? I need multiple antennas on a node without there being multiple spatial streams. Kindly reply.

Thanks,
Mahesh

Rediet

unread,
Aug 10, 2017, 4:02:13 AM8/10/17
to ns-3-users
I'm sorry Mahesh, but I don't currently have the time to look into your code in detail. All I can say from a quick glance is that there seems to be a problem since you install Wi-Fi devices twice (once in your WildHelper and once in your simulation scenario); it might have some consequences. BTW, the datarate that you have defined in your WildHelper constructor seems to be the one to be used...

As for the implementation of multiple antennas in GetGainDb, a hint would be that you'll have to sum the gains obtained by each antenna considering the current angle and it's orientation with respect to it (otherwise stated you'll have to call the equivalent of the current GetGainDb method for each antenna). It'll also imply modifying the accessors.

Mahesh

unread,
Aug 14, 2017, 8:26:05 AM8/14/17
to ns-3-users
Hello Rediet,

Thanks for your response. So I am implementing multiple directional antennas on a single node. Please find attached the working code. This is how I have achieved the same:
- I modified the accessors in MyAntennaModel by defining multiple orientation attributes like "Orientation1", "Orientation2". For now, I have a common "Beamwidth", "maxAttenuation" and "maxGain" accessor.

- In the GetGainDb method, I have just made the following change. Replaced
double phi = a.phi - m_orientationRadians
with
double phi = a.phi - m_orientationRadians1 - m_orientationRadians2;

You talked about summing up the gains obtained by each antenna considering the current angle and it's orientation (OR calling the equivalent of GetGainDb for each antenna). How do I go about doing this part and where ?

In wild-helper.cc, for 2 antennas I have:
Ptr<MyAntennaModel> am1 = CreateObject<MyAntennaModel> ();
Ptr<MyAntennaModel> am2 = CreateObject<MyAntennaModel> ();
//double actualGain1 = am1->GetGainDb (DtoC);
//double actualGain2 = am2->GetGainDb (CtoD);

How and where do I use this actualGain1 and actualGain2 ? Do have a look at my code. There's only a slight modification from the earlier one. Looking forward to your kind reply.

Thanks,
Mahesh

test_multiple_directional_antennas.zip

Mahesh

unread,
Aug 15, 2017, 10:22:13 AM8/15/17
to ns-3-users
Can someone please reply ?

- Mahesh

Kindly clarify this.

For more options, visit <a href="https:

Mahesh

unread,
Aug 16, 2017, 7:55:31 AM8/16/17
to ns-3-users
An update on my last post:

I have modified the accessors in MyAntennaModel by defining multiple orientation attributes like "Orientation1", "Orientation2". For now, I have a common "Beamwidth", "maxAttenuation" and "maxGain" accessor.

As per Rediet's hint, I have summed up the gain due to both the orientation's in GetGainDb function. This is what I have currently:

double phi1 = a.phi - m_orientationRadians1;
double phi2 = a.phi - m_orientationRadians2;

double gainDb1 = -std::min (12 * pow (phi1 / m_beamwidthRadians, 2), m_maxAttenuation);
double gainDb2 = -std::min (12 * pow (phi2 / m_beamwidthRadians, 2), m_maxAttenuation);

double gainDb = gainDb1 + gainDb2;

When I run the simulation, I am getting 0 throughput on all the nodes. I guess the antenna gains are cancelling out each other's effects. How should I rectify it ? I have attached the latest code.

Thanks,
Mahesh
test_multiple_directional_antennas.zip

Rediet

unread,
Aug 18, 2017, 10:11:43 AM8/18/17
to ns-3-users
Hello Mahesh,

I think it's because the parabolic antenna only models the attenuation (just like cited paper), considering that the max gain along the main lobe will be added afterwards. So here, at best, you'll get 0 dBr attenuation along the main lobe. By doing so it differs from cosine antenna.
In your case you'll need to reuse the maxGain attribute to model the gain in the main lobe and add it to each gainDbx. You'll thus get a gain per antenna (and not an attenuation, thus the minus). Sorry for the back and forth but didn't catch the subtlety until I dug into the article.

Rediet

PS: Maybe that's why the 88dB RxGain was considered. But here you'll need to add that gain per antenna (and not only once), so better keep the addition in the antenna model.
Message has been deleted

Mahesh

unread,
Oct 1, 2017, 9:16:16 AM10/1/17
to ns-3-users
COSINE ANTENNA MODEL CUSTOM IMPLEMENTATION CRASHING

Hi Rediet and Hi all,

I have implemented my own version of cosine antenna model that is very similar to the default cosine-antenna-model.cc file in ns-3. I have extended that code to make use of 4 antennas. So what I have done is defined 4 attributes each of beamwidth, orientation and maxGain.

Now, inside the GetGainDb function of my custom "my-cosine-antenna-model.cc" file, I do the following:

double gainDb1 = 20 * std::log10 (ef1);
double gainDb2 = 20 * std::log10 (ef2);
double gainDb3 = 20 * std::log10 (ef3);
double gainDb4 = 20 * std::log10 (ef4);

And finally, I do
double gainDb = gainDb1 + gainDb2 + gainDb3 + gainDb4 + m_maxGain1 + m_maxGain2 + m_maxGain3 + m_maxGain4;

In my main file, I call the custom cosine-antenna-model as follows:
phyHelper.Set ("ChannelNumber", UintegerValue (42));
phyHelper
.Antenna1 ("ns3::MyCosineAntennaModel", "Beamwidth1", DoubleValue (bw1), "Orientation1", DoubleValue (or01), "MaxGain1", DoubleValue (mg1));
de_wireless1
.Add (wifi.Install (phyHelper, wifiMac, nc_wireless.Get (0)));
de_wireless1
.Add (wifi.Install (phyHelper, wifiMac, nc_wireless.Get (4)));

where phyHelper is an instance of SpectrumWifiPhyHelper and de_wireless1 is an instance of NetDeviceContainer. For nodes 0 and 4, the above few lines will set the channel number to 42 and then call the Antenna1 using the antenna parameters of beamwidth, orientation and maxGain.

Then I do
phyHelper.Set ("ChannelNumber", UintegerValue (58));
phyHelper
.Antenna2 ("ns3::MyCosineAntennaModel", "Beamwidth2", DoubleValue (bw2), "Orientation2", DoubleValue (or02), "MaxGain2", DoubleValue (mg2));
de_wireless2
.Add (wifi.Install (phyHelper, wifiMac, nc_wireless.Get (1)));
de_wireless2
.Add (wifi.Install (phyHelper, wifiMac, nc_wireless.Get (5)));

This will setup the channel number to 58 for nodes 1 and 5, and then call the Antenna2 using the antenna parameters of beamwidth, orientation and maxGain.

Likewise, I setup Antenna3 and Antenna4 also in a similar way.

My question is - since all 4 antennas communicate on a different channel with same SpectrumPhy, should I be making any changes to GetGainDb where I add the gains of 4 antennas based on the cosine-antenna-model ?

Also, when I run my program, it crashes abruptly. Where am I going wrong ? I have attached the code. Please help me.
cosine_antennas_multiple_channels.zip

Rediet

unread,
Oct 9, 2017, 3:24:13 AM10/9/17
to ns-3-users
Hello Mahesh,

I don't think that you can have two antennas on the same SpectrumPhy. You have installed on SpectrumPhy per node in your script, using the same helper though.
Second, since you have set up your nodes, per couple, on different channels you'll not have any interference.
Third, you'll have to add a way of signifying that an orientation has been used (i.e. activate orientation X attribute) so that you don't end up using the default angle. Btw, why do you need to change your orientation number between your different installations? Why not use orientation 1 each time, since you only set up only one orientation?

BR,

Rediet
Reply all
Reply to author
Forward
0 new messages