Research Article

Localization in 3D Wireless Sensor Networks with Obstacle Consideration

Algorithm 2

Location computation
Input: Location of beacons
Base station sends control message to beacons to start transmission
Beacons share control message among them
foreach do
  Transmit data messages containing location information
end
foreach nodedo
  ifnode receives a messagethen
   ifduplicate messagethen
    Discard message
  else
    
    Update info table
    ifthen
     Compute x and y
     If successfully computed,
      computed = 1
     Compute z
     ifcomputed = = 1then
      retransmit and goto sleep
     else
      wait for message
     end
    end
   end
  end
end