2014-04-27 10 views
2

간단한 802.15.4 시뮬레이션 프로그램 (2 개 노드, CBR 트래픽)이 있습니다.NS2, 802.15.4에서 100 바이트보다 큰 패킷이 삭제되었습니다.

CBR 패킷의 크기가 100보다 작 으면 패킷은 문제없이 전달되지만 패킷 크기를 늘리 자마자 모든 패킷이 삭제됩니다.

나는 조각화가 기본적으로 일어나지 않기 때문에 (802.15.4의 최대 크기는 127 옥텟이기 때문입니다. 그게 사실이야? 시뮬레이션 프로그램을 어떻게 수정해야합니까 (현실 세계에서 조각화가 발생한다고 생각합니까?).

set val(chan)   Channel/WirelessChannel  ;# channel type 
set val(prop)   Propagation/TwoRayGround  ;# radio-propagation model 
set val(netif)   Phy/WirelessPhy/802_15_4  ;# network interface type 
set val(mac)   Mac/802_15_4     ;# 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)  100        ;# max packet in ifq 
set val(nn)   2       ;# number of mobilenodes 
set val(rp)   AODV       ;# protocol tye 
set val(x)    40       ;# X dimension of topography 
set val(y)    40       ;# Y dimension of topography 
set val(stop)   500       ;# simulation period 
set val(energymodel) EnergyModel     ;# Energy Model 
set val(initialenergy) 100       ;# value 

set ns    [new Simulator] 
set tracefd   [open aodv1.tr w] 
set namtrace   [open aodv1.nam w] 

$ns use-newtrace 
$ns trace-all $tracefd 
$ns namtrace-all-wireless $namtrace $val(x) $val(y) 

set dist(35m) 1.56962e-07 
set dist(40m) 1.20174e-07 
Phy/WirelessPhy set CSThresh_ $dist(40m) 
Phy/WirelessPhy set RXThresh_ $dist(40m) 


# set up topography object 
set topo  [new Topography] 
$topo load_flatgrid $val(x) $val(y) 

create-god $val(nn) 

# configure the nodes 
$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) \ 
      -channel [new $val(chan)] \ 
      -topoInstance $topo \ 
      -agentTrace ON \ 
      -routerTrace OFF \ 
      -macTrace OFF \ 
      -movementTrace OFF \ 
      -energyModel $val(energymodel) \ 
      -initialEnergy $val(initialenergy) \ 
      -rxPower 35.28e-3 \ 
      -txPower 31.32e-3 \ 
     -idlePower 712e-6 \ 
     -sleepPower 144e-9 

      #-IncomingErrProc MultistateErrorProc \ 
      #-OutgoingErrProc MultistateErrorProc 

for {set i 0} {$i < $val(nn) } { incr i } { 
     set mnode_($i) [$ns node] 
} 



for {set i 1} {$i < $val(nn) } { incr i } { 
    $mnode_($i) set X_ [ expr {$val(x) * rand()} ] 
    $mnode_($i) set Y_ [ expr {$val(y) * rand()} ] 
    $mnode_($i) set Z_ 0 
} 

# Position of Sink 
$mnode_(0) set X_ [ expr {$val(x)/2} ] 
$mnode_(0) set Y_ [ expr {$val(y)/2} ] 
$mnode_(0) set Z_ 0.0 
$mnode_(0) label "Sink" 


for {set i 0} {$i < $val(nn)} { incr i } { 
    $ns initial_node_pos $mnode_($i) 10 
} 


#Setup a UDP connection 
set udp [new Agent/UDP] 
$ns attach-agent $mnode_(1) $udp 

set sink [new Agent/Null] 
$ns attach-agent $mnode_(0) $sink 

$ns connect $udp $sink 
$udp set fid_ 2 

#Setup a CBR over UDP connection 
set cbr [new Application/Traffic/CBR] 
$cbr attach-agent $udp 
$cbr set type_ CBR 
$cbr set packet_size_ 100 
$cbr set rate_ 0.1Mb 
$cbr set interval_ 2 
#$cbr set random_ false 

$ns at 5.0 "$cbr start" 
$ns at [expr $val(stop) - 5] "$cbr stop" 

# Telling nodes when the simulation ends 
for {set i 0} {$i < $val(nn) } { incr i } { 
    $ns at $val(stop) "$mnode_($i) reset;" 
} 

# ending nam and the simulation 
$ns at $val(stop) "$ns nam-end-wireless $val(stop)" 
$ns at $val(stop) "stop" 
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt" 
proc stop {} { 
    global ns tracefd namtrace 
    $ns flush-trace 
    close $tracefd 
    close $namtrace 
} 

$ns run 
+0

문제는 시뮬레이션 프로그램을 고정에 관한 것입니다. 내 시뮬레이션 프로그램에 문제가 있습니다. – wmac

답변

2

확인 아래 TCL은 ..

set val(chan)   Channel/WirelessChannel  ;# channel type 
set val(prop)   Propagation/TwoRayGround  ;# radio-propagation model 
set val(netif)   Phy/WirelessPhy/802_15_4  ;# network interface type 
set val(mac)   Mac/802_15_4     ;# 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)  100        ;# max packet in ifq 
set val(nn)   2       ;# number of mobilenodes 
set val(rp)   AODV       ;# protocol tye 
set val(x)    40       ;# X dimension of topography 
set val(y)    40       ;# Y dimension of topography 
set val(stop)   500       ;# simulation period 
set val(energymodel) EnergyModel     ;# Energy Model 
set val(initialenergy) 100       ;# value 

set ns    [new Simulator] 
set tracefd   [open aodv1.tr w] 
set namtrace   [open aodv1.nam w] 

$ns use-newtrace 
$ns trace-all $tracefd 
$ns namtrace-all-wireless $namtrace $val(x) $val(y) 



# set up topography object 
set topo  [new Topography] 
$topo load_flatgrid $val(x) $val(y) 

create-god $val(nn) 

# configure the nodes 
$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) \ 
      -channel [new $val(chan)] \ 
      -topoInstance $topo \ 
      -agentTrace ON \ 
      -routerTrace ON \ 
      -macTrace ON \ 
      -movementTrace OFF \ 
      -energyModel $val(energymodel) \ 
      -initialEnergy $val(initialenergy) \ 
      -rxPower 35.28e-3 \ 
      -txPower 31.32e-3 \ 
     -idlePower 712e-6 \ 
     -sleepPower 144e-9 

      #-IncomingErrProc MultistateErrorProc \ 
      #-OutgoingErrProc MultistateErrorProc 

for {set i 0} {$i < $val(nn) } { incr i } { 
     set mnode_($i) [$ns node] 
} 



for {set i 1} {$i < $val(nn) } { incr i } { 
    $mnode_($i) set X_ [ expr {$val(x) * rand()} ] 
    $mnode_($i) set Y_ [ expr {$val(y) * rand()} ] 
    $mnode_($i) set Z_ 0 
} 

# Position of Sink 
$mnode_(0) set X_ [ expr {$val(x)/2} ] 
$mnode_(0) set Y_ [ expr {$val(y)/2} ] 
$mnode_(0) set Z_ 0.0 
$mnode_(0) label "Sink" 


for {set i 0} {$i < $val(nn)} { incr i } { 
    $ns initial_node_pos $mnode_($i) 10 
} 


#Setup a UDP connection 
set udp [new Agent/UDP] 
$ns attach-agent $mnode_(1) $udp 

set sink [new Agent/Null] 
$ns attach-agent $mnode_(0) $sink 

$ns connect $udp $sink 

#Setup a CBR over UDP connection 
set cbr [new Application/Traffic/CBR] 
$cbr attach-agent $udp 
$cbr set packet_size_ 10000 
$cbr set rate_ .1Mb 
$cbr set interval_ .2 
#$cbr set random_ false 

$ns at 5.0 "$cbr start" 


# ending nam and the simulation 
$ns at $val(stop) "$ns nam-end-wireless $val(stop)" 
$ns at 20 "stop" 

proc stop {} { 
    global ns tracefd namtrace 
    $ns flush-trace 
    close $tracefd 
    close $namtrace 
exec nam aodv1.nam 
} 

$ns run 
+0

변경 사항을 적용 할 때주의해야합니다. 나는 MTU가 작고 UDP가 조각화 (그리고 TCP와 같은 시퀀스 번호 추가) 기능을 가지고 있지 않고 조각 모음을 할 수 없기 때문에 120보다 큰 패킷을 전송할 수 없다고 믿기 시작했다. Btw. 코드의 마지막 줄에 오류가 발생했습니다 (내 것으로 교체되고 작동하는 것으로 보입니다). – wmac

+0

테스트를 마친 후에는 아무 것도 변경되지 않고 큰 패킷 만 삭제됩니다. 수신 패킷이 추적에 나타나지만 데이터 길이가 고정되어 전송 된 패킷과 일치하지 않습니다. – wmac

+0

왜 설명이 없습니까? –