[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Problem in Trace Traffic Generator ...



Date: Sun, 18 Jun 2000 21:59:51 +0200 (MET DST)
From: Vincenzo Mazzotta <[email protected]>
To: [email protected]
Subject: [ns] Problem in Trace Traffic Generator ...

I'm using a traffic trace generator
to test my queue, but this TCL code generate an error: 

proc attach-Trace-traffic {node sink} {

    set ns [Simulator instance]
    set source [new Agent/UDP]
    $ns attach-agent $node $source
    
    set T_file [new Tracefile]
    $T_file filename ./example-trace
    set traffic [new Traffic/Trace]
    $traffic attach-tracefile $T_file
    $source attach-traffic $traffic
    $ns connect $source $sink
    return $source
   }

My TCL code is :
;#                 ------------------
;# Source 1   --->|     switch       |
;# Source 2   --->|        +         |---> Sink
;# Source 3   --->|  Optical Queue   |
;#                 ------------------

proc attach-Trace-traffic {node sink} {

    set ns [Simulator instance]
    set source [new Agent/UDP]
    $ns attach-agent $node $source
    
    set T_file [new Tracefile]
    $T_file filename ./example-trace
    set traffic [new Traffic/Trace]
    $traffic attach-tracefile $T_file
    $source attach-traffic $traffic
    $ns connect $source $sink
    return $source
   }


set ns [new Simulator]
;# Define my node
set Source1 [$ns node]
set Source2 [$ns node]
set Source3 [$ns node]
set Switch  [$ns node]
set Sink    [$ns node]

puts stdout "Nodes created..."

;# Define my links
$ns duplex-link $Source1 $Switch 10000Mb 1us DropTail
$ns duplex-link $Source2 $Switch 10000Mb 1us DropTail
$ns duplex-link $Source3 $Switch 10000Mb 1us DropTail
puts stdout "Links DropTail created..."

$ns duplex-link $Switch $Sink 10000Mb 1us Optical
puts stdout "Links Optical created..."


set QueueSWITCHER [[$ns link $Switch $Sink] queue]

;# Take a reference to link object between two node
;# and set :

;# 1. bandwidth variable in Optical Queue
$QueueSWITCHER set bandwidth 10000Mb

;# 2. packet limit in Optical Queue
$QueueSWITCHER cmd limit 3

;# 3. delay line number in Optical Queue
$QueueSWITCHER cmd #delay-lines 2

;# 4. initialize every delay line in Optical Queue
$QueueSWITCHER    cmd #init-delay-line 0 0.0000001
$QueueSWITCHER    cmd #init-delay-line 1 0.0000002


set Sink1 [new Agent/LossMonitor]
set Sink2 [new Agent/LossMonitor]
set Sink3 [new Agent/LossMonitor]
set Sink4 [new Agent/LossMonitor]

puts stdout "Sinks created..."

$ns attach-agent $Sink $Sink1
$ns attach-agent $Sink $Sink2
$ns attach-agent $Sink $Sink3
$ns attach-agent $Sink $Sink4

puts stdout "Agentes created..."

set source1 [attach-Trace-traffic $Source1 $Sink1 ]
set source2 [attach-Trace-traffic $Source2 $Sink2 ]
set source3 [attach-Trace-traffic $Source3 $Sink3 ]

puts stdout "Source created..."

$ns at 0.0 "$source1 start"
$ns at 0.0 "$source2 start"
$ns at 0.0 "$source3 start"

$ns at 1.204 "$source1 stop"
$ns at 1.204 "$source2 stop"
$ns at 1.204 "$source3 stop"


$ns at 1.204s "finish"

puts stdout "Simulation START..."
$ns run

And the error is

rogent> Nodes created...
Links DropTail created...
Links Optical created...
Sinks created...
Agentes created...

    (_o73 cmd line 1)
    invoked from within
"_o73 cmd attach-traffic _o76"
    invoked from within
"catch "$self cmd $args" ret"
    (procedure "_o73" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$source attach-traffic $traffic"
    (procedure "attach-Trace-traffic" line 11)
    invoked from within
"attach-Trace-traffic $Source1 $Sink1 "
    (file "Optical.tcl" line 76)

    Exit 1               ns Optical.tcl

Somebody can explain what's happened ??
I don't know like connect a Traffic Trace Generator to an Agent.
I see on NS Documentation but there is only in page 173 two line ...

Thanks in Advanced
Vincenzo Mazzotta
[email protected]