Gregory Hildstrom Projects Publications Resume Contact About Youtube Donate

SGL (.sgl) Binary Data File Format

This data format was developed to overcome deficiencies in several other binary data formats. The important things to notice in the example given are the variable number of channels and the variable bytes per scan. These two variables allow this data format to store a wide range of data types. A selection of 1 byte per scan would be 8-bit data and the data size for each scan in the table would be 1 instead of 4. A selection of 2 bytes per scan would be 16-bit data and the data size for each scan would be 2 instead of 4. The default selection of 4 bytes per scan is for 32-bit data.

Example SGL 4-byte (32-bit) 4-channel 4-scan Binary Data File
SectionStart ByteEnd ByteData ValueData TypeByte OrderingData Size (Bytes)
Header03Number of channelsIntegerlow-byte-first4
Header47Bytes per scan (1-16 default 4)Integerlow-byte-first4
Header811Scan rateFloatlow-byte-first4
Header1275Acquisition InformationStringASCII64
Header7683Channel 0 Calibration factorDoublelow-byte-first8
Header8491Channel 1 Calibration factorDoublelow-byte-first8
Header9299Channel 2 Calibration factorDoublelow-byte-first8
Header100107Channel 3 Calibration factorDoublelow-byte-first8
Header108171Channel 0 InformationStringASCII64
Header172235Channel 1 InformationStringASCII64
Header236299Channel 2 InformationStringASCII64
Header300363Channel 3 InformationStringASCII64
Header364427Channel 0 NameStringASCII64
Header428491Channel 1 NameStringASCII64
Header492555Channel 2 NameStringASCII64
Header556619Channel 3 NameStringASCII64
Data620623Channel 0 Scan 0Float (default)low-byte-first4
Data624627Channel 1 Scan 0Float (default)low-byte-first4
Data628631Channel 2 Scan 0Float (default)low-byte-first4
Data632635Channel 3 Scan 0Float (default)low-byte-first4
Data636639Channel 0 Scan 1Float (default)low-byte-first4
Data640643Channel 1 Scan 1Float (default)low-byte-first4
Data644647Channel 2 Scan 1Float (default)low-byte-first4
Data648651Channel 3 Scan 1Float (default)low-byte-first4
Data652655Channel 0 Scan 2Float (default)low-byte-first4
Data656659Channel 1 Scan 2Float (default)low-byte-first4
Data660663Channel 2 Scan 2Float (default)low-byte-first4
Data664667Channel 3 Scan 2Float (default)low-byte-first4
Data668671Channel 0 Scan 3Float (default)low-byte-first4
Data672675Channel 1 Scan 3Float (default)low-byte-first4
Data676679Channel 2 Scan 3Float (default)low-byte-first4
Data680683Channel 3 Scan 3Float (default)low-byte-first4


Example SGL 2-byte (16-bit) 4-channel 4-scan Binary Data File
SectionStart ByteEnd ByteData ValueData TypeByte OrderingData Size (Bytes)
Header03Number of channelsIntegerlow-byte-first4
Header47Bytes per scan (1-16 case 2)Integerlow-byte-first4
Header811Scan rateFloatlow-byte-first4
Header1275Acquisition InformationStringASCII64
Header7683Channel 0 Calibration factorDoublelow-byte-first8
Header8491Channel 1 Calibration factorDoublelow-byte-first8
Header9299Channel 2 Calibration factorDoublelow-byte-first8
Header100107Channel 3 Calibration factorDoublelow-byte-first8
Header108171Channel 0 InformationStringASCII64
Header172235Channel 1 InformationStringASCII64
Header236299Channel 2 InformationStringASCII64
Header300363Channel 3 InformationStringASCII64
Header364427Channel 0 NameStringASCII64
Header428491Channel 1 NameStringASCII64
Header492555Channel 2 NameStringASCII64
Header556619Channel 3 NameStringASCII64
Data620621Channel 0 Scan 0Shortlow-byte-first2
Data622623Channel 1 Scan 0Shortlow-byte-first2
Data624625Channel 2 Scan 0Shortlow-byte-first2
Data626627Channel 3 Scan 0Shortlow-byte-first2
Data628629Channel 0 Scan 1Shortlow-byte-first2
Data630631Channel 1 Scan 1Shortlow-byte-first2
Data632633Channel 2 Scan 1Shortlow-byte-first2
Data634635Channel 3 Scan 1Shortlow-byte-first2
Data636637Channel 0 Scan 2Shortlow-byte-first2
Data638639Channel 1 Scan 2Shortlow-byte-first2
Data640641Channel 2 Scan 2Shortlow-byte-first2
Data642643Channel 3 Scan 2Shortlow-byte-first2
Data644645Channel 0 Scan 3Shortlow-byte-first2
Data646647Channel 1 Scan 3Shortlow-byte-first2
Data648649Channel 2 Scan 3Shortlow-byte-first2
Data650651Channel 3 Scan 3Shortlow-byte-first2


SGL Header Variable Descriptions
SectionData ValueData TypeByte OrderingData Size (Bytes)Description
HeaderNumber of channelsIntegerlow-byte-first4Stores the number of channels
HeaderBytes per scan (1-16 default 4)Integerlow-byte-first4Bytes per scan changes the number of bytes and the data type of the stored data scans
HeaderScan rateFloatlow-byte-first4The rate that every channel is sampled or scanned
HeaderAcquisition InformationStringASCII64Acquisition information like start time stamp in YYYYMMDDHHmmss format and other notes
HeaderChannel N Calibration factorDoublelow-byte-first8The calibration factor used to go from counts to volts or volts to Eus
HeaderChannel N InformationStringASCII64Extra channel information like gauge number, frame number, bulkhead number, or location
HeaderChannel N NameStringASCII64The name of the channel; unused trailing characters should be the null character '\0'