LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-01-2013, 01:31 PM   #1
msdngirl
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Rep: Reputation: Disabled
Question implement cbrp in ns2.34


hi
i want working on CBRP - cluster based routing protocol ..i do some changes for add new protocol in ns2 but when i select CBRP as routing protocol i see errors.. but when i select AODV and other routing protocol this script run successfully...
my changes are :

1. Changed in Makefile

cbrp/ntable.o cbrp/cbrpagent.o \
cbrp/hdr_cbrp.o \

2. $NS_ROOT/queue/priqueue.cc

case PT_CBRP:

3. $NS_ROOT/common/packet.h :

in line 85
// CBRP packet
static const packet_t PT_CBRP = 63;
// insert new packet types here
static packet_t PT_NTYPE = 64; // This MUST be the LAST one
and in line 254
type == PT_CBRP ||
and in line 390
// CBRP patch
name_[PT_CBRP]= "CBRP";

4. $NS_ROOT/trace/cmu-trace.h : void format_cbrp(Packet *p, int offset);

5• $NS_ROOT/trace/cmu-trace.cc : do nothing

6• $NS_ROOT/tcl/lib/ns-packet.tcl

In line 172 add this: CBRP # routing protocol for ad-hoc networks,

7• $NS_ROOT/tcl/lib/ns-lib.tcl :

in line 633 add:
CBRP {
set ragent [$self create-cbrp-agent $node]
}
In line 860 add:
# cbrp patch
Simulator instproc create-cbrp-agent { node } {
set ragent [new Agent/CBRP [$node node-addr]]
$self at 0.0 "$ragent start"
$node set ragent_ $ragent
return $ragent
}

8• $NS_ROOT/tcl/lib/ns-agent.tcl:

In line 202 add :
#CBRP
Agent/CBRP instproc init args {

$self next $args
}
Agent/CBRP set sport_ 0
Agent/CBRP set dport_ 0

9• $NS_ROOT/tcl/lib/ns-mobilenode.tcl

In line 201 add:
# Special processing for CBRP
set cbrponly [string first "CBRP" [$agent info class]]
if {$cbrponly != -1 } {
$agent if-queue [$self set ifq_(0)] ;# ifq between LL and MAC
}


After all

1. ./configure
2. Make clean
3. Make

when i run this below code with dsr , it run without error
source IEEE802-11a-smallCSR.tcl

set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhyExt
set val(mac) Mac/802_11Ext
set val(ifq) Queue/DropTail/PriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(ifqlen) 50
set val(nn) 8
set val(rp) DSR
set val(x) 1000
set val(y) 1000


set ns [new Simulator]
$ns use-newtrace
set traceFile [open out.tr w]
$ns trace-all $traceFile
set namFile [open new.nam w]
$ns namtrace-all-wireless $namFile $val(x) $val(y)

set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn); # :P
set chan_ [new $val(chan)]

$ns node-config -adhocRouting $val(rp) -llType $val(ll) \
-macType $val(mac) -ifqType $val(ifq) \
-ifqLen $val(ifqlen) -antType $val(ant) \
-propType $val(prop) -phyType $val(netif) \
-topoInstance $topo a-agentTrace ON -routerTrace OFF \
-macTrace ON -movementTrace ON -channel $chan_


for {set i 0} {$i < $val(nn)} {incr i} {
set n($i) [$ns node]
$n($i) random-motion 1
}

$n(0) set X_ 20.0
$n(0) set Y_ 20.0
$n(0) set Z_ 0.0

$n(1) set X_ 135.0
$n(1) set Y_ 135.0
$n(1) set Z_ 0.0

$n(2) set X_ 880.0
$n(2) set Y_ 880.0
$n(2) set Z_ 0.0

$n(3) set X_ 980.0
$n(3) set Y_ 980.0
$n(3) set Z_ 0.0

$n(4) set X_ 40.0
$n(4) set Y_ 40.0
$n(4) set Z_ 0.0

$n(5) set X_ 35.0
$n(5) set Y_ 85.0
$n(5) set Z_ 0.0

$n(6) set X_ 400.0
$n(6) set Y_ 400.0
$n(6) set Z_ 0.0

$n(7) set X_ 200.0
$n(7) set Y_ 200.0
$n(7) set Z_ 0.0

$ns at 0.0 "$n(0) setdest [$n(0) set X_] [$n(0) set Y_] 0.0"
$ns at 0.0 "$n(1) setdest [$n(1) set X_] [$n(1) set Y_] 0.0"

$ns at 0.0 "$n(2) setdest [$n(2) set X_] [$n(2) set Y_] 0.0"
$ns at 0.0 "$n(3) setdest [$n(3) set X_] [$n(3) set Y_] 0.0"
$ns at 0.0 "$n(4) setdest [$n(4) set X_] [$n(4) set Y_] 0.0"
$ns at 0.0 "$n(5) setdest [$n(5) set X_] [$n(5) set Y_] 0.0"

$ns at 0.0 "$n(6) setdest [$n(6) set X_] [$n(6) set Y_] 0.0"
$ns at 0.0 "$n(7) setdest [$n(7) set X_] [$n(7) set Y_] 0.0"

set udp01 [new Agent/UDP]
set sink01 [new Agent/Null]
$ns attach-agent $n(0) $udp01
$ns attach-agent $n(1) $sink01
$ns connect $udp01 $sink01
set cbr01 [new Application/Traffic/CBR]
$cbr01 set rate_ 700Kb
$cbr01 set pktSize_ 150b
$cbr01 attach-agent $udp01

set udp23 [new Agent/UDP]
set sink23 [new Agent/Null]
$ns attach-agent $n(2) $udp23
$ns attach-agent $n(3) $sink23
$ns connect $udp23 $sink23
set cbr23 [new Application/Traffic/CBR]
$cbr23 set rate_ 3Mb
$cbr23 attach-agent $udp23

proc stop {} {
global ns traceFile namFile
$ns flush-trace
close $traceFile; close $namFile
exit 0
}

$ns at 5 "$cbr01 start"
$ns at 25 "$cbr01 stop"
$ns at 5 "$cbr23 start"
$ns at 25 "$cbr23 stop"
$ns at 30.0 "stop"
$ns run


but when i run this code with CBRP has error:
naz@ubuntu:~/code$ ns nodee.tcl
num_nodes is set 8

(_o15 cmd line 1)
invoked from within
"_o15 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 "_o15" line 2)
(SplitObject unknown line 2)
invoked from within
"_o15 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 "_o4" line 14)
(Simulator create-wireless-node line 14)
invoked from within
"_o4 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o4" 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 n($i) [$ns node]
$n($i) random-motion 1
}"
(file "nodee.tcl" line 37)

i think CBRP Has not been properly compiled
can any one help me?
thanks
 
Old 02-02-2016, 02:51 AM   #2
sweta648
LQ Newbie
 
Registered: Dec 2015
Posts: 4

Rep: Reputation: Disabled
Dear friend.

I am a student of M.E and now working on the Cluster Based Routing
Protocol (CBRP) for ns-2.

I need a tcl script for cluster formation.

I tried so much to install CBRP patch but there are lots of error in that.

Please help me, if you have then please share with me.my Mail ID:- swetaramani648@gmail.com

Its a big help for me.

Thanks & regards
 
Old 02-02-2016, 07:41 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sweta648 View Post
Dear friend.
I am a student of M.E and now working on the Cluster Based Routing Protocol (CBRP) for ns-2.

I need a tcl script for cluster formation. I tried so much to install CBRP patch but there are lots of error in that. Please help me, if you have then please share with me.my Mail ID:-Its a big help for me.

Thanks & regards
Read the LQ Rules. You re-opened a THREE YEAR OLD THREAD, hijacked it with your own question. Neither is a good thing. Further, this is a COMMUNITY forum...we aren't going to write your scripts for you, and we CERTAINLY aren't going to email them to you, so you can avoid the 'chore' of actually logging back in to check a reply.

If you have a specific problem, then open your own thread, WITH that problem, and the code that YOU have written, and we will help. Otherwise, show some effort of your own, write your own scripts, and stop asking for handouts.

EDIT: ESPECIALLY since you posted this same thing THREE OTHER TIMES in different old threads, each time asking for a handout. You were given links to over 100,000 samples in another thread, how much more would you like us to hand you?

Last edited by TB0ne; 02-02-2016 at 07:43 AM.
 
  


Reply

Tags
cbrp, ns2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install cbrp protocol in ns2.35 Sudha Rajaram Linux - Newbie 11 02-14-2016 08:04 PM
how to add cbrp in ns2.35 shravani Linux - Software 3 10-30-2013 12:26 PM
implement CBRP in ns2.34 msdngirl Linux - Wireless Networking 1 07-01-2013 08:37 AM
problem in running cbrp protocol in ns2.34 fbin Programming 0 07-12-2012 01:29 AM
[SOLVED] How to change makefile in ns2.34 to compile cbrp? fbin Linux - Wireless Networking 0 06-29-2012 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration