Advertisement
JaMaNi133

aawdasd

Mar 6th, 2024 (edited)
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. --ctrlRod,power,fuel,tempCore,tempCase
  2. fileName="test1.csv"
  3.  
  4. file=fs.open(fileName,"w")
  5. file.writeLine("speed,power")
  6. file.writeLine("rpm,fe/t")
  7. file.close()
  8.  
  9. powerProd,speed=0,0
  10. reactor = peripheral.wrap("back")
  11. function saveData()
  12.     file=fs.open(fileName,fs.exists(fileName) and "a" or "w")
  13.     print(string.format("%d ,%d",speed,powerProd))
  14.     file.writeLine(string.format("%d ,%d",speed,powerProd))
  15.     file.close()
  16. end
  17.  
  18. function measure()
  19.     points = 0
  20.     powerProd,fuelRate=0,0
  21.     while points < 4 do
  22.         points = points + 1
  23.         powerProd = powerProd+reactor.getEnergyProducedLastTick()
  24.         speed = speed+reactor.getRotorSpeed()
  25.         sleep(0.25)
  26.     end
  27.     powerProd = powerProd/points
  28.     speed = speed/points
  29. end
  30.  
  31. sleep(10)
  32. print("starting")
  33. t = 0
  34. while t < 1800 do
  35.     measure()
  36.     saveData()
  37.     t = t + 1
  38.     print(string.format("point %d/1800   %.1f percent",t,t/18))
  39. end
  40. print("done")
  41. reactor.setActive(false)
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement