General train-based smelter station
https://factorioprints.com/view/-KtudPVTi7Nr6b4A3I2w
https://imgur.com/a/gAuJ2
So whats this for?
So I wanted to make a train base where production of an item is done in a separate minifactory that's supplied using trains carrying the base ingredients (iron, copper, steel, oil products...). Each supply train would go to the raw mining facility, then to the smelter and then to the manufacturing place.
This "smelter" is where I got stuck because of 2 reasons:
1. Not unloading final products
The loading and unloading had to be done in the same station to conserve space. This meant that the smelted product could not be unloaded again. A simple filter inserter won't work because iron can be either an ingredient or a result.
2. When can a train leave
First issue is that iron ore and iron plates (same with copper), even though the smelting happens 1:1, don't take up an equal amount of space. Second issue is that steel and stone bricks don't get smelted 1:1. I couldn't let the train just leave when it's inventory is full or even half full.
Both of these problems made me start learning and building a more advance combinator circuit. After a bit of trial I came up with this:
![Image](https://forums.factorio.com/images/ext/a853419668fcb35f3290cd341f0cb74d.png)
detailed view
It looks like a mess, but it works. Let me explain it for you:So I develloped this in groups, each having its distinct function:
Each groups takes one or more signals and one or more to other groups.
The first input is the Ore-sorter directly left of the station.
It's function is simple: it takes the inventory count from the station and converts it to the signal Ithat's a big letter i.
This signal goes through the Stage-check below more on this and the stages later and into the Ore-count on the right.
The Ore-count saves the first ever inventory count of the train as a signal I.
When there is a signal in the Ore-count the Start-pulse at the very bottom fires, giving a 1-tick pulse into the Stage-count on the left.
There are 3 stages: S == 0, 1 and 2. 0 means no train has arrives, 1 is unloading and 2 is loading.
The Stage-check from before checks for a stage of 0. This insures that the Ore-count takes the very first signal.
When the stage is 1, one side of the inserters activate unloading the train until it is empty. When the train is empty the stage is 1 and the signal I from the Ore-sorter is 0.
These 2 signals are used by the Ore-empty-pulse left of the Ore-sorter to send a second signal of S to the Stage-count.
Now that the stage is set to 2 the first row of inserters is disables and the other side is enabled, loading the train with the smelting result.
During filling the stage is 2 and the content of the train is read by the Result-count right of the station. Thogether with the I signal from the Ore-count these signals go into the Depart-check right below the station. When the I signal equals the signal from Result-count and when the stage is 2 the train gets the signal to leave: green signal == 2.
When the train leaves the station stops outputting a read train signal, resetting both counters.
groups
schematic of different groups with in- and outputs
Explanation ended stop scrollingUsage:
If you'd like to use this, first of all thank you all you need to so is build this circuit (prefereable using bots) and connect all your inserters to the left pole in the Ore-empty-pulse using a red wire. The input inserters check for S == 1 and the output checks for S == 2. If, for some reason, your smelting recipies are different, all you need to change are the values in the Result-count. The combinator for steel has a *5 modifier because 1 steal beam needs 5 iron plates. You can expand the input and output ores by adding more combinators to both the sort groups, wherever you find space. Just hook the input to the input and output to the ouput using the correct wires to the alreadt existing combinators.
If you find any flaws or improvements, please let me know.
I'm quite sure this isn't the most elegant solution, but it's not the worst.