Well, I have recently started to study NS2 (Using version 2.30), and I got
some exercises to do. The purpose of one of them is to make two mobile
nodes move towards the same location (seems to be very basic, I know). I
actually did the script .tcl, but when I try to see the animation using
nam, a weird message appears: "Cannot connect to existing nam instance.
Starting a new one..."
I amd sending my .tcl script, and I would really appreciate if someone
could see if there is something wrong, or could tell me how to fix this.

ps.: I am using ns(2.30)/nam(1.12) on Fedora 64bits, so, in order to make
my nam work, I had to edit several files, switching some int (32bits)
variables for long long (64bits). And then compile it using the makefile.
Also, when I try to validade my Nam, errors occur.

Errors when validating:
"Diagnose with: diff test-output-dynamic/test-dynamic-1.nam.test
test-output-dynamic/test-dynamic-1.nam.org
test failed.
validate overall report: some tests failed:
 ./test-all-ptp ./test-all-lan ./test-all-wireless ./test-all-dynamic
to re-run a specific: cd tcl/test; ./test-all-TEST-NAME"



My .tcl script for making two nodes move towards the same destination:
"# ======================================================================
# 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)             2                          ;# number of mobilenodes
set val(rp)             DSDV                       ;# routing protocol
# ======================================================================
# Main Program
# ======================================================================
set ns_ [new Simulator]
set tracefd     [open simple.tr w]
$ns_ trace-all $tracefd
set nff [open out.nam w]
$ns_ namtrace-all $nff
set topo       [new Topography]
$topo load_flatgrid 500 500

create-god 2

$ns_ node-config         -adhocRouting $val(rp)
$ns_ node-config                         -llType $val(ll)
$ns_ node-config                         -macType $val(mac)
$ns_ node-config                         -ifqType $val(ifq)
$ns_ node-config                         -ifqLen $val(ifqlen)
$ns_ node-config                         -antType $val(ant)
$ns_ node-config                         -propType $val(prop)
$ns_ node-config                         -phyType $val(netif)
$ns_ node-config                         -channelType $val(chan)
$ns_ node-config                         -topoInstance $topo
$ns_ node-config                         -agentTrace ON
$ns_ node-config                         -routerTrace ON
$ns_ node-config                         -macTrace OFF
$ns_ node-config                         -movementTrace OFF

set node_(0) [$ns_ node]
$node_(0) random-motion 0
set node_(1) [$ns_ node]
$node_(1) random-motion 0

$node_(0) set X_ 0.0
$node_(0) set Y_ 0.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 50.0
$node_(1) set Y_ 50.0
$node_(1) set Z_ 0.0

$ns_ at 1.0 "$node_(0) setdest 25.0 25.0 2.5"
$ns_ at 1.0 "$node_(1) setdest 25.0 25.0 2.5"
$ns_ at 30.0 "finish"

proc finish {} {
        exec nam out.nam &
        puts "sai certo....."
        exit 0
}

$ns_ run"



Hoping to hear from you soon,
Fernando.

Reply via email to