03-09-2016 02:11 AM
Hi All,
I have an issue with my code (relevant section image shown below) and I am hoping you guys can help me understand why I am experiencing the problem that I am. The problem experienced has to do with the acquisition rate wired to the daqmx sample clock. When my VI is running, there is no prblem with the data displayed on the waveform initially regardless of the acquisition rate I specify. However, when the true case is initiated inside the case 1 structure and I reinitialize my daqmx task, I experience extreme data lagging problems (the waveform chart, data logging, and user inputs lag way behind data changes) if I set the acquisition rate above 400Hz. As long as I keep the acquisition rate below 400 everything seems to work fine but once I go above that rate, I experience the problem only when the true condition is met inside the case 1 structure and so I switch to acquiring and reading the data in the while loop that is inside the case structure. I hope my explanation of the problem is clear enough and I would appreciate any insight as to what might be going on here. Thanks.
Solved! Go to Solution.
03-09-2016 05:02 AM
I think your major lag is due to that property node. A property node is HORRIBLY slow to write to. The simple solution could be to replace it with a local variable.
A better solution would be to use a Producer/Consumer architecture. Since it looks like you only care about logging the data when above 300, you could just enqueue the data when above 300 and then your logger just sits there and waits for data to come in when you are lower than 300. This will help since you will not have to destroy and recreate your task and have duplicate code. This is one of the few times I would recommend not to use the DAQmx Logging capability.
03-09-2016 06:11 PM
You were exactly right crossrulz. I switched the poperty node to a local variable and the lag went away. I had no idea that a property node would create such a drastic slow down. Thank you.
03-09-2016 06:48 PM
@crockengineer wrote:I had no idea that a property node would create such a drastic slow down.
Let me put it this way, the last time I did the benchmark, the property node was about 10,000x slower than the local variable. The local variable was slightly slower than writing to the terminal.