Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
LabVIEW-Measurements.pdf
Скачиваний:
61
Добавлен:
29.05.2015
Размер:
3.37 Mб
Скачать

Chapter 6

Analog Input

Improving Control Loop Performance

There are some performance issues you should take into account if you plan to have other VIs or loops run in parallel with your hardware-timed control loop. When you call the AI Single Scan VI in a hardware-timed control loop, the VI waits until the next scan is acquired before returning, which means that the CPU is waiting inside the NI-DAQ driver until the scan is acquired. Consequently, if you try to run other LabVIEW VIs or while loops in the same block diagram in parallel with your hardware-timed control loop, they may run more slowly or intermittently. You can reduce this problem by putting a software delay, with the Wait (ms) VI, at the end of your loop after you write your analog output values. Your other LabVIEW VIs and loops can then execute during this time.

Another good technique is to poll for your analog input without waiting in the driver. You can set the AI Single Scan VI time limit in sec to 0. Then, the VI reads the DAQ Device FIFO buffer and returns immediately, regardless of whether the next scan was acquired. The AI Single Scan VI scaled data output array is empty if the scan was not yet acquired. Poll for your analog input by using a Wait (ms) or Wait Until Next ms Multiple function together with the AI Single Scan VI in a While Loop within your control loop diagram. Set the wait time smaller than your control loop interval (at least half as small). If the scaled data output array is not empty, exit the polling loop passing out the scaled data array and execute the rest of your control loop diagram. This method does not return data as soon as the scan has been acquired, as in the example described previously, but provides ample time for other VIs and loops to execute. This method is a good technique for balancing the CPU load between several loops and VIs running in parallel.

Refer to the examples in the examples\daq\solution\control.llb for more control examples.

Buffered Waveform Acquisition

One way to acquire multiple data points for one or more channels is to use the non-buffered methods described earlier in this chapter in a repetitive manner. However, acquiring a single data point from one or more channels over and over is very inefficient and time consuming. Also, with this method of acquisition, you do not have accurate control over the time between each sample or channel. You can use a data buffer in computer memory to acquire data more efficiently.

LabVIEW Measurements Manual

6-20

www.ni.com

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]