Ask Your Question
0

Couldn't run tcl script in ns2 in fedora

asked 2017-01-16 00:20:40 -0600

shahama gravatar image

updated 2017-01-16 09:26:02 -0600

mattdm gravatar image

When I try to run my own tcl script (10.tcl) in ns2.34, it gives me this error.

couldn't read file "/home/bony/ns-2.34/ns-allinone-2.34/ns-2.34.aodv":
no such file or directory
            while executing
        "source.orig /home/bony/ns-2.34/ns-allinone-2.34/ns-2.34.aodv"
            ("uplevel" body line 1)
            invoked from within
        "uplevel source.orig [list $fileName]"
            invoked from within
        "if [$instance_ is_http_url $fileName] {
        set buffer [$instance_ read_url $fileName]
        uplevel eval $buffer
        } else {
        uplevel source.orig [list $fileName]
        ..."
            (procedure "source" line 8)
        invoked from within
    "$ns_ $path.$valrp"
        (file "10.tcl" line 20)

This is the 10.tcl code i'm using. when I try to run this 10.tcl file in ns2 in fedora, it gives me above error. please help me to solve this issue:

#===================================
#     Simulation parameters setup
#===================================
set ns_ source
set path /home/sha123/ns-2.34/ns-allinone-2.34/ns-2.34
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)     10                         ;# number of mobilenodes
set valrp       aodv                   ;# routing protocol
set val(x)      943                        ;# X dimension of topography
set val(y)      567                        ;# Y dimension of topography
set val(stop)   20.0                       ;# time of simulation end
set speed       10
$ns_ $path.$valrp

set packet_size 512;#packetsize
#===================================
#        Initialization        
#===================================
#Create a ns simulator
set ns [new Simulator]

#Setup topography object
set topo       [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)

#Open the NS trace file
set tracefile [open out.tr w]
$ns trace-all $tracefile

#Open the NAM trace file
set namfile [open out.nam w]
$ns namtrace-all $namfile
$ns namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)];#Create wireless channel

#===================================
#     Mobile node parameter setup
#===================================
$ns node-config -adhocRouting  $valrp \
                -llType        $val(ll) \
                -macType       $val(mac) \
                -ifqType       $val(ifq) \
                -ifqLen        $val(ifqlen) \
                -antType       $val(ant) \
                -propType      $val(prop) \
                -phyType       $val(netif) \
                -channel       $chan \
                -topoInstance  $topo \
                -agentTrace    ON \
                -routerTrace   ON \
                -macTrace      ON \
                -movementTrace ON

#===================================
#        Nodes Definition        
#===================================
#Create 10 nodes
set n(0) [$ns node]
$n(0) set X_ 284
$n(0) set Y_ 380
$n(0) set Z_ 0.0

 $ns initial_node_pos $n(0) 20
set n(1) [$ns node]
$n(1) set X_ 343
$n(1) set Y_ 195
$n(1) set Z_ 0.0

 $ns initial_node_pos $n(1) 20
set n(2) [$ns node]
$n(2) set X_ 411
$n(2) set Y_ 308
$n(2) set Z_ 0.0

 $ns initial_node_pos $n(2) 20
set n(3) [$ns node]
$n(3) set X_ 468
$n(3) set Y_ 460
$n(3) set Z_ 0.0

 $ns initial_node_pos $n(3) 20
set n(4) [$ns node]
$n(4) set X_ 567
$n(4) set Y_ 363
$n(4) set Z_ 0.0

 $ns initial_node_pos $n(4) 20
set ...
(more)
edit retag flag offensive close merge delete

Comments

This is perfectly on topic here, but it looks like a problem with your nsnam installation in your home directory. You might have better luck on a support forum or mailing list specific to that project. I don't know how many experts on this particular technology you're likely to find here.

mattdm gravatar imagemattdm ( 2017-01-16 09:27:13 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-12-07 11:49:52 -0600

You may use,

set valrp AODV; # routing protocol is case sensitive in NS2.

Have a nice coding.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2017-01-16 00:20:40 -0600

Seen: 219 times

Last updated: Jan 16 '17