LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queues and logging 2 values at different rates

Hi all,

 

I have been developing a VI to open and close a 3/2 solenoid valve which creates a pulse in a fluid line. The VI uses 2 producer and consumer loops to send a voltage pulse and then a third loop to log this pulse and the resulting pressure in a transducer.

 

At the moment i can only figure out how to log both these values at the same sample rate but it would be great if i could have them log at different rates i.e pressure 100 Hz, voltage pulse 10 Hz if someone could please give me some advice on this?

 

I am also very unsure about my architecture in general as i am very much a beginner. Is this the best way to go about this?

 

Feel free to tear me to shreds 🙂

 

Xander

 

 

 

 

 

 

 

0 Kudos
Message 1 of 3
(2,803 Views)

1. I don't see a need for either of your Producer/Consumer loops.  All the consumers do is update indicators.  You don't have anything that timing critical that you can't just keep them together.

2. Do NOT log based on local variables.  That is just riddled with race conditions.  Instead, you should be using a queue to send data to the logging loop.  This way, you can easily include a timestamp, etc with the data (ie use the Waveform data type).

3. Please, stop using teh DAQ Assistant.  The main complaint with it is the use of the Dynamic Data Type.  We have seen SOOOOOOOOOOOOOOOOOOO many issues from it abstracting the actual data.  Go give this article a good read: Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications

4. What do you want your log file to look like?  If you are sampling at different rates, then you would likely need 2 files to save the data and then correlate them somehow with timestamps.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(2,747 Views)

Hi,

 

Thanks for getting back to me I really appreciate it! Please see my responses below.

 

 

  1. I thought this might be flagged as I really wasn’t sure how to attack this. Would you suggest having 2 producers, 1 for the pressure and the other for the pulsing to queue the data, then 1 consumer for both of them to dequeue them, display and log. Or should the logging be in a different loop? If so can you dequeue the same data in 2 places?
  2. I did read that local variables aren’t great I guess it was just a quick fix on my part. Will look to queues as mentioned above. I am currently time stamping my log file with a get tome/date string just before it’s saved. Is it much better to use waveform data
  3. Noted, it was on my list of 2 do’s. Will give that article a read later today. I see you can convert the daq assistant to daqmx code by right clicking? Is this advised?
  4. I would preferably like it all on the same note pad/sheet as I will eventually be scaling this up to encompass the entire system and having 10-15 separate sheets would be a pain for whoever is analysing the data. I will have multiple values logging with transducers, encoders, LVDT, load cell and thermocouples all logging at different rates from 1per day to 1kHz. I was thinking for example I had a pressure transducers logging at 200 Hz and a thermocouple logging at 1 Hz then the value for the TC would be blank for 199 lines.
0 Kudos
Message 3 of 3
(2,717 Views)