Sayomie550

Untitled

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