problem in printing the variables within agents

View: New views
1 Messages — Rating Filter:   Alert me  

problem in printing the variables within agents

by JCJC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are several agents defined in my .tcl file, named agent0,agent1,agent2.....agentn, in C++ coding, I've had some variables binding within the agent's defination, for example
agent::agent():agent(...)
{
   bind("v1",&v1);
}

At the end of the simulation, I try to print the v1 within each agent to a file

set out [open testresult a]
        for {set i 0} {$i <= 1} {incr i} {
                # How can I puts out ? those variables
        }
        puts $out $output
        close $out

I tried $agent($i)(v1) but ns2 does not like it.  Can some body give me a hint? Thank you very much