Docstoc

implementation and analysis of gpsr greedy perimeter stateless

Document Sample
implementation and analysis of gpsr greedy perimeter stateless Powered By Docstoc
					Implementation and Analysis of GPSR: Greedy Perimeter Stateless Routing for Wireless Networks
University of California, Santa Barbara Computer Science Department CS 230B Fall 2004 Maria del Mar Alvarez-Rohena malvarez@cs.ucsb.edu Chris Eberz chriseberz@gmail.com

1. Functionality Our program simulates a network of nodes that can be either stationary or mobile. The network, either a randomly generated network based on a random seed provided by the user, or a ring or star topology, will construct its connections from a simple beaconing protocol wherein each node broadcasts an empty packet so that all nodes in radio range will cache that node in their routing table. In each node’s table, neighbors will be dropped if they are not heard from in a specific amount of time, which, in our program, is tied to the period of beacon packets which is specified by the user. Our program allows the user to select from 3 algorithms for forwarding, Greedy forwarding, GPSR forwarding, and our slightly modified version of GPSR, Ordered Pair GPSR. Once a routing method is selected, the user may select the number of packets to be sent across the network (and at what frequency) during the simulation. Once the simulation is finished, the program outputs metrics to the console, including successfully delivered packets, packets dropped by the selected routing method, and packets lost during transmission. Finally, the user can also select if the graph is to move during the simulation. As suggested in our source, the method we use for moving nodes is the random waypoint method, where a node chooses a random direction vector (from a range specified by the user), and moves in that direction in the amount of the magnitude of the vector. So that the same network, test packets and order of movement could be tested with different algorithms, all things random in the program are generated by the same user provided seed mentioned above. Program variables selected by user: • Network type (Uniform Random, Ring, Star) • Forwarding Algorithm (Greedy, GPSR, Ordered Pair GPSR) • Network size and density • Node radio range • Random Seed • Beacon and test packet periods • Movement and movement range 1

Figure 1. GPSR Simulation Input Interface

Figure 2. GPSR Simulation Output Interface

2

2. Algorithms behind the Greedy Perimeter Stateless Routing Protocol 2.1. Greedy-Perimeter Stateless Routing The core algorithm of GPSR is GPSR-FORWARD [2], which is ran by each node every time it receives a packet p from one of its neighbors nin. The algorithm looks first at the packet destination and compares it with the node’s address (self.a). If it’s the same, it receives the packet; otherwise it looks at the packet’s mode field, and forwards it according to the mode M. When a packet is forwarded in greedy mode, if it returns failure, the M, Lp, Lf, and e0 fields1 are edited in the packet, and it is then forwarded to the node t given by the PERIMETER-INITFORWARD algorithm. Otherwise, the packet gets forwarded according to the GREEDYFORWARD algorithm. If the packet is on perimeter mode, the algorithm checks first if it can switch to greedy mode. It will go back to greedy, if the distance from that node self to the destination is less than the distance from the point in which we entered perimeter mode (Lp) to the destination. In the adverse case, it will first search for the first node t counter clockwise from the line L p D using the RIGHT-HAND-FORWARD method. GPSR-FORWARD then checks if the edge created by (self, t) intersects L p D , using the FACE-CHANGE algorithm, if this is the case, t will be updated by it, otherwise it will leave it as is. After we obtain the node t, the packet p gets forwarded to it. If at any point it sees that it is back at edge e0, instead of forwarding the package, it drops it, to avoid looping around a face in the graph. The worst-case complexity of this algorithm is O(NC), where N is the number of neighbors per node (its degree), which is the time complexity of the FACE-CHANGE algorithm.
GPSR-FORWARD(p, nin) 1 if p.D == self.a then receive packet 2 else 3 if p.M == Greedy then 4 if GREEDY-FORWARD(p, nin) == failure then 5 p.M = Perimeter 6 p.Lp = p.Lf = self.l 7 t = PERIMETER-INIT-FORWARD(p) 8 p.e0= (self.a, t) 9 forward p to t 10 else if p.M == Perimeter then 11 if DISTANCE(self.l, p.D) < DISTANCE(p.Lp, p.D) then 12 p.M = Greedy 13 GREEDY-FORWARD(p) 14 else 15 t= RIGHT-HAND-FORWARD(p, nin) 16 if p.e0 == (self.a, t) then 17 drop p 18 else 19 t = FACE-CHANGE(p, t) 20 forward p to t
1

Lp is the node where greedy failed, Lf, first node encountered in that face of the planar graph, and e0 is the edge in

that face that intersects with the line L p D , where D is the destination in the packet.

3

2.2 Greedy Forwarding In greedy forwarding mode, a node x forwards a packet to the neighbor that is closer to the packet’s destination. The GREEDY-FORWARD [2] algorithm takes care of this.

Figure 3. Greedy Forwarding: x wants to sent a packet to D and it forwards it greedily to y. The circle around x is its transmition radio [1].

The GREEDY-FORWARD algorithm looks at the Euclidean distances from each of its neighbors to the packet destination p.D and picks the one with smallest distance. It then compares the distance of the closer neighbor with the one from it to p.D, if so happens that the neighbor is closer; it forwards the packet to that network. But, if none of its neighbors are closer to p.D than it, then the algorithm returns failure (see Figure 4).

Figure 4. Greedy Forwarding failure: x wants to sent a packet to D, but none of its neighbors are closer to D than x [1].

Because of the for-loop in line 3, the time complexity of GREEDY-FORWARD is O(N).
GREEDY-FORWARD(p) 1 nbest = self.a 2 dbest = DISTANCE(self.l, p.D) 3 for each (a,l) in N do 4 d = DISTANCE(l, p.D) 5 if a == p.a or d < dbest then 6 dbest = d 7 nbest = a 8 if a == p.a then break 9 if nbest != self.a then 10 return success 11 forward p to nbest 12 else return failure

4

2.3. Perimeter Forwarding The idea behind perimeter forwarding is to forward the packets using the right hand rule across the faces in the planar graph that intercept the line L p D (see Figure 5). The algorithms used in perimeter forwarding are the following:

Figure 5. Perimeter Forwarding: x is the node where Greedy forwarding failed. Algorithm uses right hand rule to forward packets [1].

The PERIMETER-INIT-FORWARD [2] algorithm forwards a packet p to a node amin, where (amin, self) is the first edge encountered countered clockwise from the line L p D .
PERIMETER-INIT-FORWARD(p) 1 amin = RIGHT-HAND-FORWARD(p, p.D) 2 return amin

The RIGHT-HAND-FORWARD [2] algorithm implements the right-hand rule method for traversing polygons, which in our case are the faces in the planar graph. The time complexity of this algorithm is O(cN) = O(N), where N is the number of neighbors in the planar graph and c is the time it takes to do a NORM2 operation. NORM can be considered as a constant operation, since the range of the arc of the tangent is (-π/2, π/2).
RIGHT-HAND-FORWARD(p, nin) 1 bin = NORM(ATAN2(self.l.y – nin.y, self.l.x-nin.x) 2 δmin = 3π 3 for each (a, l) in N do 4 if a == nin then continue 5 ba = NORM(ATAN2(self.l.y – l.y, self.l.x – l.x)) 6 δb = NORM(ba-bin) 7 if δb < δmin then 8 δmin = δb 9 amin = a 10 return amin
2

Normalizes argument in radians ∈

[0, 2π] by repeatedly adding 2π

5

If the next edge (self.a, t) counter clockwise selected by RIGHT-HAND-FORWARD intercepts L p D , GPSR updates the packet e0 field and instead of selecting node t to forward the packet to, it selects the next edge counter clockwise from (self.a, t) (See Figure 5). This is basically what is done in the FACE-CHANGE [2] algorithm. Note that this algorithm will only send a packet across a face that is closer to the destination (line 3).
FACE-CHANGE(p, t) 1 i = INTERSECT(t.l, self.l, p.Lp, p.D) 2 if i != NULL then 3 if DISTANCE(i,D) < DISTANCE(p.Lf, p.D) then 4 t = RIGHT-HAND-FORWARD(p, t) 5 t = FACE-CHANGE(p, t) 6 p.e0 = (self.a, t) 7 return t

The worst-case time complexity of FACE-CHANGE is O(NC), where C is the depth of a recursive FACE-CHANGE call. 3. Experimentation We were able to get slightly better performance in terms of delivery success out of the GPSR algorithm by changing the way it drops packets as undeliverable. In the GPSR algorithm, if packet moving in perimeter mode crosses the same edge that was first crossed on the packet’s current face, then, having made a complete tour of the face without any progress, GPSR drops the packet. In the GPSR packet header, this edge is stored as a pair of node addresses, and is compared without regard to the order of the pair. Because of this, there are cases where a path to the destination does in fact exist, and would be reached if the packet had not been dropped. Specifically, when the first edge crossed after a face change ends at a node with only one edge, the right-hand rule chooses that same edge, in the other direction, as the next edge, and it is dropped. In Figure 6 there is an example of this problem. Our version of GPSR, Ordered Pair GPSR, simply treats the edge e0 as an ordered pair of nodes so that a packet will be dropped only if it is being crossed in the same direction. To prove that this will not cause the packet to be forwarded forever when it is in fact undeliverable, consider that the GPSR algorithm changes the face in a planar graph in which it is traversing along the perimeter only if the new face is closer to the destination. It does this by saving the point on an edge where the line from the node where greedy forwarding failed to the destination intersects that edge. Not only will the algorithm only cross on to another face through an edge that intersects this line, but only if the point of intersection is strictly greater than the last point of intersection where traversal of this face began. Thus there is a finite number of faces along the path to the destination, or more specifically, a finite number of face changes made during the packet’s journey. For these reasons it was clear in the original algorithm that in each face either the packet would leave the face, the destination would be found on the perimeter of that face, or the first edge traversed would be traversed a

6

second time, and the packet would be dropped. In a face made up of nodes that have more than 1 edge, a traversal of the edges repeats with the same direction for each edge. When there is a node with a single edge, for example a sort of “spike,” any edges between that node and the first node with 3 or more edges it touches will be traversed in BOTH directions in the cycle about the perimeter of the face. If you take these edges and in there place make two directed edges, the graph is like in the first example where each edge is traversed in the same direction each time. Thus, any edge that is 2-directional on a face that was traversed first by a packet entering that face will be traversed in the same direction, unless the packet leaves the face.

Figure 4. Example of GPSR’s failure to route routable packages.

7

3.1. Results

GPSR Performance on Static Randomly Generated Networks
100 % Packet Transmission Rate 95 90 85 80 75 70 65 60 50 100 150 # Nodes 200 250 Greedy GPSR OpGPSR

Number of Hops in Static Randomly Generated Network
14 12 10 8 6 4 2 0 0 50 100 150 200 250 # Nodes Greedy GPSR OpGPSR

Average # Hops

8

GPSR on Multiple Topolgies
105 100 95 90 85 80 75 Random Static Random Mobile Ring Static Ring Mobile Star Static Star Mobile

Packet Transmission Rate

Topology

Mobile Network Performance
120

100 Packet Transmission Rate

80

60

40

20

0 Greedy GPSR Algorithms for 100 nodes OpGPSR

9

4. Conclusions We have implemented a multi-threaded simulation of the Greedy Perimeter Stateless Routing protocol for static and mobile wireless sensor networks. We tested the algorithm on different topologies, and both on static and mobile networks. The Random Waypoint model was used to simulate sensor network mobility. Our simulations of GPSR imply that GPSR is more scalable on mobile networks. After studying GPSR in detail, we encountered cases in which the GPSR Forwarding routing does not find routes when they exist. To handle forwarding failure existing routes, we proposed the Ordered Pair Greedy Perimeter Stateless Routing protocol. Our simulation results show that on static sensor networks, Order Pair GPSR’s packet transmission ration is higher than GPSR.

5. References [1] Karp, B. and Kung, H.T., Greedy Perimeter Stateless Routing for Wireless Networks, in Proceedings of the Sixth Annual ACM/IEEE International Conference on Mobile Computing and Networking (MobiCom 2000), Boston, MA, August, 2000, pp. 243-254. [2] Karp, B., Geographic Routing for Wireless Networks, Ph.D. Dissertation, Harvard University, Cambridge, MA, October, 2000

10


				
DOCUMENT INFO
Shared By:
Stats:
views:15
posted:12/20/2009
language:English
pages:10
Description: implementation and analysis of gpsr greedy perimeter stateless