Showing results for 
Search instead for 
Did you mean: 

Response delay in Vibration Data and FFT graph & trend plot?

Hi all,

I am acquiring Accerelerometer sensor signal from a single channel of NI 9234 module. I have used Producer-Consumer design for Acquisition and Processing.

I am facing few problems as described below:

1. There is a delay in the reponse of Vibration data in the waveform graph after the VI runs for sometime.   

2. FFT response is been delayed too. 

3. Elements in the Queue goes on increasing.


I need to do trend analysis of the Vibration Data:

I need to recall a series of .tdms files and do the statistical analysis of the Vib data and plot the trend.

Any suggestions how to go about this.



Download All
0 Kudos
Message 1 of 28

How long this applications runs? First thing you should take care of are the two "Insert Into Array" function which will make your memory grow infinitely.  If the application runs for a while your OS may start using paging file which will have a significant impact on the application behavior (speed).

Message 2 of 28

Hi Michel,

Thanks for your time.

This application has to be optimized to run for atleast 4 hours a day. Is there a workround for the "Insert into array" function? 


Any suggestions about how to go about Trend Plot for Vibration Data?

0 Kudos
Message 3 of 28

First, what are your requirement about the data? From your code it seems that you want to save every acquired samples into TDMS files? If you want to do so, instead of the "Insert into array" you should write your data directly into the results file.  This is the first step you should accomplish.


Regarding the Trend Plot for Vibration Data, I guess you want to be able to view what happen in the last few hours?  One possible solution would be to "decimate" your acquired data that will be used for the trending display (this decimated data can also be saved into another file).

0 Kudos
Message 4 of 28

Hi Michel,

Thanks for your time,

For Trend Display?

I want to save the acquired samples into TDMS file and recall. I need to display the tread of changes, when compared with the old data (say 3 weeks ago data, 2 weeks ago data and a weeks data) and how the error/differences are progressing over time need to be plot.

If i dont use the Insert into array, Should i use the TDMS write function inside the consumer loop? I wonder if that may cause overflow error. 


Response delay in FFT

Vibration data response is fine but the problem is with the FFT Graph response. There is a delay. 


Any suggestions folks

Thanks in advance



0 Kudos
Message 5 of 28

What's your CPU usage at?  You have no delays in your while loops, so you're probably pegging the CPU pretty hard.


Assuming your default values are what you are using, you're generating new data every 100ms.  You're then generating 2 FFTs, capturing a plot image and saving it to disk, and opening and loading data from disk for the second FFT, and doing a peak detection on the FFT.  Since you are saying your queue size is growing, I'm pretty sure that all that stuff is not able to execute in 100ms.  And you start falling behind.


Why are you continuously opening the TDMS file and not closing it?  If you are not changing the filename during execution, you should just open it in the beginning.

0 Kudos
Message 6 of 28

Hi Matthew,

Thanks for your reply, 

With a delay of 100ms in both the loops, CPU usage varies b/w 50%-70% if i run the program for half an hour or so. 

Without any delay in both the loops, CPU usage varies b/w 50%-78% if i run the program for half an hour or so. 

I have opened 2 TDMS files and closed both of them, am i doing something wrong?

Excuse me if i am not clear about anything


0 Kudos
Message 7 of 28

Hi all,

I tried with a time delay of 100ms in both the loops. It doesnot seem to work. FFT response is the problem. The queue size keeps on growing. The second loop falls behind. I am not quite sure how to go about this issue. Should i use a one producer and a 2 consumer loop for Processing and File i/o. 

Thanks in advance

0 Kudos
Message 8 of 28

I think you should eliminate the second FFT because it's doing the same thing for each iteration.  Then, looking at the "Samples to Read=1000" and the "Rate=10000" it looks like you are sending data to the consumer every 100ms which is good for now.


Again, if you keep these "Insert Into Array" you will get into trouble.


Can you run the code below and let me know your CPU and Time(ms).





0 Kudos
Message 9 of 28

Hi Michel,

Thanks for your response,

I ran your code, it works fine. The CPU time varies like this. If i run the vi for sometime, the normal range is from 25 to 30% for most of the time and for some fraction of seconds it reaches 40% and comes back to normal range, and the Time is 0 ms. 

Now the probIem is,  am worried about other features. I need to do the following:

1. I need to read tdms files and do the FFT.

2. I need to save Measurement data.

3. Need to recall File I/O for Trend Display.

 All this cannot be done in a single loop.

Should i go for 1 producer and Multiple consumer design?  

I am worried i might lose data if i dequeue the data in multiple consumer loops.

I need your help.


0 Kudos
Message 10 of 28