# Calculating Watt & Watt-hour consumed from battery

#### Vindhyachal Takniki

Joined Nov 3, 2014
500
1. I have a data logger for 48V battery which takes reading every 1 second of voltage & current & store it in a file.

2. Reading is something like this:
a) 47.4V, 50A
b) 47.3V, 49.4A
..
..
and so on until battery discharges completely in one hour.

3. How to calculate Watt & Watt hour consumed from it over hour

Normally if voltage is same, I calculate by difference of current between two multiply by voltage.

But in this case voltage is also reducing(during discharge) & going up during charge.

How to do the calculations of Watt & Watt/hour in it, should I take average of voltage over period of time & multiply by current difference?

#### WBahn

Joined Mar 31, 2012
25,545
It's probably good enough to assume that the voltage and current are constant from one measurement to the next and just multiply them together to get your power and multiply that by one second to get your energy.

If you want, you can take the average between two readings and use that, but you'll find that this will work out to virtually the same thing.

Another they you could do is a curve fit across multiple measurements, but you'll probably find that this is a lot of extra work to get a result that is virtually the same as the first approach.

#### Vindhyachal Takniki

Joined Nov 3, 2014
500
voltage varies from 39V-51V during entire operation
and current vary from 0-50Amps depending upon load at that moment,
so cant say they are constant from one reading to next especially current

#### MrAl

Joined Jun 17, 2014
7,457
1. I have a data logger for 48V battery which takes reading every 1 second of voltage & current & store it in a file.

2. Reading is something like this:
a) 47.4V, 50A
b) 47.3V, 49.4A
..
..
and so on until battery discharges completely in one hour.

3. How to calculate Watt & Watt hour consumed from it over hour

Normally if voltage is same, I calculate by difference of current between two multiply by voltage.

But in this case voltage is also reducing(during discharge) & going up during charge.

How to do the calculations of Watt & Watt/hour in it, should I take average of voltage over period of time & multiply by current difference?

Hi,

To do this properly you have to consider the time of each reading, not just the reading itself.
For example, say we have these two simple readings over one hour;
20v, 10a
10v, 5a

for the first we have 200 watts, the second 50 watts. If we add them, we get 250 watts and divided by 2 we get 125 watts and over one hour that is 125 watt hours. But now let's assign time values to each reading:
20v, 10a, 50 mins
10v, 5a, 10 mins

Now we still have the total time of one hour (60 minus) but now the first reading lasted 5 times longer than the second reading, so we have:
200*50/60+50*10/60=175 watt hours.

So because we had 200 watts for a longer time we had a larger energy usage.

To put it another way, it is the sum of all the watts times the times those watts occur.

Another example:
200 watts, 10 mins
100 watts, 20 mins
500 watts, 60 mins

The total time now is 90 minus and the sum is:
200*10+100*20+500*60=34000 watt minutes

and to get to watt hours divide by 60 (and i round to two decimal places):
34000/60=566.67 watt hours

If you take readings say every 10 minutes you can get decent results. Log the voltage, current, and time.

This is actually like numerical integration.

#### WBahn

Joined Mar 31, 2012
25,545
He stated that he logs reading every second.

#### WBahn

Joined Mar 31, 2012
25,545
voltage varies from 39V-51V during entire operation
and current vary from 0-50Amps depending upon load at that moment,
so cant say they are constant from one reading to next especially current
Since you are logging readings once a second, the variations from one reading to the next will be small. The voltage, in particular, will not vary much from one reading to the next. Even if the current occasionally changes by a large amount from one second to the next, that will likely be very occasional when a load starts or stops. As long as your typical profile does make drastic changes during most one second intervals, you should be okay. Besides, that's all the data you have to work with.

#### MrAl

Joined Jun 17, 2014
7,457
Hello again,

The time values were not included in the data set. That's the missing time value set: We need those too in order to calculate this.

2. Reading is something like this:
a) 47.4V, 50A
b) 47.3V, 49.4A
Taking a reading every second though leads to a result with decent accuracy. For example:
200 watts, time 0 though 300 seconds (300 seconds duration),
100 watts, time 300 to 900 seconds (600 seconds),
then we have:
200*300+100*600=120000 watt seconds

divide by 3600 to get watt hours (and two decimal places shown here):
120000/3600=33.33 watt hours

#### Vindhyachal Takniki

Joined Nov 3, 2014
500
trapezoidal integration works fine

#### MrAl

Joined Jun 17, 2014
7,457
trapezoidal integration works fine

Hello,

Yes that is what i had illustrated really, in simpler terms.

#### WBahn

Joined Mar 31, 2012
25,545
trapezoidal integration works fine
If you look at the math, trapezoidal integration is virtually identical to simply multiplying the value at each sample by the sampling interval. The only difference is due to the very last sampling interval, which is negligible if you have very many sampling intervals (more than about ten, in most cases).