LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   new simulator problem (https://www.linuxquestions.org/questions/linux-newbie-8/new-simulator-problem-4175482653/)

ishugopalan 10-29-2013 10:54 AM

new simulator problem
 
Hi all,
my tcl code begins with
set ns [new Simulator]

while executing this line throws an error for invalid command "new"
help me out in solving the issue..if there s any flaw in setting env variable or improper installation

thanks

knudfl 10-29-2013 12:00 PM

Welcome to LQ.

Looks like a typo ?
Shouldn't it be :
Code:

set ns_  [new Simulator]

ishugopalan 11-07-2013 08:53 AM

thanks for ur reply....

Also,Im new to NS2 and working on tcl scripts..i got below error message..can u plz check n help me in sorting out my error...
file name-demo.tcl:

num_nodes is set 50

(_o14 cmd line 1)
invoked from within
"_o14 cmd addr"
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
"_o14 addr"
("eval" body line 1)
invoked from within
"eval $node addr $args"
("default" arm line 2)
invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
(procedure "_o3" line 14)
(Simulator create-wireless-node line 14)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns node"
invoked from within
"set node_(0) [$ns node]"
(file "demo.tcl" line 72)

knudfl 11-07-2013 12:08 PM

# 3 .

There may be a chance to find some errors in "demo.tcl",
if you attach the file as demo.tcl.txt, to a new post.

Attachments : The paper clip tool in the Advanced Editor.

-

ishugopalan 12-21-2013 02:11 AM

thanks for ur reply...
could you please help in writing awk script to generate xgraph based on x co-ordinate = time
y-co-ordinate = throughput

sample output in trace file:

s 10.000000000 _1_ AGT --- 0 tcp 40 [0 0 0 0] ------- [1:0 4:0 32 0] [0 0] 0 0
r 10.000000000 _1_ RTR --- 0 tcp 40 [0 0 0 0] ------- [1:0 4:0 32 0] [0 0] 0 0
s 10.000000000 _1_ RTR --- 0 AODV 48 [0 0 0 0] ------- [1:255 -1:255 30 0] [0x2 1 1 [4 0] [1 4]] (REQUEST)
r 10.000988490 _2_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 30 0] [0x2 1 1 [4 0] [1 4]] (REQUEST)
r 10.000988501 _5_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 30 0] [0x2 1 1 [4 0] [1 4]] (REQUEST)
r 10.000988515 _3_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 30 0] [0x2 1 1 [4 0] [1 4]] (REQUEST)
r 10.000988813 _7_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [1:255 -1:255 30 0] [0x2 1 1 [4 0] [1 4]] (REQUEST)
s 10.001869717 _2_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
r 10.003018050 _7_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
r 10.003018084 _3_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
r 10.003018188 _5_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
r 10.003018207 _1_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
r 10.003018212 _6_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
r 10.003018290 _4_ RTR --- 0 AODV 48 [0 ffffffff 2 800] ------- [2:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
s 10.003018290 _4_ RTR --- 0 AODV 44 [0 0 0 0] ------- [4:255 1:255 30 2] [0x4 1 [4 4] 10.000000] (REPLY)
s 10.004118430 _7_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [7:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)
s 10.005400235 _5_ RTR --- 0 AODV 48 [0 ffffffff 1 800] ------- [5:255 -1:255 29 0] [0x2 2 1 [4 0] [1 4]] (REQUEST)

Many thanks in advance


All times are GMT -5. The time now is 06:53 AM.