Ns2 Pegasis Routing Protocol, in this section we are going to see about
What is pegasis?
- The PEGASIS (Power-Efficient Gathering in Sensor Information Systems) protocol forms a chain of the sensor nodes and the chain is formed using a greedy approach, starting from the node farthest to the sink node.
- It’s one of the clustering routing protocol.
Steps involved in pegasis:
- Chain construction.
- Gathering data.
Types of pegasis routing protocol:
- Improved energy efficient pegasis based protocol (IEEPB).
- H-pegasis.
- Energy Efficient PEGASIS Based (EEPB).
- Pegasis-ANT.
- Pegasis with double cluster head (PDCH).
Sample Ns2 code for Pegasis routing Protocol:
set opt(tr) "$opt(dirname)/pegasis.tr" ;# Trace file # Need to spread the data by k+1 set opt(spreading) [expr $opt(num_clusters)+1] set outf [open "$opt(dirname)/conditions.txt" w] puts $outf "\nUSING PEGASIS:\n" close $outf # Parameters for centralized control cluster formation algorithm set opt(adv_info_time) [TxTime [expr $opt(hdr_size) + 12]] set opt(finish_adv) [expr $opt(nn_) * $opt(adv_info_time)] set opt(bs_setup_iters) 1000 ;# Num iters for sim. annealing alg. set opt(bs_setup_max_eps) 10 ;# Max change for sim. annealing alg. set outf [open "$opt(dirname)/conditions.txt" a] puts $outf "Desired number of clusters = $opt(num_clusters)" puts $outf "Spreading factor = $opt(spreading)" puts $outf "Changing clusters every $opt(ch_change) seconds\n" close $outfTweet