LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   K-means Algorithom code in ns2 (https://www.linuxquestions.org/questions/linux-networking-3/k-means-algorithom-code-in-ns2-4175537455/)

Rizwanamalek 03-21-2015 12:48 PM

K-means Algorithom code in ns2
 
Is any one have k-means clustering algo source code in .tcl formate for ns2.34?

Rizwanamalek 03-22-2015 01:46 PM

Any one have k-means code in .tcl formate please reply me.

knudfl 03-22-2015 03:26 PM

Google, k-means.tcl
https://www.google.com/webhp?hl=all&...&q=k-means.tcl

The first hit is http://wiki.tcl.tk/11147
>>> SimpleKMeans.tcl

And kmeans.tcl : http://en.pudn.com/downloads581/doc/...380916_en.html
. http://www.cs.cmu.edu/afs/cs/project...tcl/kmeans.tcl


Google, ns2 kmeans.tcl
https://www.google.com/webhp?hl=all&...s2+k-means.tcl
. http://en.pudn.com/downloads26/sourc...l83627_en.html
. http://ns2-master.blogspot.dk/2012/0...using-tcl.html
. http://www.coep.org.in/page_assets/341/121003017.pdf
. http://dk.wow.com/search?s_pt=aolsem...ring&ifmobile=
. http://dk.wow.com/search?q=k+means+c...=mid_relsearch


-

Rizwanamalek 03-23-2015 05:16 AM

1 Attachment(s)
Thank you sir for your reply i got the code of k-means algo in .TCL formate.
I have to apply this code on LEACH protocol in WSN. For that i have refered http://nile.wpi.edu/NS/ and based on this for applying k-means i have to configure the nodes? and i have to change in make file? and afte that i have to run make command?

knudfl 03-23-2015 06:19 AM

Ref. post #4.

New objects are added to the Makefile.in : Like leach.
Line 76 : <TAB>-I./mit/rca -I./mit/uAMPS
Line 221: <TAB>mit/rca/energy.o mit/rca/rcagent.o \
Line 222: <TAB>mit/rca/rca-ll.o mit/rca/resource.o \

... and you can then run ./install in the top directory ns-allinone-2.34/:
$ export CC=gcc<?> CXX=g++<?> && ./install
... to create a new executable 'ns'


-

Rizwanamalek 03-23-2015 09:39 AM

lines 76 ,221,and 222 is already there in make.in file. And i have performed $ export CC=gcc4.3 CXX=g++4.3 && ./install in implemantation of leach-ns234-patching.tar.gz.I want to know 1] how can i apply this k-means.tcl on LEACH protocol? 2]how can i get output?

knudfl 03-23-2015 10:13 AM

The listed "kmeans.tcl" files are configuration files.
And I guess that the right kmeans.tcl can be added like the also added mit/uAMPS/ns-pegasis.tcl
... It is a pure guess : I have not found any k-means "build examples".
So you may be left with what you can find out yourself.

Rizwanamalek 03-23-2015 11:52 AM

I explain in detail that, I have installed centos and ns2.34. In this i have implemented LEACH using leach-ns234-patching.tar.gz. As given in my base paper i have to apply this k-means algo on LEACH protocol. This algo for cluster formation. I have not found any link or reference from which i know how to apply this k-means.tcl to LEACH protocol? If you have any reference or link about how to apply this code on LEACH protocol? Please forward me.

Rizwanamalek 03-24-2015 12:26 AM

Sir , I have not found any information related to how to apply this .tcl algo on LEACL protocol. If you have any example please reply me?

Rizwanamalek 03-24-2015 03:05 AM

Reply me if you have any related information or link it is important for me how can i apply this kmeans.tcl algo on Leach protocol?

haitam09 10-08-2015 07:17 AM

How to implemente kmeans.tcl in leach
 
Hi Sir Rizwanamalek,

I have the same problem.

i want to implement k means clustering leach into underlying ns2.34 but i have problems to configure it.

if have resolved this, please help me.my email : haitam09@hotmail.fr

Thanks in advance.

haitam09 12-29-2015 05:02 AM

NS2 leach protocol :error "error when calling class $cls: $args" $
 
1 Attachment(s)
Hello friends,
I want to simulate network of 30 noeuds by using kmeans method of clustering on leach protocol in WSN.
Please help me.
thanks in adavances
But when i run my kmeansleach.tcl script, it gives me the error following :
num_nodes is set 30
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

(_o14 cmd line 1)
invoked from within
"_o14 cmd addr"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o14" line 2)
(SplitObject unknown line 2)
invoked from within
"_o14 addr"
("eval" body line 1)
invoked from within
"eval $node addr $args"
("default" arm line 2)
invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
(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 < $NETWORK_NODE } { incr i } {
set node($i) [$ns node]
}"
(file "kmeansleach.tcl" line 49)
===================================================================================
kmeansleach.tcl is attached

knudfl 01-09-2016 04:36 PM

Re #12, @haitam09.

Looks like you are using an executable 'ns' with some strange functions ?
So what did you add to ns-allinone-2.3x ? Leach ? Kmeans ? Or ?
... Seems like any executable can be used ? ....

My result :
Code:

$ ns-pegasis kmeansleach.tcl (or $ ns-leach kmeansleach.tcl, or $ ns235-orig kmeansleach.tcl)
num_nodes is set 30
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

mac/chanel.cc: INITIALIZE THE LIST xListHead
warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

warning: no class variable Phy/WirelessPhy::alive_

        see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable Phy/WirelessPhy::Efriss_amp_

warning: no class variable Phy/WirelessPhy::Etwo_ray_amp_

warning: no class variable Phy/WirelessPhy::EXcvr_

warning: no class variable Phy/WirelessPhy::sleep_

warning: no class variable Phy/WirelessPhy::ss_

warning: no class variable Phy/WirelessPhy::dist_

clusheadXpos(0) = 58
clusheadYpos(0) = 592
clusheadZpos(0) = 0.0
clusheadXpos(1) = 603
clusheadYpos(1) = 143
clusheadZpos(1) = 0.0
clusheadXpos(2) = 268
clusheadYpos(2) = 526
clusheadZpos(2) = 0.0
distmean1(0) = 85
distmean2(0) = 993
distmean3(0) = 275
distmean1(1) = 549
distmean2(1) = 445
distmean3(1) = 273
distmean1(2) = 423
distmean2(2) = 571
distmean3(2) = 147
distmean1(3) = 1071
distmean2(3) = 281
distmean3(3) = 795
distmean1(4) = 909
distmean2(4) = 227
distmean3(4) = 633
distmean1(5) = 536
distmean2(5) = 458
distmean3(5) = 430
distmean1(6) = 276
distmean2(6) = 718
distmean3(6) = 0
distmean1(7) = 0
distmean2(7) = 994
distmean3(7) = 276
distmean1(8) = 792
distmean2(8) = 202
distmean3(8) = 516
distmean1(9) = 872
distmean2(9) = 138
distmean3(9) = 596
distmean1(10) = 233
distmean2(10) = 761
distmean3(10) = 333
distmean1(11) = 741
distmean2(11) = 437
distmean3(11) = 465
distmean1(12) = 649
distmean2(12) = 349
distmean3(12) = 397
distmean1(13) = 652
distmean2(13) = 342
distmean3(13) = 376
distmean1(14) = 994
distmean2(14) = 0
distmean3(14) = 718
distmean1(15) = 943
distmean2(15) = 427
distmean3(15) = 667
distmean1(16) = 686
distmean2(16) = 354
distmean3(16) = 410
distmean1(17) = 321
distmean2(17) = 673
distmean3(17) = 131
distmean1(18) = 950
distmean2(18) = 256
distmean3(18) = 674
distmean1(19) = 602
distmean2(19) = 392
distmean3(19) = 326
distmean1(20) = 478
distmean2(20) = 516
distmean3(20) = 458
distmean1(21) = 1097
distmean2(21) = 129
distmean3(21) = 821
distmean1(22) = 224
distmean2(22) = 770
distmean3(22) = 312
distmean1(23) = 713
distmean2(23) = 281
distmean3(23) = 437
distmean1(24) = 465
distmean2(24) = 529
distmean3(24) = 189
distmean1(25) = 476
distmean2(25) = 518
distmean3(25) = 200
distmean1(26) = 967
distmean2(26) = 247
distmean3(26) = 691
distmean1(27) = 584
distmean2(27) = 410
distmean3(27) = 308
distmean1(28) = 448
distmean2(28) = 546
distmean3(28) = 430
distmean1(29) = 643
distmean2(29) = 505
distmean3(29) = 457
listsize1 = 1

listsize3 = 1

listsize3 = 2

listsize2 = 1

listsize2 = 2

listsize3 = 3

listsize3 = 4

listsize1 = 2

listsize2 = 3

listsize2 = 4

listsize1 = 3

listsize2 = 5

listsize2 = 6

listsize2 = 7

listsize2 = 8

listsize2 = 9

listsize2 = 10

listsize3 = 5

listsize2 = 11

listsize3 = 6

listsize3 = 7

listsize2 = 12

listsize1 = 4

listsize2 = 13

listsize3 = 8

listsize3 = 9

listsize2 = 14

listsize3 = 10

listsize3 = 11

listsize3 = 12

mac/channel.cc: sendUp - Calc highestAntennaZ_ and distCST_
mac/channel.cc: highestAntennaZ_ = 1.5,  distCST_ = 89.8
SORTING LISTS ...DONE!

... The simulation doesn't finish, but the files kmeans.nam (11kB .. 26.1kB), kmeans.tr (2.4kB .. 22.3kB) are created.
... And $ nam kmeans.nam shows a nice animation.


-

haitam09 01-12-2016 04:27 AM

Thank you Sir knudfl for your reply.

1)
when i run $ns-leach kmeansleach.tcl , it gives me the erreur :

ns-leach*: commande introuvable

2)
But when i run $ ns kmeansleach.tcl , it gives me the following erreur
num_nodes is set 30
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

(_o14 cmd line 1)
invoked from within
"_o14 cmd addr"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o14" line 2)
(SplitObject unknown line 2)
invoked from within
"_o14 addr"
("eval" body line 1)
invoked from within
"eval $node addr $args"
("default" arm line 2)
invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
(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 < $NETWORK_NODE } { incr i } {
set node($i) [$ns node]
}"
(file "kmeansleach.tcl" line 49)
----------------------------------------------------------------------------------
I inform you that I have already installed leach protocol in NS2.34 under UBUNTU and it works well.
But when I want to apply "kmeans clustering" by using the file kmeansleach.tcl in leach protocol.
It does not work.
Thank you your help.
Best regards

knudfl 01-12-2016 10:19 AM

Re #14.

First : Please do not show the generic (useless) errors, that the otcl library is spitting out.
Tells absolutely nothing about what's going on.
(Except that the executable 'ns' in your command can't be used for anything.)


This command is with a clean ns-2.35 : No patches, no leach, no changes :
Code:

[knudfl@localhost haitam09]$ ns235-orig kmeansleach.tcl
num_nodes is set 30
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
clusheadXpos(0) = 178
clusheadYpos(0) = 220
clusheadZpos(0) = 0.0
clusheadXpos(1) = 720
clusheadYpos(1) = 570
clusheadZpos(1) = 0.0
clusheadXpos(2) = 388
clusheadYpos(2) = 473
clusheadZpos(2) = 0.0
distmean1(0) = 278
distmean2(0) = 614
distmean3(0) = 225
distmean1(1) = 355
distmean2(1) = 537
distmean3(1) = 108
distmean1(2) = 551
distmean2(2) = 361
distmean3(2) = 594
distmean1(3) = 372
distmean2(3) = 672
distmean3(3) = 329
distmean1(4) = 284
distmean2(4) = 608
distmean3(4) = 285
distmean1(5) = 137
distmean2(5) = 1029
distmean3(5) = 600
distmean1(6) = 892
distmean2(6) = 0
distmean3(6) = 429
distmean1(7) = 450
distmean2(7) = 442
distmean3(7) = 457
distmean1(8) = 675
distmean2(8) = 217
distmean3(8) = 408
distmean1(9) = 31
distmean2(9) = 923
distmean3(9) = 494
distmean1(10) = 149
distmean2(10) = 1041
distmean3(10) = 612
distmean1(11) = 209
distmean2(11) = 911
distmean3(11) = 482
distmean1(12) = 689
distmean2(12) = 203
distmean3(12) = 226
distmean1(13) = 795
distmean2(13) = 171
distmean3(13) = 406
distmean1(14) = 262
distmean2(14) = 1154
distmean3(14) = 725
distmean1(15) = 450
distmean2(15) = 790
distmean3(15) = 407
distmean1(16) = 213
distmean2(16) = 679
distmean3(16) = 250
distmean1(17) = 570
distmean2(17) = 322
distmean3(17) = 153
distmean1(18) = 397
distmean2(18) = 709
distmean3(18) = 440
distmean1(19) = 136
distmean2(19) = 756
distmean3(19) = 327
distmean1(20) = 632
distmean2(20) = 268
distmean3(20) = 169
distmean1(21) = 463
distmean2(21) = 429
distmean3(21) = 0
distmean1(22) = 120
distmean2(22) = 1012
distmean3(22) = 583
distmean1(23) = 480
distmean2(23) = 412
distmean3(23) = 33
distmean1(24) = 212
distmean2(24) = 680
distmean3(24) = 251
distmean1(25) = 184
distmean2(25) = 762
distmean3(25) = 333
distmean1(26) = 0
distmean2(26) = 892
distmean3(26) = 463
distmean1(27) = 562
distmean2(27) = 710
distmean3(27) = 605
distmean1(28) = 450
distmean2(28) = 442
distmean3(28) = 127
distmean1(29) = 147
distmean2(29) = 1039
distmean3(29) = 610
listsize3 = 1

listsize3 = 2

listsize2 = 1

listsize3 = 3

listsize1 = 1

listsize1 = 2

listsize2 = 2

listsize2 = 3

listsize2 = 4

listsize1 = 3

listsize1 = 4

listsize1 = 5

listsize2 = 5

listsize2 = 6

listsize1 = 6

listsize3 = 4

listsize1 = 7

listsize3 = 5

listsize1 = 8

listsize1 = 9

listsize3 = 6

listsize3 = 7

listsize1 = 10

listsize3 = 8

listsize1 = 11

listsize1 = 12

listsize1 = 13

listsize1 = 14

listsize3 = 9

listsize1 = 15

channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!
Segmentation fault

A little different than the result I got 3 days ago (#13).
The "Segmentation fault" happens when the trace files already are created.
Result $ nam kmeans.nam https://drive.google.com/file/d/0B7S...ew?usp=sharing


The reason that I'm using "ns renamed" : You can only have one 'ns' ... and I have 200 :
They must all be renamed to "ns-<protocol>" / ns-unique-name.


I guess your leach functions aren't working either : 'leach.alive.txt' must be about 43 lines.

Build example ns-2.35 + Leach ...
!! Absolutely necessary is a 64bits OS !!
#11 here http://www.linuxquestions.org/questi...4175556129/#11


-


All times are GMT -5. The time now is 07:31 PM.