Page 1 of 1

[1.1.61] Portable solar panels do not respect surface.solar_power_multiplier > 1 (unlike regular solar panels)

Posted: Thu Aug 04, 2022 5:23 pm
by Wiwiweb
TL;DR:
Portable solar panels correctly get reduced power for surface.solar_power_multiplier < 1.
But they do not get increased power for surface.solar_power_multiplier > 1, unlike regular solar panels which do.
Simple repro setup:
1) Put on an armor with 1 battery and 1 portable solar panel.

2) Freeze daytime to 100% day:

Code: Select all

game.player.surface.freeze_daytime = true
game.player.surface.daytime = 1
3) Adjust solar_power_multiplayer to a value:

Code: Select all

game.player.surface.solar_power_multiplier = X
4) Pick up the battery and put it back down to reset its charge down to 0.

5) Count 10 seconds, check battery's charge, calculate effective power.

Results:

solar_power_multiplier = 0.5, 15kW power
solar_power_multiplier = 1, 30kW power
solar_power_multiplier = 2, 30kW power (!)

Re: [1.1.61] Portable solar panels do not respect surface.solar_power_multiplier > 1 (unlike regular solar panels)

Posted: Thu Sep 08, 2022 11:06 am
by boskid
This is quite tricky to fix. Normal solar panels (entities) are just increasing counter of solar panels so the electric network can compute power of one panel times the amount of panels and it works as expected. In case of a solar panel equipment, they are based on the electric energy source which has its own energy buffer with size, the solar panel equipment is adding the energy to this buffer and the electric network consumes the energy from this buffer. Issue is that this buffer has a capacity equal to one tick of energy production at the solar power multiplier of 1. In order to fix this i would need to go with simillar approach as solar panel entities which i do not want to do because of the amount of differences in code between 1.1 and 1.2 nearby, or i would need to adjust the buffer capacity each tick which i also do not want to do because that is an area that is tricky due to save-loading, or i would need to make the buffer N times larger than the required value but then the issue will reapper at higher solar_power_multiplier and the solar panel itself will start working as a tiny battery since it will hold some charge.

Re: [1.1.61] Portable solar panels do not respect surface.solar_power_multiplier > 1 (unlike regular solar panels)

Posted: Thu Sep 08, 2022 12:53 pm
by Xorimuth
Space Exploration doesn’t use solar multipliers higher than ~16, so setting the buffer size to ~30x would solve this problem for pretty much everyone. I doubt anyone would even notice an extra half-second’s worth of energy.

Re: [1.1.61] Portable solar panels do not respect surface.solar_power_multiplier > 1 (unlike regular solar panels)

Posted: Sun Sep 11, 2022 6:27 am
by boskid
Thanks for the report. I was able to find a relatively simple fix for this so it is now fixed for 1.1.69. Fix was to change solar panel's energy source buffer size every tick to match the solar power multiplier if it goes above 1.