Train Circuit Networks

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
J7J
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Aug 20, 2024 6:21 pm
Contact:

Train Circuit Networks

Post by J7J »

I'm planning on making a train base, I've already got sorted out all of the signaling, but I need some help with circuit conditions, how would I make it so that trains are only allowed to go to a station if said station doesnt have anything in its chests? Is this even optimal? Thanks :D
Koub
Global Moderator
Global Moderator
Posts: 7918
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Train Circuit Networks

Post by Koub »

What I do in this situation is just link the chests in the station to the train stop, and only activate the train stop if any = 0. Does the job. All my loading stations for a given item are named the same way, as are all my unloading stations for a given item. And my trains are simply programmed "go to pickup item X" > "wait until cargo full" > "go to unload item X" > "wait until cargo empty".

Might break some day, but works just fine at the moment.
Koub - Please consider English is not my native language.
User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1686
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Train Circuit Networks

Post by MeduSalem »

Koub wrote: Tue Aug 20, 2024 7:00 pmMight break some day, but works just fine at the moment.
It doesn't. It will work forever. Been doing it the same way for years without any issues (albeit I set a little more buffer in the chests than 0). ^^

Even if it will annoy some freaks, all the complex & super fancy combinator contraptions some people developed & showed off in the past 7-8 years cannot hold a candle to the pure simplicity of above. xD
J7J
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Aug 20, 2024 6:21 pm
Contact:

Re: Train Circuit Networks

Post by J7J »

Thanks to the both of you for helping me :D, a follow up question, how would I implement a depot system for various trains for the same item?
Koub
Global Moderator
Global Moderator
Posts: 7918
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Train Circuit Networks

Post by Koub »

[Koub] Moved to Gameplay Help, might be of some use to somebody else some day.

If I understand your need correctly, what you want is to build a stacker (don't know if it's the official real life name, or just a Factorio community thing).

A stacker is a set of parallel lines before a station, but out of your main line. The way it works is the train wants to go to station X, it takes the main line, then leaves it to get to the actual station. And the stacker is on the way. If the station already has a train in it, the new one will wait in the stacker, until the first train leaves the station.
Picture of my current game
In this picture, in red are my train stations, in green the stacker where the excess trains can wait their turn, and in blue my main track. I can add as many additional waiting lines to the stacker as I want, if I encounter "trains waiting to go to the same station" problem. Additionally, I limit most of my stations to "only 1 train going there at a time", because I don't have big needs.
Koub - Please consider English is not my native language.
J7J
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Aug 20, 2024 6:21 pm
Contact:

Re: Train Circuit Networks

Post by J7J »

Thank you so much man :D I'm all set for making a train megabase now, might give some updates, have a great day!
User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1686
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Train Circuit Networks

Post by MeduSalem »

J7J wrote: Tue Aug 20, 2024 7:47 pm Thanks to the both of you for helping me :D, a follow up question, how would I implement a depot system for various trains for the same item?
I personally don't use depots/stackers.

To avoid the need of depots I rather set "only 1 train going to a station at a time" like Koub wrote earlier.
And I always use at least 1 train less than the total amount of loading+unloading stations for a particular item. Then it should never deadlock because there will always be at least 1 free station somewhere in the network where a train can go to.

Depending on the mood/stage of the game I then usually use one of the 2 following approaches:
  1. Trains park in the unloading stations.

    As it says, the trains will park in the parallel unloading stations until they are empty and it is the loading stations (like in outposts) which order a train to come to pick up stuff if there is enough to pick up already.

    Works best if there is a central area to unload stuff. If there are multiple unload areas for the same item all over the base then there will usually be one that is "most frequented" and the other less frequented ones might get starved out a little (However it will not break the system if you have enough trains).
  2. Trains park in the loading stations.

    The trains will park in the multiple loading stations until they are full and wait there until the unload stations orders a train to come and drop off stuff.

    That 2. is my preferred method for most of the game however because it works not only for delivering ore from outposts, but also for delivering repair packs, ammunition & items to the outposts on demand. It even works nicely for delivering items between various blocks of my factory.



But as for depots... I have seen many discussions about depots in the past, seen many designs, but I say in most average bases people don''t need depots.
There are 2 major reasons for why a depot might be needed though.
  1. You have not set train stations to request only 1 train.

    That is kinda the worst thing to do anyway because then there might be everything from 0 to whatever ridiculous amount of trains you have set wanting to go there all at once, possibly spamming the station with more than it can handle.

    In my opinion that should be avoided for multiple reasons... the most obvious one being that in an unprepared station that can possibly lead to deadlocks on the main track if not all the trains can enter the station/depot.
    But the less obvious reasons... even if you might have the space in the stacker to accommodate for all trains... it unnecessarily increases traffic in the rail-network for short burst periods of time (every time several trains want to go to 1 station) and it might also create the situation that there is a shortage of trains elsewhere because they will be trapped in the stacker waiting for quite a while; which then gives you the wrong feeling that you have not enough trains so you add even more trains, which makes all of the problems even worse up to the point you might collapse the rail-network simply because you have too many trains.

    My advice is... Just don't set it to anything other than 1 train.
  2. Extremely huuuge map/base with very, very long distances.

    There it kinda might become a necessity to use depots/stackers as means for buffering because of the unforeseeable travel delay of trains.
    I never played such huge bases where that became necessary however.
    Usually the distances in my maps are rather normal, where the generic buffer target I set in the train station's circuit logic totally covers the travel delay of trains. (That is why I don't set the stations to request a train to come by at 0 items in the chests but already earlier)
Tertius
Filter Inserter
Filter Inserter
Posts: 991
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Train Circuit Networks

Post by Tertius »

I'd like to add some thoughts about stackers/depots.
Consider you have an unloading station and you don't want its buffer chests run empty to ensure continuous supply to the downstream factory. If an empty train leaves this station, the next train must arrive early enough the buffer chests don't run empty. Depending on how fast the chests are being emptied, there may be time between 10 or 20 seconds, or up to a few minutes. Totally depends on the the station and downstream factory design.

Now there are loading stations. Most often they are at mining outposts. If a train from the most far mining station is able to arrive within the time frame from above, you can directly drive between loading and unloading stations. No need of some intermediate train buffer such as a depot.
However, if you have mining outposts where the train isn't able to arrive in time, so the buffer chests will run empty, you need a means to bring full trains near the unloading station where they can wait and are released to their unloading station as soon as that station becomes empty. In this case you need a stacker or a depot.

I call a waiting area a stacker, if there is no additional station. The train schedules still have only 2 stations: the loading station and the unloading station. The crucial thing is to give the unloading station a train limit above 1, so one train will arrive at the station and is unloaded and one or more additional trains will end up in the stacker. To make this work, the rails between the stacker and the station are built with chain signals, so trains will stop in the stacker and not directly in front of the station (so they don't block the rail). As soon as the train leaves the station, the chain signals turn to green and one of the trains in the stacker will proceed to the station. Time between trains in the station is just a few seconds, so the buffer chests will never run empty, as long as there is a large enough supply of trains.

You can also build a waiting area that has its own station. In this case, you have a depot station between the loading station and the unloading station in the train schedule. This way you uncouple the loading station from the unloading station and have more freedom with the train limits of your station. However, you need to manage one more station in the schedule.

For a megabase on a real map, you probably need stackers or depots, because many ore mines are usually far out, so the time to arrive at the base is simply too long for the buffer chests to last.

Personally, I prefer simple stackers with enough lanes for enough trains and static train limits in both loading and unloading stations. Trains have the most simple schedule: 1. loading station - wait for full, 2. unloading station - wait for empty. A limit of 2-3 at unloading stations and 1-2 at loading stations, depending on throughput and distance (the higher the distance or throughput, the higher the limits).
No need for elaborate and dynamic train limit manipulation. The requirement boils down to: "if there is space at an unloading station, let the next train enter this station", and this can be achieved with static train limits alone. Can never fail. I came to this conclusion after working out elaborate train limit combinator setups - in the end, I realized all circuits for this is just overengineering.
NineNine
Fast Inserter
Fast Inserter
Posts: 180
Joined: Mon Oct 24, 2022 11:20 pm
Contact:

Re: Train Circuit Networks

Post by NineNine »

I agree with MeduSalem. I build really big megabases, but I don't use stackers, either.

I don't particularly care if a train arrives to resupply a factory before the buffer chests empty out. I generally build my bases in a grid format, so if I don't have enough of a certain type of material, it's two mouse clicks to just make more of them. Having any one cell's chests empty out isn't going to cause any sort of delay for the rest of the factory because I have multiple cells of everything important.

On top of it not mattering if the assemblers briefly run dry, the amount of space (and complexity) of stackers isn't worth it to me.

I subscribe to the KISS methodology: Keep It Simple, Stupid.
Post Reply

Return to “Gameplay Help”