2017-05-20 18 views
1

ns2에서 somo로 만든 이동성 파일로 도로에 여러 클러스터를 만들려고합니다.
파일 mobility.tcl은 스모의 이동성입니다. 다음과 같이네트워크 바넷 + 파일링 클러스터링 sumo + 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_을 가지고 단순한 "노드 생성"어드레스 필드 길이

주소 범위 밖에 32,573 2,048

오타가 발생할 것이다.

$ 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이고 사용 가능한 경우 세그먼트 오류가 발생합니다. 남 애니메이션 : OK. 편집 된 파일, somiMadani-vanet.tcl → → 보관 → 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

편집 이세 5 계층 : 필요한 계층 노드를 만들기 → hts100-0 → ns-2.3x/tcl/{ex/{hier-rtg-10.tcl, hts100-0.tcl, test/hts1000.tcl}를 참조하십시오. 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