Bug 434432 - battery time estimate totally wrong
Summary: battery time estimate totally wrong
Status: RESOLVED FIXED
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 5.7.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2021-03-15 11:16 UTC by Amnon
Modified: 2022-12-08 11:54 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27


Attachments
screenshot of power panel (23.00 KB, image/jpeg)
2021-03-15 21:29 UTC, Amnon
Details
second screenshot (23.49 KB, image/jpeg)
2021-03-15 21:33 UTC, Amnon
Details
3rd shot (23.71 KB, image/jpeg)
2021-03-15 22:21 UTC, Amnon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amnon 2021-03-15 11:16:52 UTC
SUMMARY

The "battery time remaining" indicator is not working properly. The time shown seems random. 

STEPS TO REPRODUCE
1. always on
2. 
3. 

OBSERVED RESULT
time random

EXPECTED RESULT
correlation with battery % 

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

When using gnome interface the battery time seems to be working
Comment 1 Amnon 2021-03-15 13:37:24 UTC
I forgot to say what the hardware is:

  Dell XPS 13, model 9310

Here is the OS data:

Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.6.0-1048-oem
OS Type: 64-bit
Processors: 8 × 11th Gen Intel® Core™ i7-1185G7 @ 3.00GHz
Memory: 15.4 GiB of RAM
Comment 2 Nate Graham 2021-03-15 21:24:24 UTC
Can you attach screenshot that shows the problem?
Comment 3 Amnon 2021-03-15 21:29:31 UTC
Created attachment 136706 [details]
screenshot of power panel

At 74% charge the time prediction is 1:54 to empty. 
This number is arbitrary. I think the same time was shown at 17% battery charge.
Comment 4 Amnon 2021-03-15 21:33:14 UTC
Created attachment 136707 [details]
second screenshot
Comment 5 Amnon 2021-03-15 21:35:54 UTC
After the first screentshot I logged out of plasma, logged in to gnome, then back to plasma. As you can see in the 2nd screenshot the battery is down to 73%, but now the time predicted in 4:37 hours. 

As I said, the time prediction in plasma appears to be random. Perhaps in gnome there is a realistic evaluation, but not sure.
Comment 6 Kai Uwe Broulik 2021-03-15 21:36:25 UTC
Can you provide upower -d when the numbers are implausible?

Admittedly we don't apply any moving average or anything so the values can vary wildly based on CPU usage in the very moment etc
Comment 7 Nate Graham 2021-03-15 21:55:38 UTC
Thank you!
Comment 8 Amnon 2021-03-15 22:20:28 UTC
After working for a while the battery is down to 67%, yet the time prediction is still 4:37. It seems that this time prediction is not correlated to anything. Screenshot attached.
Comment 9 Amnon 2021-03-15 22:21:07 UTC
Created attachment 136713 [details]
3rd shot
Comment 10 Amnon 2021-03-15 22:22:58 UTC
Here is the output from upower (IU've no idea what this means):

amyekut@amyekut-XPS-13-9310:~$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Mon 15 Mar 2021 23:25:00 (3040 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               BYD
  model:                DELL FP86V09
  serial:               916
  power supply:         yes
  updated:              Tue 16 Mar 2021 00:15:01 (39 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              34.314 Wh
    energy-empty:        0 Wh
    energy-full:         50.9732 Wh
    energy-full-design:  50.9732 Wh
    energy-rate:         3.306 W
    voltage:             7.936 V
    time to empty:       10.4 hours
    percentage:          67%
    capacity:            100%
    technology:          lithium-polymer
    icon-name:          'battery-full-symbolic'
  History (rate):
    1615846501  3.306   discharging

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Tue 16 Mar 2021 00:15:01 (39 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              34.314 Wh
    energy-full:         50.9732 Wh
    energy-rate:         3.306 W
    time to empty:       10.4 hours
    percentage:          67%
    icon-name:          'battery-full-symbolic'

Daemon:
  daemon-version:  0.99.11
  on-battery:      yes
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: PowerOff
Comment 12 Fushan Wen 2022-12-08 11:49:13 UTC
Git commit b55f85ce464be8595df70c903b19534cbe36b7c3 by Fushan Wen.
Committed on 08/12/2022 at 11:48.
Pushed by fusionfuture into branch 'master'.

Apply exponential moving average to remaining time when unplugged

This applies exponential moving average to the remaining time history
records to calculate the remaining time, to mitigate the impact of a
short-time heavy load on the estimation of remaining time.

M  +6    -0    daemon/org.kde.Solid.PowerManagement.xml
M  +58   -0    daemon/powerdevilbackendinterface.cpp
M  +15   -0    daemon/powerdevilbackendinterface.h
M  +11   -0    daemon/powerdevilcore.cpp
M  +3    -0    daemon/powerdevilcore.h

https://invent.kde.org/plasma/powerdevil/commit/b55f85ce464be8595df70c903b19534cbe36b7c3
Comment 13 Fushan Wen 2022-12-08 11:49:47 UTC
Git commit e0513a276845b36a2c0e44120a4cc5d5c37ed59c by Fushan Wen.
Committed on 08/12/2022 at 11:49.
Pushed by fusionfuture into branch 'master'.

applets/batterymonitor: use smoothed remaining time

which can mitigate the impact of short-time heavy loads on the
estimation.

Requires https://invent.kde.org/plasma/powerdevil/-/commit/b55f85ce464be8595df70c903b19534cbe36b7c3

M  +1    -1    applets/batterymonitor/package/contents/ui/main.qml
M  +44   -13   dataengines/powermanagement/powermanagementengine.cpp
M  +1    -0    dataengines/powermanagement/powermanagementengine.h

https://invent.kde.org/plasma/plasma-workspace/commit/e0513a276845b36a2c0e44120a4cc5d5c37ed59c