Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Analog Voltage data directly into 2D array

I perform raster-scan experiments in our lab wherein I need to acquire 5 (30 later) channels of analog voltage data for each scan. I have been able to do this using the DAQmx Toolkit package provided for Wavemetric's Igor Pro. I was able to set up a 2D buffer of the same size as my 2D scan and then acquire data directly into the allocated 2D array. Depending on the number of scan lines and pixels, I would set the acquisition rate accordingly. Once the buffer was filled, the data was overwritten onto the same buffer. This code made it easy to visualize data. However, this approach limited my acquisition rate to 1kS/sec. 

 

Is there any analog to this in other programming languages? I have been going over the C examples and this ability doesn't seem to exist there either. As of now, I have to acquire 1D data using labview along with a "trigger" channel and write all the data to a text file, analyze it later and cut it appropriately using the 'trigger' channel (analog pulses for end of each raster scan line) data as a reference to form the 2D array for each channel. Any guidance in this matter is greatly appreciated.

0 Kudos
Message 1 of 7
(3,295 Views)

There is no native 2D support in the driver, so you will need to program that. If you would like, you can recommend that on our idea exchange, which is watched by our RD for what our customers want out of our products.

 

Any programming language you use, you will need to make considerations for efficiency. I suspect that there are some things you can do to optimize your LabVIEW code so that you can stream data into the structure more quickly. For instance, be sure to replace subsets instead of building arrays. See these resources: VI Execution Speed and Determining When and Where LabVIEW Allocates a New Buffer.

 

The API available in LabVIEW is identical to the API exposed to other programming languages, so you can use any resources you are familiar with for optimization with a DAQmx application.

- Regards,

Beutlich
0 Kudos
Message 2 of 7
(3,280 Views)

Hi,

 

I have attached a schematic of my experimental setup and what I plan to do with the data once it is acquired. I have tried implementing my latest schematic in code and was not able to acquire at > 300 kS/s. I had to switch to TDMS file write. This meant that I cannot look at the raw data once the experiment is complete and I am stuck with humungous amounts of data that I have to post process. I need to acquire a lot of data for downsampling & filtering since the signal is noisy, but I don't need all of the raw data. For example, I may acquire ~ 1 GB of raw data but by the time I am done processing the data, I end up with something like 2-3 MB. I am trying to improve the analog filters I have in my circuit to clean up the data so that I don't have to acquire large amounts of data all the time. 

 

Is it possible to parse a stream of analog data using digital input pulses as delimiters, filter/decimate the data and place it into a 2D array ready for real-time display and file output?

 

Thanks,

0 Kudos
Message 3 of 7
(3,106 Views)

Hi Suhas87,

 

So let me see if I understand what you are asking here. You want to parse your analog data together and filter out some of the data using the pulses from a digital signal and then place it back into a 2D array to be seen while the program is running? What if you just triggered a finite number of analog data points when the digital signal is read high?

 

Also, since this is an older post a lot of people in the community will not see this question come up. You could get more help answering your question from the community if you posted this question to a new post.

 

Regards,

Tommy G.
Product Manager - Search
0 Kudos
Message 4 of 7
(3,082 Views)

Hi Suhas,

 

 

You certainly can do all that, but it may demand careful use of your design pattern. For starters, you probably want to ensure that you have one loop that is performing the data acquisition, and only the data acquisition (plus storing in a memory space like a queue), and then another loop that has all of the processing. This is called the producer-consumer loop, and it allows the data acquisition to run independently from the processing, and you only perform processing when there is not any data to acquire.

 

Depending on the demands for monitoring and logging, different kinds of design patterns may help your performance, but there are plenty of applications that stream more data regularly. I recommend getting started with a simple Producer Consumer if you are new to design patterns, and you can find more information about them here:

 

Application Design Patterns: Producer/Consumer

- Regards,

Beutlich
0 Kudos
Message 5 of 7
(3,068 Views)

Thank you for your advice

 

I had implemented producer-consuemer versions for this project a while ago. I remember that Labview was not able to cope with the data acquisition speeds (2MS/s x 6 channels). Also, if I recall correctly the consumer loop was not able to keep up with the producer loop. I can check to see what the exact outcome was. 

 

Suhas

0 Kudos
Message 6 of 7
(3,051 Views)

Are you able to share snippets of your code?

- Regards,

Beutlich
0 Kudos
Message 7 of 7
(3,045 Views)