LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

increasing data acquisition speed of my VI

Hi,

 

I am using labVIEW to both controll a xyz scanning stage for a microscope and aquire the output, i was wondering if there was anyway to increase the speed of data acquisition. Iv tried running the performance and memory profiler, and it seems to me that the DAQmx reader is using most of the run time.

 

The way its setup i send incrementing values from for-loops to the xy-stage(to move the stage) through serial port and read one output value per xy point with a DAQmx reader.

 

I am using a Ni usb-6251 BNC to acquire the data.(as of now i am sending the data using the 6251 too, but thats just until i get my measuring equipment.

 

I also see that the program runs much faster if i turn of the Ni 6251.So again it looks like the DAQ read is the problem.

 

See attached VI

 

Regards

 

Erik

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

Dear Erik,

 

thank you so much for your post on our webforum. It looks like you want to take a number of samples. At this moment you are reading software timed; for every sample (for loop iteration) the DAQmx read function goes through all the software layers to read a sample. What you can do instead is hardware timing. At a certain moment you put the DAQ card to work and the DAQ card will take at a specified sample rate a number of samples and stream those to the internal memory of your computer. With the DAQmx read function you will then read the complete number of samples at once.

Notice that between DAQ card and memory no action from your VI is involved; you only have to configure your DAQ card to act this way. Your VI only has to perform one read. Please open the example finder and go to the browse tab; Hardware in and output \DAQmx\Analog Measurements\Voltage\Acq&Graph Voltage-Int Clk.vi for an example about finite samples.

Secondly I can recommend to use the error clusters from the DAQmx functions (wirer them from previous to the next one) to implement a correct error handling. If with creating a DAQmx channel for some reason an error occurs, the next DAQmx functions will not be executed.

Instead of using a sequence structure a state machine  design pattern is a common design architecture. Please let me know if I can be of any further assistance.

 

Best regards,

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 2 of 7
(3,329 Views)

Hi Martijn,

 

I can see that will speedup the runtime, but how will i combine the measurements with the correct xy position to make a intensity image of it?

 

Regards 

 

Erik

 

 

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

Hello Erik,

 

I didn't notice the serial VI, because it wasn't included in your post (so it became a question mark). So the idea is to send out a serial command and after that you want to take one sample? If you want to take multiple samples after one serial command, we can have a look at triggering; this can be done in software or hardware. It is easy to implement this in software, but please remember that windows isn't really reliable on timing, a great example can be found with the example finder under help. Please go to the browse tab , choose hardware input and output => DAQmx => Analog measurements => Voltage => Acq&Graph Voltage-Int Clk-SW Trig Restart

 

What is the desired sample rate? What is the rate you are achieving now? You can measure time with two Tick count (ms) functions, please review the attached VI. But please remember that since you didn't put any timing in your loop the rate of the loop is not predictable.

 

Please let me know if you have any further questions,

 

Best regards,

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 4 of 7
(3,289 Views)

Hi again,

 

Yes the idea is that i send a serial command to the xy-stage, and then take one measurement from that point, then move one step on the x-axis and take another measurement and so on.

 

I cant open your attached vi, says i need version 9.0 i only have 8.6.

 

As of now i am getting about 1100 measurements in 22 seconds, timed with a watch.

 

Is there anyway to run the DAQmx read outside the loop, and get Nsamples while the loop is running and still combine the measurements with the right xy positions(the loop counts really)?.

 

Regards

 

Erik

0 Kudos
Message 5 of 7
(3,257 Views)

Hi Erik,

 

I'm sorry for the delay in answering to your problem. I will have a further look into your problem. Single point will be the best solution in your case. We only have the choice to use hardware timed single point (1 sample hw timed). However I think the complete system is the limitation; for every sample Labview has to go through all the software layers (windows, driver), this takes time and is (because of the behavior of windows) not deterministic.

Please find the attached VI to benchmark; you can also try hardware single point to see if there is any difference. Please let me know the result.

 

Best regards,

 

 

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 6 of 7
(3,217 Views)

Hi Martijn,

 

The benchmark gives me 19 or 20 on the loop time, i have not tried the system with 1 sample hardware timed yet, not sure how to set it up, but i will look into it.

 

Regards

 

Erik

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