UPS Optimization - Red Science (editor)
Re: UPS Optimization - Red Science (editor)
Taking inspiration about what you said for perfect clocks, I reduced the amount of stubs needed for the first part of the belt. This seems to have increased performance by about another 2-3%. These first couple of inserters don't need the stubs since there just isn't enough science on the belt yet.
Edit:
After continuing benchmarking, it seems that it is margin of error. 4.2.2 and 4.2.4 keep getting around the same result. 4.2.2 has a lower max time so I'll probably go with that
Removed stubs for the first 3 inserters.
Edit:
After continuing benchmarking, it seems that it is margin of error. 4.2.2 and 4.2.4 keep getting around the same result. 4.2.2 has a lower max time so I'll probably go with that
Removed stubs for the first 3 inserters.
- Attachments
-
- Red Science UPS Editor - guitars11 v4.2.4.zip
- (4.46 MiB) Downloaded 59 times
Last edited by guitars11 on Wed Apr 12, 2023 6:43 pm, edited 2 times in total.
Re: UPS Optimization - Red Science (editor)
ask the person who calculated this timingguitars11 wrote: ↑Wed Apr 12, 2023 3:04 pm - I think this is something to look into because right now the inserters are clocked to pick up 8.4 items/sec. I'm not entirely sure where the community found this number, if it is just from trial and error or if there is some math behind it but would be interested to see perfect timings. Is the PM mod a mod which calculates timings?
this is probably twice as fast as the consumption of plates/gears
link1 >>> 1 + 1/10 item/s
timings
Re: UPS Optimization - Red Science (editor)
PM = Productivity Module 3. For timing I use Excel/Google sheets, no such mod sorry I'm aware of.
The timing numbers can be dervied from:
- time required for the given product, the speed and productivity bonus of the assembler machine, and the level of it (supply)
- the amount of products needed to fill a blue belt (demand)
In your case the timing is 327.27 ticks (3600/11) which is exactly 6 cycles for the machine. Due to PMs it produces 8.4 products.
The "magic" here is to avoid starving the machine. For some reason - I still have to dig into this - sometimes the machine is not fed beyond a certain # of products (9? to be?) made:
- the smelter has 100 plates, so a full stack is avail but the inserter does nothing
- the gear machine has 11 gears, I've set the stack size to 8 so a full stack is avail. The inserted does nothing
- the RS machine has 7 products but it cannot produce more as it is not fed This screenshot was taken when I've increased the cycle time. With 327 tick inserter times, this never happens.
In theory it could go up to 8 cycles (436) - so 11 or 12 packs to move out (11.2). But it does not happen due to this problem.
9 cycles won't work as it is 12.6 on avg vs. 12 bandwidth of the inserter putting the science packs to the output belt.
In case I use only speed modules, everything is simpler as no "extra" products to cope with. But as the measurements show, prod mods it the way to max UPS as less input material to process means less CPU needm as simple as that..
There is an old discussion about this starving problem when the machine is fed, but I don't get the final conclusion tbh:
"The ingredients for 1 craft in addition to the ingredients for the number of crafts that can complete during one full inserter swing; but at least the ingredients for 2 crafts and at most the ingredients for 100 crafts"
https://wiki.factorio.com/Inserters#Insertion_limits
-> viewtopic.php?p=309796#p309796
I'd say this is a bug in Factorio what we see on the screenshot, looks the devs call this a "feature" as impacts only highly optimized cases like this... For me: the machine should stop only AFTER 12 RS packs are produced.
The timing numbers can be dervied from:
- time required for the given product, the speed and productivity bonus of the assembler machine, and the level of it (supply)
- the amount of products needed to fill a blue belt (demand)
In your case the timing is 327.27 ticks (3600/11) which is exactly 6 cycles for the machine. Due to PMs it produces 8.4 products.
The "magic" here is to avoid starving the machine. For some reason - I still have to dig into this - sometimes the machine is not fed beyond a certain # of products (9? to be?) made:
- the smelter has 100 plates, so a full stack is avail but the inserter does nothing
- the gear machine has 11 gears, I've set the stack size to 8 so a full stack is avail. The inserted does nothing
- the RS machine has 7 products but it cannot produce more as it is not fed This screenshot was taken when I've increased the cycle time. With 327 tick inserter times, this never happens.
In theory it could go up to 8 cycles (436) - so 11 or 12 packs to move out (11.2). But it does not happen due to this problem.
9 cycles won't work as it is 12.6 on avg vs. 12 bandwidth of the inserter putting the science packs to the output belt.
In case I use only speed modules, everything is simpler as no "extra" products to cope with. But as the measurements show, prod mods it the way to max UPS as less input material to process means less CPU needm as simple as that..
There is an old discussion about this starving problem when the machine is fed, but I don't get the final conclusion tbh:
"The ingredients for 1 craft in addition to the ingredients for the number of crafts that can complete during one full inserter swing; but at least the ingredients for 2 crafts and at most the ingredients for 100 crafts"
https://wiki.factorio.com/Inserters#Insertion_limits
-> viewtopic.php?p=309796#p309796
I'd say this is a bug in Factorio what we see on the screenshot, looks the devs call this a "feature" as impacts only highly optimized cases like this... For me: the machine should stop only AFTER 12 RS packs are produced.
- Attachments
-
- Output full problem v2.png (427.19 KiB) Viewed 3503 times
Re: UPS Optimization - Red Science (editor)
why the bug?
we count according to the formula:
the ingredients will enter the assembly machine only if there are less than 3 items in the assembly machine
it's easy to check
hence the machine will produce all input items: 12*1.4 = 16.8 items
the inserter will unload 12 items -> 4.8 items in assembly -> 4.8 > 2.166 -> ingredients are not loaded
right?
we count according to the formula:
b8:return Math::clamp(uint32_t(std::ceil(1.166 / (recipeCraftingTime / craftingMachineCraftingSpeed))) + 1, 2, 100);
Code: Select all
(1.116 / (5.5 / 5.5) ) + 1 = 2.166
it's easy to check
hence the machine will produce all input items: 12*1.4 = 16.8 items
the inserter will unload 12 items -> 4.8 items in assembly -> 4.8 > 2.166 -> ingredients are not loaded
right?
Re: UPS Optimization - Red Science (editor)
I need help figuring out if there is any difference between these builds:
v4.2.2 : https://factoriobox.1au.us/map/info/535 ... 055c1b5f06
v4.2.6 : https://factoriobox.1au.us/map/info/29d ... 1c959962eb
v4.2.7 : https://factoriobox.1au.us/map/info/d89 ... bf064a5aa2
4.2.6 gets rid of more stubs from the beginning and 4.2.7 gets rid of the beginning stubs as well when switching to the other side of belt (so about halfway through). 4.2.7 does have to side swap the science on the belt so that might lower performance.
In theory, 4.2.7 should be the best but it's margin of error I think. Hopefully there is a difference on other cpus.
v4.2.2 : https://factoriobox.1au.us/map/info/535 ... 055c1b5f06
v4.2.6 : https://factoriobox.1au.us/map/info/29d ... 1c959962eb
v4.2.7 : https://factoriobox.1au.us/map/info/d89 ... bf064a5aa2
4.2.6 gets rid of more stubs from the beginning and 4.2.7 gets rid of the beginning stubs as well when switching to the other side of belt (so about halfway through). 4.2.7 does have to side swap the science on the belt so that might lower performance.
In theory, 4.2.7 should be the best but it's margin of error I think. Hopefully there is a difference on other cpus.
Re: UPS Optimization - Red Science (editor)
Also what are your guys' thoughts on a discord server? I feel like it would be easier to share information
Re: UPS Optimization - Red Science (editor)
v4.2.2
Performed 1000 updates in 1778.962 ms
Performed 1000 updates in 1780.580 ms
Performed 1000 updates in 1776.502 ms
Performed 1000 updates in 1778.169 ms
Performed 1000 updates in 1774.626 ms
Map benchmarked at 563 UPS
v4.2.6
Performed 1000 updates in 1844.368 ms
Performed 1000 updates in 1864.564 ms
Performed 1000 updates in 1829.271 ms
Performed 1000 updates in 1832.156 ms
Performed 1000 updates in 1825.548 ms
Map benchmarked at 548 UPS
v4.2.7
Performed 1000 updates in 1839.949 ms
Performed 1000 updates in 1795.699 ms
Performed 1000 updates in 1791.480 ms
Performed 1000 updates in 1798.856 ms
Performed 1000 updates in 1789.249 ms
Map benchmarked at 559 UPS
note: just for fun repeated it, got 551 UPS.
Below 2-3% we're at the limits of the benchmarking, especially w/1000 ticks. Learned that in the Iron smelting thread in 2022...
Belts are highly optimized in general. I remember someones written that the underground belt when it comes up from the ground - inserting to that tile is a bit more costly.
Re: UPS Optimization - Red Science (editor)
Awesome thanks! Seems like 4.2.2 is still just slightly better for this build. And I didn't know that about the underground belts. InterestingBelter wrote: ↑Wed Apr 12, 2023 11:14 pm
v4.2.2
Performed 1000 updates in 1778.962 ms
Performed 1000 updates in 1780.580 ms
Performed 1000 updates in 1776.502 ms
Performed 1000 updates in 1778.169 ms
Performed 1000 updates in 1774.626 ms
Map benchmarked at 563 UPS
v4.2.6
Performed 1000 updates in 1844.368 ms
Performed 1000 updates in 1864.564 ms
Performed 1000 updates in 1829.271 ms
Performed 1000 updates in 1832.156 ms
Performed 1000 updates in 1825.548 ms
Map benchmarked at 548 UPS
v4.2.7
Performed 1000 updates in 1839.949 ms
Performed 1000 updates in 1795.699 ms
Performed 1000 updates in 1791.480 ms
Performed 1000 updates in 1798.856 ms
Performed 1000 updates in 1789.249 ms
Map benchmarked at 559 UPS
note: just for fun repeated it, got 551 UPS.
Below 2-3% we're at the limits of the benchmarking, especially w/1000 ticks. Learned that in the Iron smelting thread in 2022...
Belts are highly optimized in general. I remember someones written that the underground belt when it comes up from the ground - inserting to that tile is a bit more costly.
Re: UPS Optimization - Red Science (editor)
server "Technical Factorio"
PS I hope I'm not breaking the rules
Re: UPS Optimization - Red Science (editor)
the produced items must be less than 12, then the inserter will immediately unload them all
12 gears -> 16.8 reds
11 gears -> 15.4 reds
10 gears -> 14 reds
9 gears -> 12.6 reds
8 gears -> 11.2 reds
we should load 8 gears into the assembly machine!
Code: Select all
0eNq1V9uOmzAQ/RdLfYMVJiRcVPWln1GtkIFJYi0YZJt00xX/3rFJQtJAE+g2D1GI7TlzZs7MmA+SlS00kgtNkg/C81ookvz4IIrvBCvNf/rYAEkI11ARhwhWmacMGG4lnUO4KOCdJLR7dQgIzTWH3oJ9OKairTKQuOHPsw5paoXb8SeioIl45b+sHXLEvbG3flkb4wiqzLJqAAq3qou2BHdFEr/rnDsI/zFE8I8Qq3ksogUQwQWCiy0XuOTme1B6DGozQG16qNORVIHWXOwsrISqPkDa4lqpQUKRnjzaslLBmA/riw9Ks/zN5UKBxKMPfAitDwWXkPdbkAsGScu6TDPYswOvpTmXc5m3XKe4VlyMbblUOr3T3YFL3eI/g0d2h4lJ/mYEaCSrmdGvZx6qhkmmDQ75Rrp+XfT+2GBQ87WTAOJapbwgSeRcHDOPfvfajcVmM09lSyQQDmTbDMlZ2/cwfnwCoR5CCOC7fVa30pQf9V5H7EYXuwXkvADpYrwyLmy8RlIbDDTibjyVJ0NDKtWCXH6/zSOlfyTyK56oW920y/TRHNG9Vuh0K+sq5QLtDNp/Xh/UvxeIQ/zJ/esJAcUXV5lSUGUl1qlbsXzPhZHESB7CqzxYOWGBccuetbqurD5clXMQObgNFiy5UlwjUWzI72A6ySC8YMw16j2nvCCcVF44Jjw6r/tTuqBo6ND+meR6X4Hm+dMCp3RC4IOtT9C4AmMjHaQeRB6GvG5A9qFOyJcFWkfbU0rGbv9Yx87tejgI+4njdvI/01DpRD3Q1aJpcxLJ7bTBOSclNqTUWsII/kKz0RhoMAM0/CzQ9azZsawMNvNKLViCMQyos5SfLzTfAo6VWn89mbh/Ppgd7XlwDPfR5RUxqdRo0d3sRHne3UzLFpybkJyRJTb7HTDp/twDmICc2ZtWgpkzm+Cd5bo8kpt4jDGKZzAK/xMjnNDYAN2mZBrG6TDtlsCsV3/n43vzKmyJ+v1hmEGJ6pI4ZkCA3B2xiSC3Lcth7LZGz6DYGkjWbrd4bep7BVI9f0wzta9aydWbmUOwwyhry49oEMZ+uIl9L1qhf78BjqyTEg==
Re: UPS Optimization - Red Science (editor)
Re: UPS Optimization - Red Science (editor)
Great find! I'm trying to think of a way this could be easily incorporated into the blueprint...flame_Sla wrote: ↑Wed Apr 12, 2023 11:34 pmthe produced items must be less than 12, then the inserter will immediately unload them all
12 gears -> 16.8 reds
11 gears -> 15.4 reds
10 gears -> 14 reds
9 gears -> 12.6 reds
8 gears -> 11.2 reds
we should load 8 gears into the assembly machine!timingsCode: Select all
0eNq1V9uOmzAQ/RdLfYMVJiRcVPWln1GtkIFJYi0YZJt00xX/3rFJQtJAE+g2D1GI7TlzZs7MmA+SlS00kgtNkg/C81ookvz4IIrvBCvNf/rYAEkI11ARhwhWmacMGG4lnUO4KOCdJLR7dQgIzTWH3oJ9OKairTKQuOHPsw5paoXb8SeioIl45b+sHXLEvbG3flkb4wiqzLJqAAq3qou2BHdFEr/rnDsI/zFE8I8Qq3ksogUQwQWCiy0XuOTme1B6DGozQG16qNORVIHWXOwsrISqPkDa4lqpQUKRnjzaslLBmA/riw9Ks/zN5UKBxKMPfAitDwWXkPdbkAsGScu6TDPYswOvpTmXc5m3XKe4VlyMbblUOr3T3YFL3eI/g0d2h4lJ/mYEaCSrmdGvZx6qhkmmDQ75Rrp+XfT+2GBQ87WTAOJapbwgSeRcHDOPfvfajcVmM09lSyQQDmTbDMlZ2/cwfnwCoR5CCOC7fVa30pQf9V5H7EYXuwXkvADpYrwyLmy8RlIbDDTibjyVJ0NDKtWCXH6/zSOlfyTyK56oW920y/TRHNG9Vuh0K+sq5QLtDNp/Xh/UvxeIQ/zJ/esJAcUXV5lSUGUl1qlbsXzPhZHESB7CqzxYOWGBccuetbqurD5clXMQObgNFiy5UlwjUWzI72A6ySC8YMw16j2nvCCcVF44Jjw6r/tTuqBo6ND+meR6X4Hm+dMCp3RC4IOtT9C4AmMjHaQeRB6GvG5A9qFOyJcFWkfbU0rGbv9Yx87tejgI+4njdvI/01DpRD3Q1aJpcxLJ7bTBOSclNqTUWsII/kKz0RhoMAM0/CzQ9azZsawMNvNKLViCMQyos5SfLzTfAo6VWn89mbh/Ppgd7XlwDPfR5RUxqdRo0d3sRHne3UzLFpybkJyRJTb7HTDp/twDmICc2ZtWgpkzm+Cd5bo8kpt4jDGKZzAK/xMjnNDYAN2mZBrG6TDtlsCsV3/n43vzKmyJ+v1hmEGJ6pI4ZkCA3B2xiSC3Lcth7LZGz6DYGkjWbrd4bep7BVI9f0wzta9aydWbmUOwwyhry49oEMZ+uIl9L1qhf78BjqyTEg==
Edit:
On second thought, if we are limiting 2 inserters to 8 items ( gears and copper) to get 11.2 red / sec, would that increase the total inserter swing count? Going every 8.4 red / sec, we would still have 2 inserters going every 12 items.
Last edited by guitars11 on Wed Apr 12, 2023 11:57 pm, edited 1 time in total.
Re: UPS Optimization - Red Science (editor)
there are many players on the server who know how to optimize UPS: MadMojoMonkey, stevetrov, murphy, etc.
Re: UPS Optimization - Red Science (editor)
Could be two cycles. Just thinking loud. But NOT working due to the same reason: won't be fed if more than 2 packs are in store.
- one for the RS, putting 11,11,11,11,12 for the 4xPM modded assembler. Cycle time: 437 x 5. 437 is 8 production cycles producing 11.2 packs.
- one for copper plates / gears (putting 12 always to feed. Cycle time: 1.4x longer. That's the problem: different cycle times mean differ # of packs stored
I'd measure the 8 stack size copper/gears feed to see how it goes.
Re: UPS Optimization - Red Science (editor)
It became the ~same UPS, but much better material for perfect timing. Also now there is a chance to get rid of the final buffering pair.
Updated v4.2.2 with the timing and the 8 stacksize as suggested above.
Had to shift the cycle for half of the machines to avoid starving for gears. Cabling/signalling is not optimizied, this just a poc:
https://factoriobox.1au.us/map/info/dfb ... 83ace49e10
Performed 1000 updates in 1781.216 ms
Performed 1000 updates in 1802.885 ms
Performed 1000 updates in 1798.601 ms
Performed 1000 updates in 1772.629 ms
Performed 1000 updates in 1812.473 ms
Map benchmarked at 564 UPS
Re: UPS Optimization - Red Science (editor)
Nice! It seems that this build has better min and max times but generally around the same performance like you mentioned.Belter wrote: ↑Fri Apr 14, 2023 8:56 pmIt became the ~same UPS, but much better material for perfect timing. Also now there is a chance to get rid of the final buffering pair.
Updated v4.2.2 with the timing and the 8 stacksize as suggested above.
Had to shift the cycle for half of the machines to avoid starving for gears. Cabling/signalling is not optimizied, this just a poc:
https://factoriobox.1au.us/map/info/dfb ... 83ace49e10
Performed 1000 updates in 1781.216 ms
Performed 1000 updates in 1802.885 ms
Performed 1000 updates in 1798.601 ms
Performed 1000 updates in 1772.629 ms
Performed 1000 updates in 1812.473 ms
Map benchmarked at 564 UPS
Here is 4.2.2 timings:
avg: 1.063 ms, min: 0.444 ms, max: 4.676 ms
Performed 5000 updates in 5167.824 ms
avg: 1.034 ms, min: 0.427 ms, max: 4.813 ms
Performed 5000 updates in 5262.160 ms
avg: 1.052 ms, min: 0.430 ms, max: 4.886 ms
Performed 5000 updates in 5182.207 ms
avg: 1.036 ms, min: 0.424 ms, max: 4.774 ms
Performed 5000 updates in 5280.837 ms
avg: 1.056 ms, min: 0.451 ms, max: 4.915 ms
and 4.2.2-8t:
avg: 1.045 ms, min: 0.411 ms, max: 3.946 ms
Performed 5000 updates in 5241.203 ms
avg: 1.048 ms, min: 0.413 ms, max: 4.002 ms
Performed 5000 updates in 5241.626 ms
avg: 1.048 ms, min: 0.407 ms, max: 4.208 ms
Performed 5000 updates in 5206.899 ms
avg: 1.041 ms, min: 0.408 ms, max: 4.295 ms
Performed 5000 updates in 5270.347 ms
avg: 1.054 ms, min: 0.416 ms, max: 4.304 ms
Re: UPS Optimization - Red Science (editor)
Code: Select all
Red Science UPS Editor - guitars11 v3.zip - 864.400 ups
Red Science UPS Editor - guitars11 v4.zip - 1088.349 ups
Red Science UPS Editor - guitars11 v4.1.1.zip - 1092.822 ups
Red Science UPS Editor - guitars11 v4.2.zip - 1182.802 ups
Red Science UPS Editor - guitars11 v4.2.2.zip - 1223.043 ups
Red Science UPS Editor - guitars11 v4.2.7.zip - 1203.596 ups
Red Science UPS Editor - guitars11 v4.2.2-8t.zip - 1152.149 ups
Red Science UPS Edit - Belter v1.03 x100.zip - 883.548 ups
- Attachments
-
- report.csv
- (5.85 KiB) Downloaded 60 times