Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This program is designed for a T1 computer, running any sized extreme reactor. It will try to float the power level at 80% by raising or lowering all rods every second. In the event that power drops below 10%, all rods will be removed to maximize power generation up until 30% power, in which normal operations will resume.
- --Minimum components required are a T1 Computer, screen is optional. This program was written by JayLocke with the assistance of the #OC IRC channel on irc.esper.net server.
- --Version 1.0 released 27 May 2018
- local component = require( "component" )
- local math = require( "math" )
- local term = require( "term" )
- local br = component.br_reactor
- local allrods = br.setAllControlRodLevels
- local rodlevel = br.getControlRodLevel(0)
- local maxpower = 10000000
- local percentstore = math.floor((br.getEnergyStored() / maxpower) * 100)
- local condition = "INITIALIZING."
- br.setActive(true)
- allrods(100)
- function refresh()
- term.clear()
- print("Power Level = " ..br.getEnergyStored().. " RF")
- print("Current power = " ..percentstore.. "%")
- print("Rods at = " ..rodlevel.. "%")
- print("Condition is " ..condition..".")
- if condition == "INITIALIZING." then print("Initial Conditions, Set!") end
- end
- function ploss()
- if condition ~= "NORMAL." then condition = "NORMAL." end
- if (rodlevel ~= 0) then allrods(rodlevel-1) end
- end
- function pgain()
- if condition ~= "NORMAL." then condition = "NORMAL." end
- if (rodlevel ~= 100) then allrods(rodlevel+1) end
- end
- function emeregency()
- if condition ~= "EMERGENCY!" then condition = "EMERGENCY!" end
- while (percentstore <= 30) do
- if(rodlevel ~= 0) then allrods(0) end
- component.computer.beep()
- os.sleep(.5)
- component.computer.beep()
- os.sleep(.5)
- refresh()
- end
- end
- refresh()
- while true do
- os.sleep(1)
- if (percentstore <= 10) then
- emergency()
- elseif (percentstore < 80) then
- print("Raising Rods")
- ploss()
- else
- print("Lowering Rods")
- pgain()
- end
- percentstore = math.floor((br.getEnergyStored() / maxpower) * 100)
- rodlevel = br.getControlRodLevel(0)
- refresh()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement