[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Problem to set parameter ...
Hi to all,
i want set parameter for my new queue with "command" method
Now the problem is the follow :
After I created a new link and setted my queue like Optical,
I need the link bandwidth because i must set bandwidth
parameter in my queue and use LinkDelay* link_ variable to
know txtime method.
My TCL code :
;# ------------------
;# Source 1 --->| switch |
;# Source 2 --->| + |---> Sink
;# Source 3 --->| cola fifo |
;# ------------------
proc attach-expoo-traffic {node sink size burst idle rate} {
set ns [Simulator instance]
set source [new Agent/CBR/UDP]
$ns attach-agent $node $source
set traffic [new Traffic/Expoo]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
$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
$ns duplex-link $Switch $Sink 10000Mb 1us Optical
puts stdout "Links created..."
set QueueSWITCHER [[$ns link $Switch $Sink] queue]
;# Take a reference to link object between two node
;# and set :
;# 1. link variable in Optical Object
$QueueSWITCHER cmd link [$ns link $Switch $Sink]
;# 2. queue limit in Optical Objects
$QueueSWITCHER cmd limit 3
;# 3. delay line number in Optical Objects
$QueueSWITCHER cmd #delay-lines 2
;# 4. initialize every delay line in every Optical Objects
$QueueSWITCHER cmd #delay-lines 2
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-expoo-traffic $n0 $sink0 1505 0.1s 0.9s 6250Mb]
set source2 [attach-expoo-traffic $n0 $sink0 1505 0.1s 0.9s 6250Mb]
set source3 [attach-expoo-traffic $n0 $sink0 1505 0.1s 0.9s 6250Mb]
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
The error go out where link command in Optical queue set a reference
variable (LinkDelay* link) to relative link
link_ variable in C++ code is defined like LinkDelay* and I use
a cast (LinkDelay*) to assign a right value.
E R R O R in LINE 47 is $QueueSWITCHER cmd link [$ns link $Switch $Sink]
Nodes created ...
Links created ...
Optical parameter error : NO LinkDelay Object => _o57
(_o56 cmd line 1)
nkDelinvoked from within
"$QueueSWITCHER cmd link [$ns link $Switch $Sink]"
(file "Optical.tcl" line 47)
Somebody have some ideas or solution ???
A duplex-link is two LinkDelay object ????
Thanks in Advanced
Mazzotta Vincenzo
[email protected]