how to add a new mobility model in ns3 library

677 views
Skip to first unread message

kanta kaliramana

unread,
Aug 6, 2015, 2:32:48 AM8/6/15
to ns-3-users
Hello Sir
I am trying to add a new mobility model in ns3 library but i have no idea how to add. Please suggest me.

Jack Higgins

unread,
Aug 6, 2015, 2:54:20 AM8/6/15
to ns-3-users

Dear Kanta,

Please check the tutorial and the manual before doing modifications.

The information you are looking for is in the following page:

https://www.nsnam.org/docs/manual/html/new-modules.html

kanta kaliramana

unread,
Aug 6, 2015, 8:32:06 AM8/6/15
to ns-3-...@googlegroups.com
Thank you  sir, This tutorial is very helpful for me.I read this tutorial and i added new mobility model in ns3 library but in this folder only these folders are included namely -doc, examples, helper, model, test, and wscript. Bindings folder are not  included there so what i do to include this folder. please guide me sir.

--
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/vvYYUBWUvuA/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,
Aug 6, 2015, 8:54:50 AM8/6/15
to ns-3-users
Hi,

the "bindings" folder is auto-generated and is present in all the modules.
Make sure to be using the latest ns-3 (we're at 3.23 right now) and be sure to understand the tutorial and manual.
As an example, you say "i added new mobility model in ns3 library". This is either a very bad case of language barrier (it could be) or you didn't understand the tutorial at all.
Please try to be specific and describe your problem in detail, otherwise the answer will always be "study the tutorial".

Thanks,

T.
Message has been deleted

kanta kaliramana

unread,
Aug 7, 2015, 6:13:51 AM8/7/15
to ns-3-users
hello sir ,
Thanks for the reply.
Sir as u suggested to me to go through the tutorial . I did it , follow the steps which are given there to create the new mobility model, My aim is to create the new mobility model by making some modification and improvement in the existing model.As the things instructed in the tutorial I follow the steps but building directories did not create.. so please suggest me that how I can create the building directories.

with Regards
KANTA  

Tommaso Pecorella

unread,
Aug 7, 2015, 7:04:41 AM8/7/15
to ns-3-users
Hi,

if you want to enhance the existing models, probably the best thing is to modify the mobility model files by adding your classes there. Again, please study (in this case the manual) and understand where to place your files and how to add them to the general ns-3 libraries.

This manual section will guide you through the creation of a new model, but studying it you'll understand also how to add a new class to an existing module.
T.

kanta kaliramana

unread,
Aug 10, 2015, 1:25:15 AM8/10/15
to ns-3-...@googlegroups.com
Hello Sir
I have follow the instruction and create  ".cc" & ".h" file. When I test the module using this configure command
"$ ./waf configure --enable-examples --enable-tests" it configures.But the problem is when I "./waf  build"  I get the error "Could not find a task generator for the name 'ns3-application'". I would really appreciate if you could let me know where  the problem is.


Tommaso Pecorella

unread,
Aug 10, 2015, 2:50:31 AM8/10/15
to ns-3-users
Not enough info sorry.
1) What kind of instructions ?
2) Where did you place your files ?
3) A reconfiguration shouldn't be needed for a new class - just or a new module, but it seems that you're not creating a new module
4) The error log is incomplete and it doesn't give much space or a guess.

Please provide a detailed explanation of the problem.

T.

kanta kaliramana

unread,
Aug 10, 2015, 6:25:57 AM8/10/15
to ns-3-...@googlegroups.com
hello sir
firstly I create a new module according to this tutorial "https://www.nsnam.org/docs/manual/html/new-modules.html" at ns-allinone-3.20/ns-3.20/src/new-module.It generate ".cc" & ".h" file in new-module/model. I copied both ".cc" & ".h" file and place it in ns-allinone-3.20/ns-3.20/src/mobility/model. After that I followed https://www.nsnam.org/docs/manual/html/new-models.html tutorial and added class in both ".cc" & ".h"  file according to this tutorial. After that I modified "mobility/wscript" added these files in wscript file namely:  'model/new-mobility-model.cc', 'helper/new-mobility-model-helper.cc', 'test/new-mobility-model-test-suite.cc', 'model/new-mobility-model.h', 'helper/new-mobility-model-helper.h',. After that when I run "./waf build" it generating error: "could not find a task generator for the name 'ns3-application' " please check this method is correct or not.


Tommaso Pecorella

unread,
Aug 10, 2015, 6:43:11 AM8/10/15
to ns-3-users
Hi,

it could be mostly correct, it depends on where did you place your new files and how you named them.
The point is: the new files created by the automatic script are meant to be used for a new module, not to generate files for an existing one. nevertheless, they should be (mostly) ok.
Please attach the src/mobility/wscript file (attach, don't copy) and copy-paste the directory structure of the mobility model (try using "ls -lR src/mobility").

T.

kanta kaliramana

unread,
Aug 10, 2015, 8:24:24 AM8/10/15
to ns-3-...@googlegroups.com
Hello Sir..

I placed my file at "/home/system/Desktop/ns-allinone-3.20/ns-3.20/src/mobility/model" .
My Mobility model name  that I include in wscript file:

'model/kaliramana-mobility-model.cc',
'helper/kaliramana-mobility-model-helper.cc'

please check the attached wscript file.

Thank You

KANTA


wscript

Tommaso Pecorella

unread,
Aug 10, 2015, 9:31:44 AM8/10/15
to ns-3-users
The wscript failed to be attached.

T.

kanta kaliramana

unread,
Aug 10, 2015, 11:21:47 AM8/10/15
to ns-3-...@googlegroups.com
Hello
Sorry Sir..
For Inconvenience,please check now

Thank you
KANTA


wscript

Tommaso Pecorella

unread,
Aug 10, 2015, 11:35:05 AM8/10/15
to ns-3-users
Again, no wscript.
copy-paste its content.

T.

kanta kaliramana

unread,
Aug 11, 2015, 12:50:44 AM8/11/15
to ns-3-users
hello sir........
good morning
I just copied the wscript content in doc file and I uploaded it . Please refer it and let me know where I did the mistake. I will appraise  your suggestion.

Regards
KANTA
Mode.docx

Tommaso Pecorella

unread,
Aug 11, 2015, 8:45:50 AM8/11/15
to ns-3-users
Hi,

it all seems to be correct. The only thing I can guess is that you somewhat changed or added some other files beside the ones we're talking about.
The message "could not find a task generator for the name 'ns3-application'" is referring to a wrong module name (one named "application"), probably referred by some wscript.
Double check to not have renamed an existing folder in the src directory, or to have removed the older you created with the automated script.

T

kanta kaliramana

unread,
Aug 12, 2015, 2:25:28 AM8/12/15
to ns-3-users
hello sir
As we followed the procedure you suggested us but got the same error. As you suggested us to check the folder in src directory. My doubt here is that I did not found the folder of any other mobility model in src directory  so ,  is it  necessary to put the folder of new model in src directory.
Second doubt is that I checked that there are only one folder in src directory but again i got the same error which I discussed previously...........
So please help me .

Regards
KANTA

Tommaso Pecorella

unread,
Aug 12, 2015, 3:05:53 AM8/12/15
to ns-3-users
Hi,

I'm sorry but I can't help you much. There is an evident language issue, and either you are unable to properly explain what you did and what is the status of your code, or I'm completely unable to understand it.

Again, the error you said (Could not find a task generator for the name 'ns3-application') is generated when the build system (i.e., waf) doesn't find the necessary files to build a module, or when there is an error in a wscript, or something similar.
I do assume that you did try a "waf distclean" followed by a "waf configure" and a "waf", because these are the very first things to do, and they are well explained in the manual.

The only thing to do before asking to send the whole src directory is to start from a clean ns-3 install and just add the files where you want them to be (i.e., in the mobility module).

T.

kanta kaliramana

unread,
Sep 2, 2015, 3:50:38 AM9/2/15
to ns-3-...@googlegroups.com
Hello sir,
Thank You, finally I solved this problem and now I am  trying to add bound parameter, inner and outer bound in my Mobility Model.  but i have no idea. can I add two bound value in  mobility model if yes then how can I add please suggest me Sir.

KANTA

Konstantinos

unread,
Sep 2, 2015, 4:04:49 AM9/2/15
to ns-3-users
Hi Kanta,

The are examples of MobilityModels that have bounds. 
For example the RandomDirection2DMobilityModel has only one Bound, that the nodes can move within it.
You could create two such attributes, one outer and one inner bound.
Then when you update the position of the nodes, you have to check two conditions, one be inside the outer bound and second to be outside the inner bound
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

kanta kaliramana

unread,
Sep 4, 2015, 3:02:08 AM9/4/15
to ns-3-...@googlegroups.com
Hello Sir,
when I add inner bound attribute in my program  then I also  create a innerbox.h and innerbox.cc program and include these files in my main program when I run it then I get an error given below.please help me to solve these error.

kanta@kanta-HP-ProBook-4530s:~/Desktop/ns-allinone-3.20/ns-3.20$ ./waf --run scratch/kk
Waf: Entering directory `/home/kanta/Desktop/ns-allinone-3.20/ns-3.20/build'
[1750/2332] cxx: src/mobility/model/kaliramana-mobility-model.cc -> build/src/mobility/model/kaliramana-mobility-model.cc.1.o
[1996/2332] cxx: scratch/kk.cc -> build/scratch/kk.cc.8.o
../src/mobility/model/kaliramana-mobility-model.cc: In static member function ‘static ns3::TypeId ns3::KaliramanaMobilityModel::GetTypeId()’:
../src/mobility/model/kaliramana-mobility-model.cc:31:76: error: no matching function for call to ‘ns3::BoxValue::BoxValue(ns3::InnerBox)’
../src/mobility/model/kaliramana-mobility-model.cc:31:76: note: candidates are:
./ns3/box.h:111:1: note: ns3::BoxValue::BoxValue(const ns3::Box&)
./ns3/box.h:111:1: note:   no known conversion for argument 1 from ‘ns3::InnerBox’ to ‘const ns3::Box&’
./ns3/box.h:111:1: note: ns3::BoxValue::BoxValue()
./ns3/box.h:111:1: note:   candidate expects 0 arguments, 1 provided
./ns3/box.h:111:1: note: ns3::BoxValue::BoxValue(const ns3::BoxValue&)
./ns3/box.h:111:1: note:   no known conversion for argument 1 from ‘ns3::InnerBox’ to ‘const ns3::BoxValue&’
../scratch/kk.cc: In function ‘int main(int, char**)’:
../scratch/kk.cc:185:90: error: no matching function for call to ‘ns3::MobilityHelper::SetMobilityModel(const char [29], const char [7], ns3::BoxValue, const char [12], ns3::BoxValue, const char [9], ns3::TimeValue, const char [6], ns3::DoubleValue, const char [13], ns3::StringValue, const char [14], ns3::StringValue, const char [10], ns3::StringValue, const char [15], ns3::StringValue, const char [16], ns3::StringValue, const char [12], ns3::StringValue)’
../scratch/kk.cc:185:90: note: candidate is:
./ns3/mobility-helper.h:121:8: note: void ns3::MobilityHelper::SetMobilityModel(std::string, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&, std::string, const ns3::AttributeValue&)
./ns3/mobility-helper.h:121:8: note:   candidate expects 19 arguments, 21 provided
Waf: Leaving directory `/home/kanta/Desktop/ns-allinone-3.20/ns-3.20/build'
Build failed

 -> task in 'ns3-mobility' failed (exit status 1):
    {task 154061708: cxx kaliramana-mobility-model.cc -> kaliramana-mobility-model.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-I.', '-I..', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../src/mobility/model/kaliramana-mobility-model.cc', '-c', '-o', 'src/mobility/model/kaliramana-mobility-model.cc.1.o']
 -> task in 'kk' failed (exit status 1):
    {task 157573420: cxx kk.cc -> kk.cc.8.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-fno-strict-aliasing', '-fwrapv', '-fstack-protector', '-fno-strict-aliasing', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/i386-linux-gnu/gtk-2.0/include', '-I/usr/include/atk-1.0', '-I/usr/include/cairo', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/pango-1.0', '-I/usr/include/gio-unix-2.0', '-I/usr/include/glib-2.0', '-I/usr/lib/i386-linux-gnu/glib-2.0/include', '-I/usr/include/pixman-1', '-I/usr/include/freetype2', '-I/usr/include/libpng12', '-I/usr/include/libxml2', '-I/usr/include/python2.7', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '-DNDEBUG', '../scratch/kk.cc', '-c', '-o', 'scratch/kk.cc.8.o']


Konstantinos

unread,
Sep 4, 2015, 4:19:37 AM9/4/15
to ns-3-users
Hi,

Please read the error you get:

error: no matching function for call to ‘ns3::BoxValue::BoxValue(ns3::InnerBox)’

You might have specified the class for InnerBox, but this is not enough. Your mobility model is expecting a 'simple' Box type not an InnerBox type.
In my opinion, there was no need to create a new class for inner box, you just had to check that nodes move outside of that 'inner' box and inside of the 'outer' box.
Both of them are of the same class ns3::Box.
To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

--
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/vvYYUBWUvuA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages