Thanks for your reply! but there is no command "Iif" in tcl/lib/ns-link.tcl. it is " Link instproc all-connectors op { foreach c [$self info vars] { $self instvar $c if ![info exists $c] continue if [array size $c] continue foreach var [$self set $c] { if [catch "$var info class"] { continue } if ![$var info class Node] { ;# $op on most everything catch "$var $op";# in case var isn't a connector } } } } " However ,the script can run successfully on NS-2.26. Thanks!
At 2011-05-07 17:14:01,fivos <fivos....@gmail.com> wrote: >Go to tcl/lib/ns-link.tcl and try renaming lif to if and recompile ns >. it should work then. >Iif ![$var info class Node] { ;# $op on most everything ----- > if >![$var info class Node] { ;# $op on most everything > >cheers > >2011/5/6 ma-haiyuan <ma-haiy...@163.com>: >> >> >> Hello everyone! >> >> When I do the tutorial for the network simulator "NS" originally developed >> by Mac Greis, the subsection VI.2, the example can not run on my ns(version >> 2.31). The error is as follows: >> >> invalid command name "Iif" >> while executing >> "Iif ![$var info class Node] { ;# $op on most everything >> catch "$var $op";# in case var isn't a connector >> }" >> (procedure "_o63" line 10) >> (Link all-connectors line 10) >> invoked from within >> "$self all-connectors isDynamic" >> (procedure "_o63" line 10) >> (SimpleLink dynamic line 10) >> invoked from within >> "$links_($l) dynamic" >> (procedure "_o177" line 8) >> (rtModel configure line 8) >> invoked from within >> "$m configure" >> ("foreach" body line 2) >> invoked from within >> "foreach m $rtModel_ { >> $m configure >> }" >> invoked from within >> "if [info exists rtModel_] { >> set rtq_ [new rtQueue $self] >> foreach m $rtModel_ { >> $m configure >> } >> }" >> (procedure "_o3" line 3) >> (Simulator rtmodel-configure line 3) >> invoked from within >> "$self rtmodel-configure " >> (procedure "_o3" line 4) >> (Simulator run line 4) >> invoked from within >> "$ns run" >> (file "example.tcl" line 60) >> >> I just download the example script without any modifization. >> >> If I comment out the commands >> #$ns rtmodel-at 1.0 down $n(1) $n(2) >> #$ns rtmodel-at 2.0 up $n(1) $n(2) >> The example can run succefully. >> >> How can this happen? >> Thanks very much! >> >> >> >>