Presentation is loading. Please wait.

Presentation is loading. Please wait.

Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats At their lowest level, all files written to your computers hard drive are a series.

Similar presentations


Presentation on theme: "Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats At their lowest level, all files written to your computers hard drive are a series."— Presentation transcript:

1 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats At their lowest level, all files written to your computers hard drive are a series of bits 1 Binary TDMS ASCII

2 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats ASCIITDMSDirect Binary Numeric Precision GoodBest Share data Best (Any program easily)Better (NI Programs easily) Good (only with detailed metadata) EfficiencyGoodBest Ideal UseShare data with other programs when file space and numeric precision are not important Share data with programs when storing simple array data and metadata Store numeric data compactly with ability to random access

3 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. Understanding File I/O File I/O writes to or reads from a file A typical file I/O operation involves the following process: 3 Open/ Create/ Replace File Read and/or Write to File Close File Check for Errors

4 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. Understanding File I/O – File Formats LabVIEW can use or create the following file formats: BinaryUnderlying file format of all other file formats ASCIISpecific type of binary file that is a standard used by most programs TDMSType of binary file created for NI products consisting of two separate files: a binary file and a binary index file 4

5 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. Understanding File I/O – File Formats Use text files in the following situations: You want to access the file from another application Disk space and file I/O speed are not crucial You must not perform random access reads or writes Numeric precision is not important 5

6 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI B. Understanding High-level File I/O High-level VIs Perform all three steps (open, read/write, close) for common file I/O operations Might not be as efficient as the functions configured or designed for individual operations Low-level VIs Individual VI for each step If you are writing to a file in a loop, use low-level file I/O functions 6

7 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI B. Understanding High-Level File I/O Write to Spreadsheet File Converts an array of double-precision numbers to a text string and writes the string to an ASCII file Read From Spreadsheet File Reads a specified number of lines or rows from a numeric text file and outputs a 2D array of double-precision numbers Write to/Read from Measurement File Express VIs that write data to or read data from an LVM or TDMS file format 7

8 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI B. Binary FilesSequential/Random Access Two methods of accessing data: Sequential Access Read each item in order, starting at the beginning of a file Random Access Access data at an arbitrary point within the file 8

9 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI B. Binary FilesSequential Access To sequentially access all of the data in a file, you can call the Get File Size function and use the result to calculate the number of items in the file, based upon the size of each item and the layout of the file You can then wire the number of items to the count terminal of the Read from Binary File function 9

10 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI B. Binary FilesRandom Access Use the Set File Position function to set the read offset to the point in the file you want to begin reading The offset is in bytes; therefore, you must calculate the offset based upon the layout of the file 10

11 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS Files TDMS Technical Data Management Streaming Use TDMS files for the following purposes: To store test or measurement data To create a structure for grouping your data To store information about your data To read and write data at high speeds 11

12 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesFile Format TDMS file Binary file (.tdms) that contains data and stores properties about the data TDMS_Index file Binary index file (*.tdms_index) that provides consolidated information on all the attributes and pointers in the TDMS file Speeds up access to the data while reading Automatically regenerated if lost TDMS file format internal structure is publicly documented 12

13 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesData Hierarchy Channel Stores measurement signals or raw data in a TDMS file Each channel can have properties describing the data The data stored in the signal is stored as binary data on disk to conserve disk space and improve efficiency Channel Group Segment of a TDMS file that contains properties and one or more channels Use channel groups to organize your data and to store information that applies to multiple channels 13

14 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesAccessing TDMS Files Use the Write to Measurement File and Read from Measurement File Express VIs Allows you to quickly save and retrieve data from TDMS format Very little control over your data grouping and properties Use the TDM Streaming API Set of functions for opening, writing to, reading from, and closing TDMS files Allows you to organize your data into channel groups and channels Use the TDM Excel Add-In Tool Allows you to read TDMS files in Microsoft Excel 14

15 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesTDM Streaming API 15

16 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesWrite Data Streams data to the specified TDMS file Data subset to write is determined by group name and channel name(s) inputs 16

17 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesRead Data Reads the specified TDMS file and returns data from the specified channel and/or channel group 17

18 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesSet Properties Sets the properties of the TDMS file, channel group, or channel 18

19 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesGet Properties Returns the properties of the TDMS file, channel group, or channel 19

20 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI C. TDMS FilesFile Viewer Opens TDMS file and presents the file data in the TDMS File Viewer dialog box 20

21 Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI Practice Generate a set of waveforms and export them as a single CSV file. Compute the waveforms PSDs and export them as a single CSV file. Open both files in excel and check the results.


Download ppt "Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats At their lowest level, all files written to your computers hard drive are a series."

Similar presentations


Ads by Google