12
Error control for multimedia communications in wireless sensor networks: A comparative performance analysis A seminar report submitted to MANIPAL UNIVERSITY Award of the Degree of Master of Technology in Network Engineering by Muragesh S Kabbinakantimath Reg. No. 120927023 For Partial Fulfillment of the Requirement for the April 2013

Error Control in Multimedia Communications using Wireless Sensor Networks report

Embed Size (px)

Citation preview

Error control for multimedia communications in wireless sensornetworks: A comparative performance analysis

A seminar report submitted

to

MANIPAL UNIVERSITY

Award of the Degree

of

Master of Technology

inNetwork Engineering

byMuragesh S Kabbinakantimath

Reg. No. 120927023

For Partial Fulfillment of the Requirement for the

April 2013

Proposed Model:

The project was impleted by using simulator ns2.27 along with video quality analysis tool known as Evalvid.

1. What is FEC?

Wireless network packet error is unavoidable and more serious than in wired networks. Unavoidable packet errorshowever, are usually recovered using ARQ (Automatic Repeat reQuest) or FEC (Forward Error Correction)techniques. In ARQ, missing packets are retransmitted during timeouts or explicit receiver requests. In FEC it is notpossible.

2. Enhanced Adaptive FEC (EAFEC):

EAFEC provides improved video delivery over wireless networks.The redundant packets are dynamically added based on on both network traffic load and wireless channel state. EAFEC algorithm usage would tune FEC packet numbers generated in such a way that they wouldn’t unnecessarily add to network congestion

2.1 Basic idea of the project:

When every wired and wireless node wants to send data packets to other wireless nodes,data must first

be sent to the Access Point (AP).The AP then forwards packets to the corresponding node.

Therefore, AP is a good place for adding the FEC mechanism for improving video delivery quality.

2.2 FEC algorithm:

Initialization:qlen = 0; rT = 0;

When a block of packets arrive:/* use queue length to determine number of redundant FEC packets */

qlen = (1 – qweight ) * current_q + qweight * qlen

if (qlen < threshold1)no_FEC = Max_FEC;else if (qlen < threshold2)no_FEC = Max_FEC * (threshold2-qlen) / (threshold2-threshold1);

elseno_FEC = 0;/* use retransmission time to reduce the no_FEC */rT = (1 – rweight) * current_rT + rweight * rT

if (rT < threshold3)no_FEC = 0;else if (rT < threshold4)no_FEC = no_FEC* ( 1 – ((threshold4 – rT)/ (threshold4-threshold3)));

elseno_F E C = no_FEC

Initialization:qlen = 0; rT = 0;

When a block of packets arrive:/* use queue length to determine number of redundant FEC packets */

qlen = (1 – qweight ) * current_q + qweight * qlen

if (qlen < threshold1)no_FEC = Max_FEC;else if (qlen < threshold2)no_FEC = Max_FEC * (threshold2-qlen) / (threshold2-threshold1);

elseno_FEC = 0;/* use retransmission time to reduce the no_FEC */rT = (1 – rweight) * current_rT + rweight * rT

if (rT < threshold3)no_FEC = 0;else if (rT < threshold4)no_FEC = no_FEC* ( 1 – ((threshold4 – rT)/ (threshold4-threshold3)));

elseno_F E C = no_FEC

3.Simulation setting

In this simulation, video server transmits video streams over the Internet and the video receivers are areconnected using wireless links. There are two background traffic flows in the simulation. One is FTP traffic,transmitted by using TCP packets. The second one is exponential traffic transmitted by using UDP packets.

Transmission rate for traffic is 1 Mbps;The link between the wireless access point and the videoreceiver is IEEE 802.11b 11Mbps. The link between Internet Internet and AP is 100Mbps.The link betweentraffic sources and Internet is set at 10Mbps.

3.3 TCL file

proc getopt {argc argv} { #file option name argc,argv global opt lappend optlist nn for {set i 0} {$i < $argc} {incr i} { set opt($i) [lindex $argv $i] }}

getopt $argc $argv set ns [new Simulator]set packetSize 1500set num_wired_nodes 4set num_mobile_nodes 1set num_bs_nodes 1 ;# number of base stationsset num_nodes [expr $num_wired_nodes + $num_mobile_nodes + $num_bs_nodes]set bs_id $num_wired_nodes

# Parameter for wireless nodesset opt(chan) Channel/WirelessChannel ;# channel typeset opt(prop) Propagation/TwoRayGround ;# radio-propagation modelset opt(netif) Phy/WirelessPhy ;# network interface typeset opt(mac) Mac/802_11 ;# MAC typeset opt(ifq) Queue/DropTail/myPriQueue ;# interface queue typeset opt(ifq1) Queue/DropTail/PriQueueset opt(ifqlen) 50 ;# Max queue lengthset opt(ll) LL ;# link layer typeset opt(ant) Antenna/OmniAntenna ;# antenna modelset opt(adhocRouting) NOAH ;# routing protocolset opt(x) 500 ;# X dimension of the topographyset opt(y) 500 ;# Y dimension of the topography

Mac/802_11 set SlotTime_ 0.000020 ;# 20usMac/802_11 set SIFS_ 0.000010 ;# 10usMac/802_11 set PreambleLength_ 144 ;# 144 bitMac/802_11 set PLCPHeaderLength_ 48 ;# 48 bitsMac/802_11 set PLCPDataRate_ 1.0e6 ;# 1Mbps Mac/802_11 set dataRate_ 11.0e6 ;# 11MbpsMac/802_11 set basicRate_ 1.0e6 ;# 1MbpsMac/802_11 set ShortRetryLimit_ 7 ;# retransmittions (7, this value do not effect FEC)Mac/802_11 set LongRetryLimit_ 4 ;# retransmissions (4, effect the no. of FEC packets)

#set up for hierarchical routing#(needed for routing over a basestation)$ns node-config -addressType hierarchicalAddrParams set domain_num_ 2 ;# domain numberlappend cluster_num 1 1 ;# cluster number for each domain AddrParams set cluster_num_ $cluster_numlappend eilastlevel $num_wired_nodes [expr $num_mobile_nodes + $num_bs_nodes] ;# number of nodes for each cluster AddrParams set nodes_num_ $eilastlevel

set ntr [open out.tr w] ;# open the namtrace file$ns trace-all $ntr set chan [new $opt(chan)]set topo [new Topography] ;#creates new topology$topo load_flatgrid $opt(x) $opt(y)

# Create God(General Operations Director) stores the total number of mobilenodes # and a table of shortest number of hops required to reach from one node to another.create-god [expr $num_mobile_nodes + $num_bs_nodes]

# creating wired nodesset s1 [$ns node 0.0.0]set s2 [$ns node 0.0.1]set s3 [$ns node 0.0.2]set r1 [$ns node 0.0.3]

# creating base station$ns node-config -adhocRouting $opt(adhocRouting) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channel $chan \ -topoInstance $topo \ -wiredRouting ON \ -agentTrace OFF \ -routerTrace OFF \ -macTrace OFF \ -movementTrace OFF

set BS(0) [$ns node 1.0.0]$BS(0) random-motion 0set bs_ifq [$BS(0) set ifq_(0)]set bs_mac [$BS(0) set mac_(0)]set bs_phy [$BS(0) set netif_(0)]puts "Base-Station node $bs_id created"#provide some co-ord (fixed) to base station node$BS(0) set X_ 250.0$BS(0) set Y_ 250.0$BS(0) set Z_ 0.0

#$bs_ifq queuetype?set queuechan [open qlen.tr w]$bs_ifq trace curq_$bs_ifq attach $queuechan

$bs_ifq set threshold1 10$bs_ifq set threshold2 40$bs_ifq set maxfecpkts 4$bs_ifq set staticfecpkts 0$bs_ifq set qweight 0.1$bs_ifq set fecpktsize 500$bs_ifq set from_mac 1$bs_ifq set threshold3 5 $bs_ifq set threshold4 15 $bs_ifq set sweight 0.1

#proc qlength {} {# global ns bs_ifq# set qlen [$bs_ifq qlen?]# puts "qlen:$qlen"#}

#$ns at 10.0 "qlength" #$bs_mac set_filename bs_mac#$ns at 105.0 "$bs_mac closefile" set rng [new RNG] ;#set random number generation$rng seed $opt(0)set rand1 [new RandomVariable/Uniform]$rand1 use-rng $rng$rand1 set min_ -50.0$rand1 set max_ 50.0

# creating mobile nodes$ns node-config -wiredRouting OFF$ns node-config -ifqType $opt(ifq1) #$ns node-config -IncomingErrProc $opt(err1)#$ns node-config -OutgoingErrProc $opt(err1)for {set i 0} {$i < $num_mobile_nodes} {incr i} { set wl_node_($i) [$ns node 1.0.[expr $i + 1]] $wl_node_($i) random-motion 0 ;# disable random motionputs "wireless node $i created ..." $wl_node_($i) base-station [AddrParams addr2id [$BS(0) node-addr]] set x [expr 250+[$rand1 value]] set y [expr 250+[$rand1 value]] $wl_node_($i) set X_ $x $wl_node_($i) set Y_ $y $wl_node_($i) set Z_ 0.0 puts "X_:$x Y_:$y"}

#$wl_phy set-error-level $pGG $pBB $pG $pB $loss_model#loss model->(0:random uniform; 1:GE)set wl_phy [$wl_node_(0) set netif_(0)]$wl_phy set-error-level $opt(1) $opt(2) $opt(3) $opt(4) $opt(5)

$ns duplex-link $s1 $r1 10Mb 1ms DropTail$ns duplex-link $s2 $r1 10Mb 1ms DropTail$ns duplex-link $s3 $r1 10Mb 1ms DropTail

# linking of root to base-station node$ns duplex-link $r1 $BS(0) 100Mb 1ms DropTailset q1 [[$ns link $r1 $BS(0)] queue]#$q1 set limit_ 100

set udp1 [new Agent/myUDP]$ns attach-agent $s1 $udp1$udp1 set packetSize_ $packetSize$udp1 set_filename sd_11set null1 [new Agent/myUdpSink2] $ns attach-agent $wl_node_(0) $null1$ns connect $udp1 $null1$null1 set_trace_filename rd_11

set original_file_name highway_qcif.txtset trace_file_name video1.datset original_file_id [open $original_file_name r]set trace_file_id [open $trace_file_name w] set frame_count 0set last_time 0set pre_time 0

while {[eof $original_file_id] == 0} { gets $original_file_id current_line scan $current_line "%d%f%d%d" seq nexttime length type

set time [expr ($nexttime-$pre_time)*1000000.0] puts $trace_file_id "$time $length $type" set pre_time $nexttime incr frame_count}

close $original_file_idclose $trace_file_idset end_sim_time $nexttimeputs "$end_sim_time"

set trace_file [new Tracefile]$trace_file filename $trace_file_nameset video1 [new Application/Traffic/myTrace3]$video1 attach-agent $udp1$video1 attach-tracefile $trace_file

set udp2 [new Agent/UDP]$ns attach-agent $s2 $udp2set null2 [new Agent/Null] $ns attach-agent $wl_node_(0) $null2$ns connect $udp2 $null2

set traffic [new Application/Traffic/Exponential]$traffic set packetSize_ $packetSize$traffic set burst_time_ 0.5$traffic set idle_time_ 0.5$traffic set rate_ 256kb #original is 256kb$traffic attach-agent $udp2

set tcp1 [new Agent/TCP/Reno]$ns attach-agent $s3 $tcp1set tcpsink1 [new Agent/TCPSink] $ns attach-agent $wl_node_(0) $tcpsink1$ns connect $tcp1 $tcpsink1set ftp1 [$tcp1 attach-source FTP] set rng [new RNG]$rng seed $opt(0)set RVstart [new RandomVariable/Uniform]$RVstart set min_ 1$RVstart set max_ 2$RVstart use-rng $rngset startT_video [expr [$RVstart value]]puts "startT_video: $startT_video sec"

set RVstart2 [new RandomVariable/Uniform]$RVstart2 set min_ 0$RVstart2 set max_ 1$RVstart2 use-rng $rngset startT_ftp [expr [$RVstart2 value]]set startT_traffic [expr [$RVstart2 value]]puts "startT_ftp: $startT_ftp sec"puts "startT_traffic: $startT_traffic sec"

# Tell nodes when the simulation endsfor {set i 0} {$i < $num_mobile_nodes } {incr i} { $ns at [expr $end_sim_time + 5.0] "$wl_node_($i) reset";}

proc stop {} { global ns ntr bs_ifq $ns flush-trace close $ntr set fecno [$bs_ifq fecno?] puts "total fec no:$fecno"}

$ns at $startT_ftp "$ftp1 start" $ns at $startT_traffic "$traffic start"$ns at $startT_video "$video1 start"$ns at [expr $end_sim_time + 5.0] "$null1 closefile"$ns at [expr $end_sim_time + 5.1] "stop"$ns at [expr $end_sim_time + 5.2] "puts \"NS EXITING...\" ; $ns halt"$ns run

4. Simulation result

4.1 Simulation stepsThe simulation steps are described as below.

(a) ./ns.exe 11.tcl seed PGG PBB PG PB Loss_Model

(b) To create a video receiving file (distorted.264) with a receiving video trace file (rd_11) without FEC recovery.

(c) To recover the receiving video trace with myfec file and create a new receiving video trace file

(d) To create a new video stream file (distorted.264) with a new receiving video trace file (rd) that has been recovered with FEC mechanism.

(e) count PSNR

As the second command in the step (d).

Users could evaluate the video transmission quality with the output file (highway_qcif_distorted.yuv)

by the tool YUVviewer.exe

Conclusion:

The proposed model is successfully impleted using the simulator ns2.27 along with video quality analysis tool Evalvid. The users can evaluate the video transmission quality with the output file highway_qcif_distorted.yuv by the tool YUVviewer.exe.