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

[ns] segmentation fault



hi all,
       i am trying to simulate pareto on/off sources
but keep getting a segmentation fault. i am using
ns2.1b8 on solaris and the script is below. can anyone
help me pls?

thank you very much

#define values

set val(flows)                         20;
set val(stop)                         
30.00;#simulation time (secs)
set val(bandwidth)                     10; #link
bandwidth (Mb)
set val(queue-length)                   5; #queue
length (pkts)


#details for )ON/OFF source

set val(pktsize)                       250;#packet
size (bytes)
set val(burst)                        0.5;#burst time
(sec)
set val(idle)                         0.5;#idle time
(sec)
set val(peak)                         100;#peak rate
(Kbps)


#===============================================================
# main source code


#create a simulator object
set ns [new Simulator]

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




#define 'finish' procedure
proc finish {} {

        global ns nf qmon bandwidth stop buffer
        $ns flush-trace
        #close the trace file
        close $nf
        #execute nam on the trace file
        exec nam.out &
        exit 0



} 
#queue limit
Queue set limit_ $val(queue-length)

#create two nodes
set n0 [$ns node]
set n1 [$ns node]

#create a simplex link between the nodes
$ns simplex-link $n0 $n1 ${val(bandwidth)}Mb 5ms
DropTail

#set up flows from n1 to n0
for {set i 0} {$i < $val(flows) } {incr i} {
  
     #create a Null agent (a traffic sink) and attach
it to node n1
     set null_($i) [new Agent/Null]
     $ns attach-agent $n1 $null_($i)
     
     #create a UDP agent and attach it to node n0
     set udp_($i) [new Agent/UDP]
     $ns attach-agent $n0 $udp_($i)
     
     #create a pareto ON/OFF traffic source and attach
to udp_($i)
     set pareto_($i) [new Application/Traffic/Pareto]
     $pareto_($i) set packetsize_ $val(pktsize)
     $pareto_($i) set burst-time_ $val(burst)       
     $pareto_($i) set idle-time_ $val(idle)
     $pareto_($i) set rate_ ${val(peak)}k
     $pareto_($i) set shape_ 1.5
     $pareto_($i) set attach-agent $udp_($i)
     
     #connect the traffic source to traffic sink null0
     $ns connect $udp_($i) $null_($i)
     
     #schedule events
     $ns at 10.0 "$pareto_($i) start"
     $ns at $val(stop) "$pareto_($i) stop"
     
}



#call the finish procedure at the end of simulation
time
$ns at $val(stop) "finish"



#run sim
ns run$



____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie