Tcl ns2将多个应用程序附加到一个代理

Tcl ns2将多个应用程序附加到一个代理,tcl,ns2,Tcl,Ns2,谁能告诉我该如何解决这个问题?我在将多个应用程序附加到一个代理时遇到问题。(我正在Ubuntu12.10上运行ns2.35) 我的环境中有两个节点(源节点和目标节点),以下是一些功能: 我在目标节点上附加了一个丢失监视器代理 我在源节点上附加了一个udp代理 我通过以下声明在udp代理上附加了9个应用程序: set nExpGen 9 for {set i 1} {$i <= $nExpGen} {incr i} { set eee($i) [new Application/Tra

谁能告诉我该如何解决这个问题?我在将多个应用程序附加到一个代理时遇到问题。(我正在Ubuntu12.10上运行ns2.35)

我的环境中有两个节点(源节点和目标节点),以下是一些功能:

  • 我在目标节点上附加了一个丢失监视器代理

  • 我在源节点上附加了一个udp代理

  • 我通过以下声明在udp代理上附加了9个应用程序:

    set nExpGen 9
    for {set i 1} {$i <= $nExpGen} {incr i} {
        set eee($i) [new Application/Traffic/Exponential]
        $eee($i) attach-agent $udp
        $ns connect $eee($i) $lmt
    #nExpGen= number of exponential generators
    #eee = exponential application
    #lmt = loss-monitor agent
    
    set nExpGen 9
    对于{set i 1}{$i我得到了解决方案:
    下面的语句在两个“代理”(这里是$A和$B)之间建立连接

    因此,对于这个问题,我将连接UDP代理和LossMonitor代理(在for循环之外)


    将“应用程序”连接到“代理程序”会导致编译错误。

    应用程序实体在您的模型中吗?是的。我使用默认的指数应用程序。我看到了
    subst$[subst$var]
    !我想这可能需要三重替换,这让我头疼。天哪……您的意思是它不应该是
    $eee($I)
    ?我如何修改或简化它?
    [set$var]
    可能有助于变量的双重扩展
    can't read "agent_addr_": no such variable
        while executing
    "subst $[subst $var]"
        (procedure "_o40" line 5)
        (Object next line 5)
        invoked from within
    "_o40 next agent_addr_"
        ("eval" body line 1)
        invoked from within
    "eval $self next $args"
        (procedure "_o40" line 11)
        (Application/Traffic set line 11)
        invoked from within
    "$dst set agent_addr_"
        (procedure "_o3" line 2)
        (Simulator simplex-connect line 2)
        invoked from within
    "$self simplex-connect $dst $src"
        (procedure "_o3" line 10)
        (Simulator connect line 10)
        invoked from within
    "$ns connect $eee($i) $lmt"
        ("for" body line 4)
        invoked from within
    "for {set i 1} {$i <= $nExpGen} {incr i} {
            set eee($i) [new Application/Traffic/Exponential]
            $eee($i) attach-agent $udp
            $ns con..."
        (file "myTest3.tcl" line 47)
    
    $ns connect $A $B
    
    $ns connect $udp $lmt