Tutorial:Solar power math

From Official Factorio Wiki
Revision as of 22:53, 15 November 2024 by Untitled7 (talk | contribs) (→‎Accumulators per solar panel)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In this tutorial we will properly quantify the amount of solar panels and accumulators needed and the proper ratio that is needed between the two buildings.

Equation symbols and units

The game uses SI units and reflects how they are used in the real world. Energy and power are often used interchangeably, but power is the first time derivative of energy, i.e. how much energy is used or produced per second. Power can be used to get machines moving, as they perform work . A type of work can be lifting some mass against gravitational acceleration for a set distance. Usually there is always a loss of usable energy due to thermal energy being released, but Factorio does not take such losses into consideration. Lastly there is the charge in accumulators. Charge traditionally has the unit Coulomb and the energy in a capacitor depends on the charge and the voltage across it, but as Factorio also doesn't consider equipment using different voltages, a the charge of a factorio-accumulator can be defined to use this combined value.

Therefore the important equation symbols for energy are as follows:

  • ... energy, in Joule, also often written in kilowatt-hours, where .
  • ... performed work, in or Newton-meter which is equal to Joule
  • ... accumulator charge, in Joule

And the important equation symbols for power are as follows, with dot-notation for the time derivative:

  • ... supplied power, in Watt, or Joule per second.
  • ... ongoing mechanical work, in Watt
  • ... change in accumulator charge, in Watt

Energy can't be generated or destroyed, only converted into a different form. This means that the balance of energy must be upheld, and therefore its rate of change must be zero. If we subtract from the supplied power both the ongoing mechanical work and the rate at which accumulators are charging (therefore taking energy from the grid), the result will be zero. As such we can write

.

The player will not have to worry about overproduction, as any power generating equipment will cap its output automatically. Only too little production will no longer provide machines with the amount of power that they desire, causing them to throttle their own power demand and working slower. Therefore in almost all cases these rates will change over time, where solar panels produce energy dependant on the time of day, while machines equally draw more or less power depending on how much they are used. For example, inserters only draw their power when they swing their arms, while only using a tiny fraction of it on standby. As such we introduce notation for various statistically relevant values.

  • Average value over an interval is annotated with a bar above:
  • Peak value with an upward facing chevron:

Average output of 1 solar panel

While only the peak output of a solar panel can be easily be told at , its exact power output over the day changes with available daylight. Thankfully, if we install some accumulators, they can do the integration for us.

In an experiment with one solar panel and 4 accumulators, we can see that one solar panel will produce 17.6 MJ of energy per day.

Solar panel energy.png

Due to rounding, this could be anywhere between 17.55 MJ and 17.65 MJ, therefore the experiment can be repeated over multiple days.

day number accumulator charge energy produced per day
1 17.6 MJ 17.6 MJ
2 35.3 MJ 17.65 MJ
3 52.9 MJ 17.633 MJ
4 70.6 MJ 17.65 MJ
5 88.2 MJ 17.64 MJ
6 106 MJ 17.666 MJ

Further experiments show that the true number will swing around and approach 17.64 MJ

A day on Nauvis lasts 7 minutes, or , which means that each solar panel provides about 42 kW of power on average.

Solarpanel output as a function

For further calculations we assume the power output function of a solar panel looks as follows:

Accumulators per solar panel

Knowing how much power a solar panel provides on average we can construct a fitting load to test how much max accumulator charge is needed.

In a second experiment we take two solar panels on separate grids and put a load of on one, and one with , which can be achieved with...

  • 8 Assembly machines 2 (5 kW per unit), and
  • 3/4 fast inserters (500 W per unit), and
  • 1/0 regular inserters (400 W per unit).

To that we add a generous 100 accumulators and observe the energy in the system.

Solar panel with load 41point9kW.png

Solar panel with load 42kW.png

Solar panel with load 42kW zoom.png

Experimental values for the 41.9 kW grid show the first peak has a height of about 4.24 MJ, with each consecutive peak growing higher as the true output of a solar panel is indeed more than 41.9 kW.
Experimental values for the 42 kW grid show each peak reaching about 4.24 MJ, but falling short for 5 seconds.

4.24 MJ is enough to fill 0.848 accumulators as they can hold a charge of 5 MJ each. Conservatively we can therefore set 0.85 accumulators per solar panel, or a ratio of 20 solar panels to 17 accumulators. A less conservative approach is to use 0.84 accumulators per solar panel, or a ratio of 25 solar panels to 21 accumulators.

Analytic solution

We can set the previously defined power function as the rate of change of the accumulator and subtract it's average output as the load which the setup should be able to continuously supply. First we check when the power reaches 42 kW

Then we shift the function for power in time and reduce it by the 42 kW so that the function will start at zero.

To find the critical point in time at which the accumulator charge reaches it's peak , we need to see when it's derivative passes zero. This happens in it's 3rd section.

The true perfect ratio for solar panels to accumulators therefore turns out to be...

It takes 0.84672 accumulators per solar panel, or a ratio of 2646 accumulators to 3125 solar panels. Speaking conservatively we can take a higher ratio of 0.85 with 17 accumulators to 20 solar panels