Owners of solar power plants may face the need to manage the energy consumption of end devices, as reducing consumption can extend battery life during the evening and in overcast weather, as well as avoid data loss in case of a hard shutdown.
Most modern computers allow for processor frequency regulation, which can lead to decreased performance on one hand and increased battery life on the other. In Windows, frequency reduction is done manually through the management program interface, while in Linux it is done via a taskbar widget and through the console (cpupower for CentOS, cpufreq-set for Ubuntu).
In Linux, executing commands through the console allows for automatic execution based on certain events.
The usps-consumptionagent utility from the free UmVirt Solar Power Station package allows you to execute commands that manage CPU performance based on real-time solar power station data.
Typical configuration for 12-volt mode:
- If the voltage on the panels is above 16 volts, set to performance mode
- If the voltage on the panels is below 16 volts or unknown, set to power-saving mode
- If the battery voltage is below 11.6, execute the shutdown command
The shutdown command can be:
- graceful shutdown (poweroff),
- suspend mode (systemctl suspend),
- hibernation (systemctl hibernate),
- a sequence of commands.
Example sequence of commands:
./suspend.py && systemctl suspendExecuting this command will save the current virtual machines to disk and put the computer into sleep mode. This command may be needed by programmers and miners when compiling 'large' programs such as Firefox, Chrome, LibreOffice, and others, when uptime might exceed a full day.
As a demonstration.
Source: habr.com
