LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-30-2012, 08:11 AM   #1
ambikanadig
LQ Newbie
 
Registered: Mar 2012
Posts: 13

Rep: Reputation: Disabled
Tcl code


Please check the below code, the code is for the Random generation, please check whether it is right or not. In terminal window when i run the code its not showing any error, but in the nam Animator there is no time segment line, when i click on the play option.
so please any one of you can help me in proceeding further.

# Creating New Simulator
set ns [new Simulator]

# Setting up the traces
set t [open randudp.tr w]
set nf [open randudp.nam w]
$ns namtrace-all $nf
$ns trace-all $t

proc finish {} {
global ns nf t
$ns flush-trace
close $nf
close $t
exec nam randudp.nam &
exit 0
}


#Create Nodes
set n(0) [$ns node]
$n(0) label "Voice 0"
$n(0) color #000000000000
puts "n(0): [$n(0) id]"

set n(1) [$ns node]
$n(1) label "Voice 1"
$n(1) color #333300000000
puts "n(1): [$n(1) id]"

set n(2) [$ns node]
$n(2) label "Voice 2"
$n(2) color #333300009999
puts "n(2): [$n(2) id]"

set n(3) [$ns node]
$n(3) label "Voice 3"
$n(3) color #33330000ffff
puts "n(3): [$n(3) id]"

set n(4) [$ns node]
$n(4) label "Voice 4"
$n(4) color #666600000000
puts "n(4): [$n(4) id]"

set n(5) [$ns node]
$n(5) label "Voice 5"
$n(5) color #666600009999
puts "n(5): [$n(5) id]"

set n(6) [$ns node]
$n(6) label "Voice 6"
$n(6) color #999900000000
puts "n(6): [$n(6) id]"

set n(7) [$ns node]
$n(7) label "Voice 7"
$n(7) color #99990000ffff
puts "n(7): [$n(7) id]"

set n(8) [$ns node]
$n(8) label "Voice 8"
$n(8) color #cccc00000000
puts "n(8): [$n(8) id]"

set n(9) [$ns node]
$n(9) label "Voice 9"
$n(9) color #cccc00009999
puts "n(9): [$n(9) id]"

set n(10) [$ns node]
$n(10) label "Voice 10"
$n(10) color #ffff00000000
puts "n(10): [$n(10) id]"

set n(11) [$ns node]
$n(11) label "Voice 11"
$n(11) color #000066660000
puts "n(11): [$n(11) id]"

set n(12) [$ns node]
$n(12) label "Voice 12"
$n(12) color #666666660000
puts "n(12): [$n(12) id]"

set n(13) [$ns node]
$n(13) label "Voice 13"
$n(13) color #0000ccccffff
puts "n(13): [$n(13) id]"

set n(14) [$ns node]
$n(14) label "Voice 14"
$n(14) color #ffff99990000
puts "n(14): [$n(14) id]"

set n(15) [$ns node]
$n(15) label "Voice 15"
$n(15) color #333366663333
puts "n(15): [$n(15) id]"

set n(16) [$ns node]
$n(16) label " Voice 16"
$n(16) color #000099990000
puts "n(16): [$n(16) id]"

set n(17) [$ns node]
$n(17) label " Voice 17"
$n(17) color #000000006666
puts "n(17): [$n(17) id]"

set n(18) [$ns node]
$n(18) label "Voice 18"
$n(18) color #ffff00009999
puts "n(18): [$n(18) id]"

set n(19) [$ns node]
$n(19) label "Voice 19"
$n(19) color #33339999ffff
puts "n(19): [$n(19) id]"


# SETTING THE LINK B.W, DELAY, QUEUE TYPE


$ns duplex-link $n(0) $n(12) 16mb 0.202ms DropTail

$ns duplex-link $n(0) $n(14) 16mb 0.201ms DropTail

$ns duplex-link $n(1) $n(12) 16mb 0.203ms DropTail

$ns duplex-link $n(1) $n(14) 16mb 0.118ms DropTail

$ns duplex-link $n(2) $n(14) 16mb 0.108ms DropTail

$ns duplex-link $n(2) $n(15) 16mb 0.110ms DropTail

$ns duplex-link $n(3) $n(15) 16mb 0.010ms DropTail

$ns duplex-link $n(3) $n(16) 16mb 0.020ms DropTail

$ns duplex-link $n(4) $n(15) 16mb 0.003ms DropTail

$ns duplex-link $n(4) $n(16) 16mb 0.204ms DropTail

$ns duplex-link $n(5) $n(12) 16mb 0.003ms DropTail

$ns duplex-link $n(5) $n(13) 16mb 0.404ms DropTail

$ns duplex-link $n(6) $n(13) 16mb 0.020ms DropTail

$ns duplex-link $n(6) $n(17) 16mb 0.20ms DropTail

$ns duplex-link $n(7) $n(13) 16mb 0.202ms DropTail

$ns duplex-link $n(7) $n(17) 16mb 0.404ms DropTail

$ns duplex-link $n(8) $n(17) 16mb 0.101ms DropTail

$ns duplex-link $n(8) $n(18) 16mb 0.302ms DropTail

$ns duplex-link $n(9) $n(18) 16mb 0.204ms DropTail

$ns duplex-link $n(9) $n(19) 16mb 0.108ms DropTail

$ns duplex-link $n(10) $n(18) 16mb 0.204ms DropTail

$ns duplex-link $n(10) $n(19) 16mb 0.142ms DropTail

$ns duplex-link $n(11) $n(16) 16mb 0.134ms DropTail

$ns duplex-link $n(11) $n(19) 16mb 0.252ms DropTail

$ns duplex-link $n(12) $n(13) 16mb 0.204ms DropTail

$ns duplex-link $n(12) $n(14) 16mb 0.208ms DropTail

$ns duplex-link $n(13) $n(17) 16mb 0.208ms DropTail

$ns duplex-link $n(14) $n(15) 16mb 0.302ms DropTail

$ns duplex-link $n(17) $n(18) 16mb 0.203ms DropTail

$ns duplex-link $n(14) $n(17) 16mb 0.208ms DropTail

$ns duplex-link $n(15) $n(18) 16mb 0.206ms DropTail

$ns duplex-link $n(15) $n(16) 16mb 0.118ms DropTail

$ns duplex-link $n(18) $n(19) 16mb 0.114ms DropTail

$ns duplex-link $n(16) $n(19) 16mb 0.102ms DropTail

$ns duplex-link $n(12) $n(17) 16mb 0.20ms DropTail


#SETTING THE ORIENTIATION FOR THE LINKS
$ns duplex-link-op $n(12) $n(14) orient right

$ns duplex-link-op $n(12) $n(13) orient down

$ns duplex-link-op $n(14) $n(15) orient right

$ns duplex-link-op $n(14) $n(17) orient down

$ns duplex-link-op $n(13) $n(17) orient right

$ns duplex-link-op $n(15) $n(18) orient down

$ns duplex-link-op $n(17) $n(18) orient right

$ns duplex-link-op $n(15) $n(16) orient right

$ns duplex-link-op $n(16) $n(19) orient down

$ns duplex-link-op $n(18) $n(19) orient right

$ns duplex-link-op $n(12) $n(17) orient right-down



set rng [new RNG]
$rng seed 0
set size [new RandomVariable/Exponential]
$size set avg_ 100
$size use-rng $rng

for {set i 1} {$i <= 19} {incr i} {
for {set j 1} {$j <=191} {set j [expr $j+1]} {
set udp($i,$j) [new Agent/UDP]
$ns attach-agent $n($i) $udp($i,$j)
set null($i,$j) [new Agent/Null]
$ns attach-agent $n($i) $null($i,$j)
$ns connect $udp($i,$j) $null($i,$j)
set Exponential($i,$j) [new Application/Traffic/Exponential]
$Exponential($i,$j) attach-agent $udp($i,$j)
$Exponential($i,$j) set interval [expr 0.202]
$Exponential($i,$j) set size_ [expr 1.0*[$size value]]
$ns at 0.5 "$Exponential($i,$j) start"
}
}


$ns at 10.0 "finish"
$ns run
 
Old 05-30-2012, 09:25 PM   #2
BeerIsGood
LQ Newbie
 
Registered: Aug 2005
Location: Emerald, Queensland, Australia
Distribution: Kubuntu => moving => Debian 6
Posts: 27
Blog Entries: 1

Rep: Reputation: 0
I would suggest finding a forum for advice on tcl. This is a forum for people that are new to Linux.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
want a ns2 program code in tcl MONICA Linux - Wireless Networking 1 04-23-2012 05:49 PM
tcl code for ns2 simulation shanky Programming 2 08-09-2011 11:57 PM
diffserv tcl code MLinux Linux - Networking 0 11-23-2010 03:09 PM
how C++ code can be exploited in tcl script? saif_ict Programming 1 04-12-2010 07:26 AM
code analysis for C, C++, Java, Tcl, PHP powah Programming 2 04-21-2005 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration