我正在使用 NS-2.35 ... 我对 AODV 协议(protocol)进行了更改以支持受控移动性。我需要将 x 和 y 位置(在执行移动性算法之后)从 C++ 传递到 TCL,然后将它们放入 (setdest) 命令中。 我在 aodv 构造函数中做了以下操作:
bind("x_axis",&x_tcl);
bind("y_axis",&y_tcl);
我在 ns-default.tcl 中给 x_axis 和 y-axis 一个默认值。
这就是我在 TCL 代码中使用它们的方式:
$ns at 21.0 "$node_(0) setdest $x_axis $y_axis 100.0"
但我收到以下错误:
num_nodes is set 36
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
can't read "x_axis": no such variable
while executing
"$ns at 21.0 "$node_(0) setdest $x_axis $y_axis 100.0""
(file "eaodv.tcl" line 309)
有什么问题吗??你能帮帮我吗?
最佳答案
我认为问题出在您对 tcl 中绑定(bind)变量的使用上
$ns at 21.0 "$node_(0) setdest x_axis y_axis 100.0"
这应该有帮助 OTcl Linkage
关于c++ - 在 NS-2 中绑定(bind)变量时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29715083/