05-09-2013 03:35 PM
I am currently working on a project that requires me to record my data at 1ms intervals or less. Currently the lowest timing interval I can record is at 10ms. If I change my wait timer to anything below 10 the recorded data in excel will skip time. For example instead of it starting at 1 ms and counting 2,3,4,5,6...,etc. It is skipping from 2,5,12,19,....,etc. So my question is if it is a limitation that I have reached on the NI Elvis or if it is possibly a problem with how I've created my LabVIEW code. My program from an operational stand point is working great, but it is my data recording that is causing me to not be able to move to my testing phase. Any help on this matter would be greatly appreciated.
Other information that might be relevant:
Operating System: Windows 7
Processor: Intel(R) Xeon(R) CPU E31245 @ 3.00 GHz
DirectX Version: 11
05-10-2013 04:33 PM - edited 05-10-2013 04:34 PM
So my immediate thought on this issue is that the code inside your primary while loop might be taking too long to process to achieve such a high sample rate. Especially when making calls into external applications (such as Excel) which can take a large amount of itme.
There is a very useful debugging tool called the Performance and Memory tool. If you aren't familiar with this tool, it will allow you to see how much memory the various chunks of your code are using and, more importantly here, how much time each subVI is taking to execute. Does the code inside your while loop take longer than 1ms to run? If so, then you will definitely see unwanted logging behavior and will need to change your approach. Would it be possible to collect more than a single sample at a time and perform calculations on a large number of samples at once before writing them to Excel in bigger chunks?
I've included a link to the LabVIEW helpful detailing the Profile Performance and Memory tool.
I would first try and figure out how long it's taking your loop code to execute and go from there.
I hope this helps!
05-22-2013 03:26 PM
Thank you for the reply. Sorry for the late response, but I was out of town.
I have went ahead and tested my code and it is running at about 15ms per interation. Which makes sense why I can't record at 1ms. The longest proccess actually isn't the code within my main while loop it's my startdx task that seems to be taking the most amount of time to complete. On average it is taking rought 12-13ms.
If I could collect more then one sample and get an array of data points to store that would be great. My primary goal in recording into excel is for later data analysis so however the data gets there isn't important.
05-23-2013 09:20 AM
Right now your code is set up to take 1 sample with every iteration of your loop. This will pull 1 sample from your buffer each time the loop runs and therefore you must wait until the while loop completes before taking another sample. You should consider using either finite or continuous data acquisition. You should read through this post for a great description of how these acquisition types work.
It may require some restructuring of algorithms inside your while loop, but this will allow you to increase your sample rate. You should check out the example for 'Voltage Continuous Input' which ships with LabVIEW to see how to implement this type of acquisition.
I hope this helps!