LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing labview code for collecting ati nano17 sensor data

Hello NI community,

There are many questions and doubts, so I will start with basic ones am struggling with-

I wish to achieve averaging of data collected over cycles to reduce white noise, I am using LabVIEW code written by ATI company.

And also how to apply a filter to the given code. Right now am collecting data and filtering it using inbuilt functions in Matlab.

I edited the code for unnecessary reasons please bear with me. 

.llb file is the complete file.

Thank you in advance

Download All
0 Kudos
Message 1 of 3
(1,184 Views)

As far as I can tell, your code is basically identical to the code from ATI (you even kept the ATI Icon for your "Raj" Top Level VI).  The main change you seemed to have made is to use the current "Write Delimited Spreadsheet" VI, and to structure the data that you put into this file in a different manner.  You even copied the paired "normal" Boolean Switches, "Bias" and "Unbias", adding your own code to make them "behave" as though they were "Latch until Pressed" (which is kind of weird -- "Latch until Released" avoids funny race conditions, and an even better solution is to have a single "Bias" control that, if Pressed and "lit up", means "Use Bias Vector and Bias Voltage", and if  Pressed again and "unlit", means "Do not use Bias Vector and Bias Voltage".  Someone needs to learn a little LabVIEW ...

 

Note that you can turn Bias on and off (and on and off and on and off ...) during the computations from taking Analog samples to writing the Data Files.  You have no (obvious) way to know whether the Data Files are Biased or Unbiased, nor where the change occurs (or so it seems to me).  You do have a "Collect Data" button, so if you push "Collect" and remember not to change Bias/Unbias, your files will, at least, be "consistent" with respect to their Bias status.  You don't seem to use Bias Voltages -- is it only to show on the Front Panel?

 

You have a single loop that "does everything".  You read 1000 samples at 10 kHz (so you get a new batch of data every 0.1 seconds), transform the data in several steps (calculate F/T Values, break apart and put back together the 2D Data Array, then write it to a Delimited Spreadsheet, transposing the data as you write.  You also seem to be opening the same Data File each time (more on this in the next paragraph).

 

You have one time-critical loop -- the DAQ loop.  If you want to sample continuous data, you need to have a While Loop that does the DAQmx Reads and then "hands the data to a parallel Loop that takes care of all of the data processing, and also handles the Opening, Writing, and Closing of the Data File(s)".  This type of cooperating Parallel Loops, one acquiring data, and the other processing it, is often called a "Producer/Consumer Design Pattern".  You want to move all of the data Processing, including the File I/O, to a Consumer While Loop (or maybe to two Consumer While Loops, one to do the first parts of the Processing (up to writing to the Measurement Graph) and the other to do the File I/O.  The File I/O loop also needs a little intelligence -- the first time it is called, it should Open the file and save the File Path in a Shift Register.  Note that there is an "Append to File" input on the Write Delimited Spreadsheet function -- this should be connected to a Shift Register that is initialized to False, but then (on the right-hand side of the While Loop) should be set to True to allow you to "Append" subsequent data without re-opening the same File.  You also need to provide a signal that says "There are no more data coming, so exit and close the file".

 

Bob Schor

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

Hello Bob,

Thank you for the reply and insight on the code.

I just edited the code so that I can get the time steps at which the data is collected and appended them to the F/T matrix.

Rest of the code is from ATI website and Bias and unbias are same from their code. I click the bias button at the beginning of data collection to remove initial noise voltages.

I collect data changing the sampling frequency accordingly.

 

I got a gist of your last paragraph that I need to use the data from one loop to process it in another. 

So if I am collecting a data of a cycle whose time period is 16 seconds then I need to have a counter which increments every 16 seconds and this data is stored and stored data should be called during the next cycle for averaging. This should be done using while loop. Although I understood it to some extent but it would be good to understand if I can get some examples in this regard .

 

Also if I want to add another input signal from encoder into this program so that I can count the cycles accurately.

What changes should I do in the code? 

0 Kudos
Message 3 of 3
(1,142 Views)