Research Article

Detection and Counter Measure of Packet Misrouting by GPS-Free Positioning of Ad-Hoc Nodes

Algorithm 2

GPS-free positioning algorithm.
(1)Function GPS_free_positioning ()
(2)Input:
(3)N: A set of nodes that participated in the ad-hoc network
(4)m, n, o: n is the neighbor’s partner m
(5)ts: the time taken by packet was reached from one node to another
(6)if (local coordinate system) then
(7)n: position (0, 0)
(8)if (neighbor of n) then
(9)while (compute one hop neighbor)
(10)N(m[i]) Communicate node N(n[j])
(11)if (N(m[i], n[j]) signal)
(12)D distance between (N(m[i], n[j]))
(13)if (D = near)
(14)Ddataset (N(m[i], n[j]), D, t)
(15)end while
(16)while (compute two hop neighbor)
(17)N(o[k]) Communicate node N(n[i], m[j])
(18)ϴ = cos
(19)if (compute position of consecutive three nodes N(n, m, o))
(20)m(x, y) = (0, 0)
(21)n(x, y) = (Di n,0)
(22)o(x, y) = (Di n cos γ, Di m cos γ)
(23)compute triangulation for distance discovers
(24)end if
(25)while end
(26)end if
(27)end if