ns2 - 当将节点的随机运动设置为 0 时会出现错误:“调用类 $cls 时出错:$args”$...”
问题描述
这是一个有线网络,row*col
数量为nodes
. 由于它是静态的,我试图将其设置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.04
,ns-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
解决方案
推荐阅读
- c - 如何使用指针正确访问点阵 MachX02 SRAM 地址
- ruby - Ruby中主线程退出时子线程终止是否可以?
- flutter - Flutter 是否支持特定于平台的文件?
- javascript - 简单解构程序 - ES6 (JavaScript) 抛出错误
- sql - 维护一般观点(oracle)
- mysql - 无法在 phpmyadmin 中查看表格
- c++ - 简单的 C++ 循环不受益于多线程
- android - Android 中的谷歌地图本地化
- excel - 通过组合框从多个工作表中获取数据,以在用户窗体 vba 的多个文本框中输入
- html - 滚动页面时数据列表未使用输入标签修复