上图是笔记
下面是tcl代码:
#Create a simulator object
set ns [new Simulator]
#Set different color for dif flow
$ns color 1 Blue
$ns color 2 Red
set tracefd [open example1.tr w]
$ns trace-all $tracefd
set namtracefd [open example1.nam w]
$ns namtrace-all $namtracefd
proc finish {} {
global ns tracefd namtracefd
$ns flush-trace
close $tracefd
close $namtracefd
exec nam example1.nam &
exit 0
}
# Set nodes, s1's id is 0, s2'id is 1
set s1 [$ns node]
set s2 [$ns node]
# Set router node, id of r is 2
set r [$ns node]
# Set dest node, id of r is 3
set d [$ns node]
# Set link parameters
$ns duplex-link $s1 $r 2Mb 10ms DropTail
$ns duplex-link $s2 $r 2Mb 10ms DropTail
$ns duplex-link $r $d 1.7Mb 20ms DropTail
# Set Queue l