Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Turbine Control v1.0
- lT = Large Turbine
- sT = Small Turbine
- Displays power output and auto adjusts turbine speed
- --]]
- lT1 = peripheral.wrap("BigReactors-Turbine_5")
- lT2 = peripheral.wrap("BigReactors-Turbine_15")
- lT3 = peripheral.wrap("BigReactors-Turbine_16")
- lT4 = peripheral.wrap("BigReactors-Turbine_4")
- lT5 = peripheral.wrap("BigReactors-Turbine_17")
- lT6 = peripheral.wrap("BigReactors-Turbine_18")
- lT7 = peripheral.wrap("BigReactors-Turbine_6")
- lT8 = peripheral.wrap("BigReactors-Turbine_19")
- sT1 = peripheral.wrap("BigReactors-Turbine_7")
- sT2 = peripheral.wrap("BigReactors-Turbine_8")
- sT3 = peripheral.wrap("BigReactors-Turbine_9")
- sT4 = peripheral.wrap("BigReactors-Turbine_10")
- sT5 = peripheral.wrap("BigReactors-Turbine_11")
- sT6 = peripheral.wrap("BigReactors-Turbine_12")
- sT7 = peripheral.wrap("BigReactors-Turbine_13")
- sT8 = peripheral.wrap("BigReactors-Turbine_14")
- local lPower = 0
- local sPower = 0
- local oPower = 0
- while true do
- --Gather the power production levels
- lPower = lT1.getEnergyProducedLastTick()
- sPower = sT1.getEnergyProducedLastTickdLastTick()
- oPower = lPower + sPower
- --Display the power production and turbine status
- function display()
- term.clear()
- term.setCursorPos(1,1)
- print("Large Turbine Power Output - " ..lPower "RF/t")
- print("Small Turbine Power Output - " ..Spower "RF/t")
- print("Overall Power Output - " ..oPower "RF/t")
- print("Large Turbine 1 Active - " ..lT1.getActive())
- print("Large Turbine 2 Active - " ..lT2.getActive())
- print("Large Turbine 3 Active - " ..lT3.getActive())
- print("Large Turbine 4 Active - " ..lT4.getActive())
- print("Large Turbine 5 Active - " ..lT5.getActive())
- print("Large Turbine 6 Active - " ..lT6.getActive())
- print("Large Turbine 7 Active - " ..lT7.getActive())
- print("Large Turbine 8 Active - " ..lT8.getActive())
- print("Small Turbine 1 Active - " ..sT1.getActive())
- print("Small Turbine 2 Active - " ..sT2.getActive())
- print("Small Turbine 3 Active - " ..sT3.getActive())
- print("Small Turbine 4 Active - " ..sT4.getActive())
- print("Small Turbine 5 Active - " ..sT5.getActive())
- print("Small Turbine 6 Active - " ..sT6.getActive())
- print("Small Turbine 7 Active - " ..sT7.getActive())
- print("Small Turbine 8 Active - " ..sT8.getActive())
- end
- --Stops and starts the turbines based on internal storage levels
- if lT1getEnergyStored() >= 980000 then
- lT1.setActive(false)
- else
- lT1.setActive(true)
- end
- --Auto adjust of the Large turbines
- function lSpeed()
- if lT1.getRotorSpeed() >= 1820 then
- lT1.setFluidFlowRateMax = lT1getFluidFlowRate + 1
- end
- if lT1.getRotorSpeed <= 1800 then
- lT1.setFluidFlowRateMax = lT1getFluidFlowRate - 1
- end
- end
- lspeed()
- display()
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement