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.getEnergyProducedLastTick()
- oPower = lPower + sPower
- --Display the power production and turbine status
- if lT1.getActive() then
- lA1 = ("True")
- else
- lA1 = ("False")
- end
- function display()
- term.clear()
- term.setCursorPos(1,1)
- print("Large Turbine Power Output (RF/t) - " ..lPower)
- print("Small Turbine Power Output (RF/t) - " ..sPower)
- print("Overall Power Output (RF/t) - " ..oPower)
- print("Large Turbine 1 Active - " ..lA1)
- --[[
- print("Large Turbine 2 Active - " ..lA2)
- 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 lT1.getEnergyStored() >= 980000 then
- lT1.setActive(false)
- else
- lT1.setActive(true)
- end
- --Auto adjust of the Large turbines
- lT1Speed = lT1.getRotorSpeed()
- lT1Flow = lT1.getFluidFlowRate()
- if lT1Speed > 1850 then
- lT1.setFluidFlowRateMax = lT1Flow + 1
- end
- if lT1Speed < 1820 then
- lT1.setFluidFlowRateMax = lT1Flow - 1
- end
- display()
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement