Tcl NS2 NAM不显示传输

Tcl NS2 NAM不显示传输,tcl,ns2,Tcl,Ns2,我是NS2新手,尝试建立一个基本的哑铃形网络模拟;我有一个节点,其中有n个TCP代理(网关或“gw”)通过链路传输到远程节点(远程网关,“rgw”),远程节点连接到n个TCP接收器(每个代理与一个接收器连接) 这是一张n=5的图片。节点0有五个带有Pareto流量生成器的TCP代理;每个节点都连接到一个TCPSink代理,该代理连接到右侧的一个节点 我有以下TCL脚本来设置和测试网络;它成功运行,但当我在NAM中查看跟踪时,我看不到数据包在移动。我用NAM运行了一个类似的教程,看起来不错,所以

我是NS2新手,尝试建立一个基本的哑铃形网络模拟;我有一个节点,其中有n个TCP代理(网关或“gw”)通过链路传输到远程节点(远程网关,“rgw”),远程节点连接到n个TCP接收器(每个代理与一个接收器连接)

这是一张n=5的图片。节点0有五个带有Pareto流量生成器的TCP代理;每个节点都连接到一个TCPSink代理,该代理连接到右侧的一个节点

我有以下TCL脚本来设置和测试网络;它成功运行,但当我在NAM中查看跟踪时,我看不到数据包在移动。我用NAM运行了一个类似的教程,看起来不错,所以我自己的代码中一定有一个bug。有人能帮我找到我的错误吗

谢谢

set ns [new Simulator]

# Set up trace
set trc [open out.trc w]
set namtrc [open out.nam w]
$ns trace-all $trc
$ns namtrace-all $namtrc

proc finish {} {
    global ns trc
    global ns namtrc
    $ns flush-trace
    close $trc
    close $namtrc
    exec nam out.nam &
    exit 0
}

# Simulation parameters
set n 5
set bw 150000000 # 150 Mb/s

# Set up bottleneck link
set gw  [$ns node]
set rgw [$ns node]
$ns duplex-link $gw $rgw $bw .30 DropTail

set snd {} # TCP senders sitting on the gateway node
set trf {} # Traffic generators for the senders
set dst {} # Destination nodes hosting the receivers
set rcv {} # TCP receivers sitting on the destination

for {set i 0} {$i<$n} {incr i} {
    # Create the objects needed for a new connection
    lappend snd [new Agent/TCP]
    lappend rcv [new Agent/TCPSink]
    lappend trf [new Application/Traffic/Pareto]    
    lappend srv [$ns node]

    # set up source and destination nodes
    $ns attach-agent $gw [lindex $snd $i]
    $ns attach-agent [lindex $srv $i] [lindex $rcv $i]
    [lindex $trf $i] attach-agent [lindex $snd $i]

    # Connect nodes
    $ns duplex-link $rgw [lindex $srv $i] 1000000000000 .100 DropTail
    # Connect agents
    $ns connect [lindex $snd $i] [lindex $rcv $i]
}

foreach traffic $trf {
    $ns at 0.0 "$traffic start"
}
$ns at 10.0 "finish"

$ns run

看起来工作正常。

请尝试以下代码,工作正常

 set ns [new Simulator]

# Set up trace
set trc [open out.trc w]
set namtrc [open out.nam w]
$ns trace-all $trc
$ns namtrace-all $namtrc

proc finish {} {
    global ns trc
    global ns namtrc
    $ns flush-trace
    close $trc
    close $namtrc
    exec nam out.nam &
    exit 0
}

# Simulation parameters
set n 5
set bw 150000000; # 150 Mb/s

# Set up bottleneck link
set gw  [$ns node]
set rgw [$ns node]
$ns duplex-link $gw $rgw $bw .3000 DropTail

set snd {}
 # TCP senders sitting on the gateway node
set trf {}
 # Traffic generators for the senders
set dst {}
 # Destination nodes hosting the receivers
set rcv {}
 # TCP receivers sitting on the destination

for {set i 0} {$i<$n} {incr i} {
    # Create the objects needed for a new connection
    lappend snd [new Agent/TCP]
    lappend rcv [new Agent/TCPSink]
    lappend trf [new Application/Traffic/Pareto]    
    lappend srv [$ns node]

    # set up source and destination nodes
    $ns attach-agent $gw [lindex $snd $i]
    $ns attach-agent [lindex $srv $i] [lindex $rcv $i]
    [lindex $trf $i] attach-agent [lindex $snd $i]

    # Connect nodes
    $ns duplex-link $rgw [lindex $srv $i] 10000 .10000 DropTail
    # Connect agents
    $ns connect [lindex $snd $i] [lindex $rcv $i]
}

foreach traffic $trf {
    $ns at 0.0 "$traffic start"
}
$ns at 10.0 "finish"

$ns run
set ns[新模拟器]
#设置跟踪
设置trc[open out.trc w]
设置namtrc[open out.nam w]
$ns跟踪所有$trc
$ns namtrace all$namtrc
过程完成{}{
全球ns trc
全球ns namtrc
$ns刷新跟踪
收盘价$trc
收盘价$namtrc
执行长nam out.nam&
出口0
}
#模拟参数
第5组
设定bw 15000000;#150 Mb/s
#设置瓶颈链接
设置gw[$ns节点]
设置rgw[$ns节点]
$ns双工链路$gw$rgw$bw.3000垂尾
集合snd{}
#位于网关节点上的TCP发送方
设置trf{}
#发送方的流量生成器
设置dst{}
#承载接收器的目标节点
设置rcv{}
#位于目标上的TCP接收器

对于{set i 0}{$iHi Naveen,感谢您的回复。我使用的带宽值似乎太高,nam无法可靠地渲染。感谢您的帮助。
 set ns [new Simulator]

# Set up trace
set trc [open out.trc w]
set namtrc [open out.nam w]
$ns trace-all $trc
$ns namtrace-all $namtrc

proc finish {} {
    global ns trc
    global ns namtrc
    $ns flush-trace
    close $trc
    close $namtrc
    exec nam out.nam &
    exit 0
}

# Simulation parameters
set n 5
set bw 150000000; # 150 Mb/s

# Set up bottleneck link
set gw  [$ns node]
set rgw [$ns node]
$ns duplex-link $gw $rgw $bw .3000 DropTail

set snd {}
 # TCP senders sitting on the gateway node
set trf {}
 # Traffic generators for the senders
set dst {}
 # Destination nodes hosting the receivers
set rcv {}
 # TCP receivers sitting on the destination

for {set i 0} {$i<$n} {incr i} {
    # Create the objects needed for a new connection
    lappend snd [new Agent/TCP]
    lappend rcv [new Agent/TCPSink]
    lappend trf [new Application/Traffic/Pareto]    
    lappend srv [$ns node]

    # set up source and destination nodes
    $ns attach-agent $gw [lindex $snd $i]
    $ns attach-agent [lindex $srv $i] [lindex $rcv $i]
    [lindex $trf $i] attach-agent [lindex $snd $i]

    # Connect nodes
    $ns duplex-link $rgw [lindex $srv $i] 10000 .10000 DropTail
    # Connect agents
    $ns connect [lindex $snd $i] [lindex $rcv $i]
}

foreach traffic $trf {
    $ns at 0.0 "$traffic start"
}
$ns at 10.0 "finish"

$ns run