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. 20210620 wtp
- --Added better colorization for temp and field strength warnings in the 'between' zone
- --Also added an emergency stop if either containment or saturation drop below 40% (I hope)
- --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.find("flux_gate")
- 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
- 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)
- x1=stab.temperature
- monitor.setTextColor(colors.green)
- if (x1>7000) then
- monitor.setTextColor(colors.orange)
- end
- if (x1>8000) then
- monitor.setTextColor(colors.purple)
- end
- print("temperature: "..x1)
- 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).."%) "..energySaturationPercent-lastEnergySaturationPercent)
- --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: "..math.floor(fieldStrengthPercent).."%".."("..fieldStrengthPercent-lastFieldStrengthPercent..")")
- monitor.setCursorPos(2,15)
- print("Energy Core Storage: "..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..", "..(x*100/2140000000000).."%")
- redstone.setOutput("top",false)
- 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.getOutput("top"))
- end
- -- Energy dump, if core>25% then during testing I have this set much higher to give me better reaction time
- -- and if net gain >100MRf/t
- -- (and less than say 1000 to prevent initialization issues)
- -- set fluxgate low flow to core net gain
- if (x*100/2141200000000)>70 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))
- -- 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