#Help with Omni (Wildcard) Trains Dynamically Choosing Stations and Limiting Train Assignment

1 messages · Page 1 of 1 (latest)

vestal gorge
#

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?

long owl
#

you need to keep track of the total amount of trains which are en route to a copper delivery. that is, the trains which are heading toward a copper supply, or toward a copper request. you can do this quite easily, just make each provider and requester station output its train count and send that onto a radar as the 'copper' signal on red wire, and requesters also send the number of trains they require as the 'copper' signal on green wire. if red < green, then you dispatch a train for that signal.

#

this doesn't solve the problem on its own, however, as multiple trains can still depart at once. but it will correctly keep count of them, so you might get 5 trains sent to copper providers from only 1 request, but 4 of those 5 would wait at the copper providers and still count as 'en route' which would prevent more trains from joining them.

#

once this system gives you an accurate train count, you can just do something like a randomiser on your depot stations which only allows trains to depart every 20 ticks or so. you might get a few double-deliveries from this, but they would resolve themselves

pure birch
#

to only have one train go, you'd need to clock the depots to release trains to destinations at staggered times - otherwise back to the depot itself
or keep the limits of pickups at 0s until you need a delivery - only increasing the limit for one station at a time using randomizers to grab a lock

dapper flume
#

you could just do it the current generic way of having 1 train per mine/output station, lot less circuits, guarantees number of trains heading to a specific station based on amount it needs

vestal gorge
# dapper flume you could just do it the current generic way of having 1 train per mine/output s...

I could and that's what we had set up, but this is more for the challenge of solving this problem and learning more advanced circuitry in the process.

I'm also trying to internalise SR Latches, memory cells and timers, but my brain struggles with them for some reason...the memory cell particularly. So often I just get an infinitely scaling number.

I've watched so many videos and read as much as I can but I still get it wrong 😔

pure birch
#

sounds like you're sending the data multiple times
so it sums with what it remembers - one tick pulses are great to avoid that

#

otherwise doing things like only remembering the initial value it receives - or the last value it received

tawdry orbit
#

Since you are already using mods, just use Project Cybersyn. It is far more intelligent than base game train logic can ever be right now. The only reason not to use Project Cybersyn and instead try to jank a logistic rail system together is if you are not using any mods.

vestal gorge
long owl
#

to send a pulse you can use an 'edge detector'. combinators take 1 tick to process, so you can send a signal through a do-nothing operation like arithmetic +0 to delay it, then in a decider you compare the delayed signal to the non-delayed signal

vestal gorge
#

Like, I saw the "-1" flash up, but the memory cell didn't store it like I wanted. I have some mental block or knowledge block about memory cells. I can't seem to make them work consistently

long owl
#

if you do previous - current, then you get a negative pulse when the signal turns on (current > previous) and a positive pulse when it turns off (previous > current)

#

so maybe it cancelled itself out

vestal gorge
#

ahhh, interesting! Thanks

long owl
#

you can enable editor mode to pause time, and edvance forward tick by tick to see how signals behave
+faq editor

strong vineBOT
#
Editor

The Map Editor is a creative/testing tool that provides infinite resources (item, fluid, power), instant entity spawning, and much more. To toggle editor mode, type /editor into the console [~].

Time is paused by default, and can be unpaused from the "Time" tab.
In the "Surfaces" tab, you can create a checkered "lab tile" testing world by clicking Remove all entities, Fill with lab tiles, and Generate new chunks with lab tiles.

The Editor Extensions mod makes using the editor more convenient, adding more testing entities and other enhancements.

vestal gorge
#

I'm gonna check it out