I am currently working on a program that will automatically adjust my reactor (Big Reactors). I have plans to have it control 3 separate reactors. I am working on getting the function for one of them working and after that I can modify it to work the other 2. The part that detects the number of control rods in the reactor and then get the current level and place them into tables. This allows me to modify the reactors size and not have to worry about changing the program.
I have run into a little problem relating to the actual adjustment function in this case meRodLogicInc(). Once it runs the first time it does not change the control rod levels.
EX: If it is producing more then 2500 RF then is currently being used it will kick a single control rod from say 64 to 65 thus reducing the output. However, it the production is still over 2500 it will not change the level even though it is going through the function to increase it.
Thank you for any help that you can provide.
function rodCount()
meRodCount = component.invoke(meReactor, 'getNumberOfControlRods')
meRodNum = 0
meRodNums = {}
meRodLevels = {}
while meRodNum<meRodCount do
meRodNums[#meRodNums+1] = meRodNum
meRodLevel = component.invoke(meReactor, 'getControlRodLevel',meRodNums[#meRodNums])
meRodLevels[#meRodLevels+1] = meRodLevel
meRodNum = meRodNum+1
end
end
function meRodLogicInc()
meRodPoint = #meRodLevels
meRodLevelAverage = 0
while meRodPoint>0 do
meRodLevelAverage = meRodLevelAverage+meRodLevels[meRodPoint]
meRodPoint = meRodPoint-1
end
mePowerLevel = component.invoke(meReactor, 'getEnergyStored')
mePowerDif = mePowerLevel-meLastPower
if mePowerDif<=0 then
meRodLevelAverage = meRodLevelAverage/#meRodNums
meCurrentRodLevel = meRodLevels[meCurrentRod]
meRodChange = meCurrentRodLevel-1
meRodCurCha = meCurrentRod-1
component.invoke(meReactor, 'setControlRodLevel', meRodCurCha, meRodChange)
end
if mePowerDif>2500 then
meRodLevelAverage = meRodLevelAverage/#meRodNums
meCurrentRodLevel = meRodLevels[meCurrentRod]
meRodChange = meCurrentRodLevel+1
meRodCurCha = meCurrentRod-1
component.invoke(meReactor, 'setControlRodLevel', meRodCurCha, meRodChange)
end
meLastPower = mePowerLevel
end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I am currently working on a program that will automatically adjust my reactor (Big Reactors). I have plans to have it control 3 separate reactors. I am working on getting the function for one of them working and after that I can modify it to work the other 2. The part that detects the number of control rods in the reactor and then get the current level and place them into tables. This allows me to modify the reactors size and not have to worry about changing the program.
I have run into a little problem relating to the actual adjustment function in this case meRodLogicInc(). Once it runs the first time it does not change the control rod levels.
EX: If it is producing more then 2500 RF then is currently being used it will kick a single control rod from say 64 to 65 thus reducing the output. However, it the production is still over 2500 it will not change the level even though it is going through the function to increase it.
Thank you for any help that you can provide.
Link to post
Share on other sites