I got this error when i tried running my nam simulation:
 tracefile events not sorted by time.
What could be wrong?
below is the tcl script

# Copyright (c) 1997 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#      This product
 includes software developed by the Computer Systems
#      Engineering Group at Lawrence Berkeley Laboratory.
# 4. Neither the name of the University nor of the Laboratory may be used
#    to endorse or promote products derived from this software without
#    specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# wireless4.tcl
# simulation of a wired-cum-wireless topology running with mobileIPv4
# ======================================================================
# Define options
# ======================================================================

set opt(chan)   Channel/WirelessChannel        ;# channel type
set opt(prop)   Propagation/TwoRayGround       ;# radio-propagation model
set opt(netif)  Phy/WirelessPhy                ;# network interface type
set opt(mac)   
 Mac/802_11                     ;# MAC type
set opt(ifq)    Queue/DropTail/PriQueue        ;# interface queue type
set opt(ll)     LL                             ;# link layer type
set opt(ant)    Antenna/OmniAntenna            ;# antenna model
set opt(ifqlen)         50                     ;# max packet in ifq
set opt(nn)            
 1                      ;# number of mobilenodes
set opt(adhocRouting)   DSDV                   ;# routing protocol

set opt(cp)     ""                             ;# cp file not used
set opt(sc)     ""                             ;# node movement file. 

set opt(x)     
 1500                            ;# x coordinate of topology
set opt(y)      1500                            ;# y coordinate of topology
set opt(seed)   0.0                            ;# random seed
set opt(stop)   70                          ;# time to stop simulation

set opt(ftp1-start)      10.0

set
 num_wired_nodes      4
#set num_bs_nodes       4  ; this is not really used here.

# ======================================================================

# check for boundary parameters and random seed
if { $opt(x) == 0 || $opt(y) == 0 } {
    puts "No X-Y boundary values given for wireless topology\n"
}
if {$opt(seed) > 0} {
    puts "Seeding Random number generator with $opt(seed)\n"
    ns-random $opt(seed)
}

# create simulator instance
set ns_   [new Simulator]

# set up for hierarchical routing
$ns_ node-config -addressType hierarchical

AddrParams set domain_num_ 5           ;# number of domains
lappend cluster_num 4 1 1 1 1              ;# number of
 clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 1 1 2 1 1 1            ;# number of nodes in each 
cluster 
AddrParams set nodes_num_ $eilastlevel ;# of each domain

set tracefd  [open wireless4-out.tr w]
set namtrace [open wireless4-out.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)

# Create topography object
set topo   [new Topography]

# define topology
$topo load_flatgrid $opt(x) $opt(y)

# create God
#   4 for HA and FA
create-god [expr $opt(nn) + 4]

#create wired nodes
set temp {0.0.0 0.1.0 0.2.0 0.3.0}           ;# hierarchical addresses 
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns_ node [lindex $temp $i]] 
}

# Configure
 for ForeignAgent and HomeAgent nodes
$ns_ node-config -mobileIP ON \
                 -adhocRouting $opt(adhocRouting) \
                 -llType $opt(ll) \
                 -macType $opt(mac) \
                 -ifqType $opt(ifq) \
                 -ifqLen $opt(ifqlen) \
                 -antType $opt(ant) \
                 -propType $opt(prop)
 \
                 -phyType $opt(netif) \
                 -channelType $opt(chan) \
         -topoInstance $topo \
                 -wiredRouting ON \
         -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace OFF 

# Create HA and FA 
set HA [$ns_ node 1.0.0]
set FA1 [$ns_ node 2.0.0]
set FA2 [$ns_ node 3.0.0]
set FA3 [$ns_ node 4.0.0]
$HA random-motion 0
$FA1 random-motion 0
$FA2 random-motion 0
$FA3
 random-motion 0

# Position (fixed) for base-station nodes (HA & FA).
$HA set X_ 250.000000000000
$HA set Y_ 1050.000000000000
$HA set Z_ 0.000000000000

$FA1 set X_ 600.000000000000
$FA1 set Y_ 1050.000000000000
$FA1 set Z_ 0.000000000000

$FA2 set X_ 600.000000000000
$FA2 set Y_ 300.000000000000
$FA2 set Z_ 0.000000000000

$FA3 set X_ 250.000000000000
$FA3 set Y_ 300.000000000000
$FA3 set Z_ 0.000000000000



# create a mobilenode that would be moving between HA and FA.
# note address of MH indicates its in the same domain as HA.
$ns_ node-config -wiredRouting OFF

set MH [$ns_ node 1.0.1]
set node_(0) $MH
set HAaddress [AddrParams addr2id [$HA node-addr]]
[$MH set regagent_] set home_agent_ $HAaddress

# movement of the MH
$MH set Z_ 0.000000000000
$MH set Y_ 1000.000000000000
$MH set X_ 250.000000000000

# MH starts to move towards
 FA1
$ns_ at 10.000000000000 "$MH setdest 600.000000000000 1000.000000000000 
20.000000000000"
# MH move from FA1 towards FA2
$ns_ at 360.000000000000 "$MH setdest 600.000000000000 350.000000000000 
20.000000000000"
# MH move from FA2 towards FA3
$ns_ at 1010.000000000000 "$MH setdest 250.000000000000 350.000000000000 
20.000000000000"


# create links between wired and BaseStation nodes
$ns_ duplex-link $W(0) $W(1) 100Mb 2ms DropTail
$ns_ duplex-link $W(1) $W(2) 100Mb 2ms DropTail
$ns_ duplex-link $W(1) $W(3) 100Mb 2ms DropTail
$ns_ duplex-link $W(2) $HA 100Mb 2ms DropTail
$ns_ duplex-link $W(2) $FA1 100Mb 2ms DropTail
$ns_ duplex-link $W(3) $FA2 100Mb 2ms DropTail
$ns_ duplex-link $W(3) $FA3 100Mb 2ms DropTail

$ns_ duplex-link-op $W(0) $W(1) orient down
$ns_ duplex-link-op $W(1) $W(2) orient left-down
$ns_ duplex-link-op $W(1) $W(3) orient right-down
$ns_ duplex-link-op $W(2) $HA orient
 left-down
$ns_ duplex-link-op $W(2) $FA1 orient right-down
$ns_ duplex-link-op $W(3) $FA2 orient down
$ns_ duplex-link-op $W(3) $FA3 orient right-down


# setup TCP connections between a wired node and the MobileHost

set tcp1 [new Agent/TCP]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $W(0) $tcp1
$ns_ attach-agent $MH $sink1
$ns_ connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ns_ at $opt(ftp1-start) "$ftp1 start"

# source connection-pattern and node-movement scripts
if { $opt(cp) == "" } {
    puts "*** NOTE: no connection pattern specified."
        set opt(cp) "none"
} else {
    puts "Loading connection pattern..."
    source $opt(cp)
}
if { $opt(sc) == "" } {
    puts "*** NOTE: no scenario file
 specified."
        set opt(sc) "none"
} else {
    puts "Loading scenario file..."
    source $opt(sc)
    puts "Load complete..."
}

# Define initial node position in nam

for {set i 0} {$i < $opt(nn)} {incr i} {

    # 20 defines the node size in nam, must adjust it according to your
    # scenario
    # The function must be called after mobility model is defined

    $ns_ initial_node_pos $node_($i) 20
}     

# Tell all nodes when the simulation ends
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $opt(stop).0 "$node_($i) reset";
}
$ns_ at $opt(stop).0 "$HA reset";
$ns_ at $opt(stop).0 "$FA1 reset";
$ns_ at $opt(stop).0 "$FA2 reset";
$ns_ at $opt(stop).0 "$FA3 reset";



$ns_
 at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ at $opt(stop).0001 "stop"
proc stop {} {
    global ns_ tracefd namtrace
    close $tracefd
    close $namtrace
}

# some useful headers for tracefile
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp \
    $opt(adhocRouting)"
puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

puts "Starting Simulation..."
$ns_ run





--- On Wed, 7/22/09, Huq, Syed M. <[email protected]> wrote:

From: Huq, Syed M. <[email protected]>
Subject: RE: [ns] Help with error
To: "Oladapo Oluwadiya" <[email protected]>
Date: Wednesday, July 22, 2009, 8:45 PM

You
 should have pasted more information from the simulation script file. I think 
the destination of the node is "beyond" your topography grid size. Check that. 
Good luck.

________________________________________
From: [email protected] [[email protected]] On Behalf Of Oladapo 
Oluwadiya [[email protected]]
Sent: Wednesday, July 22, 2009 4:19 PM
To: [email protected]
Subject: [ns] Help with error

hello,

i got this error when i tried simulating a mobile ip scenario in ns.though the 
simulation runs,but runs just for 9.6s instead of 1010s set in
 script.

Sorting lists....Done!
ns: _o159 setdest 600.000000000000 1000.0000000000 1.000000000000:
 (_o159 cmd line 1)
invoked from within
"_o159 cmd setdest 600.000000000000 1000.000000000000 1.000000000000"
invoked from within
"catch "$self cmd $arg" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorinfo
set savedInfo $error Info
error "error when calling class $cls: $args" $..."
(procedure " _o159" line 2)
(SplitObject unknown line 2)
invoked from within
"_o159 setdest 600.000000000000 1000.000000000000 1.000000000000"

below is part of the code involved in the error...

# create a mobilenode that would be moving between HA and FA.
# note address of MH indicates its in the same domain as HA.
$ns_ node-config -wiredRouting OFF

set MH [$ns_ node 1.0.1]
set node_(0) $MH
set HAaddress [AddrParams addr2id [$HA
 node-addr]]
[$MH set regagent_] set home_agent_ $HAaddress

# movement of the MH
$MH set Z_ 0.000000000000
$MH set Y_ 1000.000000000000
$MH set X_ 250.000000000000

# MH starts to move towards FA1
$ns_ at 10.000000000000 "$MH setdest 600.000000000000 1000.000000000000 
1.000000000000"
# MH move from FA1 towards FA2
$ns_ at 360.000000000000 "$MH setdest 600.000000000000 350.000000000000 
1.000000000000"
# MH move from FA2 towards FA3
$ns_ at 1010.000000000000 "$MH setdest 250.000000000000 350.000000000000 
1.000000000000"




      


      

Reply via email to