Sayomie550

Untitled

Mar 25th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.74 KB | None | 0 0
  1. --[[
  2. Turbine Control v1.0
  3.     lT = Large Turbine
  4.     sT = Small Turbine
  5.    
  6.     Displays power output and auto adjusts turbine speed
  7. --]]
  8.  
  9. lT1 = peripheral.wrap("BigReactors-Turbine_5")
  10. lT2 = peripheral.wrap("BigReactors-Turbine_15")
  11. lT3 = peripheral.wrap("BigReactors-Turbine_16")
  12. lT4 = peripheral.wrap("BigReactors-Turbine_4")
  13. lT5 = peripheral.wrap("BigReactors-Turbine_17")
  14. lT6 = peripheral.wrap("BigReactors-Turbine_18")
  15. lT7 = peripheral.wrap("BigReactors-Turbine_6")
  16. lT8 = peripheral.wrap("BigReactors-Turbine_19")
  17. sT1 = peripheral.wrap("BigReactors-Turbine_7")
  18. sT2 = peripheral.wrap("BigReactors-Turbine_8")
  19. sT3 = peripheral.wrap("BigReactors-Turbine_9")
  20. sT4 = peripheral.wrap("BigReactors-Turbine_10")
  21. sT5 = peripheral.wrap("BigReactors-Turbine_11")
  22. sT6 = peripheral.wrap("BigReactors-Turbine_12")
  23. sT7 = peripheral.wrap("BigReactors-Turbine_13")
  24. sT8 = peripheral.wrap("BigReactors-Turbine_14")
  25. local lPower = 0
  26. local sPower = 0
  27. local oPower = 0
  28.  
  29. while true do
  30.     --Gather the power production levels
  31.     lPower = lT1.getEnergyProducedLastTick()
  32.     sPower = sT1.getEnergyProducedLastTick()
  33.     oPower = lPower + sPower
  34.    
  35.    
  36.     --Display the power production and turbine status
  37.     function display()
  38.         term.clear()
  39.         term.setCursorPos(1,1)
  40.         print("Large Turbine Power Output - " ..lPower)
  41.         --print("Small Turbine Power Output - " ..Spower)
  42.         --print("Overall Power Output - " ..oPower)
  43.         print("Large Turbine 1 Active - " ..lT1.getActive())
  44.         print("Large Turbine 2 Active - " ..lT2.getActive())
  45.         print("Large Turbine 3 Active - " ..lT3.getActive())
  46.         print("Large Turbine 4 Active - " ..lT4.getActive())
  47.         print("Large Turbine 5 Active - " ..lT5.getActive())
  48.         print("Large Turbine 6 Active - " ..lT6.getActive())
  49.         print("Large Turbine 7 Active - " ..lT7.getActive())
  50.         print("Large Turbine 8 Active - " ..lT8.getActive())
  51.         print("Small Turbine 1 Active - " ..sT1.getActive())
  52.         print("Small Turbine 2 Active - " ..sT2.getActive())
  53.         print("Small Turbine 3 Active - " ..sT3.getActive())
  54.         print("Small Turbine 4 Active - " ..sT4.getActive())
  55.         print("Small Turbine 5 Active - " ..sT5.getActive())
  56.         print("Small Turbine 6 Active - " ..sT6.getActive())
  57.         print("Small Turbine 7 Active - " ..sT7.getActive())
  58.         print("Small Turbine 8 Active - " ..sT8.getActive())
  59.     end
  60.    
  61.     --Stops and starts the turbines based on internal storage levels
  62.     if lT1.getEnergyStored() >= 980000 then
  63.         lT1.setActive(false)
  64.     else
  65.         lT1.setActive(true)
  66.     end
  67.    
  68.     --Auto adjust of the Large turbines
  69.     --[[
  70.     function lSpeed()
  71.         if lT1.getRotorSpeed() >= 1820 then
  72.             lT1.setFluidFlowRateMax = lT1getFluidFlowRate + 1
  73.         end
  74.         if lT1.getRotorSpeed() <= 1800 then
  75.             lT1.setFluidFlowRateMax = lT1getFluidFlowRate - 1
  76.         end
  77.     end
  78.    
  79.     lSpeed()
  80.     --]]
  81.     display()
  82.     sleep(5)
  83. end
Advertisement
Add Comment
Please, Sign In to add comment