How do I calculate energy consumption via script
Posted: Sat Jun 06, 2020 3:14 pm
I'm the author of the Max Rate Calculator mod. One of the more frequent requests is for it to calculate the energy usage of the tool's selection area.
I've been using the new ctrl-shift-e tool to look at entity prototypes to see how I might do this, but it's not obvious to me.
For example, the Assembler 1 has an energy_usage value of 1250, it's tooltip shows Min Energy Consumption of 2.5 kW and max of 77.5 kW.
Now I observe that 1250 x 2 = 2.5k,, and that 2.5k x 31 = 77.5k. Are these two constants, 2, and 31 surfaced in the entity prototype? I'm not seeing them.
The same constants work for the other two kinds of assemblers, also the electric furnace, the oil refinery and the chemical plant.
An electric mining drill has energy_usage of 1500, and the tooltip shows max usage of 90. So here 1500 / 90 = 6. Where does this '6' come from.
Inserters are even odder. There's no obvious ratio between min and max as shown on the tooltip among the types of inserters, and the entity prototype values don't have an energy_usage value (though there are a couple of values for energy used by rotation and extension ).
Are the various constants associated with energy consuming entities available that I can use in my mod to calculate energy usage?
Does the recipe/resource ever affect the energy usage?
Thanks in advance...
I've been using the new ctrl-shift-e tool to look at entity prototypes to see how I might do this, but it's not obvious to me.
For example, the Assembler 1 has an energy_usage value of 1250, it's tooltip shows Min Energy Consumption of 2.5 kW and max of 77.5 kW.
Now I observe that 1250 x 2 = 2.5k,, and that 2.5k x 31 = 77.5k. Are these two constants, 2, and 31 surfaced in the entity prototype? I'm not seeing them.
The same constants work for the other two kinds of assemblers, also the electric furnace, the oil refinery and the chemical plant.
An electric mining drill has energy_usage of 1500, and the tooltip shows max usage of 90. So here 1500 / 90 = 6. Where does this '6' come from.
Inserters are even odder. There's no obvious ratio between min and max as shown on the tooltip among the types of inserters, and the entity prototype values don't have an energy_usage value (though there are a couple of values for energy used by rotation and extension ).
Are the various constants associated with energy consuming entities available that I can use in my mod to calculate energy usage?
Does the recipe/resource ever affect the energy usage?
Thanks in advance...