Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL script not giving the right graphs..

Status
Not open for further replies.

BabyPinky8888

Programmer
Feb 24, 2009
10
US
i am running a tcl script which does not give me the right graphs.. can someone tell em as to where I am making a mistake ?


source /home/..../ns2/ns-allinone-2.33/ns-2.33/obs-0.9a/tcl/lib/ns-obs-lib.tcl
source /home/....../ns2/ns-allinone-2.33/ns-2.33/obs-0.9a/tcl/lib/ns-obs-defaults.tcl
source /home/....../ns2/ns-allinone-2.33/ns-2.33/obs-0.9a/tcl/lib/ns-optic-link.tcl


StatCollector set debug_ 1
Classifier/BaseClassifier/EdgeClassifier set type_ 0
Classifier/BaseClassifier/CoreClassifier set type_ 1
Classifier/BaseClassifier set nfdl 16
Classifier/BaseClassifier set fdldelay 0.000
Classifier/BaseClassifier set maxfdls 5
Classifier/BaseClassifier set ebufoption 0
#no FDLs:
Classifier/BaseClassifier set option 0
OBSFiberDelayLink set FDLdelay 0.0


#bandwidth (bps) that EACH channel gets
set bwpc 1000000000
set delay .5ms
#number of control channels
set ncc 16
#number of data channels
set ndc 16

#burst assembly time (s)
BurstManager bursttimeout 0.01
#burst size threshold (bytes)
#1000000 (1MB)
BurstManager maxburstsize 1000000

#.000001 (1us)
BurstManager offsettime 0.00004
Classifier/BaseClassifier/CoreClassifier set bhpProcTime .000001
Classifier/BaseClassifier/EdgeClassifier set bhpProcTime .000001


Agent/TCP set packetSize_ 1000
Agent/TCP set window_ 10000
Agent/TCP set max_ssthresh_ 512
#Setting option for HSTCP
#Agent/TCP set windowOption_ 8

set tcpflow 2


#simulator object
set ns [new Simulator]
#stat collector
set sc [new StatCollector]

set trace [open trace1a.tr w]

for { set i 0 } { $i < $tcpflow } {incr i } {

set cwn($i) [open cwnd$i.tr w]

set tput($i) [open tp$i.tr w]

}

$ns trace-all $trace


#called when the simulation is complete
proc finish {} {

global ns sc


#display the stats
$sc display-sim-list

puts "done"
exit 0
}


#writes all the data to the trace files
proc record {} {

global ns tcpflow tcpSrc sink cwn tput tcpsink tcp
set time 1.0
set now [$ns now]

$ns at [expr $now + $time] "record"

set bytes [$sink(0) set bytes_]

set tbytes(0) [expr $bytes/1]

set bytes1 [$sink(1) set bytes_]

set t1bytes(1) [expr $bytes1/1]


puts "bytes1 $tbytes(0)"

puts "bytes $t1bytes(1)"

#set total [expr $bytes1 + $bytes]

set cwnd(0) [$tcp(0) set cwnd_]

set cwnd(1) [$tcp(0) set cwnd_]

#puts $total

puts $tput(0) "$now $tbytes(0)"

puts $tput(1) "$now $t1bytes(1)"

puts $cwn(0) "$now $cwnd(0)"

puts $cwn(1) "$now $cwnd(1)"

$sink(0) set bytes_ 0

$sink(1) set bytes_ 0

puts "$now"

}


#add method create topology to simulator object
proc create_topology { } {
global E C ns
global bwpc ncc ndc delay

set edge_count 6
set core_count 4

for { set i 0 } { $i < $edge_count } { incr i } {
set E($i) [$ns create-edge-node $edge_count]
}

for { set i 0 } { $i < $core_count } { incr i } {
set C($i) [$ns create-core-node $core_count]
}


set maxch [expr $ncc + $ndc]
$ns createDuplexFiberLink $E(0) $C(0) $bwpc 1ms $ncc $ndc $maxch
$ns createDuplexFiberLink $C(0) $E(1) $bwpc 1ms $ncc $ndc $maxch
$ns createDuplexFiberLink $C(0) $E(2) $bwpc 1ms $ncc $ndc $maxch
$ns createDuplexFiberLink $C(1) $E(3) $bwpc 1ms $ncc $ndc $maxch
$ns createDuplexFiberLink $C(1) $E(4) $bwpc 1ms $ncc $ndc $maxch
$ns createDuplexFiberLink $C(1) $E(5) $bwpc 1ms $ncc $ndc $maxch
$ns createDuplexFiberLink $C(0) $C(1) $bwpc 5ms $ncc $ndc $maxch

$ns build-routing-table
}


proc setup-flows {} {
global E n1 n2
global tcpSrc tcp sink
global tcpsink
global ns pkts

set tcpSrc(0) [$ns create-connection-list TCP/Sack1 $E(0) TCPSink/Sack1 $E(2) 0]
set tcpSrc(1) [$ns create-connection-list TCP/Sack1 $E(0) TCPSink/Sack1 $E(2) 0]

set ftp [new Application/FTP]
set ftp1 [new Application/FTP]

$ftp attach-agent [lindex $tcpSrc(0) 0]
$ftp1 attach-agent [lindex $tcpSrc(1) 0]

set tcp(0) [lindex $tcpSrc(0) 0]
set tcp(1) [lindex $tcpSrc(1) 0]

set sink(0) [lindex $tcpSrc(0) 1]
set sink(1) [lindex $tcpSrc(1) 1]

# starting time for sending simulated data flow across the network
$ns at 0.0 "$ftp start"
$ns at 0.0 "$ftp1 start"


}

create_topology
setup-flows


$ns at 0.0 "record"
$ns at 500 "finish"
$ns run
 
I don't see any graphs.

_________________
Bob Rashkin
 
Be that as it may, I, at least, don't understand the question. Perhaps the OP could post some more targeted information, like what a statement produces and what he was expecting it to produce.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top