Advertisement
Ubidibity

BR Turbines 20151114

Nov 14th, 2015
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- credits to:
  2. -- https://youtu.be/sHN-KQKUkaY
  3.  
  4. -- for an api reference, I use and recommend:
  5. -- http://ftbwiki.org/Reactor_Computer_Port
  6. -- http://ftbwiki.org/Turbine_Computer_Port
  7.  
  8. function tscram()
  9. -- a turbine's going to fast, CPO3's yellin' "Shut 'em all down!!"
  10.     turbine1.setActive(false)
  11.     turbine2.setActive(false)
  12.     turbine3.setActive(false)
  13.     turbine4.setActive(false)
  14.     mon.setTextColor(colors.red)
  15.     print("TURBINE SCRAM!!!!  (2 min power down)")
  16.     sleep(120)7
  17. end
  18.  
  19. local reactor1 = peripheral.wrap("BigReactors-Reactor_1")
  20. local mon = peripheral.wrap("monitor_1")
  21. local turbine1 = peripheral.wrap("BigReactors-Turbine_1")
  22. local turbine2 = peripheral.wrap("BigReactors-Turbine_2")
  23. local turbine3 = peripheral.wrap("BigReactors-Turbine_3")
  24. local turbine4 = peripheral.wrap("BigReactors-Turbine_4")
  25. local capacitor1 = peripheral.wrap("tile_blockcapacitorbank_name_1")
  26. local tspeed1 = 0
  27. local tspeed2 = 0
  28. local tspeed3 = 0
  29. local tspeed4 = 0
  30.  
  31. -- basic capacitor low, 10k of 100k capacity
  32. local low = 10000
  33. -- turbine high 80k 1000000 capacity
  34. local high = 80000
  35. -- turbine full at 1M
  36. local full = 1000000
  37.  
  38. reactor1.setAllControlRodLevels(90)
  39.  
  40. while true do
  41. -- note the rod percentage is dependant upon blades, rotor material, and number of turbines
  42. -- this number is for 1 80 blade turbine with electrum rotors (37\ blocks)
  43.  
  44.   if capacitor1.getEnergyStored() <= low then
  45.     reactor1.setAllControlRodLevels(85)
  46.     if reactor1.getActive() == false then
  47.       reactor1.setActive(true)
  48.     end
  49.   end
  50.  
  51.   if turbine1.getEnergyStored() == full then
  52.      reactor1.setActive(false)
  53.   else
  54.     if turbine1.getEnergyStored() >= high then
  55.       reactor1.setAllControlRodLevels(95)
  56.       reactor1.setActive(true)
  57.     end
  58.   end
  59.  
  60.   mon.clear()
  61.  
  62.   mon.setTextScale(1)
  63.   mon.setCursorPos(15,19)
  64.   mon.setTextColor(colors.blue)
  65.   mon.write("pooter stat(os)")
  66.  
  67.   mon.setCursorPos(1,1)
  68.   mon.setTextColor(colors.white)
  69.   mon.write("Active: ")
  70.   mon.setTextColor(colors.green)
  71.   mon.write(reactor1.getActive())
  72.    
  73.   mon.setCursorPos(1,2)
  74.   mon.setTextColor(colors.white)
  75.   mon.write("Casing Heat: ")
  76.   mon.setTextColor(colors.green)
  77.   mon.write(math.floor(reactor1.getCasingTemperature()))
  78.  
  79.   mon.setCursorPos(1,3)
  80.   mon.setTextColor(colors.white)
  81.   mon.write("Fuel Heat: ")
  82.   mon.setTextColor(colors.green)
  83.   mon.write(math.floor(reactor1.getFuelTemperature()))
  84.  
  85.   mon.setCursorPos(1,4)
  86.   mon.setTextColor(colors.white)
  87.   mon.write("T1,2,3,4-RF: ")  
  88.   mon.setTextColor(colors.green)
  89.   mon.write(math.floor(turbine1.getEnergyStored()),",",
  90.             math.floor(turbine2.getEnergyStored()),",",
  91.             math.floor(turbine3.getEnergyStored()),",",
  92.             math.floor(turbine4.getEnergyStored())
  93.            )
  94.   mon.setCursorPos(1,5)
  95.   mon.setTextColor(colors.white)
  96.   mon.write("C-RF: ")  
  97.   mon.setTextColor(colors.green)
  98.   mon.write(math.floor(capacitor1.getEnergyStored()))
  99.  
  100.   mon.setCursorPos(1,6)
  101.   tspeed1 = math.floor(turbine1.getRotorSpeed())
  102.   if tspeed1>2000 then
  103.     tscram()
  104.   end
  105.   tspeed2 = math.floor(turbine1.getRotorSpeed())
  106.   if tspeed2>2000 then
  107.     tscram()
  108.   end
  109.   tspeed3 = math.floor(turbine1.getRotorSpeed())
  110.   if tspeed3>2000 then
  111.     tscram()
  112.   end
  113.   tspeed4 = math.floor(turbine1.getRotorSpeed())
  114.   if tspeed4>2000 then
  115.     tscram()
  116.   end
  117.   mon.setCursorPos(1,6)
  118.  
  119.   mon.setTextColor(colors.white)
  120.   turbine1.setActive(true)
  121.  
  122.   mon.write("T1-T4 RPM: ")  
  123.   mon.setTextColor(colors.green)
  124.   mon.write(tspeed1,tspeed2,tspeed3,tspeed4)
  125.  
  126.   mon.setCursorPos(1,7)
  127.   mon.setTextColor(colors.white)
  128.   mon.write("T1-Fin: ")  
  129.   mon.setTextColor(colors.green)
  130.   mon.write(math.floor(turbine1.getInputAmount()))
  131.  
  132.   mon.setCursorPos(1,8)
  133.   mon.setTextColor(colors.white)
  134.   mon.write("T1-Fout: ")  
  135.   mon.setTextColor(colors.green)
  136.   mon.write(math.floor(turbine1.getOutputAmount()))
  137.  
  138.   sleep(10)
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement