# Calculating total current consumed over time?

I'm currently building a battery testing rig which drains a battery and then charges it continuously and monitors/logs all associated data (voltage, run time, and instantaneous current discharged/charged).

I'd like to determine the current discharged over time, but not sure how to calculate that.

> For example: Say I at program time 00:00:01s the current consumed is
> 15mA, and then at program time 00:00:02s the current consumed is 20mA
> (so on and so forth).


Currently my program is just logging the instantaneous current every second. Beyond that I'm not sure what calculations are needed.

• What do you mean by "current consumed over time"? Average current? Total charge used? Total energy used? If you're not sure what to call the thing you want to calculate, then say what you want it for. Oct 26, 2016 at 14:42
• What your asking makes little sense since current is an instantaneous thing. You can calculate the average by adding them all up and dividing by the number of readings assuming the interval between the readings or you can work out the charge by multiplying each reading by the time between it and the next one and adding all these up. You can then express this in ampere-hours or coulombs. A coulomb is 1 amp for 1 second or equivalent for example 2 amps for half a second. Oct 26, 2016 at 14:51
• It sounds to me like he's trying to design a battery-testing circuit without knowing what to measure. A battery-testing circuit should test that it meets battery specifications (charge time, peak/nominal discharge rate, cell voltage vs. current draw curve, self-discharge rate, etc.). The author of this question should specify which battery specifications he's testing. He said he's not sure what calculations are needed -- well, what is he trying to calculate? Or is he asking what information about a battery can you measure with current vs. time information? Aug 7, 2018 at 16:20

## 2 Answers

For system power consumption it's more normal to write things as either peak or average power consumption in either Watts or amps. Total power/current is then calculated by multiplying the average power/current by the operating time.

If however you are sure what you want is total current over time then that would be measured in Ah (Amp-hours). It's normally only used when talking about battery capacities rather than system power consumption but I suppose could be useful if you are measuring how much battery you have used.
The calculation is fairly trivial. Assuming you have a measurement once per second and want the answer in Ah then it's:
Total current at time t = Total current at time t-1 + Current at time t/3600

• If you import into a spreadsheet.
• C=Q/V and dQ/dt=I
• "CURRENT OVER TIME" = integral of Idt = Q
• or the sum of all your I*t readings in seconds and converted to amp-hours.
• Power,P over time= V* I* t = Energy [Joules]
• E=[watt-seconds]=[Volt*Amp-hour*3600s/h]

.

• the capacity of one cell is bigger than an ultracap using Ic=C(Vmax-Vmin)/dt ( converting hours to seconds) using cumulative Amp-seconds =sum(Idt)
• Cumulative I*t is the integral of I(t) or Ah total for Charge vs discharge.
• Power likewise can be computed during each phase, charge-discharge for each sample and accumulated. VIt duration added to previous value.
• You will be able to compute charger losses, and discharge losses or efficiency of Storage
• with a complex model of the battery you can compute battery Ah capacity and Wh capacity, ESR vs SoC, leakage R, and if you also measured case temp, T compute efficacy of ESR and C vs T ( improves but ages with higher T) and then compute battery life vs depth of discharge and depth of charge for cumulative Ah delivered where if SoC remains between 50% & 75% for LiPo, you get > 2x the lifetime Ah