Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

Optimize System Throughput for High-Speed Data Acquisition

by Tom Coté
Adapted from an article that appeared in the 1996 edition of
SENSORS Data Acquisition

To keep up with the demands of ever faster DA applications, you've got to get the most out of your PC-based system. With a little thought and the right configuration, you can optimize your system to make sure it acquires data as efficiently as possible.

It seems like every time you turn around computer hardware and software has experienced another quantum growth spurt. The new levels of performance brought on by this growth have established computer-based systems' place in data acquisition (DA). With the right components, these systems are effective measurement tools for a wide variety of applications, equaling or surpassing traditional instrumentation. But the trick is to make sure your system is acquiring data as efficiently and cost-effectively as possible for your particular application.

Reviewing the Basics

There are three main components to a typical PC-based DA system: signal processing, a DA device, and a computer (see Figure 1). Sensors--such as thermocouples, pressure transducers, and strain gauges--convert real-world signals to either voltages or currents, which are then transferred at a fixed speed to the DA device.

The DA device converts the voltage or current to digital readings, typically 12-bit or 16-bit. The A/D converters (ADCs) of most portable DA devices offer acquisition rates between 100 kHz and 1 MHz. These same ADCs typically store output in 16-bit integers, so the throughput rate (in bytes/s) is usually twice the acquisition rate.

Most DA devices have a FIFO buffer to temporarily store the converted analog inputs prior to their transfer to the host. Regardless of the transfer rate, the ADC can always acquire data at its maximum rate up to the size of the buffer. If you require more data than the buffer can hold, the transfer rate must match the acquisition rate.

Interrupt Latency and Other Bottlenecks

The ADC initiates the transfer of data to the computer by sending an interrupt request. The delay between the request and the start of the transfer is called interrupt latency. This latency varies from less than a millisecond to many milliseconds. For continuous data acquisition, the ADC must continue to acquire and store data in its local buffer during this time.

For example, theoretically, a 100 kHz ADC must have a buffer large enough to hold 100 samples if the interrupt latency is 1 ms. In practice, though, the buffer should be several times larger. Average user requirements of current PC technology dictate 64 KB or less. If your DA device doesn't have a fixed-size FIFO buffer, you can install additional memory to acquire continuous data.

Hard Disk Storage

After the DA device transfers data to the computer, the computer takes the digital readings and stores them to a hard disk. Once there, the data can be retrieved and processed when the acquisition is complete and timing is less critical.

For short acquisitions, if the ADC buffer size and computer transfer rate support the ADC's maximum rate, the amount of data acquired is limited by the computer's available memory. Acquiring more data places harsher requirements on the interface speed, and it requires a hard disk of sufficient speed to store the data. Because the CPU can do only one thing at a time, the transfer of data from the ADC and the speed of writing to the hard disk should exceed the acquisition rate by at least a factor of two.

For example, suppose you want to acquire data with a 16-bit ADC at 100 kHz for several hours. The data are acquired at 200 KBps. As a result, you should make sure that both the interface between the ADC and the computer, as well as the hard disk and its computer interface, support a rate of at least 400 KBps. In fact, unless the CPU is fast enough to make its overhead negligible, rates of 600 KBps are probably necessary. You can easily attain these rates on today's computers, but bottlenecks occur as the acquisition rate to the hard disk is raised above 100 kHz.

Choosing a PC Platform

For data acquisition (DA) applications requiring 200 KBps throughput or more, consider getting at least a 66 MHz 486DX system with 8 MB of RAM, an IDE hard drive (for desktop systems, a PCI controller), and an enhanced parallel port (for parallel interfaces between the computer and the DA device) or a Type II PCMCIA slot (for notebooks).

Whatever computer you choose, keep in mind there are several nonessential functions you may want to eliminate when acquiring data at rates of 100-1000 kHz. Among the most common speed limiters are graphics and video modes, which require valuable memory and processor time to accommodate up to 64,000 colors. Some programs use memory buffers to store data. The more memory, the greater the acquisition speed and duration that the system provides. If your system has 16 MB of RAM, you can allocate 12 MB to serve as a buffer, which allows you to collect 6 million 16-bit samples, or 7.5 million 12-bit samples in packed mode. This not only eliminates the limitations of the hard drive but greatly increases the DA rate where speeds of 1 MHz can be reached easily.

In addition, you need to keep a few things in mind if you are using a notebook. Configured for long battery life, these computers are not designed to operate at maximum rates. The notebook may be a 60 MHz machine, but because of the need to extend battery life, the processor may run at 15 MHz or less. This limits throughput. Also, power management utilities can shut down functions of the computer that require time to power up, causing an A/D converter buffer to be overrun. Be sure to check manufacturer specifications because all notebooks are configured differently.

Ensuring High Throughput to Disk

There are three key considerations for maintaining high throughput rates to the hard disk: interface speed, data packing, and hard disk performance. The optimum interface depends in great part on whether your application is portable or benchtop. For portable applications, you can connect a DA device to a notebook via a standard parallel port, an enhanced parallel port, or a PCMCIA interface. For benchtop applications, you can connect a DA device to a desktop PC via an ISA bus, a PCI bus, a standard parallel port, or an enhanced parallel port. Generally, for today's portable applications, you'll find a PCMCIA interface to be the best overall connection because it can provide you with a data transfer speed of 5 MBps and is standard among most notebooks. The enhanced parallel port is the next best interface, with a maximum data transfer rate of 3 MBps. For benchtop applications, the ISA bus or the PCI bus is the best interface because they plug directly into your PC. An ISA bus provides a maximum data transfer speed of 6 MBps; a PCI bus delivers a maximum of 133 MBps.

Data packing is simple and can be enabled in the A/D system via your PC's software. For 12-bit acquisitions, four samples are packed in three 16-bit integers, reducing the needed throughput by 25%. For most applications, particularly applications >250 kHz, data packing is recommended. You may lose some resolution, but depending on your required gain resolution, the loss is minimal (1/2 LSB).

There are four steps to maximizing hard disk performance: disable software disk caching, do not use hard disk compression, defragment your hard disk, and find your hard disk's sweet size. The first two functions remove unnecessary steps in saving data to the hard drive, which can substantially affect the maximum DA rate. The defragmentation utility consolidates all the free space of the drive, reducing computer time spent saving the acquisition to several places on the disk.

The fourth way to maximize performance is to identify the number of bytes the drive can write in one cycle. This is your hard disk's sweet size. If the number of bytes written is less than or greater than the sweet size, the system will experience dead time. To avoid this dead time, you can experimentally determine the appropriate size. Write a specific number of bytes to your hard drive repeatedly and note the time it takes for each write. Vary the number of bytes until the minimum time required to write the bytes becomes clear.