LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I acquire data at a desired rate while continously monitoring the data?

Solved!
Go to solution

I attached the vi that I currently have - so far it steams continously but I cant get it to log at a desired rate.

0 Kudos
Message 1 of 7
(3,175 Views)
Solution
Accepted by topic author HelpMe9211

Helpme9211,

 

Your post was a little light on details but looking at your code I suspect you wish to display the temperature from all 10 channels and then log to disk at a slower rate than you're updating the display. 

 

I noticed a few things that might be causing problems:

 

 

  • Your DAQ assistant is set to acquire 100 samples at 100 Hz (thus taking 1 second to return any values).  You also have a 100ms delay in your loop which will be ignored since the DAQ Assistant is already taking longer than that to return.
  • You are writing to file every loop iteration, even though you only formulate a value string every 600 iterations (or every 10 minutes due to the loop rate set above).
  • You perform a lot of seemingly unnecessary array manipulation.  I haven't run your code but it looks like you currently take 100 samples from every channel and then just take the first value from each channel and then recombine those first values into a new array.  A more efficient way would be to just acquire the values you want to use and just wire the array directly. 

 

 

I made a quick pass at cleaning those things up -- again, I haven't run any of this code since I don't have any HW here but I think it should help get you on the right track. 

 

 vi_snippet.png

 

Is this a VI you wrote yourself? If so I'd be interested to know which materials you used to learn LabVIEW.  I'm looking at ways we can help new LabVIEW users be successful faster and it'd be nice to know where people are finding help/resources.

 

~SimonH

Message 2 of 7
(3,155 Views)
I made the changes - but the data doesn't stream to file during the run. Only when I start and stop the vi 
0 Kudos
Message 3 of 7
(3,130 Views)

I'm sorry I clicked post prior too finishing - I'm confused about the sampling rates, frequency and what they should be set for within the DAQ block and within the vi itself.

I've had some help but I'm really an end user trying my best to program I guess. 

0 Kudos
Message 4 of 7
(3,127 Views)

How often do you want to log to file?

 

How long are you letting your program run?

 

Your DAQ assistant is set to acquire 1000 samples at a 1kHz rate.  That sets your loop iteration at 1 sec.  The code is set to log the last second of data to file either when you hit Stop, or every 300 loop iterations which means 5 minutes.

 

If that is not what you want, you'll have to provide more details on how often you want to log data, and how much data you want to log.  As it is now, you are throwing away 299 seconds worth of data and only keeping 1 second worth of data.

0 Kudos
Message 5 of 7
(3,124 Views)
Sorry you're correct - I'll run it for an hour and check it - Thank you
0 Kudos
Message 6 of 7
(3,120 Views)

Also the way your code is setup you are only displaying the first of the 1000 samples you take on each channel each loop iteration.

 

Temperature is a fairly slow signal so I imagine setting the DAQ Assistant to 1 Sample (On Demand) is what you want. 

 

2010-04-20 14 00 08.png 

 

This would also stop the DAQ Assistant reducing your loop rate to 1 Hz and would allow you to run at the 10 Hz defined by the 100ms delay. 

 

~Simon 

Message 7 of 7
(3,097 Views)