如何更改 NS2 模拟中链路的延迟?

发布于 2024-12-19 17:08:34 字数 313 浏览 3 评论 0原文

我需要运行 NS2 模拟,链路的延迟会发生变化 在运行时,我在 tcl 脚本中使用以下过程:

$ns delay $node3 $node4 $delay_time 

更改 $node3 和 $node4 之间链接的延迟。
但只有在模拟开始之前设置它才有效。
如果我想改变某个时间的延迟,例如

$ns at 1.0 "$ns delay $node3 $node4 10ms"

它不起作用。那么如何改变运行时链接的延迟呢?

感谢您的任何帮助。

I need to run a NS2 simulation that the delay of a link will change
during the runtime, and I use following procedure in tcl script:

$ns delay $node3 $node4 $delay_time 

to change the delay in a link between $node3 and $node4.
But it only works when it's set before the simulation starts.
If I want to change the delay in a certain time, e.g.

$ns at 1.0 "$ns delay $node3 $node4 10ms"

It doesn't work.So how to change the delay of a link during runtime?

Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一笔一画续写前缘 2024-12-26 17:08:34

我自己断断续续地寻找这个答案已经有一段时间了。我一直在不断地回到这个令人沮丧的未解答的问题。这里是。

如上所述,您有 $node3 和 $node4。

要获取链接,请使用

set myLink [[$ns link $n(0) $n(1)] link]

注意,这不仅仅是链接,它是链接中的 link_ (手册第 68 页 http://www.isi.edu/nsnam/ns/doc/ns_doc.pdf 或 html 版本 http://www.isi.edu/nsnam/ns/doc/node63.html)。这是管理链路延迟的部分。为了改变链接延迟,使用

$myLink set delay_ 1ms

这部分在ns-2.35/tcl/lib/ns-link.tcl中找到

I have been looking for this answer on and off for quite some time myself. I have been constantly making my way back here to this depressingly unanswered question. Here it is.

Say as above, you have $node3 and $node4.

To get your link, use

set myLink [[$ns link $n(0) $n(1)] link]

Note that this is not just the link, it is the link_ within the Link (manual page 68 http://www.isi.edu/nsnam/ns/doc/ns_doc.pdf or html version http://www.isi.edu/nsnam/ns/doc/node63.html). This is the part that manages the link delay. In order to change the link delay, use

$myLink set delay_ 1ms

This part was found in ns-2.35/tcl/lib/ns-link.tcl

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文