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

[ns] I don't know whats's happened ???



Hi to all ...
i've a problem ... simulating a topology using my Optical queue i noted that ....
The packet arrived in my queue in right istant but the problem is that before arrive all packets and after go out all packets .. Network Simulator works in this form ..???
See the packet that arrived in 0.701525 second when go out ... the go out time is defined by now+line_delay that in this case is ugually to 1 us ..... what the reazon of this behavior in NS-2 ???
I know only that 1.40305 seconds is the end time for simulation ....

My TCL SCRIPT is :

;#                             --------
;# 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]

;#set f [open out.tr w]
;#$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf

;# Define my node
set Source1   [$ns node]
set Source2   [$ns node]
set Source3   [$ns node]
set Switch    [$ns node]
set SinkFinal [$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 $SinkFinal 10000Mb 1us Optical
puts stdout "Links Optical created..."

set sink1 [new Agent/LossMonitor]
set sink2 [new Agent/LossMonitor]
set sink3 [new Agent/LossMonitor]

$ns attach-agent $SinkFinal $sink1
$ns attach-agent $SinkFinal $sink2
$ns attach-agent $SinkFinal $sink3

set QueueSWITCHER [[$ns link $Switch $SinkFinal] 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.000001
$QueueSWITCHER cmd #init-delay-line 1 0.000002

puts stdout "Agentes created..."

set source1 [attach-expoo-traffic $Source1 $sink1 1000 0.1s 0.9s 6250Mb]
set source2 [attach-expoo-traffic $Source2 $sink2 1000 0.1s 0.9s 6250Mb]
set source3 [attach-expoo-traffic $Source3 $sink3 1000 0.1s 0.9s 6250Mb]

puts stdout "Source created..."

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

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

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

See my output  for fewer packets :
 

rogent> ns Optical.tcl
Nodes created...
Links DropTail created...
Links Optical created...
Optical Parameter OK   : Set maximum number packets to : 3
Optical Parameter OK   : Set delay lines number to : 2
Optical Parameter OK   : Delay line [0] = 1e-06
Optical Parameter OK   : Delay line [1] = 2e-06
Agentes created...
Source created...
Simulation START...
In 0.701524 seconds arrived a new packet to queue.
I'm finding to insert in line 0 where delay = 1.000000e-06
Packet inserted in queue at line delay 0 go out in time : 0.701525
Packet inserted in line delay 0
In 0.701525 seconds arrived a new packet to queue.
I'm finding to insert in line 0 where delay = 1.000000e-06
Packet inserted in queue at line delay 0 go out in time : 0.701526
Packet inserted in line delay 0
In 0.701526 seconds arrived a new packet to queue.
I'm finding to insert in line 0 where delay = 1.000000e-06
Packet inserted in queue at line delay 0 go out in time : 0.701527
Packet inserted in line delay 0
In 0.701528 seconds arrived a new packet to queue.
I'm finding to insert in line 0 where delay = 1.000000e-06
Packet inserted in queue at line delay 0 go out in time : 0.701529
Packet inserted in line delay 0
In 0.701529 seconds arrived a new packet to queue.
I'm finding to insert in line 0 where delay = 1.000000e-06
Packet inserted in queue at line delay 0 go out in time : 0.70153
Packet inserted in line delay 0
In 0.70153 seconds arrived a new packet to queue.
I'm finding to insert in line 0 where delay = 1.000000e-06
Packet inserted in queue at line delay 0 go out in time : 0.701531
Packet inserted in line delay 0
Timer tell me that must go out a packet.
Packet arrived in time : 0.701525 go out from Optical Queue in time : 1.40305
A packet send out.
ns: scheduler going backwards in time from 1.403051 to 0.701526.
Timer tell me that must go out a packet.
Packet arrived in time : 0.701526 go out from Optical Queue in time : 0.701526
A packet send out.
Timer tell me that must go out a packet.
Packet arrived in time : 0.701528 go out from Optical Queue in time : 0.701527
A packet send out.
Timer tell me that must go out a packet.
Packet arrived in time : 0.701529 go out from Optical Queue in time : 0.701529
A packet send out.
Timer tell me that must go out a packet.
Packet arrived in time : 0.70153 go out from Optical Queue in time : 0.70153
A packet send out.
Timer tell me that must go out a packet.
Segmentation Fault (core dumped)
rogent>