zoukankan      html  css  js  c++  java
  • setdest 和cbrgen工具的使用,出现的错误

    在路径 ~/ns-2.34/indep-utils/cmu-scen-gen/setdest下运行

    ./setdest -n 250 -p 0.0 -M 10.0 -t 10 -x 1500 -y 1500 > S250

    在路径~/ns-2.34/indep-utils/cmu-scen-gen下运行
    ns cbrgen.tcl -type tcp -nn 250  -seed 1.0 -mc 100 > T250
    会得到s250和T250两个文件,把这两个文件拷到下面tcl文件的通路径下,运行tcl文件
    # ======================================================================
    set val(chan)           Channel/WirelessChannel    ;# channel type
    set val(prop)           Propagation/TwoRayGround   ;# radio-propagation model
    set val(netif)          Phy/WirelessPhy            ;# network interface type
    set val(mac)            Mac/802_11                 ;# MAC type
    set val(ifq)            Queue/DropTail/PriQueue    ;# interface queue type
    set val(ll)             LL                         ;# link layer type
    set val(ant)            Antenna/OmniAntenna        ;# antenna model
    set val(ifqlen)         50                         ;# max packet in ifq
    set val(nn)             250                        ;# number of mobilenodes
    set val(rp)             AODV                       ;# routing protocol
    set val(cp)             T250        
    set val(sc)             S250                
    
    # ==================================================== =================
    # Main Program
    # ======================================================================
    
    set ns_    [new Simulator]
    set tracefd     [open out.tr w]
    set winfile  [open winFile w]
    #global ns_
    
    $ns_ trace-all $tracefd
    set namtrace    [open out.nam w]
    $ns_ namtrace-all-wireless $namtrace 1500 1500
    
    set topo    [new Topography]
    $topo load_flatgrid 1500 1500
    set god_ [create-god $val(nn)]
    #create-god $val(nn)
    
    $ns_ node-config -adhocRouting $val(rp) 
                     -llType $val(ll) 
                     -macType $val(mac) 
                     -ifqType $val(ifq) 
                     -ifqLen $val(ifqlen) 
                     -antType $val(ant) 
                     -propType $val(prop) 
                     -phyType $val(netif) 
                     -channelType $val(chan) 
             -topoInstance $topo 
             -agentTrace ON 
                     -routerTrace ON 
                     -macTrace OFF 
              -mvementTrace ON 
    
    for {set i 0} {$i < $val(nn) } {incr i} {
        set node_($i) [$ns_ node]
    }
    puts "Loading scenario file..."
    source $val(sc)
    
    puts "Loading connection pattern..."
    source $val(cp)
    
    # Tell nodes when the simulation ends
    
    for {set i 0} {$i < $val(nn) } {incr i} {
        $ns_ at 10.0 "$node_($i) reset";
    }
    
    $ns_ at 10.0 "stop"
    $ns_ at 10.01 "puts "NS EXITING..." ; $ns_ halt"
    proc stop {} {
    
        global ns_ tracefd
        $ns_ flush-trace
        close $tracefd
            exec nam out.nam &
            exit 0
    }
    
    puts "Starting Simulation..."
    $ns_ run

    注意两点: setdest产生的文件用到了node_数组变量和god_变量 ,这里要在提出了文件中给出:

    1. set ns_    [new Simulator]
    2. set god_ [create-god $val(nn)]      ;#这里把create-god $val(nn)换成了左边这样,为了防止出现

      can't read "god_": no such variable
      while executing
      "$god_ set-dist 0 1 8"
      (file "S250" line 1004)

    ...这样的错误

    哈哈哈哈好开心,自己解决的~~~~

  • 相关阅读:
    Vue基本指令
    C primer plus 6 编程练习答案
    Archlinux安装总结
    xcfe桌面快捷键整理
    openSUSE XFCE桌面 多媒体解码器安装
    Arch i3wm
    arch xfce快捷键
    Archlinux配置~小米笔记本Air 13.3英寸版本
    Archlinux安装指南~小米笔记本Air 13.3英寸版本
    Linux~Archer 进化之路
  • 原文地址:https://www.cnblogs.com/wang-130213/p/8603688.html
Copyright © 2011-2022 走看看