2017-05-20 4 views
1

ns2でsomoで作成されたモビリティファイルを使用して道路に複数のクラスタを作成したいとします。
ファイルmobility.tclは、相撲のモビリティです。ネットワークでのクラスタ化+ファイルsmo + ns2との共同作業

set val(chan)   Channel/WirelessChannel ;# channel type 
set val(prop)   Propagation/TwoRayGround ;# radio-propagation model 
set val(netif1)   Phy/WirelessPhy   ;# network interface type 
set val(netif2)   Phy/WirelessPhy   ;# network interface type 
set val(mac)   Mac/802_11p    ;# 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)   400      ;# max packet in ifq 
set val(nn)    747      ;# number of mobilenodes 
set val(rp)    DSDV      ;# routing protocol 
set opt(x)    6162 
set opt(y)    6029 
# ====================================================================== 
# Main Program 
# ===================================================================== 
# 
# Initialize Global Variables 
# 
set ns_  [new Simulator] 
# set up for hierarchical routing 
$ns_ node-config -addressType hierarchical 

AddrParams set domain_num_ 10   
lappend cluster_num 2 6 2 3 6 1 5 5 2 6     
AddrParams set cluster_num_ $cluster_num 
lappend eilastlevel 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20    
AddrParams set nodes_num_ $eilastlevel 
set tracefd  [open paris.tr w] 
$ns_ trace-all $tracefd 
set namf [open paris.nam w] 
$ns_ namtrace-all-wireless $namf $opt(x) $opt(y) 
# set up topography object 
set topo  [new Topography] 
$topo load_flatgrid $opt(x) $opt(y) 
# 
# Create God 
# 
create-god $val(nn) 
# configure node 
    $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(netif1) \ 
     -channelType $val(chan) \ 
     -topoInstance $topo \ 
     -agentTrace ON \ 
     -routerTrace ON \ 
     -macTrace OFF \ 
     -movementTrace ON 

      for {set i 0} {$i < $val(nn) } {incr i} { 
    set node_($i) [$ns_ node] 
    $node_($i) random-motion 0  ;# disable random motion 
      $ns_ initial_node_pos $node_($i) 30 
      } 
    $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(netif2) \ 
     -channelType $val(chan) \ 
     -topoInstance $topo \ 
     -agentTrace ON \ 
     -routerTrace ON \ 
     -macTrace OFF \ 
     -movementTrace ON 

     for {set i 0} {$i < $val(nn) } {incr i} { 
    set node_($i) [$ns_ node] 
    $node_($i) random-motion 0  ;# disable random motion 
      $ns_ initial_node_pos $node_($i) 30 
      } 
    source mobility.tcl 

    set udp0 [new Agent/UDP] 
    $ns attach-agent $n(0) $udp0 
    set cbr0 [new Application/Traffic/CBR] 
    $cbr0 attach-agent $udp0 
    set udp1 [new Agent/UDP] 
    $ns attach-agent $n(1) $udp1 
    $udp1 set class_ 1 
    set cbr1 [new Application/Traffic/CBR] 
    $cbr1 attach-agent $udp1 
    set null0 [new Agent/Null] 
    $ns attach-agent $n(50) $null0 
    set null1 [new Agent/Null] 
    $ns attach-agent $n(80) $null1 
    $ns connect $udp0 $null0 
    $ns connect $udp1 $null1 
    $ns at 1.0 "$cbr0 start" 
    $ns at 1.1 "$cbr1 start" 
    set tcp [new Agent/TCP] 
    $tcp set class_ 2 
    set sink [new Agent/TCPSink] 
    $ns_ attach-agent $node_(0) $tcp 
    $ns_ attach-agent $node_(22) $sink 
    $ns_ connect $tcp $sink 
    set ftp [new Application/FTP] 
    $ftp attach-agent $tcp 
    $ns_ at 10.0 "$ftp start" 
    # 
    # Tell nodes when the simulation ends 
    # 
     for {set i 0} {$i < $val(nn) } {incr i} { 
    $ns_ at 500.0 "$node_($i) reset"; 
    } 
     $ns_ at 500.0 "stop" 
    $ns_ at 1000.01 "puts \"NS EXITING...\" ; $ns_ halt" 
    proc stop {} { 
global ns_ tracefd 
$ns_ flush-trace 
close $tracefd 
    } 
    puts "Starting Simulation..." 
    $ns_ run* 

とエラーは、次のとおりです:次のように

私のコードがあるいくつかのタイプミスを編集するとき

[email protected]:~/champ elysees$ ns paris2.tcl 
    num_nodes is set 747 
    Error!! 
    str2addr:Address 32573 outside range of address field length 2048* 
+0

1)いいえSUMOモビリティファイルは、ファイルに接続されていません。 2)テストされたクラスタリングの例を見てください。https://drive.google.com/file/d/0B7S255p3kFXNM3g4d3FBRXFDM3c/view?usp=sharing ... 3)そして接続されたsumoファイルhttp:// neoで例を取り上げてください。 lcc.uma.es/staff/jamal/vanet/?q=node/11→urban-VANET-scenario-U1.tar.gz、urban-VANET-scenario-U2.tar.gz、urban-VANET-scenario-U3 .tar.gz –

答えて

0

あなたのコードは、ほとんどOKです。 Mac/802_11pは今日ですMac/802_11Extです。 802_11pの古いパッチを使用してビルドに失敗した場合を除きます。しかし、私はそれがタイプミスだと思う。階層型の使用:ノードは階層型に作成する必要があります。 nsは二つの定義、nsns_があります:シンプルな "ノードの作成は、" アドレスフィールドの長さの

住所32573範囲外2048

タイプミスの原因となります。

$ sed -i 's/ns/ns_/g' somiMadani.tcl && sed -i 's/ns__/ns_/g' somiMadani.tcl 

$ sed -i 's/n(/node_(/g' somiMadani.tcl 

シミュレーション:

nodeは二つの定義、nnode_ .....簡単で固定していhttp://neo.lcc.uma.es/staff/jamal/vanet/?q=node/11から、mobmod-teatinos-M40A.tcl:私は40のノードとSUMOモビリティファイルを使用していました。セグメンテーションフォールトは、トレースファイルが約80MBで使用可能な場合に発生します。 Namのアニメーション:OK。編集したファイル、somiMadani-vanet.tcl→→Dropboxは→https://www.dropbox.com/s/sv7p4tqc6pk0oje/somiMadani-vanet.tcl?dl=0で読みやすい、somiMadani-vanet.tcl.txt https://www.dropbox.com/s/fy8valous07m5er/somiMadani-vanet.tcl.txt?dl=0

編集、6月5階層:必要な階層ノードを作成:ns-2.3x/tcl/{ex/{hier-rtg-10.tcl, hts100-0.tcl, test/hts1000.tcl}→→hts100-0を参照してください。 tcl、hts1000.tclは、hier-rtg-100.tcl、hier-test-1000.tclで使用される によって使用されます。

新たとえば、あなたのコード+ hts100-0.tclスニペットの "n-hts120-0.tcl":Vanet_n-802.11p.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNcVcwSXhPWGUycDA/view?usp=sharing

関連する問題