Wiring Provider station to supply both 4 and 8 wagon trains

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

Post Reply
zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Wiring Provider station to supply both 4 and 8 wagon trains

Post by zOldBulldog »

LTN novice here, but having a blast with all the possibilities. A bit confused about how to handle multiple-length trains as a provider.

- I want to transport full wagons.
- My Provider station supports 4 and 8 wagon trains.
- If I set the provider threshold to the capacity of 4 wagons but wire all 8 chests... schedules are generated when the front 4 chests are low, so the train can't finish loading before the timeout.
- If could set the provider threshold to the capacity of 8 wagons, but when a requester wants only a 4-wagon train... the schedule might not get generated.
- I could wire the front 4 chests and set the provider threshold to 4 wagons full, but that will prevent me from requesting 8 wagons full as the schedule might not get generated. I could then request 8-wagons only half full... but that seems dumb.

I am sure this is a common use case. What is the proper way to handle/configure/wire it?

torne
Filter Inserter
Filter Inserter
Posts: 341
Joined: Sun Jan 01, 2017 11:54 am
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by torne »

Just setting the provider threshold to 8 wagons is fairly simple, but has two problems that I can see:
- the downside you mention: if supply is >=4 wagons but <8 wagons then no 4-wagon deliveries will be dispatched. I don't think this is necessarily a big deal though: if you used a 4 wagon threshold, you're effectively prioritising all the 4-wagon requesters: if there's enough of them consuming material then they will starve all 8-wagon requesters.
- it's still possible for 4-wagon trains to get stuck waiting, because you might end up with >=8 wagons worth, but all packed into the rear 4 wagons' worth of chests. It won't happen as often, though.

One possible compromise that's more complex here:
- make sure it has a balanced loader so it will refill the chests for the front 4 wagons each time a 4-wagon train comes until they are balanced again.
- set the provide threshold to either 4 or 8 wagons worth
- use a combinator to check if the front 4 wagons worth of chests have enough to fill 4 wagons: if they don't, cut off the amount provided to the LTN stop entirely. If they do, send the full amount from all 8 wagons' worth of chests.
- at any 4-wagon *requester* station, set the request threshold to at least 4 wagons worth.
- at any 8-wagon *requester* station, set the request threshold to at least 8 wagons worth.

8-wagon trains will never be sent to pick up less than a full load and will never have to wait, because there will always be enough to fill all 8 wagons. There will also always be enough to fill *one* 4-wagon train, so as long as the 4-wagon deliveries are relatively infrequent it will generally work, but it's still possible for several 4-wagon deliveries to be dispatched at around the same time and for the later ones to get stuck waiting.

I don't think I've seen anyone with a general answer to this problem but it would be really interesting if someone does have one. I think generally people use a single size of train for any given item: while they might have mixed sizes in the entire network it's common for any particular station to only accept exactly one size of train.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by zOldBulldog »

I started thinking along the lines you mention and I implemented something reasonably simple that seems to work:

To ensure that trains are properly handled:
- I already had an 8-8 balancer between my smelter and the station.
- I set the set the station to only read the chests for the 4-wagon train, and the Provider threshold also for a 4-wagon train.

To maximize availability to both 4 and 8 wagon trains:
- I used a simple arithmetic combinator to put the content of the 4 front chests into signal A, and the rear into signal B.
- Used a decider combinator to block supply to the rear 4 chests when B < A. I did this using MiniLoaders as they behave like inserters but operate on both lanes of the belt and push material through at the same speed as the belt.

So far it seems to be working. I need to do more testing.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by Optera »

I use Wide Chests / Merging Chests for all my station buffers.
With these it makes no difference what train size is using the station.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by zOldBulldog »

Optera wrote:
Fri May 03, 2019 5:13 am
I use Wide Chests / Merging Chests for all my station buffers.
With these it makes no difference what train size is using the station.
LOL, the issue was about LTN calling the right size train (4 or 8), not handling the chests. And yes, merging chests is a great tool.

Towards the end of the the thread I mention a solution that worked - and appears reliable - although it is far from ideal.

Maybe I should add screenshot when I get back to the computer.

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by eduran »

The LTN side is simple enough: Set threshold to the size of an 8-wagon train. Set train size limit to <= 8. Done. LTN will decide which trains to use based on the train size limits of the requester and the amount of cargo to be transported.
If you set the threshold to that of an 8-wagon train and have balanced buffer chests, there is no issue. Achieving balanced chests even if they are unloaded in an unbalanced way is the real problem you are facing.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by zOldBulldog »

eduran wrote:
Fri May 03, 2019 9:37 am
The LTN side is simple enough: Set threshold to the size of an 8-wagon train. Set train size limit to <= 8. Done. LTN will decide which trains to use based on the train size limits of the requester and the amount of cargo to be transported.
If you set the threshold to that of an 8-wagon train and have balanced buffer chests, there is no issue. Achieving balanced chests even if they are unloaded in an unbalanced way is the real problem you are facing.
Hmmm the description of Threshold for the provider gave me the impression that if I set it to that of an 8-wagon train it would then not accept any 4-wagon trains as they can't carry that quantity. Did I misinterpret it?

I agree that the balancing of unbalanced unloads is important. Luckily I got that part handled already.

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by eduran »

Thresholds act as on/off switch for item signals. If a signal is below the threshold, LTN treats it as non-existent. If it is above, the threshold has no further meaning.

Say you have a provider with 20k items buffered and a threshold of 10k. You have three requesters (A, B, C) requesting 5k, 10k and 5k (in that order of priority/age). LTN will schedule deliveries to A and B. The provider now only provides 5k items (less than the 10k threshold) and LTN therefore treats it as no longer providing that item. As soon as the buffer refills to 10k another delivery of 5k to requester C is scheduled.

torne
Filter Inserter
Filter Inserter
Posts: 341
Joined: Sun Jan 01, 2017 11:54 am
Contact:

Re: Wiring Provider station to supply both 4 and 8 wagon trains

Post by torne »

eduran wrote:
Fri May 03, 2019 9:37 am
The LTN side is simple enough: Set threshold to the size of an 8-wagon train. Set train size limit to <= 8. Done. LTN will decide which trains to use based on the train size limits of the requester and the amount of cargo to be transported.
If you set the threshold to that of an 8-wagon train and have balanced buffer chests, there is no issue. Achieving balanced chests even if they are unloaded in an unbalanced way is the real problem you are facing.
Right - this will only work if the chests are *always* balanced, which can only be guaranteed if you're using wide/merged chests that don't need any balancing - otherwise you could always end up in the situation where you've serviced a large number of 4-wagon deliveries and the front chests haven't yet been able to refill, but the back chests still contain more than the threshold. This is what my suggestion of making the signals conditional on the front chests being sufficiently full partially mitigates (though it still can't prevent it from happening if enough trains are dispatched in a short period of time).

Post Reply

Return to “Logistic Train Network”