Cross Layer Implementation in Wireless networks in NS2

70 views Asked by At

Aim of the project is to Explore and Implement Cross-Layer Design Techniques to Improve Communication in Wireless Networks Using NS2. Please provide me with the code in tcl language to implement this

This was the code i ran but i shows error,

typeset ns [new Simulator]    

set val(ifq)        Queue
set val(ll)         LL
set val(ifqlen)         50 
set val(mac)        Mac

$ns node-config -llType $val(ll) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
                -macType $val(mac) \

set tracef [open test.tr w]
$ns trace-all $tracef
set namtf [open test.nam w]
$ns namtrace-all $namtf

proc finish {} {
    global ns tracef namtf
    $ns flush-trace
    close $tracef
    close $namtf
    exec nam test.nam &
    exit 0
}
set i 0
set node_($i) [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]

$ns duplex-link $node_($i) $n1 10Mb 10ms DropTail
$ns duplex-link $n1 $n2 10Mb 10ms DropTail
$ns duplex-link $n2 $n3 10Mb 10ms DropTail
$ns duplex-link $n3 $n4 10Mb 10ms DropTail

$ns duplex-link-op $node_($i) $n1 orient right
$ns duplex-link-op $n1 $n2 orient right
$ns duplex-link-op $n2 $n3 orient right
$ns duplex-link-op $n3 $n4 orient right

set bop0 [new Agent/BOP]
#bop: a new transport layer protocol
$ns attach-agent $node_($i) $bop0  
$bop0 bop-get-mac [$node_($i) set mac_(0)]

set bop4 [new Agent/BOPSink]
$ns attach-agent $n4 $bop4

$ns connect $bop0 $bop4

set ftp [new Application/FTP]
$ftp attach-agent $bop0
$ftp set type_ FTP

$ns at 1.0 "$ftp start"
$ns at 4.0 "$ftp stop"

$ns at 5.0 "finish"

$ns run  here

But shows this error invalid command name "Agent/BOP" while executing "Agent/BOP create _o105 " invoked from within "catch "$className create $o $args" msg" invoked from within "if [catch "$className create $o $args" msg] { if [string match "__FAILED_SHADOW_OBJECT_" $msg] { delete $o return "" } global errorInfo error "class $..." (procedure "new" line 3) invoked from within "new Agent/BOP" invoked from within "set bop0 [new Agent/BOP]" (file "amj.tcl" line 43) . Pls help It is not running

0

There are 0 answers