Đánh giá kết quả mô phỏng

Một phần của tài liệu Giao thức MAC điều khiển công suất trong mạng AD HOC (Trang 55)

Thông qua các kết quả nhâ ̣n đƣợc nhƣ trình bày ở trên, tôi có thể nhâ ̣n xét nhƣ sau:

Từ hình 4.1 nhâ ̣n thấy thông lƣợng trung bình toàn ma ̣ng tăng dần khi mâ ̣t đô ̣ nút tăng và kết hợp điều khiển công suất truyền và hình 4.4 khi sƣ̉ du ̣ng điều khiển công suất kết quả đa ̣t đƣợc là tỷ lê ̣ chuyển phát gói tin thành công cao hơn . Nguyên nhân là do trong cùng mô ̣t pha ̣m vi hoa ̣t đô ̣ng mâ ̣t đô ̣ cá c nút tăng dần có nghĩa là khoảng cách các nút xích lại gần nhau . Khi các nút gần nhau nếu truyền với công suất lớn dễ gây đu ̣ng đô ̣ do đó phải truyền la ̣i nhiều , dẫn đến thông lƣợng thấp hơn và tỷ lệ chuyển phát gói tin cũng thấp hơn khi sƣ̉ du ̣ng điều khiển công suất.

Tƣ̀ hình 4.2 và 4.3 cho thấy năng lƣợng tiêu thu ̣ trung bình trong mô ̣t đơn vi ̣ thông tin trên các nút gƣ̉i và nút nhâ ̣n khi sƣ̉ du ̣ng điều khiển công suất truyền thấp hơn nhiều so với mă ̣c đi ̣nh 802.11.

Tƣ̀ kết quả đa ̣t đƣợc có thể thấy khi các nút ở khoảng cách gần nhau nếu điều chính công suất phát sẽ tiết kiê ̣m đƣợc rất nhiều năng lƣợng tiêu thu ̣ trên các nút gửi và nút nhận.

4.4 Mã nguồn thực hiện mô phỏng

# Define options

set val(chan) Channel/WirelessChannel ; set val(prop) Propagation/TwoRayGround ; set val(netif) Phy/WirelessPhy ;

set val(mac) Mac/802_11 ;

set val(ifq) Queue/DropTail/PriQueue ; set val(ll) LL ;

set val(ant) Antenna/OmniAntenna ; set val(ifqlen) 50 ;

set val(nn) 9 ;# number of mobilenodes set val(rp) AODV ;

set val(x) 500 ; set val(y) 500 ;

set val(stop) 300 ;# time of simulation end set opt(bw) 2Mb

set ns [new Simulator]

set tracefd [open thesis3x3.tr w] set namtrace [open thesis3x3.nam w] Antenna/OmniAntenna set X_ 0 Antenna/OmniAntenna set Y_ 0 Antenna/OmniAntenna set Z_ 1.5 Antenna/OmniAntenna set Gt_ 1 Antenna/OmniAntenna set Gr_ 1

Mac/802_11 set RTSThreshold_ 0 ;# RTS/CTS Phy/WirelessPhy set CPThresh_ 10.0

Phy/WirelessPhy set freq_ 9.14e+08 Phy/WirelessPhy set L_ 1.0

$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) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace ON \ -movementTrace ON

# Energy model for every node #Energy=Power*time

#Jule is unit of initialEnergy and rest of Energy is unit is watt $ns node-config -energyModel EnergyModel \

-initialEnergy 13200 \ -txPower 0.744 \ -rxPower 0.0648 \ -idlePower 0.05 \

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

}

# Provide initial location of mobilenodes Source ./data3x3

Source ./tcp3x3.cn

# Define node initial position in nam for {set i 0} {$i < $val(nn)} { incr i } { # 40 defines the node size for nam $ns initial_node_pos $node_($i) 60

}

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

# ending nam and the simulation

$ns at $val(stop) "$ns nam-end-wireless $val(stop)" $ns at $val(stop) "stop"

$ns at 150.01 "puts \"end simulation\" ; $ns halt" proc stop {} {

global ns tracefd namtrace $ns flush-trace

close $tracefd close $namtrace

exec nam thesis3x.nam & }

proc finish {} {

exec xgraph simple.tr -geometry 500*500 exit 0

}

$ns run

# type: perl avg_throughput.pl <trace file>

$infile=$ARGV[0]; $speed=$ARGV[1]; $receivedsize = 0; $start_time = 1000; $end_time=0; $num=0;

open (DATA,"<$infile") || die "Can't open $infile $!"; while (<DATA>)

{

@x = split(' '); $packetsize=$x[7];

# Store start time

if (($x[3] eq "AGT")&&($x[0] eq "s")&& ($x[6] eq 'tcp')) { if ($x[1]<$start_time) { $start_time=$x[1]; } }

# Update total received packets size and store packets arrival time if (($x[3] eq "AGT")&&($x[0] eq "r")&& ($x[6] eq 'tcp'))

{

if ($x[1]>$end_time) {

$end_time=$x[1]; }

# Rip of the header

$headersize=$packetsize%512; $packetsize-=$headersize; # Soter received packet size $receivedsize+=$packetsize; } } $tt=$receivedsize/($end_time-$start_time); $TH=($tt*8)/1024; $time=$end_time-$start_time;

print STDOUT "So bit nhan duoc = $receivedsize \n"; print STDOUT "Thoi gian thuc hien mo phong = $time\n"; print STDOUT "Average throughput = $TH kbps\n"; close DATA;

exit(0);

# type: perl packet_delay-radio.pl <trace file> #tỷ lệ chuyển phát gói tin thành công

# --- $infile=$ARGV[0]; $speed=$ARGV[1]; $sum_sent=0; $sum_received=0; # --- open (DATA,"<$infile") || die "Can't open $infile $!";

while (<DATA>) { @x = split(' ');

if (( $x[0] eq "s") && ( $x[6] eq "tcp" ) && ( $x[3] eq "MAC" )&& ($x[7] gt "512"))

{$sum_sent++; }

if (( $x[0] eq "r") && ( $x[6] eq "tcp" ) && ( $x[3] eq "MAC" ) &&( $x[7] gt "512" ))

{$sum_received++; } }

# --- $packet_delivery_ratio=($sum_received/$sum_sent)*100;

print STDOUT "Total packets sent = $sum_sent\n";

print STDOUT "$speed", " ", "$packet_delivery_ratio%\n"; close DATA;

KẾT LUẬN VÀ HƢỚNG NGHIÊN CỨU TIẾP THEO Kết luận

Đề tài luận văn „Giao thức MAC điều khiển công suất trong mạng ad-

hoc” đề cập đến vấn đề điều khiển công suất phát giúp giảm tiêu thụ năng lƣợng của nút mạng và giảm can nhiễu trong hệ thống. Sau quá trình nghiên cứu, luận văn đã đạt đƣợc một số kết quả nhất định cả về lý thuyết và thực nghiệm. Luận văn đã trình bày tổng quan về khái niệm, đặc điểm, ứng dụng của mạng ad-hoc. Ngoài ra luận văn nghiên cứu một số phƣơng pháp áp dụng cho giao thức Mac điều khiển công suất nhƣ : Điều khiển công suất cơ sở, PCM, F-PCM. Đi cùng với lý thuyết là phần thực nghiệm mô phỏng. Tôi đề xuất điều khiển công suất theo khoảng cách của nút. Cụ thể trong luận văn tôi thiết lập kịch bản mô phỏng với mật độ các nút tăng dần từ 3x3, 4x4, 5x5, 6x6, 7x7, 8x8 với cùng phạm vi hoạt động là 500m x500m. Tôi so sánh năng lƣợng tiêu thu ̣ trung bình trên các nút gƣ̉i và nút nhâ ̣n, so sánh thông lƣợng trung bình toàn ma ̣ng khi chƣa sƣ̉ du ̣ng điều khiển công suất với giao thƣ́c mă ̣c đi ̣nh 802.11. Kết quả đa ̣t đƣợc khi điều khiển cô ng suất thì thông lƣợng tăng , năng lƣợng tiêu thu ̣ cũng hết ít hơn và tỷ lệ chuyển phát gói tin thành công cũng cao hơn 802.11.

Hƣớng phát triển tiếp theo

Tiếp the o, tôi dƣ̣ đi ̣nh nghiên cƣ́u thuâ ̣t toán đi ̣nh tuyến và kết hợp với giao thƣ́c điều khiển công suất để giúp tiết kiê ̣m năng lƣợng trong toàn ma ̣ng.

TÀI LIỆU THAM KHẢO

Tiếng Việt

1. Nguyễn Đình Việt (2010), Bài giảng đánh giá hiệu năng mạng máy tính, Trƣờng Đại học Công nghệ - Đại học quốc gia Hà Nội.

Tiếng Anh

2. Martinus Dipobagio Institute of Computer Science (ICS), Freie Universität Berlin, An Overview on Ad Hoc Networks

3. E.-S. Jung and N. H. Vaidya, A Power Control MAC Protocol for Ad Hoc

Networks, in MOBICOM 2002, Sep, 2002

4. S. Agarwal, S. Krishnamurthy, R. H. Katz, and S. K. Dao. Distributed Power Control in Ad-hoc Wireless Networks, Proc. PIMRC01, 2001.

5. Fang Liu, Kai Xing, Xiuzhen Cheng, Shmuel Rotenstreich Department of Computer Science The George Washington University Washington,

Energy-efficient MAC layer protocols in ad hoc networks, DC 2005

6. Model and Improvement in Power Control MAC Protocol for Ad-Hoc Networks

7. The ns Manual(formerly ns Notes and Documentation)

8. Chlamtac, I., Conti, M., and Liu, J. J.-N. Mobile ad hoc networking: imperatives and challenges. Ad Hoc Networks, 1(1), 2003, pp. 13–64. 9. Michel Barbeau and Evangelos Kranakis(2007), Principles of Ad Hoc

Networking, John Wiley & Sons Ltd

10. Kim, C. K. Toh. F-PCM (2006): a fragmentation-based power control MAC protocol for IEEE 802.11 mobile ad hoc networks, Wireless Communications and Mobile Computing.

11. D. Wang, M. Hu, and H. Zhi, A survey of secure routing in ad hoc networks, The Ninth International Conference on Web-Age Information,

pp. 482–486, 2008

12. T. Karygiannis and L. Owens, Wireless network security 802.11,

bluetooth and handheld devices, 2002.

Một phần của tài liệu Giao thức MAC điều khiển công suất trong mạng AD HOC (Trang 55)