Thanks a lot Mubashir, heres the code

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             ;# 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)             20                         ;# number of mobilenodes

set val(rp)             DumbAgent                  ;# routing protocol

set val(x)              50

set val(y)              50


Mac/802_11 set dataRate_ 11Mb

#Create a simulator object

set ns_ [new Simulator]


#Open the NAM trace file

set nf [open out.nam w]

$ns_ namtrace-all $nf



#Define a 'finish' procedure

proc finish {} {

        global ns_ nf

        $ns_ flush-trace

        #Close the NAM trace file

        close $nf

        #Execute NAM on the trace file

        exec /home/faraz/Desktop/ns-allinone-2.33/nam-1.13/nam out.nam

        exit 0

}



# set up topography object

set topo       [new Topography]

$topo load_flatgrid $val(x) $val(y)



# Create God

create-god $val(nn)



# Create channel

set chan_1_ [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 \

                -agentTrace OFF \

                -routerTrace OFF \

                -macTrace ON \

                -movementTrace OFF \

                -channel $chan_1_

for {set i 0} {$i < $val(nn) } {incr i} {
        set node_($i) [$ns_ node]
        $node_($i) random-motion 0   ;# disable random motion
        }



$ns_ at 0.1 "finish"


puts "Starting..."

$ns_ run

Regards,
Faraz
________________________________________
From: Mubashir Rehmani [mshrehm...@gmail.com]
Sent: Thursday, January 08, 2009 2:49 AM
To: Syed Faraz Hasan
Subject: Re: [ns] How to set up mobile nodes?

Hi Faraz

Can you please write the code in your email, because ns user mailing list drops 
all the attachments.

Regards

2009/1/8 Syed Faraz Hasan 
<faraz_hasa...@email.ulster.ac.uk<mailto:faraz_hasa...@email.ulster.ac.uk>>


Hi all,

I get an error which I have enclosed when I try setting up nodes in wireless 
scenarios. I have tried a lot of different things as suggested by other 
tutorials but get the same error everytime. When I delete the lines defining 
the nodes from the code, there are no error messages. Code that I am using is 
also enclosed.

Please help me out at this, I really need help quickly.

Faraz




--
Mubashir Husain Rehmani



Reply via email to