##
#
# Test script.
#
# Copyright 2007-2008, Freie Universitaet Berlin. All rights reserved.
# Please refer to the COPYING file for detailed licensing information.
#
# Author: Georg Wittenburg
#
# $Id: tx_radius.tcl 2686 2008-06-26 10:30:01Z wittenbu $
#
##



source common/config.tcl

# Number of mobile nodes.
set val(nn)	31

# Node spacing interval (m).
set spacing	100

# Size of topography (m).
set val(x)	[expr $val(nn) * $spacing]
set val(y)	1000

# Simulation duration and expetected time of completion (s).
set simulation_duration	3600.0



source common/header.tcl

# Create, initialize and connect nodes, agents and applications.
for {set i 0} {$i < $val(nn)} {incr i} {
	set node_($i) [$ns_ node]
	$node_($i) set X_ [expr $i * $spacing]
	$node_($i) set Y_ [expr $val(y) / 2]
	$node_($i) set Z_ 0
	$node_($i) random-motion 0		;# Disable random motion
	$god_ new_node $node_($i)
	$ns_ initial_node_pos $node_($i) 10

	set agent_($i) [new Agent/MessagePassing]
	set application_($i) [new Application/C]
	$node_($i) attach $agent_($i)
	$application_($i) attach-agent $agent_($i)
	$application_($i) seed heuristic 0	;# Enable heuristic random seed in application
	$ns_ at [$rng_ uniform $start_phase_begin $start_phase_end] "$application_($i) start"
	$ns_ at [$rng_ uniform $stop_phase_begin $stop_phase_end] "$application_($i) stop"
	$ns_ at $finalize_phase_begin "$application_($i) finalize"
}



# Broadcast a NOP to all nodes in the neighborhood.
for {set t $simulation_begin} {$t < $simulation_end} {set t [expr $t + 1]} {
	$ns_ at $t "$application_(0) ICMP_send_nop -1 1"
}

# Start simulation.
puts "Starting Simulation..."
$ns_ run
