From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RMS calculation through Rectangular Window with 25% time gap

Solved!
Go to solution

 

From any signal (e.g. sine), I need to calculate the RMS value, with a 1 millisecond integration time, through a Rectangular Window, with a 25% time gap.
In other words, instead of calculating an RMS value by considering every 1 ms interval, I need to calculate the RMS value of a 1 ms window, then apply a 25% (of the window) time gap and then calculate the next RMS value by considering a 1 ms interval, and so on.

So, in a single 1 ms window, there is a 75% superposition.

 

I appreciate any help.

 

Thank you in advance.

0 Kudos
Message 1 of 13
(3,596 Views)

!1-1.png

Use the point by point functions to get the RMS for evry "Window"  In this case every mSec then decimate the arrar to remove all the points you don't need


"Should be" isn't "Is" -Jay
Message 2 of 13
(3,589 Views)

 

First, I want to thank you for your quick answer.

 

Second, can you share some more explanation about the routine? Where do you calculate the RMS?

Can you join the VI? Or can you tell me where I can find such items as in the joined file?

 

Thank you very much.

0 Kudos
Message 3 of 13
(3,542 Views)

Firstly that's a snippet.  Just drag drop to a block diagram. Poof code.  Sum divided by count in the loop is moving average.  RMS is not what you wanted.  It would look really funny during zero crossings.  But you could square the waveform and take the square root.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 13
(3,531 Views)

Hello Jeff,

 

At my side the dragging an dropping from the browser doesn't seem to work.

If I save the png, then it does work.

 

I get the following message:
http://forums.ni.com/t5/image/serverpage/image-id/147934i8CA7AD4AFF879317/image-size/original?v=mpbl...

 

Can you confirm that this is the same at your side?

 

From here I can drag and drop the snippets:

http://www.ni.com/white-paper/9330/en/

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 5 of 13
(3,507 Views)

Depending on the browser used you may need to drag-n-drop to desktop then to a LabVIEW Block diagram

There is a "Jing" Here


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 13
(3,504 Views)

Hey Jeff,

 

Thanks for the feedback!

 

I think it's over here a combination of browser and image placeholders being used on the fora.

 

Drag and drop to desktop or just saving the png to the pc is indeed working ok.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 7 of 13
(3,501 Views)

(Att: joined files)

 

 

Hello,

 

Thank you for your answers.

 

1) In your routine, I don't understand the use of the:

 

  a) division operator : 0.001/dt, why? I could stand dt/0.001, but the other way, I can't. Plus, is this value a constant?

  b) equal operator, consisting of comparating 2 same values (thus always TRUE)!

 

2) "Use the point by point functions to get the RMS for evry "Window"  In this case every mSec then decimate the array to remove all the points you don't need ". What does that actually mean? 

 

3) But you could square the waveform and take the square root. Do you think this will do it?

 

Thank you.

 

Download All
0 Kudos
Message 8 of 13
(3,439 Views)

@AlainKabs wrote:

(Att: joined files)

 

 

Hello,

 

Thank you for your answers.

 

1) In your routine, I don't understand the use of the:

 

  a) division operator : 0.001/dt, why? I could stand dt/0.001, but the other way, I can't. Plus, is this value a constant?

  b) equal operator, consisting of comparating 2 same values (thus always TRUE)!

 

2) "Use the point by point functions to get the RMS for evry "Window"  In this case every mSec then decimate the array to remove all the points you don't need ". What does that actually mean? 

 

3) But you could square the waveform and take the square root. Do you think this will do it?

 

Thank you.

 


a) time in LabVIIEW is commonly in mSec- it is a conversion  1k mSec = 1 second

b) Not-A-Number or "NaN" is a special case for IEEE-754 floats. (They are not really numbers but, the best answer a compurters memory can represent for real numbers)  NaN is never equal to anything..BY DEFINITION!. even NaN!  So a DBLl equal to itself must be a number and not "Not A Number"

 

NaN is not graphed in LabVIEW Graphs and Charts.

3) But you could square the waveform and take the square root. Do you think this will do it? NO


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 13
(3,429 Views)
Solution
Accepted by AlainKabs

 

Hello.

It has been a long time since I last posted a thing.


 I have succeeded to get what I wanted, now I need to optimize it.

I simulate a sine wave and I get a 1 millisecond integration time 't' just fixing the number of samples 'N' and the sampling frequency 'fs' ( fs = N / t  <=> t = N / fs ). Then I use the 'Extract Portion of Signal' tool and I calculate the RMS value of that portion in a loop.
Does anyone know if there is a way to do the same thing without the 'Extract Portion of Signal' because that tool uses too much memory so the treatment time is just too long with 4k samples and at 4M samples/second.

 

Thank you.

0 Kudos
Message 10 of 13
(3,284 Views)