【问题标题】:explanation needed for tcl filetcl 文件需要的解释
【发布时间】:2016-03-19 02:48:02
【问题描述】:

我是 NS2 的新手。我正在创建一个 tcl 文件。谁能解释一下下面几行的含义?

set udp_(0) [new Agent/UDP] 
$ns_ attach-agent $node_(1) $udp_(0) 
set null_(0) [new Agent/Null] 
$ns_ attach-agent $node_(2) $null_(0)
set cbr_(0) [new Application/Traffic/CBR]
$cbr_(0) set packetSize_ 512
$cbr_(0) set interval_ 4.0
$cbr_(0) set random_ 1
$cbr_(0) set maxpkts_ 10000
$cbr_(0) attach-agent $udp_(0)
$ns_ connect $udp_(0) $null_(0)
$ns_ at 2.5568388786897245 "$cbr_(0) start"

提前致谢

【问题讨论】:

  • 你在寻找什么样的解释?
  • 我想知道@Donal Fellows 的每一行都做了什么

标签: networking tcl ns2


【解决方案1】:

假设 ns_ 的分配类似于 set ns_ [new Simulator](您没有发布所有相关代码 - 例如,什么是 node_(1)?)

在 tcl 中 set varName valuevalue 分配给变量 varName
[...]Command substitution

在您的情况下,它为您提供了 NS2 功能的句柄
(例如,$cbr_(0) set ... 调用 Application/Traffic/CBR 对象的设置例程。

粗略地说:scipt 通过 UDP 连接建立 CBR...

也许这Simple Simulation Example 澄清了一些事情。否则你应该阅读 NS2 的文档 ;-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-14
    相关资源
    最近更新 更多