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

Re: [ns] Multiple Simulator Object Invocation



Hi again,

It's solved by having "$ns_ destroy" before the invocation line.

Noparut

On Mon, 29 Jan 2001, vanitcha wrote:

>Hi,
>
>Has anyone tried invoking a simulation from another simulation? Below is
>part of my code and error messages. The problem is the "if <condition>"
>part which is supposed to invoke another run of simulation if the
>condition is satisfied. Without this "if" part, the program works just
>fine. Any suggestions?
>
>Thanks.
>
>Noparut Vanitchanant
>
>--------------------------------------------------~
>debug: one round
>debug: one round
>ns: finish: invalid command name "_o3 _o2426"
>    while executing
>"$ns_ get-nodetype"
>    (procedure "_o2433" line 22)
>    (Node init line 22)
>    invoked from within
>"_o2433 init "
>    (Class create line 1)
>    invoked from within
>"Node create _o2433 "
>    invoked from within
>"catch "$className create $o $args" msg"
>    (procedure "new" line 3)
>    invoked from within
>"new Node"
>    ("eval" body line 1)
>    invoked from within
>"eval new [Simulator set node_factory_] $args"
>    (procedure "_o2426" line 21)
>    (Simulator node line 21)
>    invoked from within
>"$ns_ node"
>    (procedure "run_sim" line 11)
>    invoked from within
>"run_sim"
>    (procedure "myMain" line 11)
>    invoked from within
>"myMain $argv"
>    (procedure "finish" line 23)
>    invoked from within
>"finish"
>
>-------------------------------------------------
>Main instproc finish {} {
>	...
>	puts "debug: one round"
>	if {<condition>} {            
>	    new Main $argv
>	}
>}
>
>Main instproc run_sim {} {
>	...
>	$ns_ at <time> "$self finish"
>}
>
>Main instproc init {arg} {
>	$self instvar ns_
>
>	set ns_ [new Simulator]
>	....
>	
>	$self run_sim
>}
>
>new Main $argv
>
>
>
>