Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

queue does not update after a while

Hi all,

 

I was hoping one of you can help me with a question concerning queus. I have attached part of the code I am using to read two temperatures using RTD probes. I also acquire a weight signal in another while loop. I want to write these numbers to an ascii file. I acquire T at 5 Hz. The problem I have is that the temperatures written to the file start out ok but after a while only the mass signal and the time stamp are correct while the temperatures are no longer updated and the T values written remain constant while the actual measured T is not. The fact that the T's are screwy but the mass and timestamp are not makes me think I'm doing something wrong in setting up the queue. If I acquire data at 5 Hz and only write to file every 60secs or so for 4 hours I should not end up with an impossible amount of data in the queue? Why are correct T's written to the file initially but no longer after 10 - 20 min?

 

I am wondering if I can solve the issue by making the queu a fixed size, I suppose there is no need to keep a large number of data points in a queu when I am going to discard those data points anyway? Does this screw up the T profile I am trying to record?

 

I suppose I can use a case structure and a elaped time block to determine when I write data to a file?

 

Thanks in advance for any help

0 Kudos
Message 1 of 4
(3,088 Views)

Hi ABiermans,

 

I would remove the Wait Until Next ms Multiple. What's happening is that you're adding elements into the queue faster than you can take them out. You should always dequeue your data as quickly as possible. If you're sampling at 5 Hz and you want to write data only once a second then you want to only write 1 out of 5 blocks of data to file. You still have to dequeue the other 4 blocks but just don't write them. Use the loop index i to implement this logic.

 

Good luck!

Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test
0 Kudos
Message 2 of 4
(3,071 Views)

I see. I kinda figured the queue didnt like having data crammed into it at a much faster rate than it is taken out. In the meantime, while figuring out the queu issue, I had to have functional code for the students to use. Attached a piece of code that should allow writing to multiple files (but not at the same time), pause and set recording intervals. This code does not use a queue. Now, I'm sure using a queue makes this code cleaner and more efficient. I think I sort of understand how to use the loop counter [i] to only write a portion of the data. The question I have then is how to pass the file reference to the consumer loop when I set the file data in the producer? I wouldnt mind critique on this piece of code.

 

When you dequeue all the elements in the consumer loop and only write some of them, what happens to the elements that are not written to file?

 

What makes labview a little tricky is that you can do a thing in many ways but only a few ways or one way is efficient and 'clean'.

 

Thanks for your time.

0 Kudos
Message 3 of 4
(3,059 Views)

Hi ABiermans,

 

I notice that your second VI is no longer a Producer/Consumer Queue architecture.  Nevertheless, you can simply pass the file reference into both loops if needed.  I recommend creating/opening the file outside of your loop(s), and then feeding this in when you plan to write/read, and finally close it outside of the loops, after exiting.  the same way you have already done this in your first VI example you attached.

 

When you dequeue the element but do not write the data, it is lost data and the reference in memory is no longer.

 

Best,

Adam
Academic Product Manager
National Intruments
0 Kudos
Message 4 of 4
(3,035 Views)