Energy Optimization with Red Inserters

Post pictures and videos of your factories.
If possible, please post also the blueprints/maps of your creations!
For art/design etc. you can go to Fan Art.

GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Energy Optimization with Red Inserters

Post by GregFirehawk »

Recently while doing some math I came across the fact that Red Inserters are slightly better than all other inserters in the game in terms of energy efficiency.

Here is the calculation for reference:

Energy Cost per Inserter Rotation:
(Max Power Consumption - Drain) / (Rotation Speed / Full Rotation Constant) = kJ per Inserter Rotation

(15.1kW - 400W) / (302 / 360)/s = ~17.523 kJ
(21.4kW - 400W) / (432 / 360)/s = 17.5 kJ
(59.3kW - 500W) / (864 / 360)/s = 24.5 kJ
(169kW - 1kW) / (864 / 360)/s = 70kJ


These are Yellow, Red, Blue, and Green Inserters respectively, in order of increasing cost.

Notice how Yellow Inserters and Red Inserters are almost identical in price at ~17.5kJ, but Red Inserters are 17.5kJ exactly, while Yellow Inserters are an extra 23J. And that number is actually rounded to the nearest whole number, as there are quite a few more decimal places.

For accurate comparison with Green Inserters, we need to account for stack size, using the following math:

Energy Cost per Item Transfer:
kJ per Inserter Rotation / Stack Size

Default
(15.1kW - 400W) / (302 / 360)/s / 1 = ~17.523 kJ
(21.4kW - 400W) / (432 / 360)/s / 1 = 17.5 kJ
(59.3kW - 500W) / (864 / 360)/s / 1 = 24.5 kJ
(169kW - 1kW) / (864 / 360)/s / 2 = 35.5 kJ


Capacity Bonus 2
(15.1kW - 400W) / (302 / 360)/s / 2 = ~8.762 kJ
(21.4kW - 400W) / (432 / 360)/s / 2 = 8.75 kJ
(59.3kW - 500W) / (864 / 360)/s / 2 = 12.25 kJ
(169kW - 1kW) / (864 / 360)/s / 4 = 17.75 kJ


Capacity Bonus 7
(15.1kW - 400W) / (302 / 360)/s / 3 = ~5.841 kJ
(21.4kW - 400W) / (432 / 360)/s / 3 = ~5.833 kJ
(59.3kW - 500W) / (864 / 360)/s / 3 = ~8.167 kJ
(169kW - 1kW) / (864 / 360)/s / 12 = ~5.833 kJ


These are the energy costs at the 3 milestones of capacity research. Note that at the endgame a Green Inserter that is fully utilized will be just as energy efficient per item as a Red Inserter. This means the only difference between them is the effective drain. Given that a Green Inserter spins twice as fast as a red one, and has a stack size of 4 times as much, that means its effective throughput is 8 times as much, while only 2.5 times as much Drain. This makes them 3.2 times as efficient as Red Inserters, but only when used at max throughput. This kind of comparison cannot be achieved in other conditions as the per item costs differ and therefore do not cancel out. This means we need to convert our drain from watts into per item units of joules, which requires a predetermined throughput. As such this cannot be generalized, and must be done on a case by case basis with reference to a pre determined design.

More Data on Green Inserters:
(169kW - 1kW) / (864 / 360)/s / 2 = 35.5 kJ
(169kW - 1kW) / (864 / 360)/s / 3 = ~23.3 kJ
(169kW - 1kW) / (864 / 360)/s / 4 = 17.75 kJ
(169kW - 1kW) / (864 / 360)/s / 5 = 14 kJ
(169kW - 1kW) / (864 / 360)/s / 6 = ~11.667 kJ
(169kW - 1kW) / (864 / 360)/s / 7 = 10 kJ
(169kW - 1kW) / (864 / 360)/s / 8 = 8.75 kJ
(169kW - 1kW) / (864 / 360)/s / 9 = ~7.778 kJ
(169kW - 1kW) / (864 / 360)/s / 10 = 7 kJ
(169kW - 1kW) / (864 / 360)/s / 11 = ~6.364 kJ
(169kW - 1kW) / (864 / 360)/s / 12 = ~5.833 kJ


Looking at the additional data, we can see Green Inserters and Red Inserters also align at a stack size of 8. This means that between unlocking Capacity Bonus 5 and Capacity Bonus 7, Green Inserters actually become superior to Red Inserters.

Lets now discuss the practical takeaways of this data. Firstly we can establish that Red Inserters are in all contexts superior to Yellow Inserters. They spin faster, transfer more item/s, and do so using slightly less energy. This means replacing Yellow Inserters with Red Inserters where feasible is always advantageous by all metrics except for construction cost or upfront expense. Keep in mind though that this saving is recurring with every spin of the Inserter, so given enough time it will recuperate those additional expenses and become profitable. The exact amount of time can be calculated like so:

Cost of change in J / ((15.1kW - 400W) / (302 / 360)/s) - ((21.4kW - 400W) / (432 / 360)/s) = Number of Spins to break even

To translate spins into time, we can use a utilization formula. To avoid redundant calculations, we will be utilizing the throughput data on the wiki https://wiki.factorio.com/inserters. Take the following equation and apply it to your use case:

(Items transferred per second / Max throughput of Inserter) * (Rotation Speed / Full Rotation Constant) = Spins per second averaged

then obviously

Number of spins to break even / Spins per second = Time

Notice I have left the cost of implementing this change as an open variable, as that will also need to be calculated for your design case, and it is also determined by your supply chain. The way to make this calculation is first determine the difference in build cost in terms of raw resources like Plates. A single belt for example costs 3 plates. We will assume fabrication is free for the sake of simplicity, as though it were hand crafted. So the formula for the price of a plate would be:

Cost of mining + Cost of Smelting + Cost of transferring Plate in and out of Furnace via Inserter = Energy Cost of Plate

Steel would be a similar equation:

Energy Cost of Plate + Cost of Smelting + Cost of transferring in and out of Furnace = Energy Cost of Steel

So using the resource cost of the difference in designs we can arrive at an energy cost, and then calculate the time it will take for us to recover that much energy in savings. I would like to share a reference table of some reference costs, but that goes beyond the scope of this topic so I will save that for a separate post.

Since you are already calculating your design costs, now would be a good time to revisit what I said earlier about reintroducing drain into our calculations. Since you have a fixed design, you have a fixed throughput of goods through your inserters, and can use our utilization equation from earlier to confirm which inserter would be optimal for your use case.

Regardless to say, given enough time Red Inserters will always profit over their yellow counterpart, and that should be the primary takeaway from this topic.

Another thing worth mentioning is that Blue Inserters should be generally avoided, as they are generally inefficient by every metric when compared to Yellow and Red Inserters. Even when compared to Green Inserters, we can see that after you unlock a Stack Size of 6, Green Inserters overtake them in efficiency, assuming the full stack size is utilized. 2 Red Inserters can match the throughput of 1 Blue Inserter, with a drain penalty of 300W. Given that we are consistently saving several kJ with each rotation though, and with both inserters rotating well over once per second, the 300W penalty is insignificant when compared to the energy savings. This means Blue Inserters should only be used in specific scenarios where less than 14.4 items/s of throughput is required, and equivalent throughput cannot be achieved through a combination of lesser Inserters. Once throughput requirements through a set of Blue Inserters exceed 14.4 items/s in total, they should be replaced with a Green Inserter. What this effectively means is that after Capacity Bonus 7 you should never use 3 or more Blue Inserters on a single machine ever, and should always upgrade to a Green Inserter at that point.

Lastly, just for fun, I've included some information for the Burner Inserter:

Burner Inserter Data:
144kW / (281 / 360)/s = ~184.484 kJ

As most people have probably figured out already, Burner Inserters should only ever be used in extremely low throughput situations. The following equation describes the comparison between Burner Inserters and Electric Inserters:

(Cost of Spin A - Cost of Spin B) / Drain = Spin Threshold

In practice:
~184.5kJ - ~17.5kJ = 167 kJ
167kJ / 400W = 417.5 seconds
or ~7 minutes

So for any use case where the Inserter is making more than one spin every 7 minutes on average, these Inserters should be avoided like the plague. This leaves them only practical for kickstarting steam engines via circuit control in the event of an outage, or for odd tasks like shoving ammo into turrets occasionally. The most interesting potential use case for these would for manufacturing low demand items in your mall for your personal use. Keep in mind these inserters also benefit from stack bonus like the rest, so you would divide the above number by your stack size for a proper energy calculation.

Also interesting to note at the time of writing this I learned two new facts. Firstly, Burner Inserters were apparently changed in 2.0. If it wasn't for me remembering the number as being closer to 3 minutes rather than 7, I would not have noticed, which just goes to show how often I use them. Here is the old cost calculation for comparison:

94.2kW / (281 / 360)/s = ~103.183 kJ
(~103.2kJ - 17.5kJ) / 400W = ~214.2 seconds
or ~3.5 minutes

So apparently they are twice as bad now :lol:

As for the second fact I mentioned, after looking at the wiki page here https://wiki.factorio.com/Burner_inserter it seems to be very badly maintained. For one thing they claim the cost per spin as 70 kJ, when we have just calculated that that is in fact less than half the actual number, and still significantly less than even the old number. Also the reason I visited the page is the first place was to clarify whether the Burner Inserter Fueling itself counted towards its energy consumption, so we could factor that into our calculation if true. My guess is it doesn't because it does not require spinning to do so, and energy seems to be defined in spins, but this information is completely missing from the page so I'm unable to confirm or deny this.

Before wrapping up I just wanted to add some of the values from earlier using the burner equation I just introduced. When using 2 Red Inserters to replace 1 Blue Inserter for example, this is an equivalent equation to the one above, which we apply like so:

Difference in energy cost per item transfer / Difference in Drain = Item Threshold

As you can the the energy cost from spins has been replaced with energy cost per item, and as the total spin speed of the two options is identical they cancel out, leaving us with the equation above. Putting it into practice:

(17.5kJ - 24.5kJ) / 300W = ~23.3 seconds

So as long as we are moving at least 1 item every 70 seconds using 2 Red Inserters will always beat 1 Blue Inserter. We can invert this fraction for items/s, which would be ~0.043. Obviously since we needed a second Red Inserter, we know that at a minimum we are moving at least 1.2 items per second, so there is no mathematical scenario where it is not profitable. This equation can be used to continue checking other variations. Also to clarify, the above calculation is made using the default spin values we originally referenced, for a stack size of 1. As you have probably caught on by now, these savings are affected by stack size. In the above equation, the stack size multiplier would be added to the denominator. This is just as with the Burner Inserter, except in this example it is actually working against us rather than in our favor. Where as the burner became more efficient each time due to how the equation was balanced, here we can see that as we divide the our values we are actually diminishing our energy savings. This is still a moot point in the above example, but perhaps possibly there is some combination of inserters you can put into this equation that makes that significant, though given there is an order of magnitude difference between the units of savings and the units of expenses I find it unlikely.

3 Yellow Inserters Replacing 1 Blue Inserter:
(~17.5kJ - 24.5kJ) / 700W = 10 seconds or 0.1 items/s

Also before I forget, here is one possible example of how you might choose to implement this in your factory for a visual reference
asd.png
asd.png (650.84 KiB) Viewed 1395 times
That is all for now. Hopefully this information was interesting and thought provoking. Please feel free to add any observations you found interesting from the data. I apologize if there are any mistakes or if the logic doesn't flow well, I was quite distracted as I was chipping away at this. I am considering sharing more such calculations on various optimizations regarding energy and pollution if people are interested, perhaps in a video format. Any feedback is appreciated.

Also please, please, please, help me get this documented on the wiki. Information regarding energy based optimizations like this as well as pollution calculations is severely lacking. This information would go beautifully right here https://wiki.factorio.com/inserters#Power_usage in that worthless section with three useless sentences in it. We can put some nice tables there like we did for the throughput, and make this data easily available

TL;DR: You should replace all your inserters with the red long armed ones, its more power efficient.

Update:
For clarity I've decided to add the following equation:

(Desired Items per second * Energy Cost difference) - Drain Difference = Power Savings

What this means is that by simply plugging in the energy saving per item in kJ we calculated originally, and then multiplying that by the number of items we know we will want to load into our destination per second, we end up in terms of joules per second, which means our output number will once again be in watts. Now we can reintroduce drain by comparing the difference between how many Inserters of type A we would need vs type B, and subtracting the corresponding drain from our savings in items moved. That now gives us a total net savings in kW. This equation should be much simpler to apply in practice than the alternative I provided before
Last edited by GregFirehawk on Wed Dec 18, 2024 2:25 am, edited 1 time in total.
jaylawl
Fast Inserter
Fast Inserter
Posts: 175
Joined: Sat Nov 23, 2024 10:14 am
Contact:

Re: Energy Optimization with Red Inserters

Post by jaylawl »

I would love to add your findings to the wiki for you, but i don't have the brainpower to fully comprehend your massive analysis (very interesting btw!) :lol:

Since you've already come this far anyway, why not make a wiki account yourself? It is a simple process and you seem to be just the right guy to expand that page with your newfound information.
eugenekay
Fast Inserter
Fast Inserter
Posts: 165
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Energy Optimization with Red Inserters

Post by eugenekay »

I like the math here; this is really neat to see it worked-out properly.

However, If the Energy Efficiency of Inserters is a serious concern for your factory, maybe it is time to invest in a slightly larger power plant? :-D I don’t think I have ever seen Inserters occupy even a Percentage of my Electric network demands.
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

eugenekay wrote: Tue Dec 17, 2024 11:59 pm I like the math here; this is really neat to see it worked-out properly.

However, If the Energy Efficiency of Inserters is a serious concern for your factory, maybe it is time to invest in a slightly larger power plant? :-D I don’t think I have ever seen Inserters occupy even a Percentage of my Electric network demands.
lol, the difference isn't much but it can add up quite more than you'd expect actually.

The difference between 2 Red Inserter and 1 Blue Inserters is 7kJ per spin. And they spin 1.2 times a second at max throughput. So in watts that's a saving of 8.4kw for every time you make that change. Do that roughly ~107 times and that's an entire steam engine worth of power being saved just by using different Inserters. So assuming you are around the red or blue science stage of the game, this could actually net you whole percentile differences in your power grid.

Remember you have hundreds and hundreds of Inserters, and you can get into the purple and yellow sciences with just like 40 steam engines or so. That would make this potentially a multi percentile difference at scale.

To cherry pick an example, imagine we are fabricating stone walls in a tier 2 assembler, and we haven't unlocked capacity bonus 2 yet. That is 7.5 items/s, meaning by using 3 red Inserters instead of 2 Blue Inserters we are saving 52.5kW on feeding that machine, minus the drain difference of 200W, making it 52.3kW of saving. The entire machine only uses 155kW, so this one change is a huge difference in power consumption in that one spot. This also doesn't account for efficiency modules. If you put 2 efficiency 1 modules in the machine, you'll now be saving 52.3kW on a machine that only uses 65kW. Not considering Inserters could potentially cost you more in electricity than the actual machine itself. Now imagine these kind of things adding up all over your factory one after the other, with the hundreds and hundreds of assemblers and Inserters. It can become significant. I see a lot of people who just spam blue Inserters everywhere for convenience, and that can get expensive quickly.

Now this is not an insurmountable expense or anything, we could just scale up our power grid a bit and brute force our way through it. But that costs more, and why play harder when you can play smarter.

I apologize the math was not as crisp this time around. I really did not want to put in that level of work again so soon l

Edit: I have realized that in order for my stone wall example to work we actually would need capacity bonus 2, so the actual power savings are less than I described in the math. I don't feel like correcting it because it's just a napkin example but keep in mind that those numbers need to be adjusted. Thankfully I provided all the equations I use so anyone really curious can always easily correct it themselves
Last edited by GregFirehawk on Wed Dec 18, 2024 9:18 am, edited 1 time in total.
eugenekay
Fast Inserter
Fast Inserter
Posts: 165
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Energy Optimization with Red Inserters

Post by eugenekay »

GregFirehawk wrote: Wed Dec 18, 2024 1:57 amRemember you have hundreds and hundreds of Inserters, and you can get into the purple and yellow sciences with just like 40 steam engines or so. That would make this potentially a multi percentile difference at scale.
There are many ways to build a Factory. :-) I rarely use Efficiency modules, but Gleba is teaching me to consider them.

I try to minimize the Number of Inserters and Transport Belts in my “large factories”, because of the cumulative effects upon update-time (aka UPS) that comes from tens of thousands of active entities. Instead, I try to use Lots of Beacons (to make the machines as fast as possible), and direct-insertion from Train Wagons to machines & back. The net effect of this is that I use several Gigawatts of power, even while idle.
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

Well met fellow inserter energy efficiency nut.

The "max consumption" reported for inserters is an upper bound for power usage rather than a steady draw. Actually the 15.1kW seems to be a short spike when picking up or dropping an item in a box. During the swing, which is most of the time during sustained item movement, the power usage is more like 4.6kW. Average power over time seems to be 6.1kW. Multiplying the average, rather than max, by the round trip time would give the energy used per item.

Yellow inserter average power for box to box seems to be about 6.1kW
Red inserter average power for box to box seems to be about 8.8kW

I tried to get round trip time from the wiki. There are 2 sets of data for this. They agree for red inserter.

Yellow inserter round trip time according to the "inserter speed" section is 72 ticks = 1.2s
Yellow inserter round trip time according to the "throughput section (1.1 experimental)" section is 1 / 0.83 items/s = 1.2048s
Both sections agree on the red inserter round trip time = 0.83333s (50 ticks)

Red inserter work per item = 7.333 kJ
Yellow inserter work per item = 7.320 kJ or 7.349 kJ depending on the data used

A better comparison might be to look at the power draw for each of the 50 or 72 ticks instead of eyeballing the dang power graph

Anyway the "max consumption" wildly overestimates the actual energy used. But does provide an upper bound.
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

evanrinehart wrote: Wed Dec 18, 2024 5:22 am Well met fellow inserter energy efficiency nut.

The "max consumption" reported for inserters is an upper bound for power usage rather than a steady draw. Actually the 15.1kW seems to be a short spike when picking up or dropping an item in a box. During the swing, which is most of the time during sustained item movement, the power usage is more like 4.6kW. Average power over time seems to be 6.1kW. Multiplying the average, rather than max, by the round trip time would give the energy used per item.

Yellow inserter average power for box to box seems to be about 6.1kW
Red inserter average power for box to box seems to be about 8.8kW

I tried to get round trip time from the wiki. There are 2 sets of data for this. They agree for red inserter.

Yellow inserter round trip time according to the "inserter speed" section is 72 ticks = 1.2s
Yellow inserter round trip time according to the "throughput section (1.1 experimental)" section is 1 / 0.83 items/s = 1.2048s
Both sections agree on the red inserter round trip time = 0.83333s (50 ticks)

Red inserter work per item = 7.333 kJ
Yellow inserter work per item = 7.320 kJ or 7.349 kJ depending on the data used

A better comparison might be to look at the power draw for each of the 50 or 72 ticks instead of eyeballing the dang power graph

Anyway the "max consumption" wildly overestimates the actual energy used. But does provide an upper bound.
This is a fascinating point. The idea that inserters don't use power in a steady fashion during movement never occured to me as even a possibility when I sat down to calculate. I guess this would need to be tested to collect proper data if that's true. Honestly I would probably take this is as good enough as long as the ratios between power consumption remain the same, but the estimate you provided suggests that it's not clear whether red or yellow Inserters have the advantage, and which is best is critical information for the persnickety blueprinter like myself. Thanks for sharing this insight

Edit: In hindsight I think I actually knew this and just forgot completely. I've opened the power panel dozens of time so surely I'd have seen that waveform at least once, yet I didn't even think to consider it
Last edited by GregFirehawk on Wed Dec 18, 2024 6:59 pm, edited 1 time in total.
Sutoraika
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Jan 31, 2015 2:03 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by Sutoraika »

i do really love things like this, in what other game will people be calculating the specific power draw from variations of the same item.
jdrexler75
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Sat Nov 28, 2020 5:27 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by jdrexler75 »

evanrinehart wrote: Wed Dec 18, 2024 5:22 am A better comparison might be to look at the power draw for each of the 50 or 72 ticks instead of eyeballing the dang power graph
To measure this I would set up an accumulator, charge it and then separate it from the grid. Then count how many items each inserter can transfer using that charge until it's empty. (And for average power usage also measure the total time.) That would probably give the most relevant result, I should think. It will probably differ greatly when transferring between chests, or belts, especially for bulk inserters.
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

This post is old but has two things to obsess over.

viewtopic.php?t=49697

North-south and east-west aligned inserters might have slightly different power usage. Maybe because of different swing length. Which leads into the second point.

They observe that if you factor out the drain then the inserters (of the same type?) seem to use the same amount of energy "per cycle", regardless of details during the swing. This corroborates what little is mentioned on the wiki about inserter power draw. Would be cool to back it up with a more recent and detailed analysis. Though how that would fit with the pulsing heartbeat power graph isn't clear to me.

Edit: It occurs to me that the accumulator experiment idea might be able to observe the "fixed energy per cycle" effect, if it exists. I will try it at some point.
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

I've devised a practical test. Once I sat down to do it it was actually shockingly easy, Probably more so than the math itself, which makes me feel a bit silly for doing all those calculations yesterday.

First we ran a test with a stack size of 1 for each Inserter, moving chest to chest as full throughput. Here is the power graph data from the games menu
power 5s.png
power 5s.png (66.08 KiB) Viewed 1126 times
power 10m.png
power 10m.png (64.4 KiB) Viewed 1126 times
Notice how the inserters do exhibit a wave like function as someone suggested before. Looking back I think I actually did know this at one point as I'd have surely seen this in the games power graph before, but for whatever reason it slipped my mind completely as a factor when doing the math earlier, and as such I ended up making myself look silly, on top of already feeling that way from just earlier. I chalk this up to not having played the game for a long time and only coming back recently to enjoy Space Age, but those are just excuses. Today is all about getting accurate data and fixing our hypothesis from before, so lets focus on that.

Looking at the power graph we can see that thankfully the game does provide us an average but its not very accurate. and it isn't perfectly stable either, with the last decimal fluctuating slightly on some of these, and all the numbers are rounded to only the nearest 100W. This is a problem because the theoretical saving between a yellow and red inserter per swing is only 24J, which means this isn't really an appropriate level of detail. Still the game refuses to provide more precise data than this by default. Thus I devised the following test setup
pulse finder.png
pulse finder.png (649.02 KiB) Viewed 1126 times
The test is initialized by the decider in the top right, which controls our GO signal. By switching the output from input count to 1, it will enable the test. It will then cutoff our GO signal after the inserter has picked up 1 rotation worth of plates. We will be using a stack size of 1 to start. Below is the finding for the Red Inserter
red pulse.png
red pulse.png (29.78 KiB) Viewed 1126 times

The curve or spike on the left is the inserter powering up and uncurling itself. This is something only exhibited the very first time an inserter is powered, and never again. Even if it was disconnected and reconnected, it will never repeat this behavior. Its purely for virgin inserters ;). After that we see the actual waveform for one cycle. Note there is a spike whenever the item enters and leaves the inserter, and then there is a valley when it is moving. So we have pick up, turn around, put down, turn back to reset. The spikes technically have a mild curve, but they are effectively a square wave so we will be ignoring that.

Looking at our timer, it has in theory measured the exact duration of a spike. My timer reads 3 ticks, but the timer has a delay of 2 ticks that need to be subtracted from the final result for each time the GO signal is toggled off, meaning if this is correct our spike is effectively just 1 tick. By running another spin through our timer, we find a result of 51 ticks. Because the timer counts the time of loading the plate for its disable condition, there is one tick extra, meaning a spin is exactly 50 ticks. 1 second is 60 in game ticks, so doing the math we find this is perfectly in line with what we would expect from our stated speed of 432 deg/s.

So what this means is that our tester works, and we now know how to calculate our new power draw from each inserter as an average, as well as our total energy cost in joules, and we can update the original formula

New Energy Cost per Inserter Rotation:
((Max Power Consumption - Drain) * (2 /seconds per tick)) + ((Power Consumption of Motion - Drain) * ((Full Rotation Constant / Rotation Speed) - (2 / seconds per tick))) = kJ per Inserter Rotation

The equation ends up a bit ugly because we need to keep converting between ticks and seconds. If I've written that correctly it should be taking the the length of the spin in ticks, multiplying it by the power cost of the actual motion of the inserter (so the valley on the graph) and swapping two of the ticks with the peak value to account for the spikes. This equation can technically be used as is if you just want to estimate based on the graph number, but since we are striving for accuracy lets see if we can collect more data. Ideally we would isolate the cost of loading the item separate from the cost of the spin, and implement that as its own constant like drain. To do this we would need accurate data for the spin power draw though, so it all circles back to more data.

This time I have isolated our setup with a single accumulator connected to a power switch. The switch is set to disconnect and isolate the grid when the GO signal is activated. We will run the test without a stop condition until it has exhausted the full 5 MJ of power in the accumulator. The testing setup also contains 9 deciders, and each consumes 1kw, so we will need to remember to compensate for that in our final result. This left us with a final time of 4 minutes, 40 seconds, and 53 ticks. Thats 16,853 converted into ticks, and since we know red inserters spin once every 50 ticks, that means we did a total of 337.06 Spins. This perfectly matches the visual state of the test as well, and lines up with our item counter, so we can be assured this is accurate. Now to calculate the power cost:

First we need to subtract the 9kw of power from the combinators for the duration of the test:
280 seconds * 9 = 2520kJ
(53 * 9) / 60 = 7.95kJ
total: 2527.95kJ


funny enough this is actually over half our entire test consumption lol

We also exclude the drain in the same fashion
280 seconds * 400 = 112kJ
((53 * 400) / 60) / 60 = 353.3333J
total: 112.353333kJ


So our effective consumption over the total time was
5000kJ - 2527.95kJ = 2472.05kkJ
2472.05kJ - 112.353333kJ = ~2359.696666

Now we subtract the cost of item spikes. For Red Inserters this is 21kW, remembering we already excluded drain. The number of item spikes is known because we logged it during the test.

(675 ticks of item spike / 60) * 21 = 236.25kJ

Subtract that out along with the 675 ticks, and that leaves us with a perfect data set for our inserters cost of rotation.
2359.696666kJ - 236.25kJ = 2123.44667kJ
16,853 - 675 = 16,178 ticks
or ~269.6333 seconds

Dividing those gives us ~7.87531312. Unfortunately we did not arrive at a neat number due to compounded rounding errors. Perhaps if someone is interested they can redo the entire calculation fractionally for better accuracy, but this is close enough for our current needs.

Having this number in kW is fantastic, because it lets us view inserters completely differently. For one thing we can now imagine the power consumption of an inserter spinning freely despite not carrying items. Not very applicable practically, but isolating the grabbing cost is interesting, and perhaps we can use that data alongside a reference table to simplify our earlier equations. I won't be bothering to generate that right now, its just a suggestion.

Anyway all this leads to our new figure for Red Inserters being
(21 * (2 / 60)) + (~7.87531312 * (48/60)) = ~7.0000025

This result is so astonishingly close to a perfect 7kJ that I believe it easier to just round it there. It's already technically a rounded number, and a discrepancy of 0.08J likely won't be missed. So that gives us 7kj per spin or 8.4kw of operational cost. Reintroducing the drain gives 8.8kW! Which is exactly the number the game provided originally in our power panel...

It's rather underwhelming to end up in the same place we started, but at least we know that number with several decimal places more precision than before, and it also helps confirm our math was correct. I will be doing a follow up later with data for Yellow Inserters as well, so we can declare a final verdict on which is more efficient (as that was the original point of all this), and I'll also be collecting some practical data regarding belts and stack sizes. Currently I can only share that stack size does not effect cost per spin at all in chest to chest transfers, so we can divide spin cost by stack size to get item cost exactly like in the original numbers I provided.

That is all for this update. As I said I will be sharing more later. Here is the blueprint string of the test I devised in case you would like to help collect more data. It is slightly nicer than the previous image as it has been refined some from actual usage

Code: Select all

0eNrNWFFv4jgQ/iuWnxNEAqQQ6Va6fdp76N7pysupW0UmGYjVxM7ZTlmu4r/fOA6B0rAtrKrliYk945nv8zeOyTNdFDVUigtD42eagU4VrwyXgsb0j9u//vx7/vvXeUzmvARFUq7SmhuSM00Y0XltiFwuSQYF26BFQmJ4+qgHZJ5zTUpgQhNgaY7DJRAMTGUtjPb2JjFrSeC7UcyFemSdcwzYyJqseVEQAZARI4muF+iUGrJUsiQmB6JA14UZkH+OXTOJ85h/KdVBdhtiGhRrrF4bWVWQDb6Jb2IusRhhlCyaYfuQcUsBVgNoNaFPDHnShAu3ELopvspNKbVB/CnPQA3IV4mJxYpAoaEpB/HJOrVjA+pRjitrGt8/U81XghWWccFKQKrbJfxUlgsumJGKbjFAZPCdxsHW6wkppFj5OUOXzOdCgzJwGBRuHzwKwiAScEmbh00i6nKBnnHg7VZiaVqXddFk9WglNXcCeKY2eTD26IbG/igItraQo2XCbplKrhGBXnOT5n3rRPt1PNoyniwgZ08cE6NXK68EBFsUkNHYqBq8brjbF+u75EqbZE+K2VS2hieuTI0jXVHOw18pAEFdXm2YVfvQPpQVUw3umP5GER515SfoYzB8yXAne0CPvB9sXA/06WByCD7jClLnMO2nol12j1k3BB083b/moC2JKyn8qrAAtkcYP1GrClmbqjYnlHgYvX3Y9m35+Ez0s1+Jfrfd4Wnk79POCTImnTsXSy5wyk9z0Ka3kzoihqiIplddSKLBGDwlGpwKSvkESY1zBfY0ZAk3UOpdO7hRh+E1Zgu5tniDIQq8lFnT4MYvgDU1dUfKQx+YyPvh6dLX1MeQDnY3CK+xzz81020uBSxLLEyb1SAbLc3ognugFMrQngXpI5bwH7RH8RFpN10RJb4u6tKHAhlQPPUrWcAbpGFv9G3E9AxVTX9eVX0lzLoSdly+u81fS2HcrwTt5vVLG4W9k+lLue9H35DBHEf+xQnEg4NCqrJxOjrv972C3dDf3cHwzLNutCfh5uPOujfg377sgKjnVXfpYfjl5EEYBGdSNb5Kqi5m5vY0M+GZzEyugZm7jxNRS3q1SZoGTOydPuECF9pduU4Qee69K7pKIi/m7e60xM69k91cAzPzj5PY3aUSm1x8uf2FRB5ce9552397Z04RFF383+ealPbTzGD8GqHY6PvQC7yxN3rw7kdojTor8oLGGuGstdCnHbMWSs2aM3RsTbxtoD1s4p0dODs4tkNn28SByxeMjm1XEf6gHTl7YtO6CuyPG0ck9iqIEPffgjxasAUU9iNQe/knn0GkecnUI07i1Vg3WziJwtl4NpuMZ+E0Gg+32/8B/hw5DA==
Update: I believe I actually made an error when calculating how many ticks the accumulator test ran for. Because we ran it to failure, the two minute shut off delay on the timer should not have been applied, as we did not stop it via circuit condition but rather by power outage. That means there are two ticks missing, skewing our numbers higher than they actually are. I will be going back up to update the equations, but I will not be updating the text surrounding them as I am lazy. Hopefully this will be enough to avoid confusion. Ultimately the discrepancy was less than a tenth of a single joule, so...

Update 2: caught another very big math mistake where drain was accidently calculated in kw instead of watts. After recalculating the result is no longer almost perfectly 7kw :cry:. Clearly I am off my game today so please let me know if I managed to miss any more errors

Update 3: apparently the "big math mistake" was right the first time. It was calculated in watts, and there were a lot of seconds so it became kJ. I found one little mistake, so I started looking for more so hard I made one up. Ruined my entire calculation which was correct the first time :oops:
Last edited by GregFirehawk on Thu Dec 19, 2024 12:16 am, edited 6 times in total.
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

Half way through doing the accumulator test I figured it would be good to have up to date inserter box to box speeds. Here's the methodology.
12-18-2024, 12-52-17.png
12-18-2024, 12-52-17.png (1.12 MiB) Viewed 1124 times
The counter starts at zero and when activated, keeps adding 1 until deactivated. Everything is deactivated when the source box reaches zero. To account for 50 round trips I do an adjustment in the calculation later.

Example, yellow inserter causes deactivation (takes item 50) when counter reaches 3433. Naively this is 68.66 ticks per item. But we didn't count the last trip so I divide (3433 + 68.66) / 50 instead. To get 70.0332. Concluding box to box round trip time for yellow inserter is 70 ticks.

Inserter speed results (round trip time box to box)
burner inserter = 76 ticks
inserter = 70 ticks
long-handed inserter = 50 ticks
fast inserter = 24 ticks
bulk inserter = 24 ticks
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

The curve or spike on the left is the inserter powering up and uncurling itself. This is something only exhibit the very first time an inserter is powered, and never again. Even if it was disconnected and reconnected, it will never repeat this behavior.
That explains a slight discrepancy between the seemingly solid round trips in ticks and my initial average power measurements. Which I'll report when done.
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

evanrinehart wrote: Wed Dec 18, 2024 6:55 pm Half way through doing the accumulator test I figured it would be good to have up to date inserter box to box speeds. Here's the methodology.

12-18-2024, 12-52-17.png

The counter starts at zero and when activated, keeps adding 1 until deactivated. Everything is deactivated when the source box reaches zero. To account for 50 round trips I do an adjustment in the calculation later.

Example, yellow inserter causes deactivation (takes item 50) when counter reaches 3433. Naively this is 68.66 ticks per item. But we didn't count the last trip so I divide (3433 + 68.66) / 50 instead. To get 70.0332. Concluding box to box round trip time for yellow inserter is 70 ticks.

Inserter speed results (round trip time box to box)
burner inserter = 76 ticks
inserter = 70 ticks
long-handed inserter = 50 ticks
fast inserter = 24 ticks
bulk inserter = 24 ticks
Me and you happened to post our methods at the same time :lol:

You seem to be running your circuit off the chest. I tried that initially at first and found I get more accurate results when I let the inserter just count how many item it picks up, and use that exclusively as the measure for circuit control. I also just ordered it to do a single turn with my setup, which I found much easier than doing any math around chests. It spat out the exact time it took to make a spin, minus a two tick delay. For the accumulator test I ran, I just let it run until failure. Circuit control with the chest is just a bit more clunky I think, idk. I didn't like it when I tried it.

I'm also curious what you're doing in the bottom right. Really just in general. I'm not super awesome with circuits and your design seems to be using a lot more variables than mine, so I'm wondering what we are doing differently
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

Since I was just getting the speeds and assuming they're exact numbers of ticks the detailed method to get there shouldn't matter much.

Note that when power runs out on a circuit network the individual combinators will continue to run for a short time because they have internal accumulators. So I made to sure to not rely on that to deactivate the counter.

The two arithmetic combinators on the bottom right are just splitting the counter into thousands (divide by 1000) and the rest of the number (remainder by 1000) so I can read the value. Which would otherwise show as like 24.7k instead of an exact number. Maybe there's an easier way to see that.

Still testing individual inserters on the 5MJ accumulator. The methodology will simply be 5MJ / running time = average power usage (box to box). And 5MJ / (running time / speed) will give the joules of work per item.

Edit: and I made sure that the "uncurling" at the beginning of powering up the inserter is already done! Good eye
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

evanrinehart wrote: Wed Dec 18, 2024 7:46 pm Note that when power runs out on a circuit network the individual combinators will continue to run for a short time because they have internal accumulators. So I made to sure to not rely on that to deactivate the counter.
I just checked after you said this by slowing down the game speed, and I don't think the clock even did a single extra tick, so I think circuit clocks are reliable. Also I happened to catch a 2 tick mistake just now on the data I posted about the red inserters, and it accounted to less than a tenth of a joule difference. So I think the circuit clocks are trustworthy enough lol. But if your data is good then its good, doesn't matter how its derived
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

TLDR yellow inserter is most efficient per item at hand size 1, beating red inserter somewhat, once you take into account the actual power usage not "max consumption". Bulk inserter is best at max hand size.

My raw data for how long one inserter can run sustained on 1 5MJ accumulator, box to box work. And some derived stuff.

inserter = 48934 ticks
long-handed inserter = 33919 ticks
fast inserter = 14351 ticks
bulk inserter = 5058 ticks

Average power used is just 5MJ / (ticks / 60). Some computations had suggestive repeating decimals but I'm not sure how meaningful they are. Results are rounded.

inserter = 6.131 kW
long-handed inserter = 8.845 kW
fast inserter = 20.904 kW
bulk inserter = 59.312 kW
burner inserter = 52.511 kW [1]

Work per item is 5MJ / (ticks / ticks-per-cycle). Same rounding. Except the red inserter came out very close to something.

inserter = 7.152 kJ/item
long-handed inserter = 7.370500 kJ/item
fast inserter = 8.362 kJ/item
bulk inserter = 23.725 kJ/item
burner inserter = 66.514 kJ/item [1]

The above assumes you override the capacity bonus to 1. So the bulk inserter will have clear advantage at max hand size. At least box to box.

Here's my setup making sure only 1 inserter is running on the accumulator and nothing else.
12-18-2024, 14-51-55.png
12-18-2024, 14-51-55.png (1.24 MiB) Viewed 1061 times
[1] I measured the average power usage of the burner inserter by running it so initial "wood" fuel is very close to out, which leaves it in a resting state, then moving exactly 50 items on a unit of replacement fuel. Then measuring the fuel bar's size in pixels with gimp. Just to dwell on burner inserter for a minute: even the wiki seems to be making a mistake on the difference between max consumption and average consumption, stating "Energy consumption increased from 94.2 kW to 144 kW." for 2.0 burner inserter. When you look closely at the fuel bar while the burner inserter works, you can clearly see it is not moving at a steady pace, indicating the power pulsing happens also for burner inserter. And so 144kW is an upper bound for power consumption and an overestimate of average power.
12-18-2024, 14-52-22.png
12-18-2024, 14-52-22.png (16.26 KiB) Viewed 1061 times

PS. I see your formulas went to great lengths to remove the drain. It is energy used while the inserter works, so I see no reason to remove it when comparing their efficiency.
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

I had to rewrite this because the forum failed to save the draft properly. Stupid forum. Anyway I'm gonna be a bit sloppy about the formatting because as you can imagine typing this all out again sucks.

Our test gave us a a rotational speed of 70 ticks for the yellow inserter spin speed, and it ran on an accumulator for 5 minutes, 31 seconds, and 5 ticks, using the same setup as before. For easier reference that 331 seconds and 5 ticks, or 19865 ticks. Here is the math going through the same process as last time.

2020kJ without decider drain
1887.816666666kJ without drain
(568 / 60) * 14.7 = 139.16kJ
1887.816666666kJ - 139.16kJ = ~1748.656666666kJ
19297 -> 321.616666
Cost of Motion is 5.437083kw
Cost per spin is 6.65203kJ
Operational Cost is 6.10173824kW with drain reintroduced

Now that I've recalculated, we find that the original hypothesis was proven wrong. Yellow Inserters do in fact cost less per spin by over half a kJ, despite the theoretical calculation suggesting otherwise. This is very disappointing to learn. This means most of the other testing is now unnecessary, and all that's left to do is see at what stack size a green inserter can beat a yellow inserter in cost per item transfer. I will be looking into that tomorrow, though it appears Evan probably beat me to it

Edit: I have realized there is a 3 tick discrepancy here. the duration of ticks ends in an 8, not a 5. I apologize for frequently making such basic mistakes in this thread. I won't be redoing the calculation as this should only be a few joules worth of difference, which distributed out over hundreds of spins should disappear into a rounding error.
Last edited by GregFirehawk on Fri Dec 20, 2024 1:35 pm, edited 1 time in total.
evanrinehart
Inserter
Inserter
Posts: 38
Joined: Fri Jul 31, 2020 11:16 pm
Contact:

Re: Energy Optimization with Red Inserters

Post by evanrinehart »

Referencing this discussion here viewtopic.php?p=653751
GregFirehawk
Inserter
Inserter
Posts: 20
Joined: Tue Dec 17, 2024 9:47 am
Contact:

Re: Energy Optimization with Red Inserters

Post by GregFirehawk »

evanrinehart wrote: Wed Dec 18, 2024 8:59 pm
PS. I see your formulas went to great lengths to remove the drain. It is energy used while the inserter works, so I see no reason to remove it when comparing their efficiency.
The reason for removing it is because it is also used when the inserter doesn't work.

It's also why your cost per item is technically wrong :mrgreen:

You've hard baked the drain into your cost per item from what I see, which is likely why our numbers are so different. Because I have isolated the drain I can use a utilization formula with item throughput to figure out my exact costs on an inserter. This is similar to how we calculate when a burner inserter becomes worthwhile, but we can apply it to all inserters. Lets say I want to move 0.1 items/s into a machine. We can do

(items/s * the cost per item I calculated in joules) + Drain

and that will accurately tell us exactly how much power that inserter would eat. Its very neat to apply in practice because item/s is an easily available unit right in the games UI. All you need is a reference table to use this freely. And it will be accurate at any utilization percentage. Because your number has the drain baked in, the lower your utilization percentage becomes the less accurate your estimate will be. In our 0.1 item/s example I calculated ~1 kw, while you would have calculated ~700W. That's a 300W difference, or in other words you would be using 1.4 times as much power as you actually accounted for. That's not insignificant. Granted these are just inserters, but if we're going to be pedantic and do all this math then we should go all the way 8-)

It just lets us make more accurate estimates for more varieties of situations. Basically the only practical application in the game for this is when discussing the Green Inserter or something, as it lets you compare all possible permutations of stack size and throughput accurately. Speaking of that, I will probably reconfigure my test tomorrow to collect data regarding green inserters and belts.

By the way, your analysis on the burner was super cool! I hadn't even considered trying to measure it because it doesn't use electricity or have drain, but the fact that you confirmed it also does a power pulse is mind blowing. Assuming your data is accurate they can beat a yellow inserter after just 2.7 minutes of inactivity. That is actually a very cool number, because that is very close to how often a lot of stuff needs fueling. For example a boiler running at 100% capacity would need 1 piece of coal every ~2.2 seconds. That means if we spec our boilers to aim for only around an 80% utilization, its optimal to use burner inserters right from the start of the game, before they even get any upgrades. This is very different to the natural impression that boilers should not be used for power due to their extremely inefficient movement. Also aiming for 70-80 % utilization in a power system is actually good practice, and its how most things work in real life. This gives you headroom for any surges, and there are some other benefits in real life too, but this is still a game so just that one for now :lol:

That is such a cool piece of knowledge that I am going to begin implementing right away, as soon as I do my due diligence to confirm it. It might also be worth using the data I gathered earlier to calculate the cost of these spikes as a ratio to see if there is a pattern. If the game just uses a consistent multiplier or something, that could help make testing more accurate. Another thing this makes me curious about is whether or not the burner inserters exhibit a cost for refueling themselves. Earlier I dismissed that possibility, but seeing the new data from the electric inserters its very possible. If it does a big power spike every time it fuels itself as well, that could be a problem. Also if you remember the scrunching behavior the virgin inserters exhibit, its possible burners also exhibit that every time they refuel themselves, which would be tragic. If they do a power spike grabbing the fuel, and they incur a scrunching penalty (which based on the earlier graph is twice as expensive as spinning) then it could potentially tank their potential. I'll try to devise some tests.

Again, very cool that you did that
Post Reply

Return to “Show your Creations”