02-08-2019 01:27 PM
Hi,
I'm trying to save DAQmx acquired data to a queue to log to file in another loop.
However the number of elements in the queue grows like 10k elements/second even if I set the sampling rate to 10s/second.
The Waveform Graph updates at the acquisition rate just fine.
I attached a simplified version of just the acquisition to queue part.
For info I'm using a simulated PCI-6224 DAQ to test this.
There must be just a little thing I'm missing.
Thank you,
Solved! Go to Solution.
02-08-2019 02:04 PM
You left out the most important part, the dequeuing. What are you doing with the data when you dequeue it?
02-08-2019 02:07 PM
I'm writing it to a file. Left that out to simplify.
But my problem is the queue is growing too fast vs my acquisition rate.
02-08-2019 02:10 PM
You do not have anything limiting how fast the queue is being updated.
Put a 100 ms wait in that loop and it should only push 10 queue elements a second.
Ben
02-08-2019 02:10 PM
Yeah, after I clicked Post, I realized the point of your question. I misread it.
You're dealing with simulated devices and I'm willing to bet that is the source of this. Do a search for Simulated devices and learn how they behave.
02-08-2019 02:12 PM
Hi ben,
I can't put a wait in the program this is from.
Isn't the queue supposed to update just when the DAQmx read sends it data?
Which would be based on the acquisition rate?
02-08-2019 02:14 PM
It's because you have the Number of Samples to Read set to -1. In the VI Description for DAQmx read it says:
"If the task acquires samples continuously and you set this input to -1, this VI reads all the samples currently available in the buffer."
If there are no points available, the VI outputs an array of waveforms that don't actually contain any data. Try setting the sampling rate to 1 and probe the output, you'll see that all the waveforms are empty because there are no new samples to read yet.
Two ideas:
02-08-2019 02:32 PM
What version of DAQmx are you using?
02-08-2019 02:32 PM
@Patrem1 wrote:
Hi ben,
I can't put a wait in the program this is from.
Isn't the queue supposed to update just when the DAQmx read sends it data?
Which would be based on the acquisition rate?
You should qualify that statement.
Then change two things.
Outside the loop, set the sample rate to 10/sec
Inside the loop wire a "1" to the number of samples to acquire.
That should give you 10 Queue entries/sec with one sample in each queue entry.
As you have already been told, you are queueing up a lot of empty updates to the queue.
Ben
02-08-2019 02:40 PM - edited 02-08-2019 02:40 PM
Thank you ng,
I did not know this behavior of the DAQmx Read to send empty data in this case. Was not that clear in the help.
Putting something else than 1 works.
Ben, what do you mean quality this?
To explain what this goes into I'm in the process of learning QMH architecture and doing a data acquisition and logging program to pratice this.
In my program the samping rate can be modified and I want the data to be read as fast as possible and send to the queue to be logged in a file by another loop.