Calculating correct values for pulsating voltages

I am stuck with rather theoretical problem. I am building a small battery managent controller. I need precise values for discharging and charging currents in order to calculate correct battery capacity and charge state.
The problem is that both discharging and charging currents are not pure DC nor sine wave. Currents can fluctuate form zero to maximum in one millisecond. So, calculated average values over a longer period are not correct. Nor are correct RMS values, as there is no sinewave.
When charging or discharging battery voltage fluctuates correspondondingly with currents. So, voltages can not be used as constants.
If calculating A/h value, then it is easy - just use arithmetic average value. But when it comes to measuring power drawn from battery and calculating correct currents and Voltages at the same time I am stuck, as arthmeticaverage voltage and current won’t give correct power.

Any ideas?

You need to integrate snap-shots of current and voltage during the adjacent snap-shots.

Take current and voltage readings as fast as you can. compute watts consumed between adjacent snapshots, then add together all your snapshots.

For example say take snapshots at 1 millisecond intervals.

T1 I=10.4 amps V=12.6 volts T2 I=2.3 amps V=12.8 volts T3 I=4.2 amps V=12.8 volts

From T1 to T2 you assume current remained constant at 10.4 amps and voltage remained constant at 12.6 volts. Therefore AH consumed = 10.4 x 0.001 / 3600 = 2.8miroAH and power = 35.28 microwatts

From T2 to T3 you assume current remained constant at 2.3 amps and voltage remaned constant at 12.8 volts. Therefore AH consumed = 2.3 x 0.001 /3600 = 0.6389 microAH and power = 8.178 microwatts.

Now you simply add together all the iterations. In this case from AH for T1 + T2 = 2.8 + 0.6389 = 3.4389 microAH and Watts for T1 + T2 = 35.28 + 8.178 = 43.458 microWatts

Note that the measurements at T3 don't come into consideration until you consider the time element from T3 to T4

Yes you are dealing with very small instantaneous numbers and there is a great deal of "averaging" going on but that's what integration is all about. The gains balance out the losses.

Jack

I should also have added that charging currents should be shown as negative values but you will have a problem with the charging voltages since the voltage measured during charge will not be the true battery voltage. True battery voltage can only be measured after termination of the charge process and the battery has been given time - say a couple of hours - to "settle". Hence charge power will always appear to be very much greater than discharge power. You can only really measure instantaneous charge AH rather than charge power.

jack

Thanx Jack for guidance :)

My battery bank is around 600A/h at the moment. Flooded Lead Acid batteries. Charging currents can vary from 100mA at quiet and cloudy&foggy day to 50A clear and windy day. Depending on weather conditions. Also battery voltages vary accordingly. It seems that A/h is the only important parameter. Still, voltages are very indicative about the charge state. Completely full or completely empty. Need to think...