Page 1 of 2

I'm trying to optimize this classic LTN blueprint

Posted: Tue Jul 16, 2019 3:06 pm
by bogen
I've loved using the Chunk-aligned modular railway system with LTN Stations, its a classic accessible and pretty general blueprint book. Its not updated any more, and therefore has some issues. One issue is that if the unloaders output to a balancer where not all outputs are taken equal of, the station gets an issue where the chests closer to the balancer are fuller than the chests further from it. This is especially important for items that have low stack count, like nuclear fuel, since longer belts far away from the balancer will store more of the items, than the belts and chests closer to the balancer.
I've rebuilt the unloading blueprint trying to solve this issue with a Madzuri circut that combines all chests, so they get equally emptied, but i haven't managed quite to get it right. Is it maybe because the Madzuri won't work with chests on both sides combined?


<ATTACHMENT filename="LTN issue.png" index="1"><s>
LTN issue.png
LTN issue.png (918.46 KiB) Viewed 5633 times
</e></ATTACHMENT>

Blueprint is here:
https://pastebin.com/hjVZ1cJ5
<br/>
Full screenshot:<br/>

<ATTACHMENT filename="New LTN - balanced unloading issue.png" index="0"><s>
LTN issue.png
LTN issue.png (918.46 KiB) Viewed 5633 times
</e></ATTACHMENT></r>

Re: I'm trying to optimize this classic LTN blueprint

Posted: Tue Jul 16, 2019 4:32 pm
by coppercoil
Madzuri logic is not necessary if you:
  1. unload chests to both belt lanes independently;
  2. use 2:1 (N:1) balancer to merge single wagon chests;
  3. use 4:4 (M:M) throughput unlimited balancer (not shown) for all wagons (each side can be balanced independently).
NoMadzuri.png
NoMadzuri.png (729.95 KiB) Viewed 5622 times

If chests become unbalanced for some reason, catch the moment when the train is being unloaded and all chests becomes full and trains is still unloading and all wagons are still not empty, and then sent the train to the mines manually.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Tue Jul 16, 2019 4:34 pm
by mmmPI
I think you need to change the settings of the green inserters to >12 instead of <12 this will make the green inserter of the most filled chest active, or the 2 most of the 3 most ect.

With >0 it works better as it doesn't let any ore in the chest.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 10:04 am
by bogen
mmmPI wrote:
Tue Jul 16, 2019 4:34 pm
I think you need to change the settings of the green inserters to >12 instead of <12 this will make the green inserter of the most filled chest active, or the 2 most of the 3 most ect.

With >0 it works better as it doesn't let any ore in the chest.
Screenshot 2019-07-17 at 11.00.34.png
Screenshot 2019-07-17 at 11.00.34.png (1.29 MiB) Viewed 5587 times
I tried that suggestion, and in some cases, the inserters seem to just stop all at once even though there is alot of content in the chests, is it some combination of numbers that cause this? Or is it because one combinator controls both sides?

Madzuri logic is not necessary if you:
unload chests to both belt lanes independently;
use 2:1 (N:1) balancer to merge single wagon chests;
use 4:4 (M:M) throughput unlimited balancer (not shown) for all wagons (each side can be balanced independently).
Screenshot 2019-07-17 at 10.59.25.png
Screenshot 2019-07-17 at 10.59.25.png (708.37 KiB) Viewed 5587 times
The setup you are proposing seems like what is in the standard blueprint. I can confirm that the problem happens doing it that way as well. Or am i misunderstanding something here? The problem happens if you only use a couple of the lanes after the balancer, not all 8

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 12:52 pm
by bogen
Screenshot 2019-07-17 at 14.51.36.png
Screenshot 2019-07-17 at 14.51.36.png (415.57 KiB) Viewed 5581 times
Here is a recreation where the problem happens, if less than 1 belt is taken, the chests nearest starts emptying faster than the chests further from the balancer, this adds up over time.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 2:31 pm
by mmmPI
I need to give it another look, the madzuri's ideas was to divide the total quantity of each chest summed up, by the number of chest in the negative.

This gives you (-average) , then each inserter compare that (-average) with the quantity of its own chest.

Let say you have 3200 iron ore, on 32 chest, that gives a number of -100.

One chest has 90 ore, one chest as 120 ore.

one inserter will receive -10, the other one 20.

If you use >12 on the inserter only 1 of them will be active, the most filled one.

so it is a combination of numbers that would make all inserter read a signal =< 12 and not a idea of side of the station.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 5:02 pm
by coppercoil
bogen wrote:
Wed Jul 17, 2019 10:04 am
The problem happens if you only use a couple of the lanes after the balancer, not all 8
Here's the key to the answer. That 8x8 balancer is not throughput unlimited. It's limited. Balanced != unlimited.

Here is the only unlimited 8x8 balancer I have found on the whole internet.



Or, you can use two simple and compact 4x4 unlimited balancers for each side independently. Despite two sides will became unbalanced, all wagons will stay balanced comparing to each other.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 6:18 pm
by bogen
when i take one yellow inserter on nuclear fuel, it still happens. Weird!
Screenshot 2019-07-17 at 20.17.17.png
Screenshot 2019-07-17 at 20.17.17.png (758.22 KiB) Viewed 5557 times

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 6:34 pm
by coppercoil
bogen wrote:
Wed Jul 17, 2019 6:18 pm
when i take one yellow inserter on nuclear fuel, it still happens. Weird!
How many items has left in the wagon? 1-3 x Inserter-Stack should be considered ok, it's negligible for 8-belt flow. One-inserter consumption is not a common case for a such setup. Low consumption means train can stay longer because... consumption is low.

By the way, the first unload may be unbalanced because it need to fill all these belts completely, and belts are different length. This should be fixed manually as described in my first post. Once fixed it should run flawlessly for hundreds hours.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Wed Jul 17, 2019 11:21 pm
by mmmPI
maybe the thing that mess up your math is when you take from only one side of the belt at the end.
The 8x8 balancer does it between belts, not between side of belt.

EDIT: what i mean by that is maybe some chest cannot be emptied from this side of the belt no matter the inserter logic.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 6:49 am
by coppercoil
mmmPI wrote:
Wed Jul 17, 2019 11:21 pm
maybe the thing that mess up your math is when you take from only one side of the belt at the end.
The 8x8 balancer does it between belts, not between side of belt.
I think you need to balance wagons, not chests. Chest balancing is the simplest way to balance wagons, but it's not neccessary.

Chest balancing may be important to some degree when looking for maximum throughput and need to minimize train unload time. Single lane case means lower throughput, so time is not critical, so chest balancing is nonessential.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 8:48 am
by Optera
While I like the intricate balancer designs using wagon > inserter > wide chest (spanning the whole train length) > loader > belt is simpler and has less calculations per tick than dozens short belt pieces and splitters.
2018-12-21-07-50-22-7378394.png
2018-12-21-07-50-22-7378394.png (4.91 MiB) Viewed 5520 times
Top station uses circuit controlled logistic requests to balance between left and right.
Bottom two use loaders with splitters to achieve the same.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 10:08 am
by mrvn
mmmPI wrote:
Wed Jul 17, 2019 2:31 pm
I need to give it another look, the madzuri's ideas was to divide the total quantity of each chest summed up, by the number of chest in the negative.

This gives you (-average) , then each inserter compare that (-average) with the quantity of its own chest.

Let say you have 3200 iron ore, on 32 chest, that gives a number of -100.

One chest has 90 ore, one chest as 120 ore.

one inserter will receive -10, the other one 20.

If you use >12 on the inserter only 1 of them will be active, the most filled one.

so it is a combination of numbers that would make all inserter read a signal =< 12 and not a idea of side of the station.
> 12 will not work. Say all chest are balanced then all inserters will receive +100 from the chest and -100 from the combinator == 0. None of them will work. That also means > 0 won't work. You need >= 0.

Problem I have with >= 0 is that it often allows only on inserter to work if the difference in chests is not a multiple of the stack size. The output stutters. So I use > -10 to allow a slight imbalance between the chest but not too much.

Note: For filling chests balanced use <= 0 or < 10 to avoid stutter. For fluids use > -100 and < 100.
Note2: When using LTN set the provider and requester limit slightly above one train to account for the slight imbalance.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 10:26 am
by coppercoil
Optera wrote:
Thu Jul 18, 2019 8:48 am
While I like the intricate balancer designs using wagon > inserter > wide chest (spanning the whole train length) > loader > belt is simpler and has less calculations per tick than dozens short belt pieces and splitters.
I haven't tried Madzuri logic in by base but I think it cannot guarantee 100% belt compression without "interwagon" balancers. If there are some imbalance between wagons, then some inserters will be held, so its throughput will drop. To compensate drop we need some belt balancers and redundant lines from each wagon. It become too complex. Maybe I'm wrong... but after deep analysis I dropped that idea. 100% saturation is important to me.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 11:14 am
by mrvn
coppercoil wrote:
Thu Jul 18, 2019 10:26 am
Optera wrote:
Thu Jul 18, 2019 8:48 am
While I like the intricate balancer designs using wagon > inserter > wide chest (spanning the whole train length) > loader > belt is simpler and has less calculations per tick than dozens short belt pieces and splitters.
I haven't tried Madzuri logic in by base but I think it cannot guarantee 100% belt compression without "interwagon" balancers. If there are some imbalance between wagons, then some inserters will be held, so its throughput will drop. To compensate drop we need some belt balancers and redundant lines from each wagon. It become too complex. Maybe I'm wrong... but after deep analysis I dropped that idea. 100% saturation is important to me.
At the start all chests are empty and therefore balanced. Then when a train arrives (presumed to be full and therefore balanced) all chests get filled equally and are therefore balanced. As long as everything is balanced all inserters work and everything is saturated. The balancing logic then only comes into play if consumption is unbalanced, in which case consumption < belt speed and saturation isn't the problem. That should be the case you build for. Consume items a hair slower than you can unload.

Except at the end of each train. The cargo wagon content may not be divisible by 72 (6 inserters, stack size 12, 144 for double sided). So a minor imbalance occurs. Once per train you get a little stutter. That where consuming a hair slower than belt speed will compensate.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 11:23 am
by mmmPI
mrvn wrote:
Thu Jul 18, 2019 10:08 am
> 12 will not work. Say all chest are balanced then all inserters will receive +100 from the chest and -100 from the combinator == 0. None of them will work. That also means > 0 won't work. You need >= 0.
100% agree.

The solution provided by Optera probably suits better the definition of optimized than the mess i'm showing there, but i had fiddled with a similar design as the original and here is how it was
overbalancedunloader.jpg
overbalancedunloader.jpg (891.58 KiB) Viewed 5502 times
This is at the very end of an unloading that happened because of the inserters taking one side of the belt, it is slightly unbalanced, as 1 wagon is late, but very small amount , 8, which will equalize soon, but at the cost of a little throughput.

Here is a wider screen with the loading of the plate, and an iron ore unloading where i didn't use any combinator logic, just the belt/splitter balancing, this is not as balanced as the copper one, but it was fine because for iron here the consumption was lower, which means the little unbalance was canceled every time the chest were filled to the max.
wider.jpg
wider.jpg (837.67 KiB) Viewed 5502 times

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 11:37 am
by coppercoil
mrvn wrote:
Thu Jul 18, 2019 11:14 am
The balancing logic then only comes into play if consumption is unbalanced, in which case consumption < belt speed and saturation isn't the problem. That should be the case you build for. Consume items a hair slower than you can unload.
I think both cases (full and reduced) consumption are possible and will switch to each other many times. That means wagons will become imbalanced and will be unable rebalance when consumption will resume to 100%. It's possible some wagons will be exausted because of uneven consumption while others will stay half empty thus blocking train department.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 11:48 am
by mrvn
coppercoil wrote:
Thu Jul 18, 2019 11:37 am
mrvn wrote:
Thu Jul 18, 2019 11:14 am
The balancing logic then only comes into play if consumption is unbalanced, in which case consumption < belt speed and saturation isn't the problem. That should be the case you build for. Consume items a hair slower than you can unload.
I think both cases (full and reduced) consumption are possible and will switch to each other many times. That means wagons will become imbalanced and will be unable rebalance when consumption will resume to 100%. It's possible some wagons will be exausted because of uneven consumption while others will stay half empty thus blocking train department.
Full consumption would mean you consume as fast as the inserters can work. That can't get imbalanced. And when reduced consumption happens then items back up and max throughput isn't an issue. Same if you merge belts so the inserters can actually unload faster than thefinal belt(s). Throughput on the inserters isn't the issue anymore so pausing them some of the time to remain balanced doesn't cause gaps in the final belt(s).

And that really how you should design your factory. You have to consume items slower than you can unload them from the train to make up for the time between trains when no unloading happens. Otherwise the buffer chests will just run dry. And that basically means the inserters from the buffer chests to belts don't run 100% of the time. The difference in speed between wagon-chest inserters and chest-belt inserter is too little to compensate for the time when no train is present. You have to slow them down more.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 11:56 am
by mrvn
mmmPI wrote:
Thu Jul 18, 2019 11:23 am
mrvn wrote:
Thu Jul 18, 2019 10:08 am
> 12 will not work. Say all chest are balanced then all inserters will receive +100 from the chest and -100 from the combinator == 0. None of them will work. That also means > 0 won't work. You need >= 0.
100% agree.

The solution provided by Optera probably suits better the definition of optimized than the mess i'm showing there, but i had fiddled with a similar design as the original and here is how it wasoverbalancedunloader.jpg

This is at the very end of an unloading that happened because of the inserters taking one side of the belt, it is slightly unbalanced, as 1 wagon is late, but very small amount , 8, which will equalize soon, but at the cost of a little throughput.

Here is a wider screen with the loading of the plate, and an iron ore unloading where i didn't use any combinator logic, just the belt/splitter balancing, this is not as balanced as the copper one, but it was fine because for iron here the consumption was lower, which means the little unbalance was canceled every time the chest were filled to the max.
wider.jpg
When I see all your balancers I have to ask: Why?

Your smelters take in 4 blue belts. Assuming you put the same number of smelter per belt they all consume goods at the same speed. So why not simply have each cargo wagon fill one belt and feed that into the smelter. The wagons are balanced, the consumption is balanced the production is balanced and loading the plate is balanced too. There theoretically is 0 need to balance at all. (except for those inserters putting ore in a chest. What for? They make no sense there.) Any slight imbalance that might occur the circuit logic on the inserters will correct by halting some of them.

You don't even need splitter for merge the output from one wagon. Simply side load all the output form one wagon onto one blue belt. The circuit logic ensures all 6 buffer chests are used equally and 6 stack inserter can fill both sides of a blue belt without tricks. Overall a lot of splitters and underground belts can be saved.

Re: I'm trying to optimize this classic LTN blueprint

Posted: Thu Jul 18, 2019 1:01 pm
by mmmPI
mrvn wrote:
Thu Jul 18, 2019 11:56 am
When I see all your balancers I have to ask: Why?
1) It look awesome
2) It was a lot of fun to make
3) It function

mrvn wrote:
Thu Jul 18, 2019 11:56 am
Your smelters take in 4 blue belts. Assuming you put the same number of smelter per belt they all consume goods at the same speed. So why not simply have each cargo wagon fill one belt and feed that into the smelter. The wagons are balanced, the consumption is balanced the production is balanced and loading the plate is balanced too. There theoretically is 0 need to balance at all. (except for those inserters putting ore in a chest. What for? They make no sense there.) Any slight imbalance that might occur the circuit logic on the inserters will correct by halting some of them.

You don't even need splitter for merge the output from one wagon. Simply side load all the output form one wagon onto one blue belt. The circuit logic ensures all 6 buffer chests are used equally and 6 stack inserter can fill both sides of a blue belt without tricks. Overall a lot of splitters and underground belts can be saved.
The furnaces were spread onto 6 uneven lane because i was filling a spot on the map between a nice coastline and a diagonal rail track and wanted to make it look nice. :roll:. Plus i trashed my things in waiting train in this no-bot base so it created always some unbalance in the wagon load. Even with that it's still probably overdone.( Hence why i call it a non-optimized mess every station is a unique weirdo in this base).

I do agree with your logic for making things simple. as in "optimized".