LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner questions - sampling and plotting.

Hello everyone,

 

I am currently doing my MSc in Chemistry where I in short words will observe pressure and temperature changes during a process. My faculty recently got Labview, with NI-USB 6341. I've managed to program a vi for logging pressure and temperature by using these forums and watching tutorials (great community!). The voltage signals from the pressure and temperature instruments are converted to bars and degrees Celsius, and are then stored with time.

 

A couple of questions:

1) The DAQ assistant has a sampling frequency of 1Hz, can I lower this? A process going two days generates approximately 180.000 datapoints for one variable. I think this is in excess. Do I do this in the DAQ assistant?

2) Is there a way to plot temperature vs time and pressure vs time as the process is going? So I can observe pressure drops or temperature drops in real-time? Can I also save these plots to the harddisk when the process is finished?

 

If there is a better solution to my vi, please let me know! Im very new to this, and there are no people with labview experience at my faculty.

 

Thank you!

0 Kudos
Message 1 of 8
(3,033 Views)

1) I do not know what the lowest hardware timed rate the USB-6341 can support is, but it almost certainly is much slower than 1 Hz. In addition to setting the timing through the DAQ Assistant or the DAQmx VIs, you can also reduce the data after it is acquired. For example you could accumulate the 1 Hz data for 1 minute, take the average of the 60 samples, save the average and discard the original data.  The advantage of doing it the latter way is that you do not need to wait a long time to stop the program. Suppose you set the DAQ Assistant to sample one time per minute. If you press the stop button immediately after it takes a sample, it will be another minute before it actually stops.

 

2)  A chart will display the data graphically over time. A chart has a built in buffer (called the Chart History). That can be read through a property node.  However, your VI currently writes the data to a file on each iteration of the loop so it is not necessary to save the chart history - it is the same data.

 

You should probably run your Fit VIs one time before the loop starts. There is no need to recalculate the slopes and intercepts (which do not change unless your  transducers change) on each iteration of the loop.

 

Lynn

Message 2 of 8
(3,005 Views)

Thank you for your answer. Follow up questions:

 

So I just add one waveform chart for pressure and one for temperature in my VI? Are the values automatically plotted against the sampling rate, as in 1 point for each second with the current setup? If the process I am monitoring takes two days, will the waveform chart be able to handle all those datapoints - and display temperature variations from start (0 seconds) to end (172.000 seconds later)?

 

You mention I should run my Fit VIs one time before the loop starts - I see your point, but how do I do this in Labview?

0 Kudos
Message 3 of 8
(2,990 Views)

To run the Fit VIs one time just move them outside the loop and wire the slope and intercept outputs to the multiply and add functions inside the loop.  The vertical line is the left edge of the while loop.

 

Fit once.png

 

You can make the chart keep more data by changing the Chart history length. After you place the chart on the front panel, pop up on the chart and select Chart History Length... from the menu. Make the history as large or larger than the maximum number of points you want it to keep.  You may need to change the x_axis scale early in the process. If you set it to show all 172000 points, it will be hard to see any details.

 

Write a little test VI like this so you can try varius settings to learn how to get the chart to do what you want. This will run much faster than your pressure/temperature system.

 

Chart test.png

 

If you have not done so, spend a little time with the Getting Started tutorials for LabVIEW. What you will learn will save you far more time than the tutorials take.

 

Lynn

Message 4 of 8
(2,983 Views)

Thank you for answering again Lynn.

 

The DAQ assistant set as continuous sampling would not let me reduce the sampling frequency below 1 Hz, so I've changed the DAQ assistant to 1 sample on demand, and I've included a timer within the loop so the sampling is done per 30 seconds. But sometimes the program won't stop when I press the STOP button, is there something wrong with my wiring?

 

So I've tried out the chart function in Labview, but I am having problems when plotting the measured values against relative time. When I run my program the X-scale changes to very large numbers (min/max 3.46*E^9). This happens even when I change the scale and turn of autoscale. What I would like to do is to plot measured values against their corresponding time (from 0s to when I stop the program). I've tried changing the buffer history, but I does not change anything. I've tried the Real-Time chart tutorial in Labview, but can't understand much of it, do I need to use a property node to define my X-scale? If anyone could show (in pictures or vi.) on how to solve it, I would greatly appreciate it. This allows me to start my experiments tomorrow.

 

 

0 Kudos
Message 5 of 8
(2,953 Views)
You are checking the status of the stop button every 30 seconds so of course it will be slow to start. Instead, you can use the elapsed time function with the DAQ code inside a case statement.

And yes, you have to use a property node or right click and set the properties on the front panel to set the scale multiplier.
0 Kudos
Message 6 of 8
(2,937 Views)
I guess I could just adjust the timeout value of the DAQ assistant in the first VI i posted, and this would allow me to input a lower sampling frequency directly in the DAQ assistant? I don't have Labview at home, so I can't try it out rightnow, but it is an acceptable solution? As it is explained here:
http://digital.ni.com/public.nsf/allkb/FEF778AD990D5BD886256DD700770103?OpenDocument
http://digital.ni.com/public.nsf/allkb/3161AE266063C6A186256D360045E927

I also found this VI while searching for solutions, but I am having problems integrating it. Is there a easier solution?
https://decibel.ni.com/content/docs/DOC-9065
0 Kudos
Message 7 of 8
(2,909 Views)

So I've managed to add the Real-Time Chart vi. example to my vi. I guess it works the way I want, by just adjusting the delay time to adjust the sampling rate. I also get two charts I can monitor during my experiments, as long as I extend the Chart History I would be able to browse back 2-3 days during my experimental runs? 11 pm or etc from one day wont be able to overwrite the same time from the previous day?

 

For some reason the VI is diffcult to stop - I have to press the stop button a couple of times for it to stop. I guess this might be because the sampling delay?

 

If there is a better solution, please let me know.

0 Kudos
Message 8 of 8
(2,863 Views)