|Download Help (Windows Only)|
Streaming is a method of generating waveforms that are too large to fit in the onboard memory of the device. Streaming can be used in dynamic generation sessions.
To stream waveform data, you allocate and identify all or a portion of the device onboard memory to act as an onboard waveform for streaming. Before initiating generation, you fill that onboard memory with the first part of your waveform. As the waveform is generated, space in the onboard memory becomes free and you fill that space with new waveform data. You repeat the process of filling the freed onboard memory in blocks of new waveform data until the waveform is complete.
The following instructions are a guide for configuring your application for streaming.
As an example, we have a 1.6 GB waveform we want to generate and a device with 256 MB of onboard memory. This 1.6 GB waveform may be in the host memory, on disk, or data that your application generates on-the-fly during generation.
Use the niHSDIO Allocate Named Waveform VI or the niHSDIO_AllocateNamedWaveform function to specify the amount of onboard memory to reserve for streaming. This memory serves as a buffer for the streaming process. The niHSDIO Allocate Waveform VI/function returns a waveform handle.
Set the Streaming Waveform Name property or the NIHSDIO_ATTR_STREAMING_WAVEFORM_NAME attribute to the waveform handle returned in Step 1. Setting this property ensures that no streaming data is overwritten before it is generated. NI-HSDIO monitors your progress to ensure that you write fresh data fast enough to keep up with the generation. If your application fails to keep up, or attempts to write fresh data on top of data that has not been generated, NI-HSDIO returns an error.
|Tip When transferring large blocks of waveform data, break up the data into smaller blocks and call the niHSDIO Write Named Waveform VI or the one of the Write Named Waveform functions multiple times—the data is appended sequentially. A computer can allocate smaller blocks of a large waveform faster than allocating a single large contiguous block in memory. Depending on the amount of RAM in the computer, transferring ten 16 MB blocks can be faster than transferring one 160 MB block.|
Use the Space Available in Streaming Waveform property or the NIHSDIO_ATTR_SPACE_AVAILABLE_IN_STREAMING_WAVEFORM attribute to determine how much of the onboard waveform is free for writing new data. As the waveform generates, space becomes available to write more waveform data. Once a certain amount of the onboard memory becomes available, say 10 percent of the allocated onboard memory, you can write more of the waveform to the streaming waveform in onboard memory. In general, writing in larger blocks, such as 16 MB, results in more efficient streaming and faster streaming rates.
Repeat the process of monitoring the available memory and writing waveform data in blocks as free space becomes available.
|Tip For an example of how this application can be written in LabVIEW, refer to the Continuous Generation - Stream From Memory VI. This VI is included in the Dynamic Generation.llb, which ships as part of the NI-HSDIO Examples. Refer to the NI-HSDIO Instrument Driver Readme for the installation location of the NI-HSDIO examples.|
To improve your maximum sustainable transfer rate for streaming, consider the following:
Transfer rates from hard drives can vary for a number of reasons. For example, where the data is physically stored on the hard drive and how much data is stored can affect transfer rates. Storing your waveform files on a fairly empty, defragmented hard drive may help increase performance.