LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot RMS values

Hi Everyone,

 

I am using USB-6009 for data acquisition of voltage and current AC with rate of 15Khz. My problem is related with RMS value. I see the correct value in the indicator on Front panel, but I did not see this value in the graph. I think I have basic mistake, but I don't know how to fix it. I will appreciated a lot for support from community.

 

LVelozo_0-1680981163750.png

 

Best Regards,

Leandro Velozo

 

0 Kudos
Message 1 of 4
(1,010 Views)

Thank you for attaching the code (your .vi file)  Much easier to read (fortunately I had LabVIEW 2021) and understand your problem.

 

Each time through the Loop, you collect 10k samples at 15 kHz.  Inside the loop, you linearly transform the resulting Waveform, take the RMS, and take the single value, build it into an array (of size 1x1), and plot it, along with the 10k samples. Do you see a problem here?  Do you see a solution?  [Hint -- how many points would you like to plot at the (single) value of your RMS?  Do you know how to make these points?]

 

Bob Schor

0 Kudos
Message 2 of 4
(1,006 Views)

Hi Bob Schor, first thanks for support. The problem here is because I did not plot one line for RMS value, I would like to have a graph as imagem below.

LVelozo_0-1680988081623.png

 

0 Kudos
Message 3 of 4
(985 Views)

Thank you for the picture.  The upper plot seems to show a sine wave with a mean of 0, i.e. A sin (2 pi f t), where A is the amplitude, f the frequency in Hz, and t is time.

 

How do you express RMS?  RMS means "Root-mean-square".  Let's simplify a bit, and say the signal is sin(x).  What's the RMS value of sin(x)?  Let's square the sine to get sin²(x) = 1 - cos²(x) = (1 - cos(2x))/2.  We'll skip the "mean" part, for now, but see what squaring the sinusoid does?  It make another (co)sinusoid that is never negative (since the cosine goes from -1 to +1, which if you add one and divide by 2, you have a signal that has the following properties:

  1. It is periodic, repeating at twice the frequency of the original signal.
  2. Has values that are shifting "up" by at least 0.5, going from 0 to 1 instead of -1 to 1.

Now consider doing an "average" of a few points.  Consider if the points are on both sides of 0 (say, N points that are samples of a single sine "cycle").  The "Average" will be 0 (since you have an equal number of points above and below 0).  The RMS, however, will be around 0.7 (actually sqrt(1/2)).

 

You aren't "averaging", so RMS is missing the "mean" part.  So RS (my initials, actually) is just the square root of a square, which is also known as a "full-wave rectifier" (it turns the negative half of the waveform positive by reflecting around the X axis).

 

To get the RMS plot (without averaging), take your waveform and either (a) take the square root of the square of each point (the R and the S part), or (b) replace each point by the absolute value of the point (the full-wave rectifier).

 

Bob Schor 

0 Kudos
Message 4 of 4
(954 Views)