12-04-2012 06:59 PM
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
Solved! Go to Solution.
12-06-2012 04:21 PM
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
12-06-2012 06:53 PM - edited 12-06-2012 06:54 PM
Hi josborne,
Yup, you got it right, the problem is with build table.vi (Reason 2)
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