Sayomie550

Untitled

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