A post series which I will be adding to periodically, not on any particular schedule but whenever I have something worth explaining. My general philosophy is not to tell anyone how to play the game, but instead to explain how to use the tools and mechanics a game provides to come up with your own solutions. So while I may show some specific use cases and solutions, these are just examples and should not be seen as the only way to do something.
Train stations in Factorio can be wired up to circuit networks, which unlocks a whole bunch of options in the train station interface. By default, only the “Send to Train” option is checked, and the lower panels in the interface only show up when certain boxes are checked. I will be referring to the signals in the image above throughout the article.
Enable/Disable
How it Works: This will simply turn the station on or off depending on the signal received. Like all circuit network components (in Factorio 1.x – this will be changing in 2.0) the conditions will be compared regardless of which colored wire the signal comes in on (red or green).
You can also control the station through a logistics network connection, which works in the same way. I’m not certain how they interact when both conditions are used, but if I had to guess, I would say each condition could enable the station, but neither would disable the station if the other was enabling it (basically acting like an OR gate between the two conditions).
What it is useful for: I do not like using this condition in the majority of cases due to better options being available for controlling your trains. This is because disabled stops are treated as if they cannot be reached, even if a train is already on the way. This can cause problems if a train stops in the middle of your mainline or a busy intersection and causes a huge traffic jam. But, in simpler train networks, this can be an easy and simple way to control individual stations.
Send to Train
How it Works: Any signal on the connected wires is sent to any train stopped at the station, which the train can then use as part of its departure conditions.
What it is useful for: Since this is currently only used for train departure conditions, it isn’t extremely useful compared to some of the other options for demand-based train networks – you would need to have a global signal network able to send a signal a long distance from the receiver station if you want that station to request a train at certain times. This is a condition that can be useful if you have an extremely specific use case for it, but for most players you won’t need it.
Set Train Limit
How it Works: This is fairly simple but has the biggest impact on designing larger train networks. This works exactly like the static train limit value you can set on a station, but can instead be dynamic and based on circuit network conditions. Setting a station’s train limit to 0 works similarly to disabling the station, but trains that have already “reserved” a slot at the station will complete their route; if there are more reservations than the current limit, additional trains will not attempt to path to that station (but will still path to other stations with the same name).
What it is useful for: The primary case is for a many-to-many train network where you have multiple stations of producers and consumers that can utilize an arbitrary number of trains with the same schedule.
In this network, all active trains have only one of four different schedules, each going from a mine ([L]oading station) to a smelter or production area ([U]nloading station). There are combinator setups at both the loading and unloading stations which dynamically set the train limits based on the amount of materials stored at the station.
Loading stations have their limit set to the total number of train loads the station is storing plus a small buffer value. This is usually just 1, but can be set higher for stations farther away. The reason for adding the buffer value is so that trains don’t wait to depart to pick up materials until the station is full – since trains can’t teleport, this helps ensure materials move more regularly.
Unloading stations basically work the same but in reverse – a desired amount of materials is set, the amount of materials stored is subtracted from that amount, and the difference (divided by how many materials one train carries) is the number of trains requested.
One caveat with this setup is that you cannot have a significant excess of trains, since if all a train’s destination stops have all their reservations taken, the train will just wait for a reservation slot to open. This can cause throughput issues since you might have multiple full trains waiting at a smelter to unload, but the station itself is occupied by a train waiting for a mine to have room for a pickup. The simplest solution is to just have the right amount of trains assigned – if you’re noticing empty trains sitting at unload stations, it’s time to remove them (or add more mines). This is what the “Trainyard” stop is for – it’s a place I can send extra trains to if they’re not currently needed (and also a place to get more trains if I need more).
This is just the primary use case for this type of train control; there are many others and this is the most versatile and useful of all the circuit network options.
Read Train Contents
How it Works: All of the conditions so far have received circuit network signals over the wires; this condition instead sends a signal out based on the items in the currently stopped train.
What it is useful for: The main use I’ve found for this is to be able to have mixed-cargo trains that don’t rely on having filtered slots in cargo wagons. Put your desired amount of items on a constant combinator, subtract the current train’s contents, and then only enable the inserters for each product when the number is above 0. This gets tricky with stack sizes and inserter capacity, but you can work around it by setting your limits to be the maximum inserter stack size less than a full stack (e.g. if you’re loading 250 assemblers with a maxed out stack inserter, set the limit to 238 and then it should never fill into more than 5 slots). This is useful for both “builder” trains and “supply” trains (for defensive structures).
Read Stopped Train
How it Works: Each train has an internal ID number which gets output to the connected wires when a train is stopped at the station.
What it is useful for: The number itself isn’t all that useful unless you get deep into the weeds and set up memory cell systems and lots of combinator spaghetti which can load different things onto a train depending on its ID if you wanted a truly product-agnostic train network. (IMO at that point just install LTN.)
I have also been told this can be useful to simply check if any train is stopped at the station, by checking if the ID is not 0. This signal also gets read out and can be checked immediately (in one combinator tick) instead of doing checks based on train contents which can take multiple ticks and lead to race conditions that cause problems.
Read Train Count
How it Works: This reads out the number of trains that currently have reservations at the station.
What it is useful for: You could wire this up to some fancy lights to show the number of trains currently en route.
One situation I think this might be useful, although I haven’t tried it in practice, is to designate one station in a many-to-many train network as the “overflow” buffer which can automatically handle excess trains. For mines this would probably be your farthest (and least likely to be depleted) outpost. The idea is if this station has all its reservations booked up, this would indicate all nearer outposts have all their slots filled as well (which in general means you just need more mines). So this station could dynamically increase its own limit in this situation, absorbing all the excess trains from the network until more capacity comes online.
You could probably also use this on the other end, to identify when you don’t have enough ore trains coming into your smelters. This would mostly be used to alert the player that more ore is needed.