Bug 472603 - Charging rate always negative, no matter whether charging or discharging
Summary: Charging rate always negative, no matter whether charging or discharging
Status: RESOLVED FIXED
Alias: None
Product: ksystemstats
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
: 492159 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-07-25 04:54 UTC by Benjamin
Modified: 2024-09-05 12:26 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin 2023-07-25 04:54:58 UTC
SUMMARY
When monitoring the "Lithium Ion Battery Charging Rate" sensor, the reported charging rate is
a. negative when charging and when discharging, so it's not clear from the sign whether the battery is charging or discharging
b. updating infrequently in varying intervals: often (not always!) the charging rate seems stuck, and doesn't change, even when change is expected due to different system load. When plugging the device, charging rate is always stuck at the last discharge value.

STEPS TO REPRODUCE
1. Have a system with a battery, unplugged
2. Open System Monitor
3. Add a "Charging Rate" sensor
4. Start stress-ng

OBSERVED RESULT
charging rate does not change (usually, not in 100% of cases)

EXPECTED RESULT
charging rate should change from ca -4 W to ca -25 W

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.27
(available in About System)
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel: 5.19.0-46-generic (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
/sys/class/power_supply/BAT0/power_now seems to report correct data, at least it produces a way more credible value and updates when system load is changing.
This is not a new issue; it has also occurred on older versions, at least for half a year.
When checking "About System" and selecting "Show More Information", in the energy tab I also see a wrong value in "Energy Consumption", so it's quite possible that actually the issue is not (only?) in System Monitor.
Device: Huawei Mateboox X Pro 2018 / MACH-WX9, Intel i5-8250U
Comment 1 Nate Graham 2024-08-27 21:55:06 UTC
*** Bug 492159 has been marked as a duplicate of this bug. ***
Comment 2 Bug Janitor Service 2024-09-02 16:17:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/ksystemstats/-/merge_requests/87
Comment 3 Arjen Hiemstra 2024-09-04 09:01:28 UTC
Git commit 220bcc14422de9f1fc849bdec60a20d0792962f5 by Arjen Hiemstra.
Committed on 04/09/2024 at 08:59.
Pushed by ahiemstra into branch 'master'.

plugins/power: Check battery state when reporting energy rate

According to the documentation of both Solid and UPower enrgy rate
should be positive when discharging and negative if charging, but that
seems to be incorrect in at least some systems. So use the battery state
to make sure we have the right sign for charge/discharge rate.

M  +12   -2    plugins/power/power.cpp

https://invent.kde.org/plasma/ksystemstats/-/commit/220bcc14422de9f1fc849bdec60a20d0792962f5