NI-SCOPE Stream to Disk Using Win32 File IO

Publish Date: May 22, 2008 | 4 Ratings | 4.25 out of 5 | Print | 1 Customer Review | Submit your review

Overview

The basic and advanced examples below demonstrate using continuous acquisition to fetch a user-defined, but quite large record of data all while continuously streaming the data to a binary file using the Win32 File I/O VIs. The digitizer is configured using the Configure Vertical and Configure Horizontal VI's. Auto setup in this case may not be useful, as it may choose a horizontal rate that exceeds the computer's streaming capabilities.

Benchmarks with the recommended hardware below have been at 110MB/s of data streaming to disk.

In these examples, continuous acquisition is used. This allows the user to start the digitizer, and continuously fetch data without losing any points. This is accomplished by configuring a software trigger and never sending the software trigger. Therefore, the digitizer will continuously acquire data into its onboard memory until Abort or Close is called.

The producer loop continuously fetches data from onboard memory into the LabVIEW memory using DMA transfers. This data is placed into a queue in order to efficiently transfer the data to a parallel consumer loop where it is written to file. If the sampling rate is low, the computer can fetch all the data from the digitizer, so data is never overwritten. However, at faster sampling rates, the computer will not be able to fetch the data before it is overwritten by new data. This results in the "data overwritten" error.

The consumer loop continuously empties data from the queue and writes data to disk using the LabVIEW primitive Write to Binary File.vi. The file is opened using the Win32 Open File.vi, which disables Windows caching during the write process, resulting in increased performance. However when Windows caching is disabled, data must be written to file in a multiple of the sector size of the disk (typically 512 bytes).

NOTE: If your digitizer has the 8MB/Ch memory option, you will need to reduce the 'Samples Per Fetch' from 4194304 to a sample size which uses less than 8MB. (1/2) * (4194304) = 2097152 works well. Please keep in mind, the 'Samples Per Fetch' has to be a multiple of the disk sector size (typically 512).

NI Recommended Hardware:

Digitizer:

  • NI 5105
  • NI 5112
  • NI 5114
  • NI 5122
  • NI 5124
  • NI 5142
  • NI 5152
  • NI 5922

    Additional Hardware:
  • PXI 8105/8106 controller
  • Addonics eSATA 4-drive RAID (ST5X1PM-4)
  • ExpressCard34 to eSATA Adapter (ADEXC34R5-2E)

    OR
  • PXIe 8105/8106/8130 controller
  • NI HDD-8263 4-drive RAID or NI HDD-8264 12-drive RAID
  • NI 8262 for PXI Express (provides link to RAID enclosure)


Software:

  • NI-SCOPE 3.3 or later
  • LabVIEW 8.0 or above

Recommended Input Signal: 10 Hz, 1.8 Vpp, sine wave

Included in this EPD are:

(Basic Version)

  • niScope Stream to Disk Queues Win32 File IO_Basic.vi
  • supporting files for Win32 File IO VI's

(Advanced Version)

  • niScope Stream to Disk Queues Win32 File IO.vi
  • niScope Stream to Memory Maximum Transfer Rate.vi
  • Export Arb Sample Clock.vi (if generating an external clock for Scope)
  • supporting files for Win32 File IO VI's
  • File IO benchmark utility VI's

 

Back to Top

Customer Reviews
1 Review | Submit your review

Win32 Close File does not work  - Sep 12, 2011

Thanks. Some of this seems very nice, but I see two problems n the attached examples: 1. Neither Win32 Close file nor ordinary Close File work in terms of releasing the file created by Win32 Open File. Try deleeting the closed file from Windows. 2. In the streaming example the Win32 Open File is used, but Writes and Close are doen using regular File functions, not Win32 functions. Isn't the whole point of using Win32 that writing using Win32 utilities is supposed to be faster the regular write?

Bookmark & Share


Downloads

Attachments:

ni-scope-streaming-basic

Requirements

niScope Stream to Disk Queues
Win32 File IO.vi


Ratings

Rate this document

Answered Your Question?
Yes No

Submit