lego11

Software sottomarino Lay

Jun 3rd, 2021 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. s = peripheral.wrap("bottom")
  2.  
  3. max_power = 2400
  4. max_flux = 2250
  5. max_thermal = 2320
  6.  
  7.  
  8. function clear()
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. end
  12.  
  13. while true do
  14. u, f, d, b1 = s.get(1)
  15. u, f, d, b2 = s.get(2)
  16. u, f, d, b3 = s.get(3)
  17. u, f, d, besm = s.get(4)
  18. u, f, d, p = s.get(5)
  19.  
  20. kW = p["average"]
  21.  
  22. batmaxp_1 = b1["maxStorageL"]
  23. batmaxp_2 = b2["maxStorageL"]
  24. batmaxp_3 = b3["maxStorageL"]
  25. batmaxp_ESM = besm["maxStorageL"]
  26.  
  27. batcurlev_1 = b1["energyL"]
  28. batcurlev_2 = b2["energyL"]
  29. batcurlev_3 = b3["energyL"]
  30. batcurlev_ESM = besm["energyL"]
  31.  
  32. batv_1 = math.floor(201.6+((268.8 - 201.6)/batmaxp_1)*batcurlev_1)
  33. batv_2 = math.floor(201.6+((268.8 - 201.6)/batmaxp_2)*batcurlev_2)
  34. batv_3 = math.floor(201.6+((268.8 - 201.6)/batmaxp_3)*batcurlev_3)
  35. batv_ESM = math.floor(21+((28.8 - 21)/batmaxp_ESM)*batcurlev_ESM)
  36.  
  37. clear()
  38. ---------------------------------------------------
  39. print(" Selex ES - Monitoraggio Alimentazione\n")
  40. print("Banco 1: "..batv_1.. " V ")
  41. print("Banco 2: "..batv_2.. " V ")
  42. print("Banco 3: "..batv_3.. " V")
  43. print("Banco ESM: "..batv_ESM.. " V")
  44. print("")
  45. print("Diesel dritta: 0 kW")
  46. print("Diesel sinistra: 0 kW")
  47. print("Cella combustibile: "..kW.. " kW")
  48.  
  49. if batv_1 < 210 or batv_2 < 210 or batv_3 < 210 or batv_ESM < 23 then
  50. term.setCursorPos(1, 19)
  51. term.setBackgroundColour(colors.white)
  52. term.setTextColor(colors.black)
  53. term.write(" UNA O PIU' BATTERIE SONO TROPPO SCARICHE ")
  54. term.setBackgroundColor(colors.black)
  55. term.setTextColor(colors.white)
  56. end
  57. sleep(1)
  58. end
  59.  
  60.  
Add Comment
Please, Sign In to add comment