Page 4 of 10

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Sun Feb 06, 2022 10:18 pm
by Belter
disentius wrote:
Sun Feb 06, 2022 9:19 pm
Nice work, Belter!
You forgot to post the saves with your post, though:)
Thank you. Saves are lurking in the attachments, check it, its there just hard to find.

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Sun Feb 06, 2022 10:35 pm
by Belter
mmmPI wrote:
Sun Feb 06, 2022 9:08 pm
It may also reveal some limits to the UPS optimization. Maybe the most efficient design in terms of raw UPS is not the most fluid in game due to having some higher varation in update times in between different frames.
I think we're at the limits of measurements, yes, even w/500 lanes. But thinking about a whatever spm megabase, I'd expect only some parts timed and things smooth out. Also output belts are never 100% used, so idle will happen probably causing more changes in UPS than timed stuff?
mmmPI wrote:
Sun Feb 06, 2022 9:08 pm
given how few times is required to update the circuit network compared to the entity though, i guess the margin of optimization are easier to find somewhere else, like in the green science if i were to guess based on previous trend :)
Unless something big comes up here, I'm done w/smelting... Steel/GC comes!
mmmPI wrote:
Sun Feb 06, 2022 9:08 pm
My idea is that it's loosely related to the magic that happens to make circular belt function properly[...]
I like this idea. The 2nd mini-gap is disappearng on a straigtht part. Maybe undeground belts has some dirty secret also, or folks at Wube did some magic when they optimized the belts or ensured full belts work consistently. I've read some FFFs, well, loads of effort went into this. As I consume the belt 100% using editor extension there is no way that plates are slipping there.

Let this be the biggest "bug" in Factorio! :)

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Mon Feb 07, 2022 2:30 am
by mmmPI
disentius wrote:
Sun Feb 06, 2022 9:19 pm
@mmmPi: Making sure the inserters do not have to wait for a free belt piece was the biggest UPS boost (by Belter) Dave managed to find a more efficient signal transmission.
thanks for the recap ! i tunneled vision on the graph which is showing the not so big UPS boost in the signal transmission in this particular case. When i look at the graph the entity (yellow part) is too complicated/chaotic to dinstinguish a clear pattern. that's where the biggest UPS boost lies. But looking at the orange part it seems that the spike are roughly similar in height and frequency between the signal compression and non-compressed signal. What changes would be the "noise" the average level of orange in-between the spikes. ( that's one way to describe) At the end the result is a clear UPS gain in the circuit network part from 0.51 to 0.31 when looking at it applied to Belter's deisgn. That's almost a 40% gain considering only the circuit parts !

To me it makes sense that the orange spike is the same height, the circuit network requires the same amount of time in both case when the inserter is activated. With that the reduction of orange in the other part would seem to confirm that when no value changes in the circuit it takes less time for the circuit network to be processed by the game. Or in other word, that entities connected to the circuit network are smart enough to not consume time machine when the circuit is not changing value. Or again, than if one can avoid having value changing all the time on the circuit network for no particular reason, it's best/ good practice to avoid it because it has an inpact on every entity connected to it. If you have somewhere 100000 inserter waiting for the "iron" signal, you don't want to connect them to the same circuit network where you read content on a full belt with the "pulse" signal or to the mega mall full of connected chest with their content changing every tick. This is the lesson i'm going to remember from the graph and your different tests :).
Belter wrote:
Sun Feb 06, 2022 10:35 pm
I think we're at the limits of measurements, yes, even w/500 lanes. But thinking about a whatever spm megabase, I'd expect only some parts timed and things smooth out. Also output belts are never 100% used, so idle will happen probably causing more changes in UPS than timed stuff?
You can set up your factory so that output belts are 100% used depending on how you setup your train conditions :) but it's pretty uncommon to design this way on purpose. Another way it happens is when you don't have enough material coming, not a shortage of 1 material in particular, but things like you can produce 100 SPM but only have enough material input for 90 due to a train congestion. It's not like 1 particular material will stockpile and then the congestion will be better, it can alternate between different material arriving too late maybe 1 will stockpile like 10 or 20% of the buffer at most when 2 train arrive in quick succession, and then all empty when no train of that material arrive to make up for the previous. The thing is happening more often unwillingly it's easier to spot when it arrives than to describe the conditions for it x).

I see it as the test is only 1 part of making the megabase, then you have to properly implement the good design recognized in the test so that it behave in the factory like it does in the test !

The signal network compression is not reducing the height of 1 particular spike of time machine consumed for the circuit network processing, it is reducing the noise in between the spikes. Thus if you implement a gigantic array with signal compression you may want to offset the spikes from one another. Otherwise you may risk having those particular frame where all the logic is happening becoming notceable in game. but that would require several clocks :)

Given the very low % of time required by the circuit network in the smelting setup in general the risk doesn't seem that high here. But those orange spike are roughly correlated with yellows spikes too, since when the inserter is active it triggers some other calculations. There are obvisouly other more important parameter than just the circuit network that result in the total time per frame looking chaotic but if you reduce all noise and synchronize everything the raw UPS gain may be happening in a visible manner at the detriment of a regularity in the the time machine required per each frame. Not the limit of measurement !
Belter wrote:
Sun Feb 06, 2022 10:35 pm
The 2nd mini-gap is disappearng on a straigtht part. Maybe undeground belts has some dirty secret
I agree they do mysterious things

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Mon Feb 07, 2022 7:53 am
by Belter
Actually I did not know why the circuits are in sync... and they are, obviously. I use 5 circuits for my 500 lane tests for the 5x100 blocks.

To test I deynced one by replacing it again the combinators using copy & paste:
Desync.png
Desync.png (49.51 KiB) Viewed 4704 times

First idea was power cut / save/load game but the state remained (well, makes sense). So Region Cloner keeps that even in sync, nice job!

It means that in normal cicumstances, working from BPs - unless a global timer is used - they won't be in sync.

Edit: in the documentation at github they do mention this feature. RTFM...

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Mon Feb 07, 2022 7:23 pm
by Belter
This BP has space for substations, which is almost never the case for high beacon setups.

I'm sure I'll be slaughtered but... ..I added substatoins and measured the difference.

9000 poles vs 2000 substations.+0.8% UPS. Result is consistent at least for me.

No idea why entity updates went up.
poles-subtations.gif
poles-subtations.gif (4.79 MiB) Viewed 4669 times
Pole-vs-Sub.png
Pole-vs-Sub.png (63.36 KiB) Viewed 4669 times

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Mon Feb 07, 2022 7:33 pm
by Gummiente27
7000 less things to progress

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Tue Feb 08, 2022 11:57 am
by disentius
I recreated your test, with the following modifications:
(500 belts, 100 down, 5 columns)

- removed circuit controllers except one in the left top (I would only use one in a real game)
- made sure all furnaces are filled to capacity (in your saves, some furnaces are still filling up, so the input inserters are more active)
- added DaveMcW's save for reference
- removed the rewire mod (it makes comparison with older tests difficult)
- 50000 ticks, 3 runs

Looks like substations are the better solution, marginally:)
2022-02-08 12_54_22-Window.png
2022-02-08 12_54_22-Window.png (39.74 KiB) Viewed 4642 times

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Tue Feb 08, 2022 9:01 pm
by Belter
disentius wrote:
Tue Feb 08, 2022 11:57 am
I recreated your test, with the following modifications:[...]
Looks like substations are the better solution, marginally:)
I really appreciate this, thank you! Your points are all valid and I will pay more attention for those in the future.

Per the Avg UPS numbers Dave's BP is 1% faster than the pole version. The substation is +2% on top of that giving a 3% difference (+2% to Dave's).

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Tue Feb 08, 2022 9:40 pm
by Belter
Mind the gap - the challenge!
There is a clear explanation why the mini-gaps appearing. Can you find it out?

I give hints - the last one is the solution. If you liked this challenge reply here your hint level 0..4.

So:
- top row has mini gaps
- bottom row has no mini gaps
Why is that?

MindTheGap.png
MindTheGap.png (858.13 KiB) Viewed 4596 times
Hint 1
Hint 2
Hint 3
Hint 4

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Wed Feb 09, 2022 12:26 am
by DaveMcW
You have discovered the difference between a 0-to-143 clock and a 1-to-144 clock.

If you want the 0 signal to last 32 ticks, you need to use the 0-to-143 version.

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Mon Feb 14, 2022 9:24 pm
by Belter
Belter v6.78p
- After fixing the timer I've re-organized my BP - signal compression is from DaveMcW
- Finally beats DaveMcW v2 - +3.71% UPS. Not much, but consistent
- No further ideas to improve UPS. Time to move to steel finally?
BelterSC v6.78p.png
BelterSC v6.78p.png (547.19 KiB) Viewed 4429 times
Belter v6.78smin
- I thought that using substations would improve even further the UPS. Wrong. Not sure why but slower.
BelterSC v6.78smin.png
BelterSC v6.78smin.png (427.06 KiB) Viewed 4429 times
DaveMcW v2
- Using the BP as posted here
DaveMcW v2.png
DaveMcW v2.png (295.27 KiB) Viewed 4426 times
Benchmark results
- Did a 3 x 50.000 tick measurement w/5x100 lanes.
- Double-checked to have all 3 saves with full smelters. Saves also attached
- Results.csv does not have header as I deleted the file with other results after started the benchmark, data is intact
- Avg UPS: avg UPS of the 3 runs. Min/Max: the slowest/fastest UPS of the 3 runs
- See this post for more pole setup results

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Tue Feb 15, 2022 10:55 am
by disentius
Davemcw with substation will beat yours:)

2022-02-15 11_51_59-Window.png
2022-02-15 11_51_59-Window.png (124.89 KiB) Viewed 4395 times

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Tue Feb 15, 2022 12:04 pm
by Belter
disentius wrote:
Tue Feb 15, 2022 10:55 am
Davemcw with substation will beat yours:)
Use v6.78 pls, not 6.75

Substation v6.78s is here: viewtopic.php?f=193&t=101598&p=561689#p561689 with saves.

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Tue Feb 15, 2022 8:49 pm
by disentius
i did use your latest saves, and posted results there.
[edit] oops.
Here: viewtopic.php?p=561734#p561734

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Wed Feb 16, 2022 10:40 am
by DaveMcW
I found a perfect alignment for the middle inserter that save a few ticks.

I also optimized the clock by removing one active circuit network.


Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Wed Feb 16, 2022 1:03 pm
by disentius
I ran a benchmark with v3(my modified davemcw with substations vs) v4 (Dave's latest entry).

Base blueprints:
v3
ironv3.png
ironv3.png (555.33 KiB) Viewed 4265 times
v4
ironv4.png
ironv4.png (735.47 KiB) Viewed 4265 times
Results:
2022-02-16 14_16_13-bm_ smelting results.csv - LibreOffice Calc.png
2022-02-16 14_16_13-bm_ smelting results.csv - LibreOffice Calc.png (81.72 KiB) Viewed 4265 times

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Wed Feb 16, 2022 1:22 pm
by disentius
(Made new saves for both)

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Wed Feb 16, 2022 3:32 pm
by disentius
Did the same test with both saves expanded to 500 belts, per remarks of Dave about RAM.
Results:
2022-02-16 16_27_38-bm_ smelting results500 belts.csv - LibreOffice Calc.png
2022-02-16 16_27_38-bm_ smelting results500 belts.csv - LibreOffice Calc.png (81.21 KiB) Viewed 4249 times
Can someone repeat the test? also, why is V3 faster?

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Fri Feb 18, 2022 3:55 am
by flame_Sla
Belter,
why is a full belt used to feed ore?
it should be much better this way

Re: UPS optimized 12-beacon smelting - w/minimal circuits

Posted: Fri Feb 18, 2022 2:09 pm
by disentius
Tested Flame's config.
As POC I made a DaveMcW v5 and tested it against v4(Dave's latest entry and v3(substations). it was a bit of a puzzle, and I had to abandon using Substations as in v3.
- all saves have run at least 10 minutes , or as long as it takes to fill the furnaces to 100 plates.
- 100 belts production

Results:
Seems like it is slightly better. v5 has more belts, and 100 more infinity loaders, and is still slightly faster.
2022-02-18 15_02_18-Window.png
2022-02-18 15_02_18-Window.png (108.02 KiB) Viewed 4159 times