Thanks Urlan..
This time I created the said routine and get this:

num_nodes is set 3
INITIALIZE THE LIST xListHead
Error:  sendmsg() for UDP should not be -1
SORTING LISTS ...DONE!
end simulation





________________________________
From: Urlan Salgado de Barros <[email protected]>
To: Mutiullah Qureshi <[email protected]>
Cc: NS-USERS Mailing List <[email protected]>
Sent: Mon, October 26, 2009 8:52:20 PM
Subject: Re: [ns] Cross-Layering script is not running.

Hello Mutiullah Qureshi,

You need to create getLL procedure.

Node/MobileNode instproc getLL { param0} {
    $self instvar ll_    
    return $ll_($param0) 
}

Call this procedure with the command:
set ll_src_ [$node_(0) getLL 0]

Urlan


2009/10/26 Mutiullah Qureshi <[email protected]>


>>Hello.
>>Please consider the following script. I have written it for demonstrating 
>>cross-layering:
>
>># Define options
>>set val(chan)           Channel/WirelessChannel    ;# channel type
>>set val(prop)           Propagation/TwoRayGround   ;# radio-propagation model
>>set val(netif)          Phy/WirelessPhy            ;# network interface type
>>set val(mac)            Mac/802_11                 ;# MAC type
>>set val(ifq)            Queue/DropTail/PriQueue    ;# interface queue type
>>set val(ll)             LL                         ;# link layer type
>>set val(ant)            Antenna/OmniAntenna        ;# antenna model
>>set val(ifqlen)         50                         ;# max packet in ifq
>>set val(nn)             3                          ;# number of mobilenodes
>>set val(rp)             AODV                       ;# routing protocol
>>set val(x)              500                  ;# X dimension of topography
>>set val(y)              400                  ;# Y dimension of topography
>>set val(stop)        150               ;# time of simulation end
>
>>set ns          [new Simulator]
>>set tracefd       [open cros_ex1_tr.tr w]
>>set namtrace      [open cros_ex1_nam.nam w]
>
>>$ns trace-all $tracefd
>>$ns namtrace-all-wireless $namtrace $val(x) $val(y)
>
>># set up topography object
>>set topo       [new Topography]
>
>>$topo load_flatgrid $val(x) $val(y)
>
>>create-god $val(nn)
>
>>#
>>#  Create nn mobilenodes [$val(nn)] and attach them to the channel.
>>#
>
>>set chan_1_ [new $val(chan)]
>
>># configure the nodes
>>        $ns node-config -adhocRouting $val(rp) \
>>             -llType $val(ll) \
>>             -macType $val(mac) \
>>             -channel $chan_1_ \
>>             -ifqType $val(ifq) \
>>             -ifqLen $val(ifqlen) \
>>             -antType $val(ant) \
>>             -propType $val(prop) \
>>             -phyType $val(netif) \
>>             -topoInstance $topo \
>>             -agentTrace ON \
>>             -routerTrace ON \
>>             -macTrace OFF \
>>             -movementTrace ON \
>
>
>>    for {set i 0} {$i < $val(nn) } { incr i } {
>>        set node_($i) [$ns node]
>>    }
>
>># Provide initial location of mobilenodes
>>$node_(0) set X_ 5.0
>>$node_(0) set Y_ 5.0
>>$node_(0) set Z_ 0.0
>
>>$node_(1) set X_ 490.0
>>$node_(1) set Y_ 285.0
>>$node_(1) set Z_ 0.0
>
>>$node_(2) set X_ 150.0
>>$node_(2) set Y_ 240.0
>>$node_(2) set Z_ 0.0
>
>># Generation of movements
>>$ns at 10.0 "$node_(0) setdest 250.0 250.0 3.0"
>>$ns at 15.0 "$node_(1) setdest 45.0 285.0 5.0"
>>$ns at 110.0 "$node_(0) setdest 480.0 300.0 5.0"
>
>>set udp_ [new Agent/UDP]
>>$ns attach-agent $node_(0) $udp_
>
>>set null [new Agent/Null]
>>$ns attach-agent $node_(1) $null
>
>>set exp_ [new Application/Traffic/Exponential]
>
>>$exp_ set burst_time_ 0.01ms
>>$exp_ set idle_time_ 0.04ms
>>$exp_ set rate_ 1.5Mbps
>>$exp_ attach-agent $udp_
>
>>$exp_ attach-agent $udp_
>>$ns connect $udp_ $null
>
>>set ll_src_ [$node_(0) getLL 0]
>>$udp_ target $ll_src_
>
>>set ftp [new Application/FTP]
>>$ftp attach-agent $udp_
>>$ns at 10.0 "$ftp start"
>
>># Define node initial position in nam
>>for {set i 0} {$i < $val(nn)} { incr i } {
>># 30 defines the node size for nam
>>$ns initial_node_pos $node_($i) 30
>>}
>
>># Telling nodes when the simulation ends
>>for {set i 0} {$i < $val(nn) } { incr i } {
>>    $ns at $val(stop) "$node_($i) reset";
>>}
>
>># ending nam and the simulation
>>$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
>>$ns at $val(stop) "stop"
>>$ns at 150.01 "puts \"end simulation\" ; $ns halt"
>>proc stop {} {
>>    global ns tracefd namtrace
>>    $ns flush-trace
>>    close $tracefd
>>    close $namtrace
>>}
>
>>$ns run
>
>
>>But this is the output:
>
>>num_nodes is set 3
>>INITIALIZE THE LIST xListHead
>
>>    (_o14 cmd line 1)
>>    invoked from within
>>"_o14 cmd getLL 0"
>>    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
>>"$node_(0) getLL 0"
>>    invoked from within
>>"set ll_src_ [$node_(0) getLL 0]"
>>    (file "cros_ex1.tcl" line 96)
>
>>I have read5th chapter of
>>"Introduction to Network Simulator NS2", that explains the Connector
>>class
>>[http://books.google.com/books?id=cD69He_oU60C&pg=PP1&dq=Introduction+to+Network+Simulator+NS2#v=onepage&q=&f=false
>> ]
>>
>and also got help from Urlan 
>[http://mailman.isi.edu/pipermail/ns-users/2009-October/066621.html]
>
>>Please someone point out the mistake(s)  or provide me with  example script 
>>of your own.
>>Thanks in advance.
>
>
>
>
>



      

Reply via email to