# [Gta04-owner] 4.3-rc6 available

H. Nikolaus Schaller hns at goldelico.com
Wed Oct 21 15:30:49 CEST 2015

```Hi Jens,

Am 21.10.2015 um 13:54 schrieb Jens Seidel <jensseidel at users.sf.net>:

> Hi Nikolaus and others,
>
> 2015-10-19 8:39 GMT+02:00 H. Nikolaus Schaller <hns at goldelico.com>:
>> And, I have done some simple suspend tests
>> and came to an interesting conclusion:
>>
>> root at letux:~# ./measure-suspend 10
>> suspending for 10 seconds
>> did wake up
>> 192960 uA over 10 seconds
>> root at letux:~# ./measure-suspend 20
>> suspending for 20 seconds
>> did wake up
>> 128520 uA over 20 seconds
>> root at letux:~# ./measure-suspend 30
>> suspending for 30 seconds
>> did wake up
>> 107040 uA over 30 seconds
>> root at letux:~# ./measure-suspend 40
>> suspending for 40 seconds
>> did wake up
>> 80280 uA over 40 seconds
>> root at letux:~#
>>
>>
>> It is really unexpected that the average is going down such
>> significantly.
>>
>> This indicates that the system is drawing a lot of energy,
>> for some initial seconds and then goes down.
>>
>> Let's try to model it by
>>
>> Iavg = (Iinitial * initial + Isuspend * (total - initial)) / total
>>
>> where initial is the initial time with high current and total the
>> total time.
>>
>> There are 3 unknown variable (Iinitial, Isuspend, initial)
>>
>> So we have to solve 3 equations, e.g.
>>
>> 192 * 10 = Iinitial * initial + Isuspend * (10 - initial)
>> 128 * 20 = Iinitial * initial + Isuspend * (20 - initial)
>> 80 * 40 = Iinitial * initial + Isuspend * (40 - initial)
>
> let's not forget the fourth equation (for 30 s result):
>
> 107 * 30 = Iinitial * initial + Isuspend * (30 - initial)
> You avoided it probably to not get an overdetermined system

Yes :) To be able to roughly estimate the values without
much effort...

> but even
> without this the given three equations have no solution at all (even
> if very small measure errors are respected).

Well, a linear equation system with n equations and n unknowns has
a unique solution (or none if some determinant is zero).

So it is the engineer's short-cut approach where 3 is prime, 5 is prime,
7 is prime and therefore all odd numbers are prime :)

In this case I have not checked the determinant - which is indeed
wrong :(

>
>> An approximate solution is (haven't tried to exactly solve the equation system):
>>
>> Iinitial = 4 s
>> Isuspend = 50 mA
>> initial = 400 mA
>
> You swapped Iinitial and initial:
>
> Iinitial = 400 mA
> Isuspend = 50 mA
> initial = 4 s

Ah yes. Too many IiIi's :)

>
>> So this means that it takes 4 seconds after suspend
>> until power is really going down. So a suspend with
>> less than 4 seconds has no effect. Interesting.
>
> context) and tried to solve the system consisting of all 4 data sets
> you have in a least squares approach:
>
> Find a residual r so that the system
>
> 192 * 10 + r(1) = Iinitial * initial + Isuspend * (10 - initial)
> 128 * 20 + r(2) = Iinitial * initial + Isuspend * (20 - initial)
> 107 * 30 + r(3) = Iinitial * initial + Isuspend * (30 - initial)
>  80 * 40 + r(4) = Iinitial * initial + Isuspend * (40 - initial)
>
> has a solution with minimal (Eucledian) norm of r: r(1)^2 + r(2)^2 +
> r(3)^2 + r(4)^2 -> min.
> I found r to be
>
> 128.1599
>  -64.0800
> -256.3200
>  192.2399
>
> What really surprised me is that all components of r are small
> multiplies of 64. So I think that your model is 100% correct and the
> accuracy of the measurement is a multiple of 64 mAs (here 256). Is
> this possible?

Well, it may be by accident by choosing the times respectively (10, 20, 40
and a factor 8 between 50 and 400 mA).

Or we have to study the data sheet of the bq27000 chip what the
granularity of its ADC really is.

It may also be that the bq27000 updates its "charge level" not fast enough.

> The solution Isuspend =44.856 mA (instead of 50 mA) follows now easily
> and uniquely by subtracting the equations from each other whereas
> Iinitial and initial cannot determined (there are infinity solutions
> all fulfilling (Iinitial - Isuspend)*initial = 1609.2 as only the
> power consumption during the startup phase is unique, not the
> splitting in startup time and startup consumption).

Indeed the determinant is zero.

But we are in a good situation if we assume the Iinitial is the same as
during full operation which is roughly the 400 mA, I had used to estimate
my solution.

With your improved Isuspend, we can calculate

initial = 1609.2 / (400 - 44.8) = 4.5 s

Even if we assume 700 mA we are in the 2.5 s range.

> Is this useful to you?

Oh yes! Thanks for review.

It shows that the suspend current is even lower than the average after
40 seconds. Which means that the battery holds longer if the device
remains in suspend :)

Maybe we could try to suspend 1, 2, 3, 4s etc. (if possible) and check
if the current is linear. I.e. we should plot Iavg(suspend-time) and look
at the curve.

This is also a good example where sharing information and community
can derive better results than a single developer (everyone makes mistakes
and draws false conclusions). And (public) review allows to improve on
it.

BR and thanks,
Nikolaus

```