NS2 xgraph实例代码demo

这篇博客分享了一段NS2中运用Xgraph进行分析的实战代码,旨在帮助正在学习NS2及其分析工具的读者,提供了一个可供参考的实例。
摘要由CSDN通过智能技术生成

最近在看NS2 学习NS2的分析工具的使用 这段代码主要是我自己用的 因为网上没有地方保存 所以就暂时存在博客里了 有这方面学习的同学可以参考一下这个例子

set ns [new Simulator]
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]

$ns duplex-link $n0 $n3 1Mb 100ms DropTail
$ns duplex-link $n1 $n3 1Mb 100ms DropTail
$ns duplex-link $n2 $n3 1Mb 100ms DropTail
$ns duplex-link $n3 $n4 1Mb 100ms DropTail

proc attach-expoo-traffic { node sink size burst idle rate } {
 #Get an instance of the simulator
 set ns [Simulator instance]

 #Create a UDP agent and attach it to the node
 set source [new Agent/UDP]
 $ns attach-agent $node $source

 #Create an Expoo traffic agent and set its configuration parameters
 set traffic [new Application/Traffic/Exponential]
 $traffic set packet-size $size
 $traffic set burst-time $burst
 $traffic set idle-time $idle
 $traffic set rate $rate
        
        # Attach traffic source to the traffic generator
    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值