Advertisement
Sayomie550

Untitled

Mar 25th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.13 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.         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 lT1getEnergyStored >= 980000 then
  63.         lT1.setActive(false)
  64.     else
  65.         lT1.setActive(true)
  66.     end
  67.    
  68.     --Auto adjust of the Large turbines
  69.     function lSpeed()
  70.         if lT1.getRotorSpeed >= 1820 then
  71.             lT1.setFluidFlowRateMax = lT1setFluidFlowRateMax - 1
  72.         end
  73.         if lT1.getRotorSpeed <= 1800 then
  74.             lT1.setFluidFlowRateMax = lT1setFluidFlowRateMax + 1
  75.         end
  76.     end
  77.    
  78.     --Auto adjust of the Small turbines
  79.     function sSpeed()
  80.         if sT1.getRotorSpeed >= 920 then
  81.             sT1.setFluidFlowRateMax = lT1setFluidFlowRateMax - 1
  82.         end
  83.         if sT1.getRotorSpeed <= 900 then
  84.             sT1.setFluidFlowRateMax = lT1setFluidFlowRateMax + 1
  85.         end
  86.     end
  87.    
  88.     display()
  89.     sleep(5)
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement