UPS optimized 12-beacon smelting - w/minimal circuits

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

Belter wrote:
Sat Jan 15, 2022 12:22 pm
causa-sui wrote:
Wed Jan 12, 2022 3:27 am
Edit 3: This is strictly of aesthetic significance, but what's the reason for moving the gap between beacons on the leftmost cell of each row? It is not consistent with the beacons around the other smelters.
This is needed to have a 12 beacon coverage in this compressed layout. If all beacons and smelters would be aligned to a 3x3 grid, it would be only a 10 beacon setup. Or I don't get your point, not sure, please explain.
At the beginning of each row, from left to right, one of the leftmost beacons is moved 1 tile up from the corresponding beacons on every cell behind it. Moving this single beacon down one tile does not change the number of beacons hitting the machine. If this doesn't make sense still, I will try to take a screenshot next time I'm at my gaming PC.

Edit: Hrm, I don't see it in your screenshots. maybe I was looking at the wrong version of the BP. I'll verify and report back if I can confirm this is still a problem.
Belter wrote:
Sat Jan 15, 2022 12:22 pm
causa-sui wrote:
Wed Jan 12, 2022 3:27 am
Why include the timer mechanism inside the smelter?
I wanted to separate this from people's global circuit network.
Yes, but why? :) To be fair, I have a global network because I included it in my rail blueprints, but I haven't had an occasion to use it for anything before now.

Is there a performance benefit of some kind? What is the risk of having the timing mechanisms on the global network? As long as the smelter itself is not emitting any signals, there shouldn't be danger here, right?
Belter wrote:
Sat Jan 15, 2022 12:22 pm
causa-sui wrote:
Wed Jan 12, 2022 3:27 am
Edit 2: We should really settle on what signal we're using to keep time, because resetting all the inserter conditions is quite a chore. The steel smelter still uses the green inserter signal, which I think is wrong because that signal could be used to indicate inventory levels elsewhere.
I agree, it would be nice to have a standard for this. Maybe using the DOT signal is the best? Then green/red wire to be used for steel..
I think DOT is safe. In particular, we should not use any signals that could be used to measure inventory levels anywhere, so all item signals are out. Some letters are reserved for other purposes as well, such as L, T, and the signals from a roboport for bot inventory (I forget what they are). As far as I know, DOT is not reserved anywhere.

The pattern for colored wires I've seen is that green is generally used for measuring inventory levels and red is used for sending orders. So that would be my preference -- otherwise I might have to use a blue combinator to switch the signal color from red (on my global network) to green (at the smelter). But as long as the smelter is only accepting signals and not emitting them, this isn't critical at all.
Belter wrote:
Sat Jan 15, 2022 12:22 pm
In general, I'd like to separate the network in the smelters blocks from the global one, maybe that's the safest? I've just started to use circuits, not that experienced than some of you here... Suggestions welcome as always!
I guess the "risk" would be that we use a signal that is also used for something else on the network, as I mentioned above. I don't know how people usually use global circuit networks though, but if someone is using a signal on their global network already only to find that our smelter BP uses it too, then that could be annoying.

I think it is possible to enable both approaches though. I suggest that we ship a blueprint book with BPs for (one BP per bullet point):

- UPS optimized iron/copper smelting
- UPS optimized steel smelting
- UPS optimized stone brick smelting
- Timer combinator(s) attached to a medium electric pole

Each smelter BP will have an extra medium electric pole sticking out both sides. This pole can be used for tiling on one side and for connecting the timer mechanism on the other.

So, if you want to time locally and keep the circuit isolated for each smelter setup, then use the Timer BP on one side and tile the smelter to the other direction. If you want to use a global timer, then hook it up on that side and tile to the other direction.

If someone has a compelling argument that using the global network should not be supported, I'm open to hearing it too. I don't have a ton of experience with using huge circuit networks, but I'm kind of excited to have finally discovered a use case :D

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Updated my original v6 post, just minor changes: v6.36

I plan to measure on the weekend the UPS impact of - if any:
- shared vs. separate circuit
- inserter timing (simple: all plate inserters swing the same time vs. timed+offset: to put plates to the right place like in v6)
- if moving arond the underground belts has any effect on this setup

+look for other BPs worth measuring and compare

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

I saw weird things during benchmarking...

FOUND IT: Region Cloner is not a straightforward tool, it duplicated the bacons! See the screenshot, the "glow". Re-running my becnhmarks now w/the corrected test base using "Clear paste area" :D
Attachments
OhNoBenchmarking.png
OhNoBenchmarking.png (1.61 MiB) Viewed 5328 times

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Intro - testing variants
- Finally had some time to benchmark myself.
- I’ve focused on the variations of my Smelter v6.36 BP shared in this thread.
- Please note that this is an extreme, focused test prducing 500 full lanes of iron plates to see the UPS impact of some changes.
Reference BP: 157.5 UPS
- the original Belter v6.36 setup for reference
- has timed inserters with offsets, putting plates the right place the right time
- my i5 can do 157.5 UPS here
0offs variant: -1.2% UPS
- Modification: removed the offsets: set condition to the same number for all plate inserters
- My conclusion: I thought it will more. Lucky spacing but still offset help a bit in UPS
undIN variant: -2.4% UPS
- Modification: changed the layout: the inserters are putting plates to the IN underground belts (shifted 1 left)
- My conclusion: worse, so no change in my BP
undIN & 0offs variant: -7.3% UPS
- Modification: see how these two combines
- My conclusion: worse than I thought
SepCircuits variant: -8.5% UPS
- Modification: circuits separated so instead of 5 we have 500 circuits, 1 for each lane.
- My conclusion: loss is expected, now we have a number, pretty bad
More information, conclusion:
UPS.png
UPS.png (5.95 KiB) Viewed 5315 times
- Well, no reason (yet) to apply changes on v6.36!
- I’ve added some verbose chars for 500 ticks showing only the times relevant for this comparison.
What is interesting that the 144 cycle is not visible/obvious on some. I’ve expected a much straightforward graph.
- I add no BPs here as there is no finding here, you can get them from the saves if interested.
Testing conditions:
- 5 x 100 lanes vanilla - 1 circuit controlling (except the last case) a block of 100 lanes
- Using editor mods only for power source, ore source and to consume the plates
- Saves stabilized already at 500 x 2700 = 1.350M plates/min
- 3 runs x 5000 tick per Save, then UPS averaged
- Win10, PowerShell 7 and an old i5 @ 2.6 Ghz w/1333Mhz RAM
Next test I plan
I'll get together some of the fantastic BPs we have for smelting, see how they do on my computer w/500 lanes.
Attachments
benchmark2.zip
(3.68 KiB) Downloaded 123 times
bs5_belterv6_sepc-fixed.zip
(4.55 MiB) Downloaded 118 times
bs5_belterv6_ref-fixed.zip
(4.65 MiB) Downloaded 126 times
bs5_belterv6_0offs-fixed.zip
(4.57 MiB) Downloaded 119 times
undIN_0offs.png
undIN_0offs.png (267.68 KiB) Viewed 5315 times
undIN.png
undIN.png (221.27 KiB) Viewed 5315 times
SepCirc.png
SepCirc.png (227.09 KiB) Viewed 5315 times
Ref.png
Ref.png (219.5 KiB) Viewed 5315 times
0offs.png
0offs.png (252.39 KiB) Viewed 5315 times
Last edited by Belter on Sun Feb 06, 2022 10:57 am, edited 2 times in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

It's impressive that you can squeeze out extra UPS with perfect timing.

Unfortunately perfect timing requires 100% belt consumption, which implies that something downstream is starving for plates. This might offset your UPS gains.

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

DaveMcW wrote:
Sat Jan 29, 2022 8:54 pm
Unfortunately perfect timing requires 100% belt consumption, which implies that something downstream is starving for plates. This might offset your UPS gains.
You're right, UPS optimization is a complex topic and must be done in context. My goal was to understand if/how much sense it make to use offsetting & now we know that in a testing scenario: 1%.. Also the other varients are interesting. I cannot compare to a not timed variant, as this BP will not produce a full belt if I remove the circuits.

Now looking for more Smelting BPs to compare to. Anything not referred in this thread - pls share it here.

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Intro - testing smelting BP for comparison
- I took some BP from this thread and did an inital benchmark
belterv0-8B-lame
- added a lame, 8 beacon setup just to see how bad it is
nilaus-miab
- Masterclass in a Book BP from Nilaus, a much better 8 beacon setup. modified to left->right
belterv5-timed, belterv5-nottimed
- older setup form here, with and w/o timing
belterv6_ref, belterv6_0offs

- my v6.36 BP from here, with and w/o offsets (BP w/offset is added here)
Results
UPS.png
UPS.png (17.58 KiB) Viewed 5290 times
Times.png
Times.png (96.86 KiB) Viewed 5290 times
note: total time has other, small components. only relevant ones shown here for comparison.
Testing setup
- same as for the previous benchmark here, 2 post up
- the attached ZIP file has all the saves and the results, also the script used (you must edit the directory names)
Attachments
UPS-details.png
UPS-details.png (35.34 KiB) Viewed 5290 times
Times-details-data.png
Times-details-data.png (11.53 KiB) Viewed 5290 times
SmeltingBenchmark.zip
(35.33 MiB) Downloaded 147 times
Last edited by Belter on Sun Feb 06, 2022 12:32 am, edited 5 times in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

What would happen if you removed the furnace at the end of the belt from the circuit network?

In theory this should give you 10% flexibility on consumption and 20% less circuit overhead. Assuming it doesn't break horribly.

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

DaveMcW wrote:
Mon Jan 31, 2022 12:34 am
What would happen if you removed the furnace at the end of the belt from the circuit network?

In theory this should give you 10% flexibility on consumption and 20% less circuit overhead. Assuming it doesn't break horribly.
I've played with it a bit and you're right in the manner of changes in consumption causes gaps - perfect timing is fragile. Hope I get your point.

The original v6.36 perfeclty timed BP produce gaps if there is a speed-up in consumption: like I put a yellow belt to the ouput to slow down (fine), then put the blue belt back. It goes out of sync & produces gaps sometimes as the inserters are running out of plates at the wrong time and fail to fill the gap.

Buffering at the end should solve most of thse situations as in the v5.2 and v5.9 BPs here or "v5-timed" in the results. Buffering also has a UPS impact due to the uneccesary high # of swings.

Thinking loud:

So to have a realistic UPS measurement it should be done with like 66% full belt consumption and 33% stop and with GAP detection to fail? I'd say that's an overkill and also it would have a major impact on the measurement itself. I can think about realistic usage of smelting:
- you have a smelter outpost and take plates by trains. So yo have a 100% then 0% consumption. Some gaps would not hurt (?)
- you feed steel/gc/whatever other product facotories directly. I'd design the bandwidth to match those - like 8 smelters are enough to feed steel

For UPS optimization a clear test setup and goal is needed. For now I'd go with
- you have a full belt of iron ore
- produce a full belt of iron plate w/o gaps - 2700 items/min
- power consumption / res need to build / pollution ignored
- we'll test if with 100/500 or more belts on an empty test setup and compare to the others
- have the best UPS

For me at least he goal is to see the UPS impact of different solutions, as we're in the 1% range of changes one could say running out of practical benefits? :)
Attachments
SlowDown.png
SlowDown.png (458.73 KiB) Viewed 5244 times
SpeedUp.png
SpeedUp.png (445.84 KiB) Viewed 5244 times
Last edited by Belter on Mon Jan 31, 2022 8:04 am, edited 2 times in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

You can add a 2:1 splitter at the end and feed in extra iron plates to simulate arbitrarily small gaps in consumption.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

Here is another version for you to test.


User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

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

Post by disentius »

Seems i like testing:)

Four setups here:
- Belters V6.38
- DaveMcW
- Dis V1
- Dis 8beacons

Tweaks I made on mine:
- moved the "fill smelter" to the last position
- tweaked the timings.
2022-02-01 22_14_08-Window.png
2022-02-01 22_14_08-Window.png (76.53 KiB) Viewed 5174 times
Attachments
bm_ verbose.zip
(19.39 MiB) Downloaded 119 times
bm_ results.csv
(2.55 KiB) Downloaded 96 times
bm_belter-iron-V6.38.zip
(1.82 MiB) Downloaded 89 times
bm_dis-iron-V1.zip
(1.26 MiB) Downloaded 92 times
bm_DaveMcW-iron-V1.zip
(1.53 MiB) Downloaded 61 times
bm_dis-iron-8beacon.zip
(1.32 MiB) Downloaded 62 times

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

Another try at signal compression.


User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

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

Post by disentius »

That is a good try Dave.
I put the original logs per save in a zip file Results.zip.
2022-02-02 11_28_07-Window.png
2022-02-02 11_28_07-Window.png (97.03 KiB) Viewed 5132 times
Attachments
bm_belter-iron-V6.38.zip
(1.82 MiB) Downloaded 115 times
bm_DaveMcW-iron-V1.zip
(1.53 MiB) Downloaded 92 times
bm_DaveMcW-iron-V2.zip
(1.45 MiB) Downloaded 94 times
bm_dis-iron-8beacon.zip
(1.12 MiB) Downloaded 59 times
bm_dis-iron-V1.zip
(1.3 MiB) Downloaded 91 times
Results.zip
(9.54 MiB) Downloaded 53 times
bm_ results.csv
(3.11 KiB) Downloaded 63 times

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

I've also run the same tests on my windows potato computer, way different.

UPS and times [ms] are averages, 3 x 10000 ticks.

I'll re-run with 500 belts to get more accuracy.

PS: half FPS? come on..
Attachments
biron results.csv
(1.66 KiB) Downloaded 61 times
20220205-UPS.png
20220205-UPS.png (7.26 KiB) Viewed 5041 times
20220205-SmeltingTimes.png
20220205-SmeltingTimes.png (99.2 KiB) Viewed 5041 times

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Got similar results w/500 lanes, though smaller diff. DaveMcW v2 still rocks!

See the attachments for the 500 lanes saves (just copied 4x to East)

Note: my intention is not to test until I got the results I like :)
20220205-UPS-100v500.png
20220205-UPS-100v500.png (9.16 KiB) Viewed 5025 times
Attachments
biron5_belter-iron-V6.38.zip
(4.42 MiB) Downloaded 66 times
biron5_DaveMcW-iron-V1.zip
(3.6 MiB) Downloaded 64 times
biron5_DaveMcW-iron-V2.zip
(3.73 MiB) Downloaded 69 times
biron5_dis-iron-8beacon.zip
(3.07 MiB) Downloaded 64 times
biron5_dis-iron-V1.zip
(3.56 MiB) Downloaded 57 times
biron results.csv
(1.66 KiB) Downloaded 63 times
biron5 results.csv
(1.69 KiB) Downloaded 63 times

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Signal compression?
DaveMcW wrote:
Wed Feb 02, 2022 5:08 am
Another try at signal compression.
So the reason DaveMcW v2 BP is faster than v6.38 as it puts only 5 (0,1,2,3,4) values to the circuit network instead of 144 (0..143) during the 144 cycle. It is visible in the time chart circuit times went down here: gave 2..4% UPS benefit which is cool! DaveMcW's trick is that instead of turning on the insterter#2 at 32 (of 144) let's divide the signal by 32 and turn if on if the signal is 1. It has the same effect. Factorio might work in an way that the entities connected to a circuit network only checked if the signal changes: so this tweak caused 5 checks instead of 144 for the all the inserters controlled by the circuit. The inserters are turned on for 32 ticks (=1 of 0..4) instead of 1 ticks (=32 of 0..143). This is fine as they swing anyway. Now the trick is to play w/the layout so these activation times give perfect positions (empty space on the lanes) for the inserters so they're activated for the shortest possible time. You have only 5 points in time, not 144...

See the graph below, X axis is time, the two signals has a different Y axis for better visiblity.

Note: yes, the 5th period is only 16 ticks, this is for the split smelter and is correct. We have 2 x 4.5 smelters to fill the 2 lanes of the belt.
SignalCompression.png
SignalCompression.png (69.76 KiB) Viewed 5007 times
Edit: removed my updated BP as it was not in par w/DaveMcW v2 per the benchmark results. See next post for the tuned BP
Last edited by Belter on Sun Feb 06, 2022 8:48 pm, edited 1 time in total.

Belter
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Belter v6.75 w/signal compression
- I thought it will be easy to apply the signal compression on my original layout. It was not. My initial attempts failed miserably and got no UPS gain
- finally I moved things around and got the same UPS, w/a tiny bit better layout. Maybe... :D

The mini-gaps dissapearing?
- I've relaized before also in previous BPs that there is a mini-gap on the belt (sometimes, and on both lanes) which disappears magically
- How? Why?? Ideas welcome!
Belter v6.75 and the mini-gap.png
Belter v6.75 and the mini-gap.png (460.51 KiB) Viewed 4949 times
Results, conclusion
- THX again for DaveMcW for sharing his BP which allowed me to measure!
- I did a 500 lane test, 3 x 10.000 ticks w/stabilized saves
- signal compression gives a clear benefit
- even the cycles (4 long, 1 short then repeat) visible, see the 500 tick graphs - amazing!
- the UPS "gain" compared to DaveMcW's v2 BP is within the maring of error, +0.15%...
- saves and results attached, would be nice to reproduce my measurements
Summary-.png
Summary-.png (60.1 KiB) Viewed 4937 times
Attachments
saves.zip
(11.62 MiB) Downloaded 97 times
Times-Belterv6.75.png
Times-Belterv6.75.png (105.62 KiB) Viewed 4949 times
Times-DaveMcWv2.png
Times-DaveMcWv2.png (116.95 KiB) Viewed 4949 times
Times-Belterv6.38.png
Times-Belterv6.38.png (107.36 KiB) Viewed 4949 times
Last edited by Belter on Sun Feb 06, 2022 9:28 pm, edited 2 times in total.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2673
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

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

Post by mmmPI »

It's amazing to "see" the circuit network update time and the intervals when the value updates, made visible on the graph.

That seem to confirm your previous hypothesis that some machines/inserters are only being updated/reading the circuit network value, when the value changes. Which is a very useful thing to know to make optimized circuits builds with global networks such as with train station. Makes me think twice about connecting a mall to the global network for example.

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. ( it's better to lag 100 ms consistently than to lag spike 3000 ms only during combat if you go extreme on that logic ). Or getting 74 UPS in regular time but dropping to 45 UPS during 2 second every 30 second when values updates. Maybe it's better to just go for 55 UPS stable :)

Or another approach: is it better to synchronize all furnaces with that method ? or to try and make different "groups" "array" to normalize as much as possible the update time ?:D Are the additionnal combinators required to make separate circuit network to clock the different group of furnaces worth it ?

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 :)


Belter wrote:
Sun Feb 06, 2022 8:25 pm
The mini-gaps dissapearing?
- I've relaized before also in previous BPs that ther is a mini-gap on the belt (sometimes, and on both lanes) which disappears.
- How? Why?? Ideas welcome!
My idea is that it's loosely related to the magic that happens to make circular belt function properly. There is no circular belt here but for a circular belt full of material to not get stuck some logic must be implemented so that items can move even if there is no "buffer/space" available. Each item taking the spot of another item. like marbles at the bottom of a circular glass. ( sometimes i think the belt get stuck in the game depending on which method you use to fill in the circular belt ).

Another way to approach this would be : when there is a circular belt, which belt do you update first ? which one is the first of the "transport line" ?

In this case i think there must be a arbitrary convention to start the update logic at a particular belt. I may be wrong, that's just my idea, that those mechanisms can introduce such temporary mini-gaps. Or at least that there is a relation between edge case in belts update logic, and those mini-gaps.

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

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

Post by disentius »

Nice work, Belter!
You forgot to post the saves with your post, though:)
The gaps are strange. Mine and dave's BP's do not have them, as far as I could see. (checked both) We both have the "divider" furnace at the back of the line, maybe that has something to do with that...

@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.

Post Reply

Return to “Combinator Creations”