Hey guys,
I wanna preface this by saying I have spend days, if not weeks, trying to find a solution to this. I've watched countless YouTube tutorials, read the wiki and cookbook, looked at various blueprints and tried ChatGPT...I am yet to find a solution or work out if there is an easier way to accomplish this.
Also, I'm doing this in Krastorio, but I really don't think that matters because it would work the same way in vanilla.
What I have is a number of "Omni" trains that I have set up to choose a station using a Wildcard string/variable. I am sending the content of the storage warehouses at our base to the train parking station via Radar and then using Decider Combinators to say "For every 8k ore that's in deficit, produce a signal of 1 for that ore". I measure this by using the maximum amount from a Constant Combinator and subtracting the current amount from that.
From there, that ore symbol is sent to all the parking stations and to the trains parked there, which use that symbol to assign a station.
I've kept a strict naming convention with all my mines to be <ore>Mine and <ore>Drop, where "<ore>" is the respective symbol the Combinators produce.
My vision is for ONE train to leave that parking, go and get ore, and drop it off at the respective Drop station.
For example, if there is a deficit of 8k copper ore, it will produce the copper ore symbol with 1. Then, one of the trains (seems random) will go to <copper>Mine, fill up and then go to <copper>Drop.
The problem I'm having is that as soon as the ore symbol is sent to all the train stations, ALL of the trains leave to go get that ore...meaning I then have 5 or 6 trains ALL collecting copper ore and then ALL waiting to drop it off.
The thing is, in Krastorio, the ore stack size is 200, so it only requires one train with one wagon to attend.
What I want to happen is for one train to leave, go collect and dump ore and for the signal system to essentially reset.
The way I think about the logic is like this (there are 6 waiting stations):
C = 6
Copper Ore = 1
When C reduces from C6 to C5 (-1) increment, then the Copper Ore signal is also reduced by -1 and disappears...until it's required again.
I'm not sure if this is the best way to approach it or if there's some better, simpler or more efficient way.
I've thought about using a timer, but it's not truly dynamic because all of the ore stations are different distances and take different times.
I've also looked at using a Selector Combinator to randomise the output on, say, a 120 tick delay but, again, this doesn't truly solve the issue. I may have room for two train loads of coal and only one of copper, but this randomisation could result in 3 copper trains still.
I hope this makes sense. I added a bunch of screenshots, but I think they're piled together.
Anyone with advanced circuit knowledge able to help?