07-14-2020 03:53 PM
Is it possible to build a translation system using CompactDAQ that reads input voltage (-10..10V) and translates it into output voltage (say, -10..10V) following some function?
How can I estimate the delay between input and output?
For example, I want to use these two cards:
And function is simple output = A*(input - B)
Ideally I want to be able to adjust A and B in real time using GUI through labVIEW
07-14-2020 06:12 PM
The delay (often termed "latency") will depend partly on how you code and partly on things outside your control (DAQmx driver, USB bus, Windows' priorities, etc.). Let's start by aiming for ~1/20th sec latency, because it's likely gonna work without much fuss.
Here's what I'd do:
1. My AO would be a software-timed on-demand task where I update the AO value about 20 times a second.
2. My AI task would read data about 20 times a second and read something like 10 to 100 samples per iteration. (I'd set the hardware sample rate accordingly.)
3. I'd reduce the AI data to a single scaled value. For starters I'd use a simple mean, but you could consider things like an exponentially weighted average, or some type of formal digital filter.
4. Then I'd use pipelining to feed this single value forward into the next iteration.
5. On the next iteration I'd scale the input value according to A*(input - B) and write the result to the AO task. This would happen in parallel to the AI task waiting for its new 1/20th sec worth of data.
See attached and snippet below.
-Kevin P