# Simulate the scenario John mentioned in discussion 10/23: # pulse UDP + TCP cross traffic # use rtt as an indicator of failure, loss rate is too binary. # Get the common functions needed. source pudp_comm.tcl set stop_t 5.0 set node_num 6 set tr_fn "pudp.tr" set nam_fn "pudp.nam" set q_fn "pudp.q" # Initialize the simulation setup. init_sim # Build the topology like: # To get influence from other traffic flow==> share the same link # # 2 # | # 0===1===3===5 # | | # 4 6 # # To get the synchronous effect (otherwise cbr->pulse effect will be reduced.) # we'd better set all the cross traffic to have the same source. # The cross traffic are: # pulse udp: 0-1-2 # background cbr udp: 0-1-3-5 # cross tcp traffic: 1-3-4 # cross tcp traffic 2: 3-5-6 # # Link 0-1-3-5 (background cbr udp) # Link 0-1-2 (pulse udp) $ns duplex-link $n(0) $n(1) 5Mb 10ms DropTail $ns duplex-link $n(1) $n(2) 5Mb 10ms DropTail # Link 1-3-4 (cross tcp 1) $ns duplex-link $n(1) $n(3) 2Mb 25ms DropTail $ns duplex-link $n(3) $n(4) 2Mb 25ms DropTail # Link 3-5-6 (cross tcp 2) $ns duplex-link $n(3) $n(5) 1Mb 50ms DropTail #$ns duplex-link $n(5) $n(6) 1Mb 50ms DropTail # The queues are big enough on the pathes (0-1) of pulse traffic, # Otherwise, pulse effect will be reduced greatly. $ns queue-limit $n(0) $n(1) 1000 #small buffers downstream. #$ns queue-limit $n(1) $n(3) 75 $ns queue-limit $n(1) $n(3) 50 $ns queue-limit $n(3) $n(5) 1000 # Setup for nam. # Link positions. # Link 0-1-2 $ns duplex-link-op $n(0) $n(1) orient right $ns duplex-link-op $n(1) $n(2) orient up # Link 1-3-4 $ns duplex-link-op $n(1) $n(3) orient right $ns duplex-link-op $n(3) $n(4) orient down # Link 3-5-6 $ns duplex-link-op $n(3) $n(5) orient right #$ns duplex-link-op $n(5) $n(6) orient down # Monitoring the queue on each share link. #$ns duplex-link-op $n(0) $n(1) queuePos 0.5 $ns duplex-link-op $n(1) $n(3) queuePos 0.5 #$ns duplex-link-op $n(3) $n(5) queuePos 0.5 set qmon(01) [$ns monitor-queue $n(0) $n(1) $q_f] [$ns link $n(0) $n(1)] queue-sample-timeout; set qmon(13) [$ns monitor-queue $n(1) $n(3) $q_f] [$ns link $n(1) $n(3)] queue-sample-timeout; set qmon(35) [$ns monitor-queue $n(3) $n(5) $q_f] [$ns link $n(3) $n(5)] queue-sample-timeout; # Create CBR traffic (good and pulse.) # creat_cbr {src_ dst_ psize_ intv_ startt_ color_} # 200 kbps data rate (0-1-3-5). creat_cbr 0 5 500 2ms 1.5 2.5 0 # should be at least 125kB, to cummulate 25 cbr packets # 5 mbps data rate (0-1-2). #creat_cbr 0 2 312500 500ms 0.5 1 #creat_cbr 0 2 625000 1s 0.5 1 Agent/TCP set nam_tracevar_ true # Creat the TCP cross traffic # creat_ftp_tcp {src_ dst_ startt_ color_} # 1-3-4 #creat_ftp_tcp 1 4 0.5 2 # 3-5-6 creat_ftp_tcp 2 4 0.5 3 $ns at $stop_t "finish" proc finish {} { global ns stop_t tr_f nam_f nam_fn qmon q_f $ns flush-trace close $tr_f close $nam_f qmon_sum $qmon(01) 0 1 5000000 qmon_sum $qmon(13) 1 3 2000000 # qmon_sum $qmon(35) 3 5 1000000 close $q_f puts "Filtering ..." exec tclsh namfilter.tcl $nam_fn puts "running nam..." exec nam $nam_fn & #run_nam $nam_fn exit 0 } $ns run