tdehwlib: Shuffled units of battery values #68

Closed
opened 4 years ago by SlavekB · 5 comments
Owner

Basic information

  • TDE version: R14.0.x
  • Distribution: all
  • Hardware: any

Description

According to the Linux power supply class documentation, there are two sets of values – charge_* and energy_*, the first in µAh and the second in µWh. The current_now value is in µA.

But in the tdehwlib code we read "some" values and store them in variables, from which we cannot subsequently determine in which units the value was stored there. For example:

else if (nodename == "charge_full" || nodename == "energy_full") {
	bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0);
}

In Device Manager at the Trinity Control Center, we state that this is Wh. But on the notebooks I saw, these are the values read from charge_*, so they are actually Ah. I have no idea that some batteries actually provide energy_* values and do not provide charge_* values.

In addition, when counting the estimated remaining time / time to charge, we count on the value of current_now, which is in A. So that would represent a further mixing of units – Wh/A.

Similarly, tdepowersave shows a value of current_now but states that it is consumption in W.

Proposed steps to fix it

  1. We should do a research to see if all batteries provide charge_* values, and whether we can omit reading energy_* values.
  2. As a result, we would always have units of Ah, so it would be correct to calculate remaining time with current_now in A.
  3. In Device Manager we should change the unit name from Wh to Ah.
  4. In tdepowersave we can multiply the value of current_now in A by value of voltage_now in V to present the consumption in W.
## Basic information - TDE version: R14.0.x - Distribution: all - Hardware: any ## Description According to the [Linux power supply class](https://www.kernel.org/doc/html/latest/power/power_supply_class.html#attributes-properties-detailed) documentation, there are two sets of values – `charge_*` and `energy_*`, the first in µAh and the second in µWh. The `current_now` value is in µA. But in the tdehwlib code we read "some" values and store them in variables, from which we cannot subsequently determine in which units the value was stored there. For example: ``` else if (nodename == "charge_full" || nodename == "energy_full") { bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0); } ``` In Device Manager at the Trinity Control Center, we state that this is Wh. But on the notebooks I saw, these are the values read from `charge_*`, so they are actually Ah. I have no idea that some batteries actually provide `energy_*` values and do not provide `charge_*` values. In addition, when counting the estimated remaining time / time to charge, we count on the value of `current_now`, which is in A. So that would represent a further mixing of units – Wh/A. Similarly, tdepowersave shows a value of `current_now` but states that it is consumption in W. ## Proposed steps to fix it 1. We should do a research to see if all batteries provide `charge_*` values, and whether we can omit reading `energy_*` values. 2. As a result, we would always have units of Ah, so it would be correct to calculate remaining time with `current_now` in A. 3. In Device Manager we should change the unit name from Wh to Ah. 4. In tdepowersave we can multiply the value of `current_now` in A by value of `voltage_now` in V to present the consumption in W.
Chris commented 4 years ago
Collaborator

So some reporting from me related to that topic, as promised:

After I tested two different machines here:

  • The first is having charge_ but no energy_ entries.

  • The second is having energy_ but no charge_ entries.

Hope that helps you. 😄

So some reporting from me related to that topic, as promised: After I tested two different machines here: - The first is having *charge_* but no *energy_* entries. - The second is having *energy_* but no *charge_* entries. Hope that helps you. :smile:
Ghost commented 4 years ago

I've got "charge_full" in /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/CMB1

Laptop: Fujitsu P702
Battery: Fujitsu CP671400-01

I've got "charge_full" in /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/CMB1 Laptop: Fujitsu P702 Battery: Fujitsu CP671400-01
Owner

I think we should choose one unit of measure (for example Ah) and convert to it in case we are reading the other value. For example if we read energy_, we should also read the battery voltage and use that to convert the read value to Ah. This should solve the problem regardless of the case the battery provides charge_ or energy_* values.

I think we should choose one unit of measure (for example Ah) and convert to it in case we are reading the other value. For example if we read energy_*, we should also read the battery voltage and use that to convert the read value to Ah. This should solve the problem regardless of the case the battery provides charge_* or energy_* values.
Poster
Owner

Yes, that is exactly what I intend. For now, Ah, A, V seem more suitable for base units. So to solve the problem, Wh and W will be converted to Ah and A.

Yes, that is exactly what I intend. For now, Ah, A, V seem more suitable for base units. So to solve the problem, Wh and W will be converted to Ah and A.
SlavekB added a new dependency 4 years ago
Poster
Owner

All related parts have been resolved. Thank you for your comments and testing.

All related parts have been resolved. Thank you for your comments and testing.
SlavekB closed this issue 4 years ago
SlavekB added this to the R14.0.8 release milestone 4 years ago
Sign in to join this conversation.
No Milestone
No Assignees
4 Participants
Notifications
Due Date

No due date set.

Reference: TDE/tdelibs#68
Loading…
There is no content yet.