Ensuring trains visit all stops with the same name fairly.

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
Ingolifs
Long Handed Inserter
Long Handed Inserter
Posts: 81
Joined: Fri Mar 17, 2017 3:18 am
Contact:

Ensuring trains visit all stops with the same name fairly.

Post by Ingolifs »

I am currently transitioning my base into a rail-based megafactory for the endgame.

The plan is to have most of the intermediate products for research and launches produced in individual bases and transported by rail. Each output of one base (e.g. circuits) is delivered by train to one of many stations, all with the same name. Once a station has more than enough of this intermediate, a circuit condition disables the stop.

I've done some testing, and while everything functions perfectly when there is a slight overpressure of starting materials (i.e. where slightly more of each starting material is produced than is consumed), it doesn't work so well when starting material supply is diminished.

When material is consumed faster than it can be replenished, the train stops are perpetually enabled, and the train only ever chooses to go to the nearest station, rather than visiting all stations fairly.

How do I ensure that trains all visit all stations fairly when they can't supply enough to disable any one station? Are there clever circuit conditions I can use?

Also, I don't have terribly much experience with these sort of rail megabases. Any other general pieces of advice about layout and design are welcome.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3715
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by DaveMcW »

Why do you need them to be fair? The production line that is getting more will back up eventually and stop demanding supplies. You can speed up the process by minimizing the use of buffers.
User avatar
Ingolifs
Long Handed Inserter
Long Handed Inserter
Posts: 81
Joined: Fri Mar 17, 2017 3:18 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Ingolifs »

Okay. When starting material production is greater than consumption there is no problem.

I am not referring to that situation. I am referring to situations where because of a depleted mining base or because of a train deadlock (which seeing as I still don't truly understand train signals, is pretty likely), materials get consumed faster than they get produced.

If iron is needed by both the gears base and the circuits base, and not enough iron gets produced to satisfy both, both train stations requesting iron will be perpetually on. In that case, the station that's closest (let's say gears) will always receive iron, and the circuits base will never receive iron.

The situation is akin to using spaghetti belts rather than a main bus and splitters.

to reiterate my question:
How do I ensure that trains all visit all stations fairly when they can't supply enough to disable any one station? Are there clever circuit conditions I can use?
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Koub »

A counter ? Every station counts "+1" whenever supplied, and you always deliver to the lowest count needing supplies.
Koub - Please consider English is not my native language.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3715
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by DaveMcW »

Ingolifs wrote: Tue Dec 04, 2018 6:05 amthe station that's closest (let's say gears) will always receive iron, and the circuits base will never receive iron.
The gear station produces gears.
The gears are delivered to the inserter station.
The inserter station does not produce anything because it has no circuits.
The inserter station fills up with gears.
The gear station fills up with gears.
The gear station fills up with iron.
Iron is delivered to the circuit station.

Problem solved!

The smaller your buffers are, the faster the problem will solve itself.
User avatar
Ingolifs
Long Handed Inserter
Long Handed Inserter
Posts: 81
Joined: Fri Mar 17, 2017 3:18 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Ingolifs »

Koub wrote: Tue Dec 04, 2018 6:17 am A counter ? Every station counts "+1" whenever supplied, and you always deliver to the lowest count needing supplies.
I do not know enough about circuits to implement this. How would you add a +1 count to a station? How do you compare multiple signals to find the lowest? And how do you get a train to go to the station selected as the lowest?

I feel like if you answer these questions, I should be able to figure it out from there. Thanks.
Zavian
Smart Inserter
Smart Inserter
Posts: 1648
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Zavian »

Ingolifs wrote: Tue Dec 04, 2018 6:05 am ow do I ensure that trains all visit all stations fairly when they can't supply enough to disable any one station? Are there clever circuit conditions I can use?
I'd just use the simple solution of letting backpressure balance things. In general you don't want the a true even distribution scheme, since some stations need more resources than others. eg circuit and gears both need lots of iron plates, however by comparison inserters needs relatively few iron plates.
Blinky
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Jan 06, 2018 9:12 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Blinky »

Nobody seems to have mentioned the obvious solution of increasing your supply. If all the iron is going to gears and not circuits then increase iron production to compensate.
ImageImage
nosports
Filter Inserter
Filter Inserter
Posts: 274
Joined: Fri Jan 19, 2018 5:44 pm
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by nosports »

Blinky wrote: Wed Dec 05, 2018 12:47 pm Nobody seems to have mentioned the obvious solution of increasing your supply. If all the iron is going to gears and not circuits then increase iron production to compensate.
And that would be the one and only factorian way to address the problem here :mrgreen: 8-)
User avatar
5thHorseman
Smart Inserter
Smart Inserter
Posts: 1193
Joined: Fri Jun 10, 2016 11:21 pm
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by 5thHorseman »

Yeah it's just one stop in the perpetual Factorio loop of too much/too little. You always have too much of something and too little of something else, and you generally want too much of things closer to the start.

You want too much ore going to your smelters.
You want too many plates going to your intermediates.
You want too many intermediates going to your production.

Whenever this is not the case, you tend to have issues. Your setup (which I've done) just shows it far more quickly than most other setups.

Solution: MOAR SMELTING
Amarula
Filter Inserter
Filter Inserter
Posts: 542
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Amarula »

I ran into the same problem when I started playing train based bases: The iron train trying to deliver to multiple clients didn't work as you found out. I tried a circuit train, going to get the inputs I needed for my circuits, and that didn't work (too much iron, no room to get copper, not using the iron I had because my factories stopped because they were out of copper). The solution I have that is working so far is one train for one purpose: one train for iron for circuits. One train for copper for circuits (actually I now have two trains for copper for circuits, one train wasn't enough). One train for iron for inserters. One train for circuits for inserters. It makes for a LOT of trains (120 trains and counting) but my problems are not from trains not delivering what is needed.
Good luck with your trains!
My own personal Factorio super-power - running out of power.
JimBarracus
Filter Inserter
Filter Inserter
Posts: 365
Joined: Mon Jul 03, 2017 9:14 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by JimBarracus »

there is no good vanilla solution for this.
most obvious, produce more.

Your demand seems to be far from that what you can supply.
mrvn
Smart Inserter
Smart Inserter
Posts: 5855
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by mrvn »

You need something like LTN to solve this easily.

The other way without waiting for backpressure to build up across all of creation is to use circuits to produce items only at a speed relative to the least filled station. So if circuit boards run out of iron the gear factory stops too and the iron can much quicker fill back up. It cuts down on the delay due to buffering at all the train stations.

And the third way is to use a transfer station, which you probably want anyway:

Create a station with N unloading stops and add N trains that collect all the iron plates form all the smelters. Unload the iron plates unto belts, merge, balance, split it up onto M loading stops. Create M trains and send them to deliver the iron plates to the various consumers. E.g. M=2 with one train going to the gear factory and one to the circuit board factory.
Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Aeternus »

It can be done with a small round-robin setup that manually flags signals red and reads them - as the signal is read, the next station in the chain's red signal is cleared so it can receive a train. It's critical to put a chain signal in front of the manually switched ones. I'm at work and can't provide a visual example unfortunately.
Played with the idea for some time, got it to work but it was far too much hassle to deal with in the long run. If you don't have enough incoming trains, make more mines, much easier. Oh, and if you want to almost halve the amount of traffic on your rail grid, put smelters at the mines and drag iron/copper plates home instead. Muuuuch more efficient as long as you can deal with pollution at the remote mines.
mrvn
Smart Inserter
Smart Inserter
Posts: 5855
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by mrvn »

Aeternus wrote: Mon Dec 10, 2018 1:48 pm It can be done with a small round-robin setup that manually flags signals red and reads them - as the signal is read, the next station in the chain's red signal is cleared so it can receive a train. It's critical to put a chain signal in front of the manually switched ones. I'm at work and can't provide a visual example unfortunately.
Played with the idea for some time, got it to work but it was far too much hassle to deal with in the long run. If you don't have enough incoming trains, make more mines, much easier. Oh, and if you want to almost halve the amount of traffic on your rail grid, put smelters at the mines and drag iron/copper plates home instead. Muuuuch more efficient as long as you can deal with pollution at the remote mines.
That gets rather complex with multiple trains and handling trains waiting to be filled, trains on the way and trains unloading, ...
Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Ensuring trains visit all stops with the same name fairly.

Post by Aeternus »

It can but not neccesarily. You just need to have a stacker and chain signal between the receiving stations and the arriving trains. The chain signal will prevent the arriving trains from pathing to the wrong station and repath if the active receiver changed.
Post Reply

Return to “Gameplay Help”