Stationeers

Stationeers

Not enough ratings
Power-Saving DeepMiner Control
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
248.409 KB
19 Jul, 2024 @ 10:34pm
20 Jul, 2024 @ 3:31am
3 Change Notes ( view )

Subscribe to download
Power-Saving DeepMiner Control

In 1 collection by Wilhelm W. Walrus
Some Good Stuff
11 items
Description
This script provides power-conscious control of deep miners and up to six accompanying electric centrifuges.​

Designed to take full advantage of the abundant wind power on Europa, this script will work efficiently even with very unreliable power generation because of the four power states it switches between: using full power, just mining, just processing, and power recovery.

alias spinner0 d0 #all centrifuges are optional. Of course, you won't process any ore alias spinner1 d1 #with 0 centrifuges, but the script won't produce an error. alias spinner2 d2 alias spinner3 d3 alias spinner4 d4 alias spinner5 d5 define minerId HASH("StructureDeepMiner") #On Europa at least, 1 wind turbine for 1 large define batteryID HASH("StructureBatteryLarge") #battery can run 1 deep miner with 2 #regular centrifuges for ~90% of the time between storms. For when its low on power, #it has power handling logic to ensure its always running a machine long enough #for it to do produce something, and not just flicker on and off uselessly. The ratio #definitions below determine when the power state changes: define useFullPower 0.30 define endFullPower 0.15 define useOnlyLogic 0.01 alias charge r15 alias usingFullPower r14 alias cIndex r13 alias spinnersAreOn r12 move usingFullPower 1 #assume full power to start DeterminePowerState: lb charge batteryID Ratio Average sgt r0 charge endFullPower and r0 r0 usingFullPower beqz r0 UseLessPower #if power hits lower bound then use less power sb minerId On 1 #else, UseFullPower: move spinnersAreOn 1 j HandleCentrifuges UseLessPower: sgt usingFullPower charge useFullPower #allow UseFullPower for next tick if recharged bgt charge useOnlyLogic PickMiningOrSpinning #use less power while not sb minerId On 0 #critically low. otherwise, UseOnlyLogic: move spinnersAreOn 0 j HandleCentrifuges PickMiningOrSpinning: jal CheckSpinnersForOre beqz r0 PickMining #PickMining if no spinners have ore to process sb minerId On 0 #else, PickSpinning: move spinnersAreOn 1 j HandleCentrifuges PickMining: sb minerId On 1 move spinnersAreOn 0 HandleCentrifuges: move cIndex 5 HandleNextCentrifuge: alias this dr13 sub cIndex cIndex 1 bltz cIndex EndTick bdns this HandleNextCentrifuge ls r0 this 0 Occupied and r0 spinnersAreOn r0 s this On r0 #set centrifuge 'on' if control val and ore slot align l r0 this Reagents brne r0 400 3 #set centrifuge open if capacity (400g) reached s this Open 1 j HandleNextCentrifuge seqz r0 r0 #isEmpty l r1 this Open #isOpen and r0 r0 r1 breqz r0 2 #skip closing centrifuge if not empty or not open s this Open 0 j HandleNextCentrifuge EndTick: mul r0 charge 100 trunc r0 r0 s db Setting r0 #display total battery % on housing yield j DeterminePowerState CheckSpinnersForOre: move r0 0 move cIndex 5 #aggregate import slot data to set aSpinnerHasOre AppendNextState: alias this dr13 sub cIndex cIndex 1 #iterate downward through all centrifuges bltz cIndex ra #exit loop if iteration complete bdns this AppendNextState #skip unset device ls r1 this 0 Occupied add r0 r0 r1 j AppendNextState