Andreas,
Thanks for the information. I am glad part of the issue has been solved.
It seems like current issue is caused by the PXI controller not being able to keep up with the acquisition given the amount of parallel processing in your application.
Software optimizations might allow you to obtain the desired rates, but for a quicker (and maybe even cheaper, if you count the development time) solution, I would recommend getting a second PXI DAQ board so that you can perform two acquisition tasks at different rates.
This will allow you to use lower rates when possible, freeing up the processor (which has to manually copy data from the driver buffer to the application memory space) and therefore possibly allow you to perform the data processing you desire while still acquiring the data.
Additionally, it seems like your application involves two very different types of acquisition tasks:
1) Relatively slow, continuous acquisition, where every sample has to be monitored (possibly evaluated and compared to some threshold)
2) Relatively fast, start/stop triggered acquisition. This ends up being a double-buffered (continuous) acquisition to the driver, because anything involving a stop (reference) trigger is interpreted as a continuous acquisition with a stop trigger.
These two different tasks indicate to me that it would be natural to have two DAQ boards in the system. It would probably save you a lot of headaches.
3) A third option would be to use a controller with a faster processor.
Some software optimizations that might help you include:
- Minimize memory allocations inside the acquisition/processing loop:
Array creation/resizing can make you pay a high performance price. I suggest pre-allocating arrays of large enough sizes instead of building them as you process the acquired data (as in where you decimate the acquired signal)
Use the Initialize Array VI before your acquisition loop, shift registers to keep track of the array throughout the loop iterations, and the Replace Array Subset VI to insert values into the pre-allocated arrays.
- Use unscaled data:
You'll be surprised how much it can help you to simply acquire the data in raw, unscaled mode. You save a lot of processor time by avoiding the scaling process applied by the driver to every acquired sample.
If you want to compare a signal to some fixed value, then simply apply the reverse scale to that value, so you can convert it to the equivalent unscaled value you would obtain when reading directly from the board's ADC. The data that you send to the remote app might then be scaled back to real-world values at the point of destiny (provided that you know the gain factors, ADC resolution and polar mode), saving your acquisition box processing time.
I hope these things help,
Alejandro