LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting array to write spreadsheet VI, issues with time stamp on graph

To review the basic function of this VI is to collect a voltage from two
channels, using the gate and trigger sub-VI it filters out only the part
of the signal I am interested in on one channel. The data should then be
added to an array and saved to later either be opened in a spreadsheet
program or eventually be analyzed using a different labview program yet to
be written.

My first problem is that I can't connect the output of the array to
something that would allow me to save it. I realize it is a problem is
the output is of different dimensions compared to the input of the vi that
saves it. I don't know how to either change the output or input so they
match.

My second problem is with the graphical display. I would like each graph
to display the real time (as in 7:15.0000 pm). Not all of them do that,
and they don't display the correct time. I can't get them to all start at
the right time, and sometimes the time scale will suddently shift to hours
later in a time of seconds.

My third problem is with collection speed. I am looking at things that
would happen between microseconds and milli seconds so I need the data
collection to be as quick as possible. I just got a 5 GHz card, but I
can't seem to make the data collection run as fast as the card could
collect. I looked at using different AI vis for the initial data
collection, but nothing seemed to collect any faster.

My final problem is really more of a question. I just want to make sure I
am making the array correctly. I want data to be continually added until
the VI is stopped. From my reading about arrays I think this is the way
to do it. I am also wondering if this is the quickest way. I know it
would be quicker if I knew the size of the array ahead of time, but I
don't know until I see the data.

That is all my questions for now. Any help or guidance you could give
would be greatly appreciated by this clueless grad student.
0 Kudos
Message 1 of 8
(3,704 Views)
Re: array to write spreadsheet
Currently, you are building an array of 2-D arrays and therefore creating a 3-D matrix which cannot be stored in a spreadsheet proper.  If your intention is simply to stack one 2-D array on top of the next on top of the next to make one gigantic 2-D array, then what you do is right click your build array vi and select "concatenate inputs".  The output will then be a large 2-D array that you can feed into the write to spreadsheet file vi.
0 Kudos
Message 2 of 8
(3,661 Views)
Re: graphs
For your graphs to display time, I believe you can right click the graph and bring up the chart properties.  Under the Format and Precision tab, select the Time (X-Axis) and underneath, change the formatting from floating point to absolute time.
0 Kudos
Message 3 of 8
(3,656 Views)
Re: array question
Using the while loop to index the arrays as you are doing is generally ok for small stuff.  The concern I would raise is that you are potentially collecting 2 million samples across two channels (4 million samples each iteration) in addition to whatever you have in that inner while loop.  If this loop were to run too long, you will encounter memory issues.  It may be better to overestimate what you need for memory and preallocate the arrays in advance or set up a loop condition to not run more than X number of times.
0 Kudos
Message 4 of 8
(3,649 Views)

Taking this a piece at a time:

  1. There are three methods you can use to save your data. First, you can put the VI inside your data collection loop and save the data as it is being generated. This will slow down your data collection, so you may not want to do this. The second method is to use a second loop to save your data. The second loop will increment through your multidimensional data and save a "dimension" at a time. The third method is to use the Write LabVIEW Measurement File Express VI. This is the easiest and the one I would recommend, provided you don't have more than a few thousand data points. If you have more than a few thousand data points, things get more complex.
  2. The graphs can only display time if it is available. You are not collecting time information on either of your data acquisitions, so any time info displayed will be somewhat erroneous. Switch the data output type of your VIs from array to waveform. The waveform includes a timestamp (t0) and acquisition speed (dt). The graphs will make use of this if you enable it (pop-up on the graph and make sure ignore timestamp is not checked). As an aside, the DAQmx API will give you better performance. Is there a reason you are using the older traditional DAQ API?
  3. What board are you using? The fastest board NI sells is an NI-SCOPE device that has a native acquisition rate of 200MHz. You can't stream data that fast across the PCI bus in any case. It has a theoretical maximum of 133MBytes/sec, and actual is usually quite a bit lower. Special hardware can help. In any case, you are using a very inefficient method to repetitively take data. You need to use a lower level API to set up your acquisition outside the loop, take the data repetitively inside the loop, and close the acquisition outside the loop when you are finished. The function you are using does all this inside the loop, making it very slow. I can't give suggestions because I don't know what type of hardware you are using or what your collection parameters are.
  4. Adding more data to an array depends upon where that data is going to end up. Do you need to keep it in memory or would you be better off saving it to disk on the fly? Please post your acquisition parameters (speed, approximate number of points, format, etc.) and maybe a bit more about the application.

LabVIEW contains many ways to do what you seem to be doing. Choosing one over another depends a lot on exactly what you are trying to accomplish. It also depends on what version of LabVIEW you have - newer ones work better and have more tools (what version are you using?). Give us a bit more info and we can help you with more than generalities.

0 Kudos
Message 5 of 8
(3,636 Views)

First of all thanks to all who have tried to help me. Here are some more questions and responses to replies.

I tried saving my data using a second loop. This worked ok, but it was a little slower. Just to clarify my data collection better, here is a short summary of its application. I am looking at quantized conductance in gold nanowires that form between two thin gold wires as they are quickly tapped together. I need as fast a collection speed as possible, as the time scale I am looking at is a few microsec. I also need to collect as much data as possible, because from the raw data I create a histogram, and from that I am looking for relatively small peaks. So in summary things are complex.

I tried a few things to fix the problem with the data not displaying correctly on the graphical display. First I made property nodes for each graph so they are initialized to the current system time. Then at least the graphs all started in 2005, however they still all started at different dates and different times. Also they still ran too quickly (ie it took 2 min real time for the graph to advance 26 min). I tried changing the data output format to waveform. All this did was start two of the graphs with no time display at all (00:00). Also I am unsure how to save data in this format.

I didn’t realize I wasn’t using DAQmx. When I installed Labview it installed and defaulted to the earlier technology. I have since installed the new driver and that has helped a little. I am using a PCI-6111 board made by NI. It has a sample rate of 5 MS/s.  I would like to keep the actual collection rate as close to that as possible. My computer has a 1 GHz processor and 768 megs of RAM. I am unsure how to set up a lower level API outside the loop, so any more specific advice you could give me about a faster data collection scheme would be much appreciated. (I actually have no programming experience at all, so I am really clueless about most things. I am attempting to read things and pick up the basics as I go along).

As for adding more data to the array, I don’t need it in memory, it can be stored directly to the disk. I do need to write another program to analyze the data, but I think that is going to be completely separate.

So quick review of acquisition parameters. I am using Labview 7.1 with Windows XP and a 5MS/s card. I need to take data as close to 5 MS/s as possible, for at least 10 sec.

Thanks in advance for any help you can offer!

Jolene

Message Edited by Support on 08-10-2005 02:49 PM

0 Kudos
Message 6 of 8
(3,589 Views)
 

First the good news.  You should be able to do what you want to fairly easily, provided your computer is relatively new (2yrs?).  Now for the bad news.  I can't hep you much, since I am not really competent with DAQmx.  However, I can point you in the right direction.  For examples on using DAQmx with continuous acquisition, check out the example finder (Help->Find examples... from the LabVIEW menu).  Do a search for "continuous" and look at the DAQmx examples.  There are several that are close to what you need.

A couple of tips will help.  First, do not fetch scaled data.  Fetch binary (unscaled).  This will cut your bandwidth needs by a factor of 4 and make it much easier to make your timing and store to disk.  Fetch the scaling coefficients and save them with the data.  An easy way to do this is to use NI-HWS (on your driver CD under the instruments leaf, if it is less than a year old).  HWS will give you disk speed limited performance and is designed with easy streaming to disk in mind.  Tune your application for speed.  Play with the buffer and transfer sizes until you hit the optimum.  Your board has a small buffer, so care will be necessary.

Finally, your data set is small enough that you could cache to memory and save to disk later.  See Managing Large Data Sets in LabVIEW for some tips on how to do this successfully.

Good luck.  Let us know if you continue to have problems.

 
0 Kudos
Message 7 of 8
(3,565 Views)
Another few things to consider:
  1. You are calling AI Acquire Waveform twice, for two channels on the same device. I think these will execute subsequently, not simultaneously, so you are not reading the two signals at the same time.  That may be the intended behavor for your circuit or not, I don't know.  If not, you are probably better off calling AI Acquire Waveforms, and sampling the two channels at once.  I think the 6111 board is a simultaneous sampling board, so the two channels are read at the same time.
  2. The calls to Get Date/Time In Seconds are not necessarily synchronized to the start of the AI Acquire Waveform, so your start time may not be correct.  The spacing between the points will be correct, though.
  3. The resolution of the Get Date/Time In Seconds VI is much lower than the output of your card.  On my (relatively new) WinXP computer, it's 16 ms.  So if you are trying to get things to sychronize on a scale finer than that, you may have problems.


0 Kudos
Message 8 of 8
(3,557 Views)