Sayomie550

Untitled

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