Advertisement
Slyke

RSSI to distance

Jun 2nd, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1.  
  2.   const clearRSSIToM=-6; // Measured in dB/m. Line of sight change in dB per meter.
  3.   const clearRSSIat1Meter=-63.462; //Measured in dB. Line of sight dB measurement at 1 meter from source.
  4.   const clearPropagationConstant=12.27; //Propagation constant, 2 is clear line of sight in atmosphere near sea level.
  5.  
  6.  
  7.   public function calculateDistanceFromRSSI($recievedRSSI, $dbAt1Meter=Triangulate::clearRSSIat1Meter, $clearRSSIToM = Triangulate::clearRSSIToM, $propagationConstant=Triangulate::clearPropagationConstant)
  8.   //Calculates distance based off RSSI.
  9.   {
  10.     //RYOMA PLS
  11.     //d=((A - RSSI) / (10n log(10)))
  12.     //log10(d)
  13.     //RSSI (dBm) = -10n log10(d) + A
  14.     //return (($dbAt1Meter / $recievedRSSI) / (10*$propagationConstant * log(10)));
  15.     $dbAt1Meter*=-1;
  16.     $clearRSSIToM*=-1;
  17.     return exp(($recievedRSSI + $dbAt1Meter) / $clearRSSIToM);
  18.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement