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

Simulation timing



Help me, ns-ers!
I want to send some traffic, and then when that is done, either do it again, or do something else.  I haven't been able to do that yet, as everything seems to happen at once! I have a file transfer in a while loop, and try to add some time to the current time, then show both values  - this happens during each while loop, but the times don't change.  The code that yielded the console output below is at the bottom of the message.
Thanks

Steve Russert
Boeing Phantom Works
Mathematics and Computing Technology
425-865-3588
[email protected]


CONSOLE OUTPUT

$ ns asym20.tcl
now = 0.20000000000000001
later= 1.1000000000000001
handshake sees exit as 1.1000000000000001
handshake exit time 0.20000000000000001
now = 0.20000000000000001
later= 1.1000000000000001
handshake sees exit as 1.1000000000000001
handshake exit time 0.20000000000000001
now = 0.20000000000000001
later= 1.1000000000000001
handshake sees exit as 1.1000000000000001
handshake exit time 0.20000000000000001
now = 0.20000000000000001
later= 1.1000000000000001
handshake sees exit as 1.1000000000000001
handshake exit time 0.20000000000000001
now = 0.20000000000000001
later= 1.1000000000000001
handshake sees exit as 1.1000000000000001
handshake exit time 0.20000000000000001

TCL CODE
proc startup {} {
	global exit cnt ns now delay
	# set current time
	set now [$ns now]
	while {$cnt < 5} {
	    set now [$ns now]
	    puts "now = $now"
	    # set time interval
	    set exit [expr $now+$delay]
	    puts "later= $exit"
	    "handshake"
	}
}

proc handshake {} {
	global tcp1 exit ftp1 delay ns cnt now
	# increment count
	set cnt [expr $cnt+1]
	#puts "$cnt"
	#send something
	$tcp1 set window_ 1
	$tcp1 set packetSize_ 100
	$ftp1 send 1
	puts "handshake sees exit as $exit"
	puts "handshake exit time [$ns now]"
}