LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Hello Kevin,

 

Ok, so the FFT is taking less than 1 ms to execute at the expense of using the CPU to 30%, which is ok for now.

 

1. I need to read tdms files and do the FFT. In your code you are loading the file at each iteration, even if the file path did not changed.  In addition, the results from the FFT is only displayed in the graph, it is not used by the critical process (FFT of the data acquisition). So, I would suggest that you move out of the loop the loading of the TDMS file into another one and only execute the code when the value of the "file path 2" changes. The basic architecture I would do is the following:

- Loop for the data acquisition (producer)

- Loop for the data acquisition processing (consumer)

- Loop for the non critical operation (Loading a TDMS file and display FFT, only on a path changes using an event structure).  The data acquisition queue will act as a buffer if this operation takes some time to execute and then the application will fall back on it's feet after this operation.

 

2. I need to save Measurement data. I tried the TDMS write file bellow and it's taking to much time (250ms average) when executing at 100ms.  So, in this case you must avoid using the TDMS file and use the primitive functions to write in the results file.  Try the code bellow and you should see the % CPU and the Time(ms) increase, monitor also the "# elements in queue".  If the "# elements in queue" keep increasing, try to change the "Sample to read" to 2000.  Increasing this number won't have a big effect on the "Write to binary file" and should avoid the "# elements in queue" from increasing.

 

ffttest2.png

 

 

3. Need to recall File I/O for Trend Display. Put this code in the "Loop for the non critical operation".

 

Michel

Message 11 of 28
(2,221 Views)

Hi Michel,

I created the three loops as you mentioned, I created a non-critical loop for (loading the tdms, fft and trend plot.)

Please find the ZIP file attached to the post.

This is what i observed:

When the  data acquisition (producer) and data acquisition processing (consumer) are running:

1st case:

1> Samples to Read =1000 (With Peak frequency FOR loop disabled)

Time=0ms, CPU use= less than 10%

2> Samples to Read =2000(With Peak frequency FOR loop disabled)

Time=0ms, CPU use= less than 10%

 

2nd case:

1> Samples to Read =1000 (With Peak frequency FOR loop enabled)

Time=reaches more than 200 ms after 30 min(approx) and there is a delay in response, CPU use= less than 30%

2> Samples to Read =2000(With Peak frequency FOR loop enabled)

Time=reaches more than 200 ms after 30 min(approx) and there is a delay in response, CPU use= less than 30%

 

When i turn on the Control for Non Critical operation loop, i am getting the error attached to the post and the program stops working. 

BTW I used the primitive functions to write(in consumer loop) and read the file (Non Critical loop), it doesnot seem to work properly. I cant open the saved tdms file outside LabVIEW (offline).

 

I need to find the FFT peaks in the consumer loop, hence its consuming a little more time. If i increase the samples to read, the program works fine for atleast half an hour.

 

Excuse me if i am not clear about anything. I am unsure how to fix all this issues. I need a little more help. 

 

 

Regards,
KM
0 Kudos
Message 12 of 28
(2,193 Views)

Hello Kevin,

 

Like I said in the previous post " I tried the TDMS write file bellow and it's taking to much time (250ms average) when executing at 100ms." So I think you should try to use the primitive function because the application won't keep up when using the TDMS write as your are doing right now because it's taking longer than 100ms.

 

You should remove the 100ms wait in the " Loop for Data Acquisition", it is useless since you have a timeout of 10 seconds on the DAQmx read.

 

Another thing you can try (if you want to stick with TDMS files) is something related to TDMS write file that is configurable in DAQmx, see the following discussion forum link.

 

https://forums.ni.com/t5/LabVIEW/write-to-multiple-data-files/m-p/3102738#M888635

Message 13 of 28
(2,182 Views)

Hi Michel,

I went thro the link for TDMS write and i implemented the same for my program. I configured DAQMX configure logging in the acquisition loop and its fine now. 

But I have some more issues:

1>  I want the Peak Frequency FOR loop in the Data Acquisition processing loop, which is incresing my processing time and the Queue size.

 

2>  In Loop for Non Critical Operation, I have three cases: Control for Non Critical Operation, Save Front Panel, Print Front Panel.

 

  • When i run the VI, i can run only a single case among the three cases until i stop the vi (Only one case works when i Run and Stop the vi).  For Ex: If i click on the Save FP control when the vi is running, it saves a image. I cannot save the image again on another click. I mean to say i can save the image only once. Same problem for other 2 cases as well.

I have attached the updated program to the post, Please suggest me where i should improve.

Regards,
KM
0 Kudos
Message 14 of 28
(2,169 Views)

Make the following correction:

 

In the " Loop for Data Acquisition Processing" you can't use the "i" terminal wired to the "for" loop that execute the "Waveform Peak Detection.vi".  When your program runs the "i" continuously increase, this means the "Waveform Peak Detection.vi" will be executed "i" times (so when i=1000 you are executing the "Waveform Peak Detection.vi" 1000 times which is bad) no wonder the application can't keep up.  In addition this function is always computing the same thing.  What do you want to display in the graph?

Message 15 of 28
(2,159 Views)

Hi Michel,

I made the correction, i replaced the Waveform Peak Detection.vi with Peak Detector VI, i eliminated the for loop. Now the processing time(0ms) and cpu usage is fine. 

There are few more problems that i am concerned about.

1> The stop control in consumer doesnot work, i can stop the vi only by using the Abort Execution in toolbar. 

2> I mentioned this problem below in my previous post

 

 In Loop for Non Critical Operation, I have three cases: Control for Non Critical Operation, Save Front Panel, Print Front Panel.

 

  • When i run the VI, i can run only a single case among the three cases until i stop the vi (Only one case works when i Run and Stop the vi).  For Ex: If i click on the Save FP control when the vi is running, it saves a image. I cannot save the image again on another click. I mean to say i can save the image only once. Same problem for other 2 cases as well.

 

Regards,
KM
0 Kudos
Message 16 of 28
(2,114 Views)

That's because you are stopping the "Loop for Non Critical Operation" loop when clicking on "Save Front Panel" button, same for other events in that loop.  Instead of wiring the button value to the loop terminal condition you should create a new event case and manage the value change of the "Stop Button".  Only this case should set the loop terminal condition to TRUE, all other cases should set the loop terminal condition to FALSE, this way you will be able to execute any cases at any time.

Message 17 of 28
(2,106 Views)

Hi Michel,

that was really helpful. I resolved the 2nd  issue i mentioned in my previous post.

But the 1st issue still exists.

The stop control in consumer doesnot work, i can stop the vi only by using the Abort Execution in toolbar.  

 

Regards,
KM
0 Kudos
Message 18 of 28
(2,082 Views)

Send me your code, I will tell you exactly what to do.

0 Kudos
Message 19 of 28
(2,078 Views)

Hi Michel,

Please find the attachment.

Regards,
KM
0 Kudos
Message 20 of 28
(2,070 Views)