将节点的随机运动设置为0时出现错误:“调用类$ cls:$ args时出错”

时间:2018-12-31 15:17:20

标签: ns2

这是一个有线网络,编号为row*colnodes。由于它是静态的,因此我尝试将random-motion设置为0。但是,当我运行ns wired.tcl 3 3 5 0.01时,出现以下错误。这里的cmd参数是

  

ns <filename> <no of rows> <no of col> <links> <cbr_interval>

      (_o10 cmd line 1)
        invoked from within
    "_o10 cmd random-motion 0"
        invoked from within
    "catch "$self cmd $args" ret"
        invoked from within
    "if [catch "$self cmd $args" ret] {
    set cls [$self info class]
    global errorInfo
    set savedInfo $errorInfo
    error "error when calling class $cls: $args" $..."
        (procedure "_o10" line 2)
        (SplitObject unknown line 2)
        invoked from within
    "$node_($i) random-motion 0"
        ("for" body line 3)
        invoked from within
    "for {set i 0} {$i < [expr $num_row*$num_col]} {incr i} {
        set node_($i) [$ns node]
        $node_($i) random-motion 0
    }"
        (file "rough.tcl" line 34)

我正在运行ubuntu-18.04ns-allinone-2.35,这是wired.tcl文件

    set ns [new Simulator]
    $ns multicast
    set start_time 0.5
    set cbr_interval [lindex $argv 3]
    set num_row [lindex $argv 0]
    set num_col [lindex $argv 1]
    set x_dim 100
    set y_dim 100
    set grid 0

    set k 6
    set num_random_flow [lindex $argv 2]

    set traceFile [open wired.tr w]
    $ns trace-all $traceFile

    set nf [open out.nam w]
    $ns namtrace-all $nf

    #create-god [expr $num_row * $num_col ]

    proc  finish {} \
    {
        puts "finishing simulation"
        global ns nf traceFile
        $ns flush-trace
        close $traceFile
        close $nf
        #exec nam out.nam &
        exit 0
    }

    puts "start node creation"
    for {set i 0} {$i < [expr $num_row*$num_col]} {incr i} {
        set node_($i) [$ns node]
        $node_($i) random-motion 0; #problem
    }


    $ns at 5.0 "finish"
    puts "starting simulation"
    $ns run

0 个答案:

没有答案