Directional Antenna WiFi Patch

411 views
Skip to first unread message

Jeremy Mack

unread,
Jul 30, 2014, 2:09:52 PM7/30/14
to ns-3-...@googlegroups.com
Hello,

I spent a lot of time figuring out how to get directional antennas working with WiFi and thought it would be good to post the process I used to get it working aswell as a patch I added to fix a large bug. 

*****I used ns-3.16, and have not tested it with any other version*****

Step 1: Download the latest WiFi Directional Antenna Patch from Brian Panneton (I used https://codereview.appspot.com/6620057/#ps1)

Step 2: Choose and download your OS. I used Ubuntu 12.04 and my supervisor used Cent OS 5.4 (very old).

Step 3: When you are installing the packages (http://www.nsnam.org/wiki/Installation)  for Ubuntu do not install the GNU Scientific Library (GSL), it will cause your simulations to crash randomly. Look at this post to see that it is not very important anyway (https://groups.google.com/forum/#!searchin/ns-3-users/Importance$20of$20GNU$20Scientific$20Library$20(GSL)%7Csort:relevance/ns-3-users/YYS_qRDaoKo/ArOSTg4ffBAJ)

Step 3: Apply the patch. I used the following line: patch -p1 < issue6620057_1.diff

Step 4: You now need to update the constant-gain-antenna-model.cc file. You can find the file at src/antenna/model and overwrite it with the attached file.

Compile, and you should be good to go. If you have any problems or if you tested it with different versions of ns-3 and it works please let me know.

Ps. Ensure you read carefully how to properly set the direction of the antenna, as it can be confusing (I pointed my antennas upwards for a month and didn't realize it)

Jeremy Mack

 
constant-gain-antenna-model.cc

abdul

unread,
Aug 8, 2014, 10:26:50 AM8/8/14
to ns-3-...@googlegroups.com

Hi all,

Many thanks Jeremy and thanks to Brian who did the patch. I applied the steps and i compiled with success the ns-3.16. I use Fedora 19 with 64 bits machine.

However, can you please provide a simple example that use any type of the Antenna with a wifi node ?
Ii do not see any m_antenna property or SetAntennaModel () function , etc .. to attach an antenna to the yans-wifi-phy or yans-wifi-Channel objets !

Thanks in advance,

Abdulhalim

Jeremy Mack

unread,
Aug 8, 2014, 10:57:58 AM8/8/14
to ns-3-...@googlegroups.com
Hello Abdul,

Here is a snippet of my code that uses the directional antenna.


Ptr<ConstantGainAntennaModel> apAntsec1 = CreateObject<ConstantGainAntennaModel>();
    apAntsec1->SetGainInsidePattern(5); //Antenna gain in dB
    apAntsec1->SetGainOutsidePattern(-1000); //sidelobe gain outside the beam in dB
    apAntsec1->SetAzimuthBeamwidth(DegreesToRadians(120));
    apAntsec1->SetElevationBeamwidth(DegreesToRadians(90)); //ideal elevation pattern covering full elevation range

Ptr<ConstantOrientationModel> sector1ori = CreateObject<ConstantOrientationModel>();
sector1ori->SetAttribute ("Orientation", AnglesValue(Angles(DegreesToRadians(330),DegreesToRadians(90))));
apAntsec1->AggregateObject (sector1ori);
APdevice.Get(1)->GetObject<WifiNetDevice>()->GetPhy()->AggregateObject(apAntsec1);

Jeremy

abdulhalim dandoush

unread,
Aug 8, 2014, 11:00:57 AM8/8/14
to ns-3-...@googlegroups.com
Hello Jeremy,

I do not how to thank you,

With my best regards,

yours sincerely,

Abdulhalim


--
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/x0l7lXJXFZw/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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--

Yair Samson

unread,
Sep 10, 2014, 8:39:42 AM9/10/14
to ns-3-...@googlegroups.com
Hi Jeremy,

I am using NS-3.19 version.

I also followed your steps and tried to apply the patch, but it seem that it is not working correctly for me.

In the wscript file of bulid.new_tast_gen(features=['ns3header'])
This command isn't working to me, so i changed it to bulid(features=['ns3header']).

Also these commands doesn't work for me:
if (bld.env['ENABLE_EXAMPLES']):
         bld.add_subdirs('examples')
so i changed it to:
if (bld.env['ENABLE_EXAMPLES']):
         bld.recurse('examples')

I did these changes in orientation wscript, core wscript and antenna wscript.
I am not sure if should havedone these changes.
then after i am tying to compile the code i get an error..

Can you help me to figure it out ?

Regards,
Yair.

בתאריך יום רביעי, 30 ביולי 2014 21:09:52 UTC+3, מאת Jeremy Mack:

abdulhalim dandoush

unread,
Sep 10, 2014, 9:07:02 AM9/10/14
to ns-3-...@googlegroups.com
Yair,

The best to integrate the directional Antenna with wifi module, is to use ns-3.16 version.

Try to apply the patch to the ns-3.16 and tell me if it is okay or not.

However, the orientation model has to be modified also if you want to use transmitting and receiving Directional Antennas. Because in the current version we consider that the directional Antennas will be aggregated to the base stations (AP) and the users use usally omni-directional Antennas.

Anyway, try to write a very simple scenario to validate the results before going so far.

Hope that can help,

Abdulhalim

--
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/x0l7lXJXFZw/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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Yair Samson

unread,
Sep 15, 2014, 2:37:17 AM9/15/14
to ns-3-...@googlegroups.com
Hi,

Thank you Abdul for the help, I wanted to ask if u tried to integrate it with NS-3.19.
I need to add an antenna in the wifi model and change the orientation and more .. 
if you or any one else can help I would much appreciate it .

Regards,
Yair

בתאריך יום רביעי, 10 בספטמבר 2014 16:07:02 UTC+3, מאת abdul:

Jakub

unread,
May 23, 2015, 11:43:25 AM5/23/15
to ns-3-...@googlegroups.com
Hello Everybody, Anybody tried this Patch and had difficulties, I followed Exactly  Jeremy Mack steps but I still have compilation errors.

Please share your experience if you used this patch, or if you used it with a Later version of ns-3

Regards
Jakub

abdulhalim dandoush

unread,
May 23, 2015, 4:57:43 PM5/23/15
to ns-3-...@googlegroups.com
Hi Jakub,

Can you report here the error message ?

Regards,

Abdulhalim Dandoush

--
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/x0l7lXJXFZw/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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
May 23, 2015, 5:12:27 PM5/23/15
to ns-3-...@googlegroups.com
I will not comment on this one because I couldn't use nice words.

For future reference, and to avoid more questions, the status of the directional antenna support in ns-3.23 is the following.

The original Jeremy's repository added (basically) ONE feature: antenna orientation can be changed according to the node's movement. This could be interesting for moving objects (e.g., a vehicle). The orientation module has NOT been included in ns-3 yet. It could be included in the future.

Jeremy's repository added another small improvement: the ability for Wi-Fi to use directional antennas.
This is an extremely small and simple modification that could be included in ns-3 soon. The wifi module maintainer knows about it.

In order to use directional antennas with Wi-Fi, it is NOT necessary to apply the full patch. Applying it over ns-3.23 or any other version beside 3.16 will only lead to errors and bugs.
Using 3.16 is, for similar reasons, something that I'd suggest only to my worse enemy. Perhaps not even to him/her.

Last but not least, for the love of what you value the most... stop trying to use mindlessly instruction given more than 1 year ago for outdated ns-3 versions.
If one wants to follow outdated instructions and patches, he/she should proceed with extreme caution and must understand every single line of code that is going to be changed.
Any other approach will lead to my usual answer to who's using unsupported things: "TOO BAD".

Thanks,

T.

Jakub

unread,
May 25, 2015, 2:22:30 PM5/25/15
to ns-3-...@googlegroups.com
Thank you Tommaso, I am completely aware of the pain and time waste to use that much out of date solutions. I appreciate your advices. My main interest here as a biggener can fall in the educational category, I am following specific issues that interest me through out the manual and tutorial Study. Things such as VANET Routing Example, Redundancy, Mobility and DSRC-> Directional antenna. It would be interesting for me to see how this patch is working so I might edit the wifi files by myself. Also, Orientation is very interesting issue for the long term, at least for me.

If this open discussion is not recommended here, I will contact Abdul privately, hopefully he will kindly support me seeing why the patch is not working after following the exact instructions for ns-3.16.

Regards
Jakub

PS: Your comments everywhere on this forum is one of most interesting highlights I follow regarding NS3, so allow me to thank all your efforts here.

Tommaso Pecorella

unread,
May 25, 2015, 5:21:38 PM5/25/15
to ns-3-...@googlegroups.com
I agree about the orientation model. it could be interesting for vehicles (handhelds are too much complex, the antenna direction is not dependent on the node direction / speed).
I'd strongly suggest to NOT follow the original directions and download the repository as a tarball (fuck the autocorrection, I had to write it 3 times).

The changes are easy enough to be re-created on top of 3.23, and this is definitely the thing to do. The patch wouldn't work over recent ns-3 versions and 3.16 (as I said) too old to be used.

If you successfully forward-port the repository, feel free to contact the original authors and submit it for review.

Cheers,

T.

Tommaso Pecorella

unread,
May 25, 2015, 5:21:56 PM5/25/15
to ns-3-...@googlegroups.com
PS: thanks


On Monday, May 25, 2015 at 8:22:30 PM UTC+2, Jakub wrote:

abdulhalim dandoush

unread,
May 26, 2015, 5:52:59 AM5/26/15
to ns-3-...@googlegroups.com
Hi Jakub,

Let us take it on private.

I think that i will soon integrate these modules with ns-3.23 as Tommaso mentioned, it is better to be up to date.

Best,

Abdulhalim Dandoush

--
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/x0l7lXJXFZw/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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

mario.fe...@gmail.com

unread,
Sep 28, 2015, 4:22:56 AM9/28/15
to ns-3-users
Dear all, 
Thank you for the patch. 
However, I try to use this patch but i have some problems
It about 'compatibility' i think. 
I'm using MacOS and Xcode version 6.2.
Any suggestions ? 
Thank you :)
   



Le mercredi 30 juillet 2014 20:09:52 UTC+2, Jeremy Mack a écrit :
Capture d’écran 2015-09-28 à 10.20.18.png

mario.fe...@gmail.com

unread,
Sep 28, 2015, 4:48:26 AM9/28/15
to ns-3-users
I also try to install this patch in another computer under ubuntu 14.04 LTS and i get the following error, 
Any helps ? 
Thank you 


Le mercredi 30 juillet 2014 20:09:52 UTC+2, Jeremy Mack a écrit :
Capture du 2015-09-28 10_42_02.png

Konstantinos

unread,
Sep 28, 2015, 5:19:59 AM9/28/15
to ns-3-users
Hi Mario,

Why don't you search the error you get online first, and then, if you do not find a solution that does not work, come to the ns-3-users mailing list for further clarifications? 
That's the proper way to learn, not by always asking others to do the work for you.

Now, regarding the Ubuntu error, I search online for "unindent does not match outer identation level". Several answers conclude to the same solution:

Now, for your MacOS, your screenshot is a bit strange. Are you running your ns-3 from the trash folder? 
Try to clean and re-build. 
$ ./waf distclean 
$ ./waf configure (plus any other configuration parameters you might need)
$ ./waf

Generally, as OS/compilers update, they become stricter and you are trying to build some code that is on ns-3.16 (3-4yr old). 
Reply all
Reply to author
Forward
0 new messages