Hi Michal,

the charge_now part of your patch seems to be correct,
but the calculation is somehow broken --

This is what we have:
/voltage_min_design
10800000
/voltage_now
11900000
/current_now
1609000
/charge_full_design
5200000
/charge_full
4996000
/charge_now
4600000

if we do charge_now/current_now, we'll get: 
2.86 (hours) or 2 hours 52 minutes.
let's now calculate power consumption:
voltage_now * current_now = 11900000 * 1609000 / 10^12 = 19.15 W
and last, let's calculate remaining battery energy:
voltage_now * charge_now = 11900000 * 4600000 / 10^12 = 54.74 Wh
and once again, remaining time:
54.74 / 19.15 = 2.86

Regards,
Alex.

Michal Hocko wrote:
> [CCing powertop mailing list]
> 
> On Mon, Jul 21, 2008 at 09:13:07AM +0400, Alexey Starikovskiy wrote:
>> Hi Michal,
> 
> Hi Alexey,
> 
>> Battery can return either energy (voltage*charge) or just charge.
>> In your case it returns only charge. You need to multiply by voltage to
>> get energy.
> 
> Thanks for your information. I was confused that both (CHARGE_ and
> ENERGY_) cases were handled by the same value but didn't realize that
> the value itself may come from different source.
> 
> Based on your suggestion, I am attaching patch for current powertop
> which reads charge_now if energy_now is not present.
> 
> I am not sure whether this is correct, testing on my laptop shows weird
> values for current consumption:
> Power usage (ACPI estimate): 1.4W (40.7 hours) (long term: 24.4W,/2.3h)
> 
> Even long term value seems to not correspond with the value exported by
> KPowersafe which shows 3:18 at this moment. 
> 
> Is there something wrong in the patch or it is just my battery exporting
> bad values? Current values from sys are attached too.
> 
>> Regards,
>> Alex.
>>
>>
>> Michal Hocko wrote:
>>> Hi,
>>>
>>> I am trying to use powertop on my computer, but I am not able to get
>>> power consumption (powertop complains with "no ACPI power usage estimate
>>> available").
>>>
>>> After powertop code reading it seems that problem is that it expects
>>> %subj file to be present what is not a case for my Fujitsu Siemens
>>> Lifebook S71110 notbebook:
>>>
>>> /sys/class/power_supply/CMB1 $ find -type f
>>> ./uevent
>>> ./power/wakeup
>>> ./type
>>> ./status
>>> ./present
>>> ./technology
>>> ./voltage_min_design
>>> ./voltage_now
>>> ./current_now
>>> ./charge_full_design
>>> ./charge_full
>>> ./charge_now
>>> ./model_name
>>> ./manufacturer
>>> ./serial_number
>>> ./alarm
>>>
>>> I can see only charge_* files but no energy_* one. 
>>>
>>> Documentation/power/power_supply_class.txt notes that ENERGY_* and
>>> CHARGE_* attributes shouldn't be mixed because of different measurements
>>> units.
>>>
>>> However, It looks like battery module doesn't make any difference when
>>> reading values for ENERGY_ and CHARGE_ attributes:
>>> drivers/acpi/battery.c:
>>> acpi_battery_get_property
>>> [...]
>>>         case POWER_SUPPLY_PROP_CHARGE_NOW:
>>>         case POWER_SUPPLY_PROP_ENERGY_NOW:
>>>                 val->intval = battery->capacity_now * 1000;
>>>                 break;
>>> [...]
>>>
>>> So the question is, why this file is not exported when the module can
>>> provide its value?
>>>
>>> If this is correct and it somehow depends on BIOS, how should powertop
>>> handle such a case when only charge_* files are available?
>>>
>>> I am using Debian distribution 2.6.25 kernel (but the same issue is
>>> present also in Vanilla 2.6.26 kernel).
>>>
>>> Let me know, if you need some more information.
>>>
>>> Thanks for any hint and
>>> best regards
> 

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to