Antnet Algorithm

387 views
Skip to first unread message

Mili Patel

unread,
Sep 20, 2019, 9:27:00 PM9/20/19
to Network Simulator 2 (NS2)
I have succesfully patched antnet in NS-2.35 but antnet.tcl by Richardson Lima is for wired netowork. Can you tell me how to write code for antnet algorithm for wireless scenario? I also want to print routing table.

knudfl

unread,
Sep 21, 2019, 5:49:44 AM9/21/19
to Network Simulator 2 (NS2)
Wired? Are you sure?      antnet-examples-07.17.tar.gz
»»want to print routing table«« :   Works OK here. Examples are attached.

Anyway, "the later version"  AntHocNet  seems OK with the wireless examples.
And a version can print rtable :  anthocnet_print-rtable_ns235.patch
36rtable.txt
antnet-rtable.txt
ring__rtable.txt
save__rtable.txt

knudfl

unread,
Sep 21, 2019, 6:20:09 AM9/21/19
to Network Simulator 2 (NS2)
More  antnet  INFO ....


LINKs-anthocnet.txt
LINKs-antnet.txt

ayene zinabie

unread,
Sep 21, 2019, 8:34:58 AM9/21/19
to ns-u...@googlegroups.com
when i run "python /usr/local/src/sumo-0.32.0/tools/randomTrips.py -n map.net.xml -r map.rou.xml -e 50 -l" command on the terminal i faced the error =python: can't open file '/usr/local/src/sumo-0.32.0/tools/randomTrips.py': [Errno 2] No such file or directory . There for how can i fix it?   

On Sat, 21 Sep 2019 at 03:20, knudfl <knu...@ofir.dk> wrote:
More  antnet  INFO ....


--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-users/138eedbc-130d-4c09-a39c-55b0994c69dd%40googlegroups.com.

Mili Patel

unread,
Sep 21, 2019, 12:51:03 PM9/21/19
to Network Simulator 2 (NS2)
Yes I am getting routing table for this TCL files but they are using duplex link between nodes. We use duplex link between two nodes only for wired network right?

Mili Patel

unread,
Sep 21, 2019, 1:36:44 PM9/21/19
to Network Simulator 2 (NS2)
I am getting below error while installing ns-2.35 patch for anthocnet. Do you have any solution for this?

/anthocnet/ahn_protocol_utils.h:16:22: error: ‘constexpr’ needed for in-class initialization of static data member ‘const float AntHocNetUtils::ALFA’ of non-integral type [-fpermissive]
   const static float ALFA = 0.7;
                      ^~~~
./anthocnet/ahn_protocol_utils.h:18:22: error: ‘constexpr’ needed for in-class initialization of static data member ‘const float AntHocNetUtils::GAMA’ of non-integral type [-fpermissive]
   const static float GAMA = 0.7;
                      ^~~~
./anthocnet/ahn_protocol_utils.h:26:23: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double AntHocNetUtils::MIN_PHEROMONE’ of non-integral type [-fpermissive]
   const static double MIN_PHEROMONE = 0.00001;
                       ^~~~~~~~~~~~~
Makefile:93: recipe for target 'anthocnet/ant_packet.o' failed
make: *** [anthocnet/ant_packet.o] Error 1
Ns make failed!

On Saturday, September 21, 2019 at 3:49:44 AM UTC-6, knudfl wrote:
Message has been deleted
Message has been deleted

knudfl

unread,
Sep 21, 2019, 3:17:26 PM9/21/19
to Network Simulator 2 (NS2)
Conditions for ns2 :  An OS installed into a hard disk partition.
→  Don't use a virtual machine. Poor results with VirtualBox, wmWare since 2017.

? Which OS are you using ?   Name and version, please.

Build examples .... no errors
In /home/name/ns2/anthocnet/2/ :
$ tar xvf ns-allinone-2.35_gcc5.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNVVlxR0ZNRGVORjQ/view?usp=sharing
cd ns
-allinone-2.35/
patch
-p0 < anthocnet_ns235.patch
export CC=gcc-4.8 CXX=g++-4.8 && ./install             // no errors

/home/name/ns2/anthocnet/3/ :
$ tar xvf ns-allinone-2.35_gcc5.tar.gz
cd ns
-allinone-2.35/
patch
-p0 < anthocnet_print-rtable_ns235.patch
export CC=gcc-4.8 CXX=g++-4.8 && ./install             // no errors


save-2-rtable.txt
TextFile__print-Pheromon-Table.txt

Mili Patel

unread,
Sep 21, 2019, 4:42:10 PM9/21/19
to Network Simulator 2 (NS2)
I am using Vmware Workstation with Ubuntu 64 bit.

knudfl

unread,
Sep 21, 2019, 4:44:35 PM9/21/19
to Network Simulator 2 (NS2)
?  Which Ubuntu version ?

This command will tell ....
$ cat /etc/issue


Mili Patel

unread,
Sep 21, 2019, 4:52:50 PM9/21/19
to Network Simulator 2 (NS2)

Ubuntu 18.04.3 LTS

knudfl

unread,
Sep 21, 2019, 5:56:57 PM9/21/19
to Network Simulator 2 (NS2)
OK,  Ubuntu 18.04 ...

You can try with an old version which have none of the damaging updates:  Ubuntu 12.04.5 .
....  Then we will know if  wmWare is usable at all for Ubuntu with ns2.
Else : Use an ns2 friendly OS :  CentOS 6.10

knudfl

unread,
Sep 21, 2019, 5:59:08 PM9/21/19
to Network Simulator 2 (NS2)
P.S. :  Are you quite sure you were using  gcc / g++ version 4.8  ? ?

ayene zinabie

unread,
Sep 22, 2019, 3:54:50 AM9/22/19
to ns-u...@googlegroups.com
hi every body how was every thing is going on? when i run sumo-gui file.sumo.cfg on ubuntu termina the graphics is displayed or the map was displayed. but when i run the simulation the vehicle movement was not seen. there fore how can i fix these problems

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.

knudfl

unread,
Sep 22, 2019, 4:48:12 AM9/22/19
to Network Simulator 2 (NS2)

ayene zinabie

unread,
Sep 22, 2019, 5:42:26 AM9/22/19
to ns-u...@googlegroups.com
ok sorry!!  help me please another question: when i run mapwol.tcl on ubuntu terminals i faced the following errors.
num_nodes is set 49
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
can't read "nodes_(0)": no such variable
    while executing
"$ns_ initial_node_pos $nodes_($i) 20"
    ("for" body line 5)
    invoked from within
"for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion

$ns_ initial_node_pos ..."
    (file "mapwol.tcl" line 61)
please how can i fix it.

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.

knudfl

unread,
Sep 22, 2019, 7:12:58 AM9/22/19
to Network Simulator 2 (NS2)
@Academic Group of NS2.

Please do not ask off-topic questions.  This thread is about AntNet, AntHocnet only.



On Sunday, September 22, 2019 at 11:42:26 AM UTC+2, Academic Group of NS2 wrote:
ok sorry!!  help me please another question: when i run mapwol.tcl on ubuntu terminals i faced the following errors.
num_nodes is set 49
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
can't read "nodes_(0)": no such variable
    while executing
"$ns_ initial_node_pos $nodes_($i) 20"
    ("for" body line 5)
    invoked from within
"for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion

$ns_ initial_node_pos ..."
    (file "mapwol.tcl" line 61)
please how can i fix it.

On Sun, 22 Sep 2019 at 01:48, knudfl <knu...@ofir.dk> wrote:

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-u...@googlegroups.com.

Mili Patel

unread,
Sep 22, 2019, 1:11:13 PM9/22/19
to Network Simulator 2 (NS2)
No I was using gcc version 7.4. I tried to use gcc version 4.8 but it using latest version by default

knudfl

unread,
Sep 22, 2019, 1:30:30 PM9/22/19
to Network Simulator 2 (NS2)
Install gcc compilers, version 4.8 :
sudo apt install g++-4.8


Repeat :  The only allowed build command  is ....
cd ns-allinone-2.35/
export CC=gcc-4.8 CXX=g++-4.8 && ./install
      // copy - paste the complete line to the terminal ! !

»» ... but it using latest version by default «« :  May be if you are using a wrong command.

Mili Patel

unread,
Sep 22, 2019, 3:11:58 PM9/22/19
to Network Simulator 2 (NS2)
I have successfully installed using your commands. But when i tried to run 1-simple.tcl I am getting below error.
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
Antnet {
set ragent [$self create-antnet-agent $node]
}
DSR {
$self..."
    (procedure "_o3" line 14)
    (Simulator create-wireless-node line 14)
    invoked from within
"_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
"eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
"$ns node"
    ("for" body line 2)

    invoked from within
"for {set i 0} {$i < $val(nn) } { incr i } {
    set node_($i) [$ns node]
    $god_ new_node $node_($i)
}"
    (file "1-simple.tcl" line 64)

knudfl

unread,
Sep 22, 2019, 4:46:12 PM9/22/19
to Network Simulator 2 (NS2)
Missing simulation command ....
My tests
$ ns235-anthocnet-64 1-simple.tcl     // no errors
$
ns235-64-orig 1-simple.tcl             // same errors as you got

Conclusion :  You are running the file with a wrong copy of  'ns'
You are now supposed to have like /usr/local/bin/{ns, ns-orig, ns-antnet, ns-anthocnet}

Mili Patel

unread,
Sep 22, 2019, 4:47:03 PM9/22/19
to Network Simulator 2 (NS2)
I have successfully ran the program without error now. It was tcl error. I used different tcl file and now its working. Thank you so much for your guidance sir. Appreciate it.

Mili Patel

unread,
Sep 28, 2019, 11:50:14 AM9/28/19
to Network Simulator 2 (NS2)
Hi Sir,

How can I generate rtable for anthocnet. Its printing blank routing table. and rtable patch is not working on ubuntu. Can you tell me any code that I can add in simple anthocnet algorithm to print not blank routing table.

knudfl

unread,
Sep 28, 2019, 1:07:16 PM9/28/19
to Network Simulator 2 (NS2)
@Mili Patel ,  Hi.

`printPheromoneTable´ was discussed here → 11/20/18 -- 11/27/18
... A text file is attached.

I thus made a patch   anthocnet_print-rtable_ns235.patch
https://drive.google.com/file/d/16GYeq1Rpho82SilBxehMRONYSj5avIKh/view?usp=sharing

And today an alternative   anthocnet_print-rtable_ns234-gcc5.patch
https://drive.google.com/file/d/19z--u9koRlhY6SkHYKbZymwjqZ0FYnCj/view?usp=sharing
.... as AntHocNet simulations tend to do `Segmentation fault´ with ns-2.35.
I.e. the year 2019 updates of glibc / libc6 etc. is disturbing many ns2 simulations.

→ 11/27/18  ... I got an rtable.txt with text.  Today an empty file.
A solution can be to use an older OS.
  • May be you can edit the C++ code to show a better result ( printPheromoneTable.)
TextFile__print-Pheromon-Table.txt

knudfl

unread,
Sep 28, 2019, 1:39:38 PM9/28/19
to Network Simulator 2 (NS2)
@Mili Patel ,  Hi.

I got a result now.  With the file "print_rtable_0-low.tcl"  from (11/27/18)

$ ns234-anthocnet_print-rtable-64 print_rtable_0-low.tcl
rtable.txt :  20 lines.

And the same result with ns-2.35 ...
$ ns235-anthocnet_print-rtable-64 print_rtable_0-low.tcl


knudfl

unread,
Sep 28, 2019, 2:59:07 PM9/28/19
to Network Simulator 2 (NS2)
@Mili Patel

The nine "AntHocNet-print-r.table-ex" :  AntHocNet-print-r.table-ex.tar.gz  are attached.
AntHocNet-print-r.table-ex.tar.gz

Mili Patel

unread,
Sep 28, 2019, 10:59:15 PM9/28/19
to Network Simulator 2 (NS2)
Hi Sir,

Its still generating blank rtable for your given files also. I have followed all steps correctly.

Mili Patel

unread,
Sep 28, 2019, 11:02:40 PM9/28/19
to Network Simulator 2 (NS2)
when I run anthocnet-wrls1 it showing below error.

ls1.tcl
num_nodes is set 300

warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!
Missing required flag -x in: W -t 150

Missing required flag -y in: W -t 150

Parsing error in event.


On Saturday, September 28, 2019 at 11:59:07 AM UTC-7, knudfl wrote:

knudfl

unread,
Sep 29, 2019, 5:54:03 AM9/29/19
to Network Simulator 2 (NS2)
@Mili Patel

See e.g. :   examples-anthocnet-3/    → from anthocnet-examples-3.tar.gz
https://drive.google.com/file/d/1D1URYEaiKr6ZvqKGkbhULjTebFZiJ01R/view?usp=sharing
...  Since 2015 there has been a sign / an empty file "anthocnet-wrls1.tcl____IS-FOR-ns234".
1. Works OK with ns-2.34 ...   2. The year 2015 issues were with Ubuntu only

Today, with ns235 .... and the edited example Pr-anthocnet-wrls1.tcl (PCLinuxOS-2019)
$ ns235-anthocnet_print-rtable-64 Pr-anthocnet-wrls1.tcl
num_nodes
is set 300

warning
: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
channel
.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_
= 1.5,  distCST_ = 550.0
SORTING LISTS
...DONE!
end simulation
Files created: complex-ant.tr 295MB, complex-ant.tr 155MB, rtable.txt 6259 lines, win-complex-ant.tr 285kB.

You can just setup a few more "ns-allinone-2". This is what I have so far
home/knudfl/ns2/anthocnet/ns-allinone-2.34/ →/usr/local/bin/ns234-anthocnet (32)  (year 2015)
home
/knudfl/ns2/anthocnet/64/ns-allinone-2.34/ →/usr/local/bin/ns234-anthocnet-64
home
/knudfl/ns2/anthocnet/ns-allinone-2.35/ →/usr/local/bin/ns235-anthocnet (32)
home
/knudfl/ns2/anthocnet/64/ns-allinone-2.35/ →/usr/local/bin/ns235-anthocnet-64

home
/knudfl/ns2/anthocnet/PrintTable/ns-allinone-2.34/ →/usr/local/bin/ns234-anthocnet_print-rtable-64
home
/knudfl/ns2/anthocnet/PrintTable/ns-allinone-2.35/ →/usr/local/bin/ns235-anthocnet_print-rtable-64

The "rtable.txt" from Pr-anthocnet-wrls1.tcl is attached.
ns2-INFO.txt
rtable.txt

knudfl

unread,
Sep 29, 2019, 7:39:32 AM9/29/19
to Network Simulator 2 (NS2)
@Mili Patel,  Hi.

I found two executable´s : ns235-anthocnet-el6, ns234-AntHocNet-el7
... built with CentOS 6.10 (el6), and CentOS 7 (el7).

Ubuntu packages are available :
anthocnet-ns2_2.35-el6-ubuntu14_amd64.deb ( 2.4 MB ) 
https://drive.google.com/file/d/1SdS-LLc0p2MV_PKTaTPY4NgvtZt0gI1R/view?usp=sharing
Provides /usr/local/bin/ns235-anthocnet-el6
Provides /usr/local/bin/ns234-AntHocNet-el7

... These packages are complete run time ns-allinone´s :
/usr/local/bin/ns*** + the required tcl files in /usr/local/lib/anthocnet/**

Download ... and install both :
sudo gdebi Downloads/anthocnet-ns2_2.35-el6-ubuntu14_amd64.deb
sudo gdebi
Downloads/anthocnet-ns_2.34-1el7-ubuntu16_amd64.deb
.... Both will present very good results on your Ubuntu OS.

$ ns235-anthocnet-el6 anthocnet-wrls1.tcl
$
ns234-AntHocNet-el7 anthocnet-wrls1.tcl

ayene zinabie

unread,
Sep 29, 2019, 9:19:28 AM9/29/19
to ns-u...@googlegroups.com
Dear, I want to analysis  the result of .tcl files on Ns2. would you tell me please? how to analysis the result?

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-users/eb902bc2-d903-467d-8532-77cbf3b8b9b5%40googlegroups.com.

knudfl

unread,
Sep 29, 2019, 10:51:52 AM9/29/19
to Network Simulator 2 (NS2)
@Mili Patel

Some of analysis done by `ns2 APP-Tool´ are working ....

Not the most easy trace files to analyze.
You may have to do testing with a lot of the 240 scripts to find some usable


knudfl

unread,
Sep 29, 2019, 11:38:28 AM9/29/19
to Network Simulator 2 (NS2)
Another analyzing tool is the "dash script"  Metrics_Performance_Extractor.sh
I.e. works best with the dash shell  ( Default in Debian, Ubuntu.)

Metrics_Performance_Extractor.sh  and the complex-ant.tr result : Attached.

Note about awk :  $ apt install gawk
I.e. the default mawk is a minimal-featured awk designed for speed of execution over functionality.
Simulation_Result.result.txt
Metrics_Performance_Extractor.sh

Mili Patel

unread,
Sep 29, 2019, 8:25:03 PM9/29/19
to Network Simulator 2 (NS2)
Hi sir,

Its showing segment fault for ns235-el6. Its running perfectly for ns234-nl7 but when it generate rtable its blank again. Do you have any solution for this?

knudfl

unread,
Sep 30, 2019, 7:08:25 AM9/30/19
to Network Simulator 2 (NS2)
@Mili Patel

`rtable.txt´  is an empty file unless a patch like `anthocnet_print-rtable_ns234-gcc5.patch´ is used.

»Its showing segment fault«    Your command line is missing.  
Please be specific ... like    $ ns235-anthocnet-el6 stop130_Rtable__n100.tcl
.... I.e. the actual executable and the simulation.tcl must be visible in your text.

I can create a new package with e.g. /usr/local/bin/ns234-anthocnet_print-rtable-EL7
............   later today,  maybe.

Creation history:
Jan  6  2018 /usr/local/bin/ns234-AntHocNet-el7
Jan  5  2018 /usr/local/bin/ns235-anthocnet-el6

knudfl

unread,
Sep 30, 2019, 1:35:31 PM9/30/19
to Network Simulator 2 (NS2)
@Mili Patel ,   Hi.

The package "anthocnet-rtable-ns_2.34-el7-ubuntu16_amd64.deb"
https://drive.google.com/file/d/18SnzuNA68uCJlIFqFalik8RP0l-br6zm/view?usp=sharing
... was created with CentOS 7 - 1908  and  Ubuntu 16.04 - amd64.

Ubuntu 16.04 :
$ ns234-anthocnet-Rtable-el7 Pr-anthocnet-wrls1.tcl
→  rtable.txt, ~6000 lines is attached as Pr-w-rtable.txt

Pr-w-rtable.txt

Mili Patel

unread,
Sep 30, 2019, 10:39:50 PM9/30/19
to Network Simulator 2 (NS2)
Thank you Sir. Its working for the "anthocnet-rtable-ns_2.34-el7-ubuntu16_amd64.deb". Thank you so much for creating this deb file. Its generating rtbale now. So 1st column is source node, 2nd column indicating destination node and 3rd column is pheromone value of node, right?

knudfl

unread,
Oct 1, 2019, 3:58:13 AM10/1/19
to Network Simulator 2 (NS2)
@Mili Patel ,   Hi.

Please read my above post where  Print Pheromone table is mentioned: Sep 21
... And read the file  "TextFile__print-Pheromon-Table.txt"
and the link https://groups.google.com/forum/?fromgroups#!topic/ns-users/S8IRJccryCM , 11/27/18

A.
There is some pheromone text in the code: anthocnet_print-rtable_ns234-gcc5.patch
677:+   MapNodePheromone_it iter = this->pheromone_regular.find(ANT_ENTRY(neighbor, destination));
696:+   MapNodePheromone_it iter = this->pheromone_regular.find(ANT_ENTRY(neighbor, destination));
722:+   MapNodePheromone_it iter = this->pheromone_regular.find(node);
745:+   MapNodePheromone_it iter = this->pheromone_virtual.find(node);
763:+      MapNodePheromone_it it = this->pheromone_regular.begin();
808:+   const MapNodePheromone_it rend = this->pheromone_regular.end();
809:+   const MapNodePheromone_it vend = this->pheromone_virtual.end();
814:+           const MapNodePheromone_it iterR = this->pheromone_regular.find(ANT_ENTRY(neighbor, destination));
815:+           const MapNodePheromone_it iterV = this->pheromone_virtual.find(ANT_ENTRY(neighbor, destination));
889:+double PheromoneTable::sumProbability(MapNodePheromone pheromone_table, const nsaddr_t destination)
894:+   const MapNodePheromone_it tend = pheromone_table.end();
899:+           const MapNodePheromone_it iterT = pheromone_table.find(node);
924:+   const MapNodePheromone_it rend = this->pheromone_regular.end();
925:+   const MapNodePheromone_it vend = this->pheromone_virtual.end();
931:+           const MapNodePheromone_it iterR = this->pheromone_regular.find(ANT_ENTRY(neighbor, destination));
932:+           const MapNodePheromone_it iterV = this->pheromone_virtual.find(ANT_ENTRY(neighbor, destination));
980:+           MapNodePheromone pheromone_regular;
981:+           MapNodePheromone pheromone_virtual;
990:+           double sumProbability(MapNodePheromone pheromone_table, const nsaddr_t destination);
3556:+typedef std::map<NodeEntry, double> MapNodePheromone;
3557:+typedef MapNodePheromone::iterator MapNodePheromone_it;

B.
@Bijal Varia got a different result 
Routing table at node 0
4      1      0.007599
4      4      0.257193
Routing table at node 1
3      0      0.005100
3      3      0.255617
Routing table at node 2
3      3      0.510000
4      0      0.006000
4      4      0.759900
5      5      0.260113
Routing table at node 3

1      1      0.950819

.
.

ayene zinabie

unread,
Oct 1, 2019, 6:24:09 AM10/1/19
to ns-u...@googlegroups.com
Tanks a lot sir. do you have an idea to add RSU on the following .tcl files?
the tcl files are done using sumo and openstreet map and finally i tried to generat .tcl files to convert to Ns2. now i need to add RSU on the map.tcl. tanks for your willingness.

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.
map.zip

knudfl

unread,
Oct 1, 2019, 9:53:07 AM10/1/19
to Network Simulator 2 (NS2)
@Academic.....

Repeat :   Off topic questions are not appreciated in an antnet / anthocnet thread.


Mili Patel

unread,
Oct 8, 2019, 11:10:58 PM10/8/19
to Network Simulator 2 (NS2)
Hi Sir,

How can I add a malicious node in anthocnet protocol?. I want to analyze network behavior in presence of malicious nodes.  

knudfl

unread,
Oct 9, 2019, 7:02:20 AM10/9/19
to Network Simulator 2 (NS2)
@Mili Patel , Hi.

Simple malicious : aodv-malicious_ns234.patch
https://drive.google.com/drive/folders/0B7S255p3kFXNZ2lWZDBRSW40Q00?usp=sharing

cd ns-allinone-2.34/
( $ patch -p0 < anthocnet_print-rtable_ns234-gcc5.patch )
$ patch
-p0 < aodv-malicious_ns234.patch
$
export CC=gcc-4.8 CXX=g++-4.8 && ./install

aodv-malicious-examples-01.18.tar.gz
https://drive.google.com/file/d/1GYqoeZYwdZKOZ7mZjr6wq8Jx94Q18iIo/view?usp=sharing
Line 139, aomdv-m.tcl :
$ns at 0.0 "[$n(4) set ragent_] hacker"

Line 115,  wireless-aodv-malicious.tcl
$ns_ at 0.0 "[$node_(2) set ragent_] hacker"

Mili Patel

unread,
Oct 9, 2019, 4:01:23 PM10/9/19
to Network Simulator 2 (NS2)
Can I use anthocnet-malicious-ns2.34-gcc5 patch for my purpose and assign node as hacker in my tcl code? 

knudfl

unread,
Oct 9, 2019, 5:01:24 PM10/9/19
to Network Simulator 2 (NS2)
@Mili Patel .

Sorry, the patch does't work with "AntHocNet protocol", only with "AODV protocol".
My mistake.   I will post a new answer if I find a solution.

Mili Patel

unread,
Oct 9, 2019, 9:28:15 PM10/9/19
to Network Simulator 2 (NS2)
Okay sir.

Mili Patel

unread,
Oct 10, 2019, 4:05:09 PM10/10/19
to Network Simulator 2 (NS2)
Hi Sir,

How can I get average energy consumption for anthocnet trace file? I tired the awk and perl scripts from https://drive.google.com/drive/folders/1rU_MFAEl1GCLMTJPLR3zbxPxkQQHkQ7T?usp=sharing but it not seems working for energy consuption although I found throughput and PDR file working. DO you have any suggestion?

knudfl

unread,
Oct 10, 2019, 7:14:12 PM10/10/19
to Network Simulator 2 (NS2)
@Mili Patel ,   Hi.

You can try using "Metrics_Performance_Extractor.sh" :
The "Energy awk code" in the script works with anthocnet trace files →
Copy "out.tr" to a "new folder"
$ sudo apt install dialog
$ cd
[new folder with the script and out.tr]
$ dash
Metrics_Performance_Extractor.sh
I.e. one trace file at the time in the "Metrics_Performance_Extractor.sh  folder".
Metrics_Performance_Extractor.sh

Mili Patel

unread,
Oct 10, 2019, 8:43:37 PM10/10/19
to Network Simulator 2 (NS2)
I am getting below error while running dash metrics_permonace_extractor.sh.

rm: cannot remove '*.result'$'\r': No such file or directory
rm: cannot remove 'Trace_Cleaned.tr'$'\r': No such file or directory
rm: cannot remove 'Jitter/': No such file or directory
rm: cannot remove ''$'\r': No such file or directory
rm: cannot remove 'Delay/': No such file or directory
rm: cannot remove ''$'\r': No such file or directory
rm: cannot remove 'Forward/': No such file or directory
rm: cannot remove ''$'\r': No such file or directory
rm: cannot remove 'Packet_Loss/'$'\r': No such file or directory
rm: cannot remove 'Throughput/'$'\r': No such file or directory
rm: cannot remove 'Energy/'$'\r': No such file or directory
: not foundformance_Extractor.sh: 11: Metrics_Performance_Extractor.sh:
Metrics_Performance_Extractor.sh: 12: Metrics_Performance_Extractor.sh: Syntax error: word unexpected (expecting "do")

knudfl

unread,
Oct 11, 2019, 4:35:22 AM10/11/19
to Network Simulator 2 (NS2)
@Mili Patel

Harmless messages are supposed to be ignored.  As usual. (The second run is different.)

»»  : not found  «« :     Looks like a missing file.tr .
Note :  Metrics_Performance_Extractor.sh can usually do Energy. Everything else can / may be ignored.

Results :   See the four attached files. 
complex-ant.tr-Dialog.jpg
complex-ant.tr-output.txt
Second-run__snippet.txt
Simulation_Result.result.txt

Mili Patel

unread,
Oct 11, 2019, 11:25:02 AM10/11/19
to Network Simulator 2 (NS2)
Still getting same errors.

knudfl

unread,
Oct 11, 2019, 12:29:21 PM10/11/19
to Network Simulator 2 (NS2)
No errors were shown :  See my results.
All the messages you get, is the normal behavior when running ` Metrics_Performance_Extractor.sh´.

Please verify the following :
You have a directory with : ` Metrics_Performance_Extractor.sh´ and one trace file.
And that you do
cd Extractor-directory/
dash
Metrics_Performance_Extractor.sh

Mili Patel

unread,
Oct 11, 2019, 3:18:53 PM10/11/19
to Network Simulator 2 (NS2)
Yes Sir, I have done the same. or Is there any way that I can find all the data like delay, throughput , energy consumtion all from one file? I have used matrics.awk but It giving me same values even when I increase number of nodes.

knudfl

unread,
Oct 11, 2019, 3:27:11 PM10/11/19
to Network Simulator 2 (NS2)
@Mili Patel

»» all the data like delay, throughput , energy consumtion all from one file «« :

No.  Like some other protocols, only the few scripts matching the trace file will work.
There is no "general script" / a script with multiple functions for anthocnet.
Unless you write such a script yourself.

Mili Patel

unread,
Oct 11, 2019, 3:32:06 PM10/11/19
to Network Simulator 2 (NS2)
okay sir. Thank you so much. And have you figured out a way to add malicious node into anthocnet?

Mili Patel

unread,
Oct 17, 2019, 1:36:58 PM10/17/19
to Network Simulator 2 (NS2)
hi Sir,

Can I implement black hole attach into AntHocNet environment? 

Mili Patel

unread,
Nov 11, 2019, 11:41:27 AM11/11/19
to Network Simulator 2 (NS2)
Hello Sir,

Have you found a way to implement malicious nodes in the anthocnet?

knudfl

unread,
Nov 11, 2019, 1:13:03 PM11/11/19
to Network Simulator 2 (NS2)
Hi.

Sorry, no.
The anhocnet/
├── ahn_ant_nest.cc
├── ahn_ant_nest.h
├── ahn_pheromone_table.cc
├── ahn_pheromone_table.h
├── ahn_protocol_utils.h
├── ahn_router.cc
├── ahn_router.h
├── ahn_traffic.h
├── ant_packet.cc
├── ant_packet.h
├── ant_types.h
.....  code is too different from the aodv, zrp files, that we have malicious / blackhole code for.
But then again, you could do some experiments with code :
Setup a couple of extra ns-allinone, you know you can have as many as you want, at the same time.

Mili Patel

unread,
Nov 14, 2019, 9:46:19 AM11/14/19
to Network Simulator 2 (NS2)
I have one more question sir. When I am increasing no of nodes from 10 to 50 like 10,20,30 .. 50 Packet Delivery Ratio (PDR) is decreasing very rapidly for 10 nodes it is 0.87 for 20 nodes it is 0.67 and for 50 it is 0.2. When I am seeing other paper for anthocnet they are having very small difference and their PDR is minimum in range of 0.9-0.8 for even 100 nodes. Do you have idea how can I overcome this issue?

knudfl

unread,
Nov 14, 2019, 10:32:53 AM11/14/19
to Network Simulator 2 (NS2)
Hi.

Example :  n100.tcl .... 100 nodes
$ ns234-anthocnet-64 n100.tcl        ## out.tr = 3.1GB
$ awk -f PDR.awk out.tr
cbr s:259048 r:254413, r/s Ratio:0.9821, f:665042

The result very much depends on the simulation used.
....  No exact answer can be posted for unknown simulation files.  Please specify file names.
PDR.awk

knudfl

unread,
Nov 14, 2019, 11:14:18 AM11/14/19
to Network Simulator 2 (NS2)
Ex 2 :  nn 81, 80low-ant.tr 48.3MB, stop 300
$ ns234-anthocnet-Rtable-el7 81Z-print-zaki.tcl  
 
$ awk -f PDR.awk 80low-ant.tr
cbr s:49140 r:49102, r/s Ratio:0.9992, f:678

------------

Ex 3 :  nn 100, 99low.tr = 63.3MB, stop 400
$ ns234-anthocnet-Rtable-el7 99Z-print-zaki.tcl  

$ awk -f PDR.awk 99low.tr
cbr s:65680 r:65642, r/s Ratio:0.9994, f:678

-----------
99Z-print-zaki.tcl
81Z-print-zaki.tcl

Mili Patel

unread,
Nov 14, 2019, 8:16:13 PM11/14/19
to Network Simulator 2 (NS2)
Why we using channe;l 1 and 2 in 99z-print-zaki.tcl? I am using m40.tcl which I attached here.
m40.tcl
m50.tcl

Mili Patel

unread,
Nov 14, 2019, 10:39:14 PM11/14/19
to Network Simulator 2 (NS2)
I want to send packet from one end to another end. In 99z-print-zaki.tcl file its only sending data from 0 to 1 which are neighbors. They are not utilizing another nodes. When I set tcp connection for both end nodes 30 and 19 in 99Z-print-zaki.tcl file its giving me 0.76 PDR. Can you give me guidance why is it happening?


On Thursday, November 14, 2019 at 8:14:18 AM UTC-8, knudfl wrote:

knudfl

unread,
Nov 15, 2019, 4:19:14 AM11/15/19
to Network Simulator 2 (NS2)
Analyzing ....
$ awk -f PDR.awk ant40.tr
cbr s:613 r:78, r/s Ratio:0.1272, f:12210
$ awk -f PDR.awk ant50.tr
cbr s:234 r:64, r/s Ratio:0.2735, f:11484

»» Why are we using channe;l 1 and 2 in 99z-print-zaki.tcl «« :
I have no idea :  The original "zaki.tcl" is by @zakizakizaki
→  "no name tcl.txt"

You are welcome to edit "[example].tcl" to any other functionality (and a new file name.)

hafte agebash

unread,
Nov 15, 2019, 7:08:38 AM11/15/19
to ns-u...@googlegroups.com
1, Can we do clustering in flat AODV? If so how?
2, what will a solution for the next error ?

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.
IMG_20191115_140930.jpg

knudfl

unread,
Nov 15, 2019, 8:56:48 AM11/15/19
to Network Simulator 2 (NS2)
@hafte agebash.

1.  You cannot ask off topic questions in other people´s threads.
....  if you want an answer.

2.  Images with text will not be read :
" You should avoid posting pictures of text. Pictures can be hard to read. Text is easier to read in different screen formats, can be copied and pasted, as well as is search engine addressable, making it easier for people to reach this post who may have a similar issue. "
.... My comment :   I guess you know how to copy-paste a text.
Or redirect the output to a file :  SomeCommand > SomeFile.txt


hafte agebash

unread,
Nov 15, 2019, 2:40:56 PM11/15/19
to ns-u...@googlegroups.com
Okey I gar you Dear knudfi, I will rewrite it again 

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.

hafte agebash

unread,
Nov 15, 2019, 3:04:09 PM11/15/19
to ns-u...@googlegroups.com
the mobile node has the ability to send and receive packets simultaneously through multiple channels to or from different adjoining nodes
To divide alloted frequency in to multiple
https://www.tandfonline.com/doi/abs/10.1080/15501320802555130?journalCode=udsn20

Mili Patel

unread,
Nov 17, 2019, 1:34:02 PM11/17/19
to Network Simulator 2 (NS2)
Okay. Thank you sir. I want to compare antsense and anthocnet algorithm. I found code file from web for antsense. Do you have any suggestion how can I implement this code in ns-2. I have attached file here.
antsense.cc
antsense.h
antsense_pkt.h
antsense_queue.cc
antsense_queue.h
neighbour_table.cc
neighbour_table.h
antnetnew.doc

knudfl

unread,
Nov 19, 2019, 11:32:07 AM11/19/19
to Network Simulator 2 (NS2)
Hi.

Antsense :  Fails at link time. (No compile errors) See `Error-antsense.txt´.
The patch :  2-pre_antsense_ns235.patch.txt
.... The antsense files were meant for ns-2.27 / ns-2.28 :
      I tried replacing the problematic files (dsdv/*) with the slightly different ns228 files. No luck.
I hope you can figure out the C++ code / the math.

Antsense links
antsense.pdf
p8_4_10.pdf
2-pre_antsense_ns235.patch.txt
Error-antsense.txt

Derek Derek

unread,
Mar 29, 2021, 3:52:28 AM3/29/21
to Network Simulator 2 (NS2)
Hi.
    I downloaded these files and modified the code(just change RoutingTable to AntRoutingTable), compile was OK.
    The following command failed:

[xdev@localhost antnet-examples-07.17]$ ns antnet-1.tcl 
ns: 
[code omitted because of length]
: invalid command name "Agent/ANTSENSE"
    while executing
"Agent/ANTSENSE instproc init args {
$self next $args
}"
[xdev@localhost antnet-examples-07.17]$

knudfl

unread,
Mar 29, 2021, 5:21:56 AM3/29/21
to Network Simulator 2 (NS2)
@tda

"Build example" is still like this ......
→  In /home/name/ns2/antnet/ :
tar xvf ns-allinone-2.35_gcc5.tar.gz 
cd ns-allinone-2.35/
patch -p0 < antnet_ns235.patch
export CC=gcc-4.8 CXX=g++-4.8 && ./install 
cd ns-2.35/
cp ns ns-antnet
sudo cp ns-antnet /usr/local/bin/
------------- Simulation -------------------
ns-antnet antnet-1.tcl 

»» I downloaded these files .... «« : Impossible to know what you got.
»» modified the code ... changed RoutingTable to AntRoutingTable «« : Why ? ?
.......... Please show what you did.

Derek Derek

unread,
Mar 29, 2021, 11:02:19 PM3/29/21
to Network Simulator 2 (NS2)
@knudfl
I did the followings:
1. patch antnet(antnet_ns235.patch), compile, everything is ok
2. patch antsense( 2_pre_antsense_ns235.patch ), there is compile error(as Error-antsense.txt), I fix with AntRoutingTable
3. run ns antnet-1.tcl, there is error

[code omitted because of length]
: invalid command name "Agent/ANTSENSE"
    while executing
"Agent/ANTSENSE instproc init args {
$self next $args
}"
I checked antnet_ns235.patch and 2_pre_antsense_ns235.patch, couldn't find out the reason

knudfl

unread,
Mar 30, 2021, 3:44:41 AM3/30/21
to Network Simulator 2 (NS2)
@tdk

Antsense doesn't work as is.      Hence "pre".  Please read the above posts.

The advanced "antnet" is anthocnet.  Also discussed in the above posts. 

knudfl

unread,
Mar 30, 2021, 5:44:30 AM3/30/21
to Network Simulator 2 (NS2)
@tdk

»» I fix with AntRoutingTable «« :    ? Which file(s) were edited ? Please show ... with line numbers.

»» [code omitted because of length] «« :  This will often mean surplus / wrong expressions in tcl/lib/ns-default.tcl

Derek Derek

unread,
Mar 31, 2021, 10:02:53 PM3/31/21
to Network Simulator 2 (NS2)
@knudfl
Please check the patch:
antsense_fix_compile_patch.txt

knudfl

unread,
Apr 1, 2021, 4:49:58 AM4/1/21
to Network Simulator 2 (NS2)
@tdk

Example check / test :
$ cd new-folder/antsense/         ## where antsense/ is the original year 2015 antsense.zip code
$ patch -p0 < antsense_fix_compile_patch.txt 
patching file antsense/antsense.cc
patching file antsense/antsense.h
patching file antsense/neighbour_table.cc
patching file antsense/neighbour_table.h
                     ## and we now have a fixed "antsense/" directory.

tar xvf ns-allinone-2.35_gcc5.tar.gz 
cd ns-allinone-2.35/
patch -p0 < pre_antsense_ns235.patch-2.txt
cd ns-2.35/
                ## and replace antsense/ with  the "antsense/" fixed code.
export CC=gcc-4.8 CXX=g++-4.8 && ./install
............... and the executable ns is created in ns-2.35/ ......  No errors.

* If you want to combine with the AntNet code ( antnet_ns235.patch) :  
* I guess you will have to edit tcl/lib/{ns-default.tcl  ns-lib.tcl  ns-mobilenode.tcl  ns-packet.tcl} to avoid [code omitted because of length]
* I.e. you cannot have conflicting / double / surplus expressions in tcl/lib/ns*

knudfl

unread,
Apr 1, 2021, 5:39:43 AM4/1/21
to Network Simulator 2 (NS2)
@tdk

Further edits to `pre_antsense_ns235.patch-2´ :
........ The five lines in tcl/lib/ns-default.tcl →
#Agent/ANTSENSE set num_nodes_x_ 4
#Agent/ANTSENSE set num_nodes_y_ 4
#Agent/ANTSENSE set num_nodes_ 16
#Agent/ANTSENSE set r_factor_ 0.001
#Agent/ANTSENSE set timer_ant_ 0.03
...... To be commented out or delete ....  to avoid  [code omitted because of length]
.... i.e. it seems that  "Agent/ANTSENSE"  isn't valid.

Derek Derek

unread,
Apr 1, 2021, 9:56:15 PM4/1/21
to Network Simulator 2 (NS2)
@knudfl

Thanks a lot, there isn't error when runs ns.
BTW, is there basic script to try antsense?

knudfl

unread,
Apr 2, 2021, 7:05:52 AM4/2/21
to Network Simulator 2 (NS2)
tdk

Suggest :  Google,   antsense.tcl
.... but I didn't find any examples ... sorry.
This is the old information from my storage :
Reply all
Reply to author
Forward
0 new messages