Advertisement
snowgum

rsrp2rssi

Aug 8th, 2022
835
0
308 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. #!/usr/bin/lua
  2.  
  3. rsrp = tonumber(arg[1])
  4. bw = tonumber(arg[2])
  5. if bw == 1.4 then
  6.     n = 6
  7. else
  8.     n = bw * 5
  9. end
  10.  
  11. if tonumber(string.match(_VERSION, "%d+%.%d")) > 5.1 then
  12.     rssi = rsrp + (10 * math.log(n * 12, 10))
  13. else
  14.     rssi = rsrp + (10 * math.log10(n * 12))
  15. end
  16. if rssi < -113 then
  17.     rssi = -113
  18. elseif rssi > -51 then
  19.     rssi = -51
  20. end
  21. print(math.floor(rssi))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement