Indicator doesn't use weighted average with different-sized batteries

Bug #1430542 reported by desrt on 2015-03-10
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
indicator-power (Ubuntu)
Medium
Unassigned

Bug Description

The indicator implements the spec:

  https://wiki.ubuntu.com/Power#Handling_multiple_batteries

which stated:

  "Their percentages should be averaged."

Apparently this was taken to mean the simple arithmetic mean, and not the weighted average (by the capacity of each battery).

  http://bazaar.launchpad.net/~indicator-applet-developers/indicator-power/trunk.15.04/view/head:/src/service.c#L1316

shows:

  const double percent = sum_percent / n_batteries;

This means that if one battery is twice as large as another, then after that battery is discharged, 50% would be reported. I'd expect 33%.

The code needs to be fixed to reflect the more precise use of the word "average". <https://wiki.ubuntu.com/Power#multiple-batteries>: "Their percentages should be averaged, weighted by the capacity of each."

Matthew Paul Thomas (mpt) wrote :

Mea culpa. It never occurred to me that a device might contain multiple batteries of different capacities.

Changed in indicator-power (Ubuntu):
assignee: nobody → Matthew Paul Thomas (mpt)
status: New → In Progress
Matthew Paul Thomas (mpt) wrote :
Changed in indicator-power (Ubuntu):
assignee: Matthew Paul Thomas (mpt) → nobody
status: In Progress → Triaged
description: updated
description: updated
Charles Kerr (charlesk) on 2016-01-18
Changed in indicator-power (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers