08-18-2014 02:05 PM
Hello everyone,
I recently inherited this mess of a VI, and cant figure out how to increase the sampling rate. I tried altering the "ms to wait' clock, but it didn't add many more data points. Attached is the main VI, as well as the subVI that contains a Daq Assistant for a load cell and LVDT. Any ideas on how to improve sampling frequency without a complete overhaul would be greatly appreciated!
Thanks in advance!
Solved! Go to Solution.
08-18-2014 02:25 PM
Okay if we are just talking about making the speed of the while loop faster there are a few things that can be done. Obviously my previous comments still hold. I think a re-write from professionals is best. But second best is to hack it in there. With the subVI and DAQ Assistant I can see a little more about what is going on.
So in your loop you setup a DAQ task to read 100 samples, on two channels, at 1KHz each, in a continuous mode. This will take 100ms based on the definition of 1Khz rate and 100 samples. But what comes out of that VI is a single sample. You are throwing away 99 samples, and reading one sample every 100ms or about 10Hz.
The easiest way to improve speed, is instead of reading 100 samples and throwing them away, read one sample, if you really only want one sample. Double click the DAQ Assistant and under Acquisition Mode change it to 1 Sample On Demand. Speed could likely be improved by not using DAQ Assistant and replacing it with DAQmx code but what ever.
Also as mentioned offline, you are opening and closing that file reference every iteration of the loop. You can have a producer consumer else where logging, or at the least just open once, and close once.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-18-2014 03:03 PM
Changing the setting of the Daq Assistant did greatly increase the number of data points collected. However, I still think I may need to have more. How do I go about opening and closing the reference file only once instead of at every point?
08-18-2014 03:12 PM
I don't know how much more speed improvement you'll see, and I don't know your current requirements. Any faster and it might be better to take N samples and display all N at once, and log all N at once. Again another reason it should be re-designed.
Still here is the logging technique I was talking about. I back saved it to 8.2 but no idea how it looks because I don't have that version to test on.
The VI is broken but it is just meant to show how the code can work with the Open on the outside of the loop, the writes on the inside, and then the close on the outside again.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-18-2014 03:34 PM
This improved it as well! I think at this point, and discrepancy in the data I am receiving is due to mechanical issues and not the VI. Thanks so much for the help!
08-18-2014 03:58 PM
If you are greatful, feel free to give kudos, and marking the topic as solved.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord