LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquisiton timing problem

Solved!
Go to solution

Hi all,

 

I got a problem with acquisition timing. I'm currently using Timed Loop for setting the iteration of 2s. However, after several hours of running the program, late executions occur (even sometimes it takes 4 to 6s for completing one execution, which I don't think my code is that heavy to process). I post my block diagram below. I would really appreciate if someone could give me the tell me the cause of this problem and how to overcome it.

 

Btw the computer spec is

Core i7

3GB RAM

Windows XP

 


Setting of timed loop:
1kHz                               clock

2000ms                           period

100                                 priority

Discard missed data        Unchecked

Maintain original phase    Unchecked

 

Thanks in advance

block diagram.JPG

0 Kudos
Message 1 of 3
(2,729 Views)
Solution
Accepted by topic author U_hend

OK, so I think there are only two possibilities for the lag:

 

Reason 1:

The YKDQ measure subVI.  Perhaps the code that actually acquires your data is hanging up for some reason.  I don't know what is hapenning in that subVI, so I can't say for sure.  But its possible it could hang for some reason?

 

Reason 2:

Build Table.vi is an express VI that builds up an internal buffer of data.  According to your code, it keeps appending to that buffer until some time is reached.  And then it writes the buffer to MS Office (right?).  LabVIEW is notoriously bad at eppending large arrays.  See here for more details.  If you keep appending to a large buffer, it will eventially slow down your PC because LabVIEW keeps moving the arrays around in memory.

 

My reccomendation:  Use a smarter method of appending to that array.  Pre-define the size of your array, and then use "Replace Array Element" instead of appending.  See here:

 

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

 

http://www.medicollector.com
Message 2 of 3
(2,681 Views)

Hi josborne,

 

Yup, you got it right, the problem is with build table.vi (Reason 2) Smiley Happy

After analyzing the VIs in profile performance and memory, I found that the the memory usage is growing at build table.vi, so the solution was to reset the build table.vi every iteration and transfer the data into index array. It seems to work fine so far. I'll update again later if everything works fine after long time measurement.

 

Thanks Smiley Happy

0 Kudos
Message 3 of 3
(2,668 Views)