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.
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Thanks again for the discussion and suggestions! I've learned a lot here.

The updated blueprints are below:
- belt based w/minimal circuit controll to save UPS
- producing a full blue belt of plates, no gaps
- needs a full belt of ore (tested with a full belt, does not fully consume)
- 12 beacon 2xSM3 / 9 smelter 2xPM3 mininal setup - see calc
- UPS optimized smelter-> inserters: doing 8..11 swings. These make the ->smelter inserter working at 12 swing mode
- modular: can be scaled to up or down to have more belts
- two version (see 2/a and 2/b)

Room for improvements/variations for UPS opt:
- it might a bit better to use an on/off signal w/an additional comparator instead of the counter -> so entities connected to the empty signal are not calculated at all
- it is not measured that using filter inserter and controlling the filter is not better. Safe to assume that not per changelog mentioned in the thread
- using bots / dc (direct insertion) might get better UPS

1. The simple timer module required to be connected to the block once - anywhere it fits:
Smelter Timer.png
Smelter Timer.png (76.74 KiB) Viewed 7139 times


2/a. The OCD compatible compressed setup - 76 beacons:
Smelter Compr v5.2.png
Smelter Compr v5.2.png (913.79 KiB) Viewed 7139 times


2/b. The messed-up but smaller setup I created recently - 60 beacons required only but taller:
Smelterv5.8.png
Smelterv5.8.png (538.78 KiB) Viewed 7137 times
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

Here's a version with only medium electric poles, no substations (but also no lamps, sorry lol)

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

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

Post by ptx0 »

if you use the debug overlay you can see little red circles over entities that are sleeping. if an inserter has a stack of items in its hand and tries to dump onto a compressed belt, that inserter will stay awake.

it's best to ensure that the inserters only stay awake for as long as they need, which might mean not getting a fully compressed belt - and if it's compressed, don't add more output to it.
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

ptx0 wrote: Sat Jan 01, 2022 7:26 pm it's best to ensure that the inserters only stay awake for as long as they need, which might mean not getting a fully compressed belt - and if it's compressed, don't add more output to it.
Hm. How would you propose to achieve this while also ensuring a net gain in UPS? I'd speculate that adding more circuit conditions to check for belt density would only move the calculation the inserter is doing into the circuit network, and so there would not be much reason to expect any performance benefit. But I haven't tested this, and maybe there is a more efficient way?
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

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

Post by NotRexButCaesar »

causa-sui wrote: Mon Jan 03, 2022 3:03 am
ptx0 wrote: Sat Jan 01, 2022 7:26 pm it's best to ensure that the inserters only stay awake for as long as they need, which might mean not getting a fully compressed belt - and if it's compressed, don't add more output to it.
Hm. How would you propose to achieve this while also ensuring a net gain in UPS? I'd speculate that adding more circuit conditions to check for belt density would only move the calculation the inserter is doing into the circuit network, and so there would not be much reason to expect any performance benefit. But I haven't tested this, and maybe there is a more efficient way?
You could have a three belt segment buffer after each inserter to hold the 12 items.
You could also have all but the last machine clocked, then let the last machine back up and fill in the gaps: this would result in all the previous inserters emptying their hand contents quickly.
—Crevez, chiens, si vous n'étes pas contents!
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

NotRexButCaesar wrote: Mon Jan 03, 2022 3:24 am You could have a three belt segment buffer after each inserter to hold the 12 items.
You could also have all but the last machine clocked, then let the last machine back up and fill in the gaps: this would result in all the previous inserters emptying their hand contents quickly.
Do the blueprints in this thread not implement that already? Especially the bit about the last machine being unclocked. If not, could you give an example?
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

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

Post by NotRexButCaesar »

causa-sui wrote: Mon Jan 03, 2022 3:43 am Do the blueprints in this thread not implement that already?
Not really: you can see that the inserters empty one after the other, rather than all at once.
video
causa-sui wrote: Mon Jan 03, 2022 3:43 am Especially the bit about the last machine being unclocked. If not, could you give an example?
Here is an example of a (not UPS optimised) smelter that has all the inserters deactivate at the same time:
video
Attachments
same time.mp4
(5.28 MiB) Downloaded 148 times
2022-01-02 20-53-17.mp4
(3.53 MiB) Downloaded 143 times
—Crevez, chiens, si vous n'étes pas contents!
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

Thanks for the videos, but I was hoping for a blueprint string? It's not obvious how this is working.

I think that having (or even risking) a less than fully compressed output belt is unacceptable for a few reasons, but others here might disagree.
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Cool videos!

All inserters turned ON and OFF at the same time (same signal condition), but because sometimes they cannot dump ~11 items on the belt as items already there they turn off in different times. As you can see it that they can put items in the white belt gaps only (debug option "show transport line gaps"). On the second video this is really cool to see that they put all items right into the gaps - lucky(? :D ) layout, also a different, 8 beacon setup.

Probably It is possible to tune the condition to fire the inserters just in the right time for this setup as well, but I'm not sure if they would grab also the same amount of items from the smelter? For me it makes the setup more fragile, and yes, a full saurated output belt is the main priority (for me at least).

Improvements - w/blueprint plz - always welcome!
Last edited by Belter on Tue Jan 04, 2022 10:39 pm, edited 1 time in total.
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

causa-sui wrote: Sat Jan 01, 2022 6:30 am Here's a version with only medium electric poles, no substations (but also no lamps, sorry lol)
Honestly it looks way better, thank you! I like your lane change mod as well.

I've made the following minor changes:
- was able to save 2 poles and 2 underground belts at the end
- lamps are back of course :)
- edit: added pole w/green wire down to allow tiling
- edit: also BP for the controller - one needed per smelting block to the 1st smelter from left

Block:


Controller:
Attachments
Smelter-v5.93.png
Smelter-v5.93.png (512.31 KiB) Viewed 6816 times
Smelter Timer to v5.9.png
Smelter Timer to v5.9.png (165.87 KiB) Viewed 6823 times
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

I've re-used the ideas here to a steel smelter setup, TY again for all!

See viewtopic.php?f=193&t=101147
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

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

Post by NotRexButCaesar »

Belter wrote: Tue Jan 04, 2022 9:36 pm On the second video this is really cool to see that they put all items right into the gaps - lucky(? :D ) layout, also a different, 8 beacon setup.
What I did was move the inserters over a few tiles so that their drop location matched the gap location, but it would be possible to do something similar with circuit conditions also. It was just for demonstrating the idea.
Belter wrote: Tue Jan 04, 2022 9:36 pm Probably It is possible to tune the condition to fire the inserters just in the right time for this setup as well, but I'm not sure if they would grab also the same amount of items from the smelter?
As long as the interval between inserter pickups is the same, they will always grab the same items.
—Crevez, chiens, si vous n'étes pas contents!
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Edit: if two combinators is OK for you, see the my next post, no buffering and also no 2^32 craziness there..

Well, you're right. I was able to achieve this (inserters not waiting) after _some_ calculations, but delaying the inserters instead of moving them.

TL;DR the result:
- Cycle time to activate the inserters is 128 ticks
- Inserters need to be delayed by 32 ticks after each other (the 4 inserters feeding each lane)
- we keep the 9th inserter to fill the remaining gaps as before

Details:

Per Factorio wiki a staight belt:
- has a speed of 24 pos/tick (if blue)
- has 256 position per tile
- can hold 4 item on both lanes
So one item takes 64 position on a lane and travels 5.625 tiles/sec.

Cycle calculation:
- Let's plan for a belt segment where all 4 inserters have a slot for 12 items!
- I know that 12 items won't be placed: smelter is not fast enough for that.
- It would mean 4 smelters would be enough for a full blue belt lane. The real number is 4.48. We end up at 10...11 swings
- which is good enough for UPS optimization - instead of 1- and we ensured that the 4 smelters are always emptied
- So we're planning 12 items for each of the 4 inserters: it is 12x4=48 items, which is 48*64=3072 positions long on the belt
- This takes 3072/24=128 ticks on a blue belt to pass. This is our cycle time.
- As the counter is a signed 32 bit integer starting from 0 and overflowing to negative numbers we need a 2^32 / 128 = 33,554,432 increment/tick. The good news is that we always come back to exaclty zero as 128 is 2^7 so the inserter condition can be "="!
- We increment the counter at each tick by this number and will get a cycle of 128 ticks

Delay calculation:
- To address the "insterters are waiting as they don't have space to put the items on the belt" problem, they must work in sync, delayed compared to each other.
- The current blueprint has 6 tiles/smelter. As we calc with 12 items: 12 items takes 3 tiles, so we need 3 tiles delay which gives a 3*256/24=32 ticks delay.
- This way the inserters are always timed to an empty part of the lane.
- The four insterters need to be delayed by 0, 32, 64 and 96 ticks, 32 ticks from each other.
- To calulate the delay we need to multiply 0, 32, 64, 96 by the increment/tick value (33.5M).
- Considering the overflow (if the number is greater than 2^31 decrease it by 2^32) we end up at these numbers: 0, 1073741824, -2147483648, -1073741824.

I've also timed the last two insertes (0 and 64 ticks delay) to minize their swing.

The final blueprint looks the same as the prev versions but these magic numbers are set to the combinator (the increment) and to the inserters (delay).
Works as designed expected! The last smelter has to fix small gaps only and overproduces as expected (9 vs 8.96 smelters) after a while, filling the buffer belts on the right side. The other 8 smelter are running 100%.

Would be nice to measure the performance of this setup compared to a robot based one - just passed the 1700% productivity for the miners... :geek:

Controller row - one per block needed (with combinator)


Normal row - attach to a block with one controller row
Attachments
Smelter-v5.98.png
Smelter-v5.98.png (757.79 KiB) Viewed 6681 times
CycleDelayCalc.png
CycleDelayCalc.png (13.3 KiB) Viewed 6681 times
DelayCalc.png
DelayCalc.png (7.72 KiB) Viewed 6682 times
Last edited by Belter on Sat Jan 08, 2022 11:47 pm, edited 3 times in total.
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

Belter v6.36: It is possible to put the plates at the right place on the belt, no buffering!
- Cycle is 144 ticks
- Using a counter sign going 0..143 - needs two combinators as 144 is not 2^N
- All smelters are overproducing by 0.5% so after a while all will be full
- All inserters are always swinging the minimum and grabbing 12 plates, except the middle two (those are doing 2 x 6 plates)

Unless there will be a game-changer comment ( :D ), this is final now. The most UPS friendly full belt producing smelting I can do with belts and inserters.

Version history:
- v6.0: created after the discussion here
- v6.31: 1 combinator replaced to a constant combinator - thx NotRexButCaesar
- v6.32: changed to a single BP, fixed the messed up inserter settings - thx Causa-sui
- v6.36: optimized/polished: saved 4 poles, 2 undergroung and 2 normal belts in total for the 2 lane BP


The output belt is full, it is a bit mesmerizing to watch the insterters putting the right amount to the right spot...

Details:

Cycle calculation must be done from the supply side now. A fully beaconed smelter can do 12 plates in 143.3 ticks:
- crafting time is 3.2 sec
- crafting speed is 2 * (100% + 600% -30%) = 13.4
- time required to craft one plate: 13.4/3.2*60 = 14.33 ticks
- crafting 10x is 143.3 ticks
- due to prod bonus it will make 10 * 120% = 12 plates - the number we're looking for the plate inserters
- so cycle time is 144 (which means 100.5% overproduction) - we give a little bit more time for the smelter, so slowly it will be full with 100 plates
- in 144 cycles the blue belt moves 144*24=3456 positions which is 3456/64=54 plates
- to put 54 plates you need 52/12=4.5 inserters and smelters
- 4.5 per lane matches the 9 smelter setup calc - we're cool just have to split the output of one smelter to both lanes
- the ore inserters are optimizing themselves, no need to time them

The offsets (delays) for the inserters can be calculated also using belt speed, 12 items length and inserter distance
- First 4.5 smelters: 0, 33. 66, 99, 142 (132-10 due to different place of the inserter)
- Second 4.5 smelters: 60 (to be on the other side of the cycle than 132: 132+144/2 ), 83 (-10 due to different place of the prev inserter), 116, 5, 38

Copy the bottom row+pole (needed to connect the green wire) for more lanes to south or north. The 1st row has the controller circuit. one is needed per block:
Attachments
Smelt-v6.36.png
Smelt-v6.36.png (883.91 KiB) Viewed 6255 times
Last edited by Belter on Sun Feb 06, 2022 10:56 am, edited 15 times in total.
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

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

Post by NotRexButCaesar »

Belter wrote: Sat Jan 08, 2022 11:01 pm Unless there will be a game-changer comment ( :D ), this is final now. The most UPS friendly full belt producing smelting I can do with belts and inserters.
You can use a constant combinator instead of an arithmetic combinator to add one to the clock (I am not sure whether that counts as a game-changer):

Belter wrote: Sat Jan 08, 2022 11:01 pm The offsets (delays) for the inserters can be calculated also using belt speed, 12 items length and inserter distance. For some reason instead of the calculated 32 ticks I had to use 33. Also for the middle smelter where the distance is different, I've used 10 ticks adjustment (it is 10.66 per calc). I've ended up with these delays, all in ticks:

First 4.5 smelters:
0, 33. 66, 99, 132 (132-10 due to different place of the inserter)
Second 4.5 smelters:
60 (to be on the other side of the cycle than 132: 132+144/2 ), 83 (-10 due to different place of the prev inserter), 116, 5, 38
I think that you have to add an extra tick for underground belts: on normal belts, the items are 'pushed back' a small distance before the inserter.
—Crevez, chiens, si vous n'étes pas contents!
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

NotRexButCaesar wrote: Sun Jan 09, 2022 3:54 am You can use a constant combinator instead of an arithmetic combinator to add one to the clock (I am not sure whether that counts as a game-changer):
It does: If it makes it simpler then its better, updated! Also used this for my timed steel monster..
NotRexButCaesar wrote: Sun Jan 09, 2022 3:54 am I think that you have to add an extra tick for underground belts: on normal belts, the items are 'pushed back' a small distance before the inserter.
I did not know that, thank you.
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

Why include the timer mechanism inside the smelter? Is there any penalty associated with using a single clock attached to a global circuit network?

Edit: The signals are inconsistent between the rows in the last version posted. Here's what I suggest:



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.

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.
causa-sui
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Sat Sep 12, 2020 4:23 am
Contact:

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

Post by causa-sui »

Did some benchmarks vs Nilaus' masterclass BPs.

Code: Select all

./factorio --benchmark /home/ryan/.factorio/saves/nilaus_iron.zip --benchmark-ticks 50000 --benchmark-runs 3 --benchmark-sanitize
  Performed 50000 updates in 10907.461 ms
  avg: 0.218 ms, min: 0.123 ms, max: 6.183 ms
  checksum: 473089710
  Performed 50000 updates in 10212.555 ms
  avg: 0.204 ms, min: 0.121 ms, max: 5.268 ms
  checksum: 473089710
  Performed 50000 updates in 11055.846 ms
  avg: 0.221 ms, min: 0.121 ms, max: 5.982 ms
  checksum: 473089710

Code: Select all

./factorio --benchmark /home/ryan/.factorio/saves/belter_iron.zip --benchmark-ticks 50000 --benchmark-runs 3 --benchmark-sanitize
  Performed 50000 updates in 8224.258 ms
  avg: 0.164 ms, min: 0.101 ms, max: 3.335 ms
  checksum: 1370178062
  Performed 50000 updates in 8417.586 ms
  avg: 0.168 ms, min: 0.102 ms, max: 3.593 ms
  checksum: 1370178062
  Performed 50000 updates in 9126.188 ms
  avg: 0.183 ms, min: 0.103 ms, max: 4.216 ms
  checksum: 1370178062
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

causa-sui wrote: Wed Jan 12, 2022 3:27 am Edit: The signals are inconsistent between the rows in the last version posted. Here's what I suggest:
Yep, my bad. Fixed in my orignal post, thank you for pointing out!
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.
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.
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..
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!
Last edited by Belter on Sat Jan 15, 2022 1:02 pm, edited 3 times in total.
Belter
Fast Inserter
Fast Inserter
Posts: 207
Joined: Sun Mar 14, 2021 12:38 pm
Contact:

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

Post by Belter »

causa-sui wrote: Wed Jan 12, 2022 4:54 am Did some benchmarks vs Nilaus' masterclass BPs.
This is very cool, thank you. Looks v6 is the most UPS optimized solution for smelting then!
Post Reply

Return to “Combinator Creations”