Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- modified to work with draconic rf storage (trying to determine actual 'gain' from reactor)
- --Rev. 20210619 wtp
- --As my previous paste could be my 'first', this one will become my 1.1 release.
- --Developed for use on 1.7 Infinity with Draconic Evolution 1.7.10-1.0.2h (Mym.li normal mode)
- --I've got the main parts I wanted, the setup and considerations are detailed below:
- --Advanced computer with a Draconic Reactor stabilizer on it's right side.
- --Red cage lamp on top (to come on when either containment field or saturation <51%)
- -- Note: neither light will light nor flash at 51%, if the last iteration left the red light illuminated it will stay
- -- illuminated until either it drops below 51% or rises up or beyond 52% (I call this the 'transition period')
- --Green cage lamb on back (to come on with both containment field and saturation >51%)
- --A wired modem is on the left side with a cable running up to the Tier-7 Draconic Energy Core Energy Pylon
- --advanced monitors 5 wide, three tall stacked below the computer facing the stabilizer I have the flux gate on.
- --The Draconic Reactor is connected directly with cryotheum ducts from the stabilizer to the T7 energy 'input'
- --then the T7 energy output goes to the reactor injector.
- -- The reactor injector flux gate has a redstone signal high at 262,000RF/t and connects back to the injector in
- -- reverse containment field mode (three repeaters and a piece of redstone) using 139,700K for my mostly used reactor
- -- The stabilizer flux gate to the T7 energy core is currently set at 2,010,000 though of course that took weeks and starts
- -- out much lower.
- -- Since the T7 fills up and the reactor essentially shuts down, I have a third flux gate 'drain' between the T7
- -- energy core and the injector flux gate which is also connected to a modem and wired back to the computer.
- -- The idea is to allow both my use and public use to draw on the reactor up to the amount the reactor creates,
- -- but to limit the flux gate if that drain gets too high as I've found connecting a new t7 to any of those tessearcts
- -- on that flux gate would run out the buffer for the reactor and it would ultimately fail (I lost at least one core this way)
- -- Its worth acknowledging that the mym.li servers disable the explosion, so while losing the chaos shards hurts,
- -- at least you don't lose the rest of the infrastructure.
- -- Changes for the 19th.
- -- Mostly cosmetic, I'm going to start by converting my print redirect output to specific monitor coordinates
- -- also better color management, so if the saturation is gaining during the transition period I want that green
- -- but the draining warning should be yellow
- -- the fluxgate flow override when it kicks in should be red
- -- the normal flux gate flow set to the generation power-field drain should be green
- -- I may also suppress the maxFieldStrength and maxEnergySaturation as it's static and you sort of get that from the
- -- current values and their respective percentages
- -- I'm also going to shuffle around and try to put the variable definitions together in a block rather than
- -- having code intermixed in the variable initialization block
- local storage = peripheral.find("draconic_rf_storage")
- local monitor = peripheral.wrap("bottom")
- local core = peripheral.wrap("right")
- local fluxgate = peripheral.wrap("flux_gate_308") -- dump energy
- local fluxgate_out = peripheral.wrap("flux_gate_309") -- from reactor
- local powerstate = 0
- local x=0
- local y=0
- local x1=0
- local msg="empty"
- local fieldStrengthPercent=0
- local lastFieldStrengthPercent
- local energySaturationPercent=0
- local lastEnergySaturationPercent=0 -- last energy saturation
- local ecrft=0 -- energy core rf per tick
- local adjtimeout=0
- local coretemp=0
- term.redirect(monitor)
- term.setBackgroundColor(colors.gray)
- fluxgate.setOverrideEnabled(true) -- required for direct computer control of flux gate flow rate
- while true do
- local stab = core.getReactorInfo()
- y=x
- x=storage.getEnergyStored()
- powerstate=stab.status
- monitor.clear()
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(15,1)
- print("status:")
- if powerstate=="online" then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.setCursorPos(23,1)
- print(powerstate)
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(7,2)
- print("generationRate: "..stab.generationRate.." RF/t")
- monitor.setCursorPos(10,3)
- coretemp=stab.temperature
- monitor.setTextColor(colors.green)
- if (coretemp>7000) then
- monitor.setTextColor(colors.orange)
- end
- if (coretemp>8000) then
- monitor.setTextColor(colors.purple)
- end
- print("temperature: "..coretemp)
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(8,4)
- print("fieldStrength: "..stab.fieldStrength)
- -- these two max values are static and don't really tell us anything
- --monitor.setCursorPos(5,5)
- --print("maxFieldStrength: "..stab.maxFieldStrength)
- monitor.setCursorPos(7,6)
- print("fieldDrainRate: "..stab.fieldDrainRate)
- monitor.setCursorPos(1,7)
- print("Fuel Conversion Rate: "..stab.fuelConversionRate.." nb/t")
- --monitor.setCursorPos(4,8)
- --print("maxFuelConversion: "..stab.maxFuelConversion)
- local fuelConversionPercent=stab.fuelConversion*100/stab.maxFuelConversion
- monitor.setCursorPos(7,9)
- print("fuelConversion: "..stab.fuelConversion.."("..math.floor(fuelConversionPercent).."%)")
- lastEnergySaturationPercent=energySaturationPercent
- energySaturationPercent=stab.energySaturation*100/stab.maxEnergySaturation
- monitor.setCursorPos(5,10)
- print("energySaturation: "..stab.energySaturation.."("..math.floor(energySaturationPercent).."%) "..tonumber(string.format("%.3f",energySaturationPercent-lastEnergySaturationPercent)))
- --if energySaturationPercent==50 then
- -- stab.setGenerationRate=stab.generationRate+10000
- -- sleep(5)
- -- end
- --monitor.setCursorPos(2,11)
- --print("maxEnergySaturation: "..stab.maxEnergySaturation)
- monitor.setCursorPos(8,12)
- print("fluxgate flow: "..fluxgate.getFlow())
- lastFieldStrengthPercent=fieldStrengthPercent
- fieldStrengthPercent=stab.fieldStrength*100/stab.maxFieldStrength
- monitor.setCursorPos(2,13)
- print("Cont. fieldStrength: "..tonumber(string.format("%.3f",(fieldStrengthPercent))).."%".." ("..fieldStrengthPercent-lastFieldStrengthPercent..")")
- monitor.setCursorPos(2,15)
- print("Energy Core Storage: "..tonumber(string.format("%.3f",x)))
- ecrft=((((x-y)/1000/1000)/2)/20) -- there are 20 ticks in a second so you /20 not multiple dufus
- monitor.setCursorPos(5,16)
- x1=ecrft
- if (x1>999999999) then
- -- leave x1 alone for millions
- msg="MRF/t"
- end
- if (x1<10000000000) then
- x1=x1*1000
- msg="KRF/t"
- end
- if (x1<1000000) then
- x1=x1*1000
- msg="RF/t"
- end
- print("Energy Core RF/t: "..x1..msg..", "..math.floor(x*100/2140000000000).."%")
- if (fieldStrengthPercent>51 and energySaturationPercent>51) then
- -- monitor.setCursorPos(15,14)
- redstone.setOutput("top",false)
- end
- if (adjtimeout>0) then
- adjtimeout=adjtimeout-1
- monitor.setCursorPos(18,14)
- monitor.setTextColor(colors.cyan)
- print("Adjtimeout="..adjtimeout)
- end
- if (coretemp<7000 and adjtimeout==0 and energySaturationPercent>51) then
- -- coretemp temp set to 'save' 7k
- monitor.setCursorPos(18,14)
- monitor.setTextColor(colors.pink)
- print("experimental: adding~10k")
- fluxgate_out.setSignalLowFlow(fluxgate_out.getSignalLowFlow()+10000)
- adjtimeout=120 -- no faster than 1 adj. per 2 min
- end
- --end
- if (fieldStrengthPercent<51 or energySaturationPercent<51) then
- monitor.setCursorPos(1,14)
- if (lastEnergySaturationPercent<energySaturationPercent) then
- monitor.setTextColor(colors.green)
- print("++++ Correcting")
- elseif (lastEnergySaturationPercent>energySaturationPercent) then
- monitor.setTextColor(colors.yellow)
- print("!!!! Degrading")
- end
- redstone.setOutput("top", not redstone.getOutput("top"))
- redstone.setOutput("back",false)
- if (fieldStrengthPercent<45 or energySaturationPercent<45) then
- redstone.setOutput("top",true)
- core.stopReactor()
- monitor.setCursorPos(20,14)
- monitor.setTextColor(colors.red)
- print("*** REACTOR SCRAM ***")
- term.setBackgroundColor(colors.yellow)
- end
- end
- monitor.setTextColor(colors.white)
- if (fieldStrengthPercent>51 and energySaturationPercent>51) then
- redstone.setOutput("top",false)
- redstone.setOutput("back",true)
- -- redstone.setOutput("back",true) -- redstone.getOutput("top"))
- end
- -- Energy dump, if core<50% then
- -- set fluxgate low flow to core net gain (presuming you're generating at least 500k)
- if (x*100/2141200000000)>50 then -- per above now I'm only setting the output when over 70%
- -- seems to work more predictably just allowing the generation rate, using the change kept allow massive drops
- -- and recover time was poor (even with the 70% safety margin) an empty T7 is really a RF vacuum.
- -- fluxgate.setFlowOverride(ecrft*4000)
- fluxgate.setFlowOverride((stab.generationRate-(stab.fieldDrainRate*2))-20500) -- *2 to dump extra above generation range
- -- end
- else
- -- Want to let a little through since I rely on this energy to keep my AE2 system operational
- fluxgate.setFlowOverride(500000)
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement