08-29-2022 03:00 AM
Hey All,
I am currently using a USB-6343 DAQ from a .NET application where I continuously monitor data from multiple (1-6) pressure transducers connected to an Analog Inputs, both to 1) plot them to a waveform chart in semi-real time and 2) flip a valve attached controlled by a Digital Output when the pressure reaches a certain threshold, relieving the pressure for a period then closing it, allowing the pressure to build again. I want to do this for a user defined number of cycles.
Thus far, I have been using a producer-consumer model where I used the EveryNSample event to read (produce) from the DAQ buffer placing the readings into Queue, combined with a timer that updates the GUI with the contents of the queue at a slower interval and a thread dedicated to peeking at the last value in the queue to see if my threshold has been met. If it has I initiate a asynchronous Task that opens the valve, sleeps for the desired time and then closes it.
This process works, but has results in quite a heavy CPU load (task per nest for open/close, dedicated monitoring thread, and thread for reading the values from the DAQ) and I always end up opening the valve a little late. Any ideas on how to do this faster or more efficiently?
09-06-2022 08:19 AM
Hello JonathanMcNeil,
Did you try to use another way to communicate data between loops, for instance Channel wires.
I am also attaching article about getting started with channel Wires. Here is the link. It might be helpful in this case.
Regards