# Calculating Irms in excel

Discussion in 'General Electronics Chat' started by Pidgeydoyle, Mar 30, 2013.

1. ### Pidgeydoyle Thread Starter New Member

Dec 4, 2012
12
1
Hey everyone,

I have an excel spreadsheet containing data points (t,A) of a non sinusoidal current waveform, I was wondering if anyone knows how to calculate Irms of the waveform using these values?

tried
=SQRT(SUMSQ(B3:B7000)/COUNTA(B3:B7000))
where B3:B7000 are my current values.

with no success

any ideas would be greatly appreciated.

2. ### crutschow Expert

Mar 14, 2008
20,026
5,630
It appears to work for me. What do you think your result is wrong?

Pidgeydoyle likes this.
3. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
674
The data points need to be uniformly spaced. if they are not, some data points will be weighted too heavily, and some not heavy enough.

Pidgeydoyle likes this.
4. ### crutschow Expert

Mar 14, 2008
20,026
5,630
Good point Ron. If the data points are non-uniformly spaced then their contribution to the average must be calculated in proportion the time allocated to that data point as a percentage of the total time.

Pidgeydoyle likes this.
5. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
674
I found a utility that takes input from an LTspice .raw file, and creates a file with uniform sampling. I haven't had time to figure out how to use it yet.

Pidgeydoyle likes this.
6. ### GopherT AAC Fanatic!

Nov 23, 2012
8,025
6,786
Pidgeydoyle likes this.
7. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
674
The whole point of the following exercise is to show that, if you have equally spaced data points, Excel will yield correct RMS data.
I got the aforementioned utility working.
In LTspice, I simulated a 1V peak, 1Hz sine wave with minimum step size=1mS. I ran the sim with compression on (default), and with it turned off. I turned off compression with .OPT plotwinsize=0 (I believe you can also do this in the Control Panel), so that all data points would be saved. With compression on, only 105 data points are saved in the .RAW file. With compression turned off, there were 1021 data points, covering 0 to 1 second.
Next, I ran the uniform sampling utility on the uncompressed file, creating 1001 equally spaced data points from the original 1021 unequally spaced points.

Here are the results of calculating RMS with Excel (same equation as used by OP) on the three files:

Compressed File: RMS=0.5706V
Uncompressed, unequalized file: RMS=0.7001V (used the first 1020 data points)
Uncompressed, equalized file: RMS=0.7071V (used the first 1000 data points)
I'm uncertain whether or not I should include the last point.

The LTspice waveform arithmetic utility reported RMS=0.7071V, which is the correct value for a 1V sine wave.

Pidgeydoyle likes this.
8. ### crutschow Expert

Mar 14, 2008
20,026
5,630
I generated a short series of 19 equally spaced data points for the sine of 0 to $\pi$/2 (0-90°). The formula gave me a value of .7071 for the data, which is correct. I also did the RMS of a square wave, which was likewise correct. So based upon Ron's and my results, I think any any error in the calculation is due to an error in the data (such as non-uniform time spacing of the points).

Pidgeydoyle likes this.
9. ### Pidgeydoyle Thread Starter New Member

Dec 4, 2012
12
1
im not sure what the problem is.

Consider the excel document called rmsABC here

http://domesticinductionheater.wordpress.com/documents/

(Didnt know any other way to show ye)

When using the formula i get an IRMS of 8.12 but pspice thinks IRMS is the horizontal line at 5.5. I am very confused!

10. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
674
A quick sanity check says Pspice is wrong. If your data were a pure 11V peak sine wave, the RMS value would be 7.778V. Since your peaks are slightly crushed, that pushes the RMS value a little higher. 8.12V seem about right.
Do you know how Pspice came up with that value?

Pidgeydoyle likes this.
11. ### Pidgeydoyle Thread Starter New Member

Dec 4, 2012
12
1
Sorry for the delay in responding.

Its seems the formula works fine. Im not sure why spice was giving me such an off the wall figure. Im sure it was my fault!

Thanks for all you help!