Solar plant owners may be faced with the need to manage the power consumption of end devices, as reducing consumption can extend battery life in the evening and during cloudy weather, as well as avoid data loss in the event of a hard shutdown.
Most modern computers allow you to adjust the processor frequency, which leads to a decrease in performance on the one hand, and an increase in battery life on the other. Windows frequency reduction is carried out manually through the control program interface, in Linux via the taskbar widget and via the console (cpupower - CentOS, cpufreq-set — Ubuntu).
В Linux Executing commands through the console allows them to be executed automatically when certain events occur.
The usps-consumptionagent utility from the free UmVirt Solar Power Station kit allows you to execute commands that control processor performance depending on the operating data of the solar power plant.
Typical configuration for 12 volt mode:
- If the voltage on the panels is higher than 16 volts, setting the performance mode
- If the voltage on the panels is below 16 volts or unknown, setting the power saving mode
- If the battery voltage is less than 11,6, execute the shutdown command
The shutdown command can be:
- soft shutdown (poweroff),
- sleep mode (systemctl suspend),
- hibernation (systemctl hibernate),
- command sequence.
Command sequence example:
./suspend.py && systemctl suspendRunning this command will save the current virtual machines to disk and puts the computer into sleep mode. This command may be useful for programmers and maintainers when compiling large programs such as Firefox, Chrome, LibreOffice, and others, where uptime may exceed daylight hours.
As a demonstration.
Source: habr.com
