Smart Miscellaneous Outpost Supply Stations

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
benoitranque
Burner Inserter
Burner Inserter
Posts: 11
Joined: Mon Jul 06, 2020 2:26 pm
Contact:

Smart Miscellaneous Outpost Supply Stations

Post by benoitranque »

So I came up with this design recently, and I think it's neat so I figured I'd share it here.
There are probably many designs like it, but this one is mine :D

Image

What this is: a pair of configurable station that can keep an outpost supplied with any items that may be required.
There are no practical limits on how many different items can be ferried, beyond train size, and this station can easily be extended if necessary.

Configuration is simple: set a signal in a constant combinator for what item and how many you want to provide to your outpost.
No need to set filters on the wagons or inserters, and no need to set requests on the requester chests. There are two constant combinators which means up to 36 different items, but you could add more (why?)

Image

On the supply (main base) side, the requester chests request twice as many items as specified from the logistics network.
This is to ensure the station always has extra for the next train. The train is loaded with the amount of items specified.

On the demand side, the station will only be enabled if the outpost needs any of the items specified.
Only the items that are needed are unloaded.

The stations also include chests and inserters for barrels, this is to ship light oil to your flamethrowers

Blueprints

Supply side https://pastebin.com/Y90jT255

Demand side https://pastebin.com/2Y8sUerP

Caveats!

There are two major caveats:
1. The train will be loaded with slightly more items than are specified, which means some slots can go to waste.
2. If the train is undersupplied on some items, it may fail to unload the items it does have.

The first one happens because all the inserters are working at the same time, and because of stack size bonuses.

The second one happens because we feed all the signals for the missing items to the filter inserters, to determine what items to unload. The inserters will use the first 5 signals that are greater than 0. The order seems to be the same as the crafting menu, and the magnitude of the signal does not matter.
The issue is, if your train is undersupplied with 5 items or more, that happen to come before the items your train does have, the filter inserter get stuck on those 5 items. For this reason I think it would be best to always oversupply your train a little.

This is also why we use filter inserters and not stack filter inserters. Stack filter inserters only allow one item to be filtered at a time.

I've not found an easy and clean solution to either of these issues, would love to see some suggestions!

Disclaimer: tested in a test world with cheats enabled. I don't know yet how this works in practice, but I plan to find out soon.

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by foamy »

benoitranque wrote:
Wed Jul 15, 2020 6:47 am
Caveats!

There are two major caveats:
1. The train will be loaded with slightly more items than are specified, which means some slots can go to waste.
2. If the train is undersupplied on some items, it may fail to unload the items it does have.

The first one happens because all the inserters are working at the same time, and because of stack size bonuses.

The second one happens because we feed all the signals for the missing items to the filter inserters, to determine what items to unload. The inserters will use the first 5 signals that are greater than 0. The order seems to be the same as the crafting menu, and the magnitude of the signal does not matter.
The issue is, if your train is undersupplied with 5 items or more, that happen to come before the items your train does have, the filter inserter get stuck on those 5 items. For this reason I think it would be best to always oversupply your train a little.

This is also why we use filter inserters and not stack filter inserters. Stack filter inserters only allow one item to be filtered at a time.

I've not found an easy and clean solution to either of these issues, would love to see some suggestions!

Disclaimer: tested in a test world with cheats enabled. I don't know yet how this works in practice, but I plan to find out soon.
All the solutions I've found to it are pretty messy. I can do count-perfect insertion of an arbitrary quantities through a single inserter, but it requires a boatload of combinators, one per item oryou can do stuff with overflow-removal or set your fill targets to be somewhat *under* a stack size to avoid overfilling, tricks like that, but =/

benoitranque
Burner Inserter
Burner Inserter
Posts: 11
Joined: Mon Jul 06, 2020 2:26 pm
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by benoitranque »

I'm not sure why you would need many combinators? The way this works is: take the items we currently have over the green circuit, multiple all by -1 to get the negative, and feed that to the red circuit. Also on the red is the output from the constant combinators.

So if I have a request for 200 ammo, and the train has 50, 200 + (-50) = 150 on the red circuit, which becomes the filter for the inserters.

So you could totally get exact loading with this, but you would need to limit stack size to 1, and only have one inserters per network. I decided to sacrifice precision for speed, convenience, and simplicity.

The other issue is more complicated. The only real solution is limiting to 5 different items per inserter. But then you need independent circuits for each.
In practice, my train should always have more supplies than the maximum an outpost may need. If I can be sure my train is properly stocked, deadlock should not happen at all.

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by foamy »

benoitranque wrote:
Thu Jul 16, 2020 2:53 am
I'm not sure why you would need many combinators? The way this works is: take the items we currently have over the green circuit, multiple all by -1 to get the negative, and feed that to the red circuit. Also on the red is the output from the constant combinators.

So if I have a request for 200 ammo, and the train has 50, 200 + (-50) = 150 on the red circuit, which becomes the filter for the inserters.

So you could totally get exact loading with this, but you would need to limit stack size to 1, and only have one inserters per network. I decided to sacrifice precision for speed, convenience, and simplicity.
You need the combinators in order to not have stack size limits. You do the basic 'multiply train contents by negative, sum with constant combinator' trick to get the amount required for any given inserter, but to get count-perfect adds you need to limit the stack size somehow, which I did by selecting the highest-valued signal (or, in the case of a tie, all of them, divided by the number of signals) and converting that to a stack size control signal. But the smallest find-max-value setup I could come up with requires a decider for each signal. Operates in constant time, though, which is nice.

Downside is, you can't put the same item through multiple inserters for this result. For semi-bulk movement -- e.g., walls -- it's a lot easier to just peg the stack size to 10 and leave some headroom in the train car.

I'm actually not sure it's a better solution than just throwing more inserters at the problem (multiple cars, 12x filter inserters limited to 1, etc) but it was an interesting challenge in circuit design :v

benoitranque
Burner Inserter
Burner Inserter
Posts: 11
Joined: Mon Jul 06, 2020 2:26 pm
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by benoitranque »

Oh I can see the challenge. But for practical purposes this is working fine now. I did change one thing, now my requester station will only be enabled if any of the items drop below half the requested amount. Before this my train was doing a whole round trip for one magazine of ammo. Not ideal :lol:

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by foamy »

benoitranque wrote:
Thu Jul 16, 2020 11:26 am
Oh I can see the challenge. But for practical purposes this is working fine now. I did change one thing, now my requester station will only be enabled if any of the items drop below half the requested amount. Before this my train was doing a whole round trip for one magazine of ammo. Not ideal :lol:

Heh, yeah. That one's bitten me before, too. I actually have mine configured via requester chests to pick up excess junk and return it to base, too, e.g. loose wood and stone, construction leftovers, stuff from teardowns, etc. Usually set the thresholds to be deliver-to-1, summon-at-1/2, remove-at-2.

jumbooates
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Aug 18, 2020 1:45 pm
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by jumbooates »

Nice. I have a similar setup but using dedicated inserters per item - this looks much more flexible. I have been thinking about building a recycling function which takes items back to base and recycles them for future use (e.g. when removing a mining outpost which is finished). Would love to see how your trash removal works. Do you need to specify all the items which are for recycling, or can you set it up so that everything which is not being auto-requested by the outpost is by default returned?

User avatar
Nosferatu
Filter Inserter
Filter Inserter
Posts: 250
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by Nosferatu »

I was about to make my own post then I saw this one ;)
Here is my service Station:
Service Station V2.png
Service Station V2.png (482.34 KiB) Viewed 6491 times
Each wagon has it's own constant combinator. Set your desired goods there and the station will automatically load exactly that amount.
The design exploits the fact that in factorio most of the time we transport multiples of 50 items.
The 4 stack inserters working together will move 48 items - then they will choose the next stack to move and do so simultaneously again.
To ensure that there are no mistakes made if above assumption doesn't work a combinator is placed before each inserter.
The first one divides the request by 12, the second by 24, third by 36, forth by 48.
That means that for example - if there are only 36 items left to move the last inserter doesn't see a signal.

The normal filter inserter is set to stack size 1 and handles the leftovers.
The combinators in front of it ensure that it only touches goods that can't be handled by the others

edit: Updated Blueprint to V3 on 06.12.2020
Found out that arithmetic combinators can calculate % (Rest of division) --> Simplified by 4 combinators
Last edited by Nosferatu on Sun Dec 06, 2020 2:43 pm, edited 3 times in total.

burninghey
Fast Inserter
Fast Inserter
Posts: 126
Joined: Fri Sep 14, 2018 2:06 am
Contact:

Re: Smart Miscellaneous Outpost Supply Stations

Post by burninghey »

I got something for ya.
Bild_2020-10-27_204756.png
Bild_2020-10-27_204756.png (155.67 KiB) Viewed 6181 times


compares items stuffed in logistic network and in train and unloads everything until amount in network equals item count in train. This way you just send trains with the stuff you want and magic happens
could ditch left combinator

Post Reply

Return to “Railway Setups”