Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reactor = peripheral.wrap("BigReactors-Reactor_0")
- monitor = peripheral.wrap("left")
- local P,I = 2.50 , 1
- local mathPower = 0 -- -1 to 1
- local mathInput = 0 -- -1 to 1
- local ipower = 0
- local iterm = 0
- while true do
- mathInput = (reactor.getEnergyStored()/10000000)*2 -1
- local ppower = -mathInput * P
- local iterm = -mathInput * I
- ipower = (ipower*0.98) + iterm
- mathPower = ppower + ipower
- if mathPower >= 1 then
- mathPower = 1
- end
- if mathPower <= 0 then
- mathPower = 0
- end
- print("\n\n\nP: ",ppower)
- print("I: ",ipower)
- print("total power : ", mathPower*100,"%")
- print("pi in: ", mathInput)
- print("-------------------------")
- reactor.setAllControlRodLevels(100-(100*mathPower))
- sleep(.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement