[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] code
The code I'm using (referring to the attach-agent and connect post I just
made) is the following:
from the beginning of the script:
for {set ctr_ 0} {$ctr_ < 10} {incr ctr_ 1} {
set agentNew_($ctr_) [new Agent/newAgent]
$ns attach-agent $n($ctr_) $agentNew_($ctr_)
}
Then, later in the simulation, if the new type of packet needs to be sent
from a node, the node does the following:
set thisNode [ $Node id ]
set thisNewAgent [ $ns get-new-agent $thisNode ]
****However, I get an error when I call the get-new-agent function, the
Simulator class is unable to locate the $agentNew_($nodeID).****
The get-new-agent function is defined below:
Simulator instproc get-new-agent { nodeID } {
$self instvar agentNew_
$self set thisAgent $agentNew_($nodeID)
puts "thisAgent is $thisAgent"
return $thisAgent
}
Thanks again for any tips!
-Lori