LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing and Data Collection Issues with DAQ Assistant

Solved!
Go to solution

Hello NI Developer Zone,

 

I am a LabVIEW Novice and have seen how helpful you all can be, and so I come to you seeking your help.


I am having some problems with a VI I built which reads a voltage input, from an SCB-100 connected to a PCI-6031E, and converts this voltage into a temperature displayed on a waveform chart. The goal is to give a constant readout of the Temperature and to display it in a chart for as long as the VI is running (and to reset the chart the next time the VI runs).

 

The problems I have currently run into are:

     - After several minutes of running the VI, I receive an error message 200279: Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten. (at the DAQ Assistant express VI).

     - I am not sure how to scale my chart so that the minimum X value is the time at which the VI was started, and have the maximum X value increase with every iteration of the loop. Currently, I am having the VI get the system time and input that to the X Scale Range property node. This has worked for the chart of the voltage, but not for the chart of the temperature

 

I appreciate all of you who have taken the time to read my post.

Thank you all for your help.

 

Sincerely,

 

Ethan A. Klein

SB Candidate in Chemistry & Physics

Massachusetts Institute of Technology

Class of 2015

 

 

P.S. I have attached my VI to give you all a better understanding of my current situation.

Sincerely,

Ethan A. Klein
SB Candidate in Chemistry & Physics
Massachusetts Institute of Technology
Class of 2015
0 Kudos
Message 1 of 10
(3,885 Views)

The problems I have currently run into are:

     - After several minutes of running the VI, I receive an error message 200279: Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten. (at the DAQ Assistant express VI).

     - I am not sure how to scale my chart so that the minimum X value is the time at which the VI was started, and have the maximum X value increase with every iteration of the loop. Currently, I am having the VI get the system time and input that to the X Scale Range property node. This has worked for the chart of the voltage, but not for the chart of the temperature

 



First, I would recommend getting rid of express vi and using the DaqMx, there are plenty of example codes in Labview>>Help>>Find Examples that would help you in it. The error you mentioned is usually related to the buffer, basically if the data acquisition is faster than the processing, bu the time labview finishes the processing of existing data, the current data that has been acquired gets overwritten by new samples, thus giving you the error. Possible solutions, make sure you are using arrays efficiently, not making multiple copies. If there is heavy math going on, I would recommend trying producer consumer architecture. 

  If you can post the vi in verion 2009 or older I can have a look at it.



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 2 of 10
(3,880 Views)

Also, make sure the ratio of data rate to samples to read is at least half and not unreasonably low either. For example, if your data rate is 10000 samples/s, your samples to read should be about 5000samples or little less. What it means is, the loop will have to run at least 2 time in a second to get desired sample rate data. If your samples to read is too low, that would mean your loop has to run ralatively faster to keep up the data rate. 

 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
Message 3 of 10
(3,876 Views)

You are trying to read 100 samples from a task that is running at 1kS/s.  So if your loop is slower than 100ms, you will lose data and get your error.  One thing that made me wonder was the reading of a control via a property node.  This is usually a slow process.  A wire would be much more efficient (which you can use and then eleminate the sequence structure).  I also noticed that you are only processing a single value.  Why not process all of the data? I think you need to use the Convert From Dynamic Data node to convert to a 1D array of scalers.


GCentral
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 4 of 10
(3,872 Views)

Thank you for writing.

 

Which property node is that you are referring to?
I do not understand the different data types that well. How can I go about processing all of the data?

(Did you mean that I should wire the "blue" data to the math functions rather than use the voltage property node?)

 

 

Sincerely,

Sincerely,

Ethan A. Klein
SB Candidate in Chemistry & Physics
Massachusetts Institute of Technology
Class of 2015
0 Kudos
Message 5 of 10
(3,860 Views)
Solution
Accepted by topic author E_A_Klein

@E A Klein wrote:

Thank you for writing.

 

Which property node is that you are referring to?
I do not understand the different data types that well. How can I go about processing all of the data?

(Did you mean that I should wire the "blue" data to the math functions rather than use the voltage property node?)

 

 

Sincerely,


Actually, any of the property nodes.  I was specifically referring to the voltage property node.  But upon reexamining, I noticed the other property nodes for the chart.  Just set the autoscale for the X scale and that should take care of two of the property nodes (right click on the chart, X Scale->AutoScale X Scale).  I would also recommend putting your math functions into a subVI to make things easier to read.  Attached is what I think you are after.

 

Hopefully those small tweaks will speed things enough to avoid your error.  If not, then we will need to start looking at the Producer/Consumer design pattern or take more readings at a time.  It might also be worth looking at getting away from the DAQ Assistant and using the real DAQmx VIs.  But one step at a time.


GCentral
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 6 of 10
(3,851 Views)

Thank you very much for your modifications to the VI.

 

I had tried autoscaling X before, but found that it did not keep the same minimum time on the X Axis (and so resorted to the roundabout method with the property nodes).

Did you do anything in particular to the plot to autoscale in this manner?
(I find that now the autoscale is working in the way I had originally hoped for....strange)

Is there any way to clear the data every time the VI is run?
Also, I find that when I change the units on the X axis to the system time, I do not get the correct time at all.

 

Thanks again for your time and effort.


Sincerely, 

Sincerely,

Ethan A. Klein
SB Candidate in Chemistry & Physics
Massachusetts Institute of Technology
Class of 2015
0 Kudos
Message 7 of 10
(3,838 Views)

@E A Klein wrote:

Is there any way to clear the data every time the VI is run?


Wire an empty array into a property node to set the History.  Use the errorr cluster to tunnel to the while loop to make sure the chart is cleared before you start capturing data.


GCentral
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 8 of 10
(3,831 Views)

Thank you. That was just what the VI needed.

My final question: The timing scale of the Temperature Chart starts at 7:00:00PM 12/31/1903 and scales not in seconds (maybe this is a default time for LabVIEW Software?)
I think this is because the waveform chart is within the while loop, though the problem is not fixed when i move it to the same structure as the chart for the voltage. Any suggestions?

 

 

Sincerely,

Sincerely,

Ethan A. Klein
SB Candidate in Chemistry & Physics
Massachusetts Institute of Technology
Class of 2015
0 Kudos
Message 9 of 10
(3,821 Views)

@E A Klein wrote:

Thank you. That was just what the VI needed.

My final question: The timing scale of the Temperature Chart starts at 7:00:00PM 12/31/1903 and scales not in seconds (maybe this is a default time for LabVIEW Software?)
I think this is because the waveform chart is within the while loop, though the problem is not fixed when i move it to the same structure as the chart for the voltage. Any suggestions?

 

 

Sincerely,


That is the absolute time = 0 in LabVIEW.  The time is saved as seconds since that time.  I'm not sure what you mean by not scaling in seconds.  Maybe you should play around with the format of the scale (right click on the scale and choose "Formatting...").

 

Currently, the voltage chart's X axis is based on samples, not time.


GCentral
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
0 Kudos
Message 10 of 10
(3,811 Views)