Advertisement
Guest User

CCturbineReactor

a guest
Jun 16th, 2014
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.22 KB | None | 0 0
  1. -- This script provides more steam to turbine
  2. -- if below 1750 rpm until it reaches 1800 rpm,
  3. -- then reduces steam flow to preset rate that
  4. -- maintains desired power level.
  5. -- Also monitors reactor fuel and case temperature
  6. -- (Reactor control is separate rednet PRC)
  7.  
  8. -- Requires wired modems for monitoring reactor
  9. -- Advance PC w/9x9 advance monitor recommended
  10. -- by efflandt - rename to 'startup' to auto boot
  11.  
  12. local mon = peripheral.wrap("right")
  13. term.clear()
  14. mon.setBackgroundColor(colors.black)
  15. mon.setTextColor(colors.white)
  16. mon.setTextScale(1)
  17. mon.clear()
  18. mon.setCursorPos(1,1)
  19. mon.write("Decreases steam flow")
  20. mon.setCursorPos(1,2)
  21. mon.write("when up to speed")
  22. mon.setCursorPos(1,3)
  23. local turbine = peripheral.wrap("back")
  24. if turbine.getConnected() == true then
  25.   mon.setTextColor(colors.green)
  26.   mon.write("Turbine connected")
  27.   else
  28.   mon.setTextColor(colors.red)
  29.   mon.write("Something wicked happened")
  30. end
  31.  
  32. local reactor = peripheral.wrap("BigReactors-Reactor_0")
  33. mon.setCursorPos(1,10)
  34. mon.clearLine()
  35. if reactor.getConnected() == true then
  36.   mon.write("Reactor connected")
  37. else
  38.   mon.write("Reactor Com problem")
  39. end
  40.  
  41. local maxSteam = 1860
  42. local normSteam = 1710
  43. local maxRPM = 1800
  44. local minRPM = 1750
  45. while true do
  46.   local rpm = turbine.getRotorSpeed()
  47.   if rpm > maxRPM then
  48.     turbine.setFluidFlowRateMax(normSteam)
  49.   elseif rpm < minRPM then
  50.     turbine.setFluidFlowRateMax(maxSteam)
  51.   end
  52.   mon.setCursorPos(1,5)
  53.   mon.clearLine()
  54.   mon.setTextColor(colors.red)
  55.   mon.write("Steam mB/t "..turbine.getFluidFlowRate())
  56.   mon.setCursorPos(1,6)
  57.   mon.clearLine()
  58.   mon.setTextColor(colors.lightBlue)
  59.   mon.write("RPM "..rpm)
  60.   mon.setCursorPos(1,7)
  61.   mon.clearLine()
  62.   mon.setTextColor(colors.yellow)
  63.   mon.write("RF/t "..turbine.getEnergyProducedLastTick())
  64.   mon.setCursorPos(1,8)
  65.   mon.clearLine()
  66.   mon.setTextColor(colors.orange)
  67.   mon.write("Buffer RF "..turbine.getEnergyStored())
  68.  
  69.   mon.setCursorPos(1,12)
  70.   mon.clearLine()
  71.   mon.setTextColor(colors.magenta)
  72.   mon.write("Fuel temp C "..reactor.getFuelTemperature())
  73.   mon.setCursorPos(1,13)
  74.   mon.clearLine()
  75.   mon.setTextColor(colors.cyan)
  76.   mon.write("Case temp C "..reactor.getCasingTemperature())
  77.   sleep(1)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement