14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T13:34:29.248067+00:00 | zai-org/GLM-5-FP8 | 1 | 3efc64a6d144d6f5 |
DDAS Serialization Module Documentation
1. Purpose
This module provides serialization and deserialization support for the DDAS (DaimlerChrysler Data Acquisition System) file format, a proprietary binary format used for storing crash test data. It bridges legacy C/C++ data structures (originally from DaimlerChrysler's DDAS V5 system) with modern .NET serialization infrastructure, enabling export of test data including channel configurations, transducer information, and floating-point measurement data. The module handles both the file format definitions and the actual binary writing of channel data.
2. Public Interface
C/C++ Structures (Header Files)
ChannelDefinition.h
enum ChannelFlags
CHANFLAG_ACTIVE- Flag indicating an active channel
Macros:
ISCHANACTIVE(pChan)- Returns 1 if channel is active, 0 otherwiseSETCHANACTIVE(pChan)- Sets the active flag on a channelCLRCHANACTIVE(pChan)- Clears the active flag on a channel
struct tagCHANNEL / CHANNEL / PCHANNEL / PCHAN
short Size- Size of this objectshort Flags- Channel flagschar Name[64]- Channel namechar Sign[8]- Sign (+, -, or blank)char Axis[8]- Axis designation (X, Y, Z, FX, MX, AX, etc.)float FilterFreq- Channel filter class in Hzfloat SetGain- Gain setting (1 - n)float ActGain- Actual (measured) gain settingfloat Rcal- Shunt calibration resistancefloat Excitation- Excitation voltage (when programmable)byte byteSpares[4]- Spare bytes (was CalDate, removed 11/08/04)TRANSDUCER Transducer- Snapshot of transducer values
DDASTestDefinition.h
enum FileTypeFlags
FILETYPE_IMPORTED4X- Test was imported from 4x format
enum HardwareType
HWTYPE_UNKNOWN- None specified (old DDAS)HWTYPE_DDAS3- DDAS III hardwareHWTYPE_KAYSERTHREDE- Kayser-Threde hardware (future)HWTYPE_COUNT- Count of hardware types
struct tagFILEINFOBLOCK / FILEINFOBLOCK
UINT Size- Block size including nSizechar FileTypeName[12]- Software type namechar FileTypeVers[12]- File version nameUINT FileTypeFlags- Hardware type in upper 16 bits, File type in lower 16 bitschar CreatedByName[16]- Created by T-numberchar UpdatedByName[16]- Updated by T-number
struct tagDATASYSTEMBLOCK / DATASYSTEMBLOCK
UINT Size,NumberOfSystems,ChannelsPerSystem,MaxSampleRate,SizeOfConfig
struct tagDDASCONFIGBLOCK / DDASCONFIGBLOCK
UINT Sizeshort AnalogUnitNo,AnalogOptions,MemoryUnitNo,MemoryOptionslong MemorySize
enum AnalogOptionFlags
ANAOPT_CHANTRIGGERS- Analog unit has channel triggers
enum MemoryOptionFlags
MEMOPT_TAPEMODE- Memory unit has tape modeMEMOPT_PREEVENT- Memory unit can select pre-event to 99MEMOPT_PREEVENTXXX- Memory unit can select pre-event to 511
enum RecordModes
RECORDMODE_EVENT- Normal (event) modeRECORDMODE_TAPE- Tape (manual) mode
struct tagACQUISITIONBLOCK / ACQUISITIONBLOCK
long nSize,nRecordMode,SampleRate,TotalSamples,PreEventSamples,TapeModeChannels,nTrigBlock
struct tagTRIGCHANDEF / TRIGCHANDEF
BYTE ChanNo- Channel number to use as triggerBYTE LevelPct- Trigger level in % full scale (0 = off)
Constants:
MAXTRIGCHANS= 4TRIGCHANDSBL= 0x80
struct tagTRIGCHANBLOCK / TRIGCHANBLOCK
unsigned short SizeBlock,NumTrigsTRIGCHANDEF TrigChan[MAXTRIGCHANS]
DataFloat.h
enum FileTypes
UNKNOWN,FLOATPOINT,PROCESSED
struct tagTESTINFO / TESTINFO
unsigned long Size,DeviceIDlong ChannelNo,SampleRate,TotalSamples,PreEventSamplesshort ChanNumInSys,NumPreCalPts,NumPostCalPtschar TestCreation[128],TimeAxisTitle[32]byte SpareBytes[2]
struct tagFILEHEADER / FILEHEADER
FILEINFOBLOCK FileInfoTESTINFO TestInfoCHANNEL Channelbyte SpareBytes[32]
struct tagDATAPEAK / DATAPEAK / PDATAPEAK / LPDP
float Min,Maxshort Xmin,Xmax
enum PeakTypes
PEAKS_MINMAX,PEAKS_3MSCONTIN,PEAKS_3MSCUMUL
struct tagDATAHIST / DATAHIST
float fVal- Data valueint nOccurrences- Number of occurrences
class CDataFloat
CDataFloat(unsigned int nSize)/CDataFloat()- Constructorsvirtual ~CDataFloat()- Destructorint GetChannelNumberInBox()bool VerifyAndCoerceAxis(bool bNegativeSign, const char* szAxis, BOOL bVerbose)void SetEngrgUnits(char *szNewEngrgUnits)void SetChannelName(char* szNewChannelName)int CalcSampIn3mSecInt()int ConvertTimeToIndex(float fTime)float ConvertIndexToTime(int nIndex)const CString GetFileName()int AppendArrayFloat(CArray<float, float&>* srcArray)CArray<float, float&>* GetDataArray()bool GetTimeAtValue(float fValue, float *pTvalue)bool GetDataPeaks(...)- Multiple overloads for peak detectionint GetChannelNumber()float GetStartTime(bool bmSec)/GetStartTimeData(bool bmSec)float GetStopTime(bool bmSec)/GetStopTimeData(bool bmSec)const char* GetFileExt()/GetFileTitle()long GetSampleRate()const char* GetFilePathAndName()int SetFilePathAndName(char* szNewFileSpec)int ClearAll(long NewNumberElements)TESTINFO* GetTestInfo()FILEINFOBLOCK* GetFileInfo()CHANNEL* GetChannel()float GetFilterClass()int GetEventOffset()CString GetDataSetName(CString &csName)FILEHEADER* GetFileHeader()bool WriteToFile(const char *lpFilename, bool bPrint)bool ReadFromFile(const char *lpFilename)float* GetDataBuffer()bool SetSize(long lNumberElements)long GetSize()bool GetDataNext(float* fData)bool StoreDataNext(float fData)bool SetIndexToStart()void operator=(const CDataFloat &src)
class CDataFloat::CPeakList
void RemoveAll()void AddDataPoint(DATAHIST* pDHist)void Get3msMin(int nPtPer3ms, DATAHIST* pDHist)void Get3msMax(int nPtPer3ms, DATAHIST* pDHist)
C# Classes
DDAS.File.cs
class File : Serialization.File, IWritable<Test>
File()- Constructor, initializes with "DDAS" format identifierstatic string Extension=> ".ddas"IWriter<Test> Exporter- Gets the file writer (lazy-initialized)
DDASTest.cs
class DDASTest
enum Fields- LabName, POCName, POCPhoneAndEmail, TestDate, TestTime, TestNumber, TestType, TestObject, DataType, SensorMakeModelSerial, SensorLocation, SensorAxis, SensorMountType, EngineeringUnits, ChannelErrors, SamplingRate, AAFilterCutoffDescription, BitResolution, DigitalFilterType, Notesstring GetValue(Fields field)- Returns "#NOVALUE" if field not setvoid SetValue(Fields field, string value)- Sets value and propagates to all channelsDDASChannel[] Channels- Get/set channel arrayTest Test- Associated test objectFilteredData[] DataUnfilteredEU- Unfiltered engineering unit dataFilteredData[] DataADC- ADC datadouble[] ActualRangesEUFiltered,ActualRangesEUUnfiltered,ActualRangesADCbool FlatFolders- Constructor:
DDASTest(Test test, FilteredData[] adc, FilteredData[] euUnfiltered, string path, double[] actualRangesEUFiltered, double[] actualRangesEUUnfiltered, double[] actualRAngesADC, bool flatFolders)
DDASChannel.cs
class DDASChannel
string GetValue(DDASTest.Fields field)- Returns "#NOVALUE" if not setvoid SetValue(DDASTest.Fields field, string value)- Sets field; special handling for DataType ("Raw", "Processed", "Converted")string FileName- Output file pathvoid Serialize(TickEventHandler tickHandler)- Writes binary DDAS fileint ChannelNumber- Returns 1 + channelIndex- Constructor:
DDASChannel(DDASTest parentTest, int channelIndex, string path)
DDAS.File.Writer.cs
class File.Writer : Writer<File>, IWriter<Test>
internal Writer(File fileType, int encoding)- Constructorvoid Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)- Throws NotImplementedExceptionvoid Write(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)- Writes test viaMyTVTTest.Channels[].Serialize()void Initialize(...)- Empty implementationint DataSamplesPerTick=> 1000string ExtensionPrefix- Property with getter/setterDDASTest MyTVTTest- Property with getter/setter
TSVSettingsWindow.cs
class TSVSettingsWindow : Form
- Constructor:
TSVSettingsWindow(TSVTest test)- Initializes grids with test fields and channel data void button1_Click(object sender, EventArgs e)- Sets DialogResult.OK and closes- Event handlers:
c1GridGlobal_CellChanged,gridChannels_CellChanged,c1GridChannels_AfterEdit,c1GridGlobal_AfterEdit
3. Invariants
Binary Format Constraints
FILEHEADERtotal size is fixed; spare bytes must total 32 bytes for alignmentTESTINFO.SpareBytesmust be exactly 2 bytes for 4-byte alignmentTRIGCHANBLOCK.TrigChanarray is sized toMAXTRIGCHANS(4) but documented as variable-sizeFILEINFOBLOCK.FileTypeFlagsencodes Hardware Type in upper 16 bits, File Type in lower 16 bits
Channel Numbering
- Channel numbers are 1-indexed in output (
ChannelNumber => 1 + _channelIndex) ChanNumInSysis 1-128 range (for multi-device systems)
Trigger Configuration
- To enable a trigger:
ChanNoandLevelPctmust be nonzero, andTRIGCHANDSBL(0x80) must NOT be set inLevelPct - Maximum 4 trigger channels (
MAXTRIGCHANS)
File Naming
- DDAS extension:
.ddas - Float data extension:
.fpd - Raw data extension:
.raw
Data Serialization
- All string fields are ASCII-encoded and null-padded to their fixed sizes
- Calibration date stored as seconds since 1971-01-01 (not Unix epoch 1970)
4. Dependencies
C/C++ Dependencies
TransducerDefinition.h- Required byChannelDefinition.hforTRANSDUCERstructFilePath.h- Required byDataFloat.hforCFilePathclass<Afxtempl.h>- MFC template collections (CArray,CList)
.NET Dependencies
System.Windows.Forms- UI components inTSVSettingsWindowC1.Win.C1FlexGrid- Third-party grid controlSystem.IO- File and directory operationsSystem.Text- ASCII encoding for binary output
Inferred External Dependencies
DTS.Serializationnamespace - BaseSerialization.File,Test,FilteredDataclassesTest.Module.AnalogInputChannel- Channel abstraction with properties likeDescription,SerialNumber,EngineeringUnits,Sensitivity, etc.
Consumers
- The
Writerclass is consumed by whatever orchestrates test exports (not shown in source) TSVSettingsWindowconsumesTSVTestandTSVChannel(referenced but not defined in provided sources)
5. Gotchas
Historical Artifacts
-
Removed CalDate field: The
CHANNELstruct'sCalDatewas removed on 11/08/04 and replaced withbyteSpares[4]. The calibration date now lives in theTRANSDUCERstructure. -
Non-Unix Epoch: The calibration date in
DDASChannel.Serialize()usesnew DateTime(1971, 1, 1)as the epoch, NOT the standard Unix epoch (1970-01-01). Comment says "Good til 2038...shouldn't be an issue for this developer." -
Typo in parameter name:
DDASTestconstructor has parameteractualRAngesADC(typo: "RAnges" instead of "Ranges").
Incomplete Implementation
-
NotImplementedException:
Writer.Write(string pathname, string id, Test test, ...)throwsNotImplementedException. Only the overload with event handlers is functional. -
Empty Initialize method:
Writer.Initialize()has an empty body.
File Format Quirks
-
Hardcoded magic values: The
Serialize()method writes hardcoded sizes (0x40,0xC0,0x1001,0x0100) without reference to the struct definitions. -
SLICE-specific assumption: Comment in
DDASChannelconstructor: "AFAIK, in this context, there is no way other than assumption to know a bridge has three channels." The calculation(channel.ParentModule.NumberOfChannels + 2) / 3 * 3assumes 3 channels per bridge module. -
Variable-size array workaround:
TRIGCHANBLOCK.TrigChanis sized toMAXTRIGCHANS(4) to avoid compiler warnings, but the comment indicates it's intended to be variable-size.
UI Threading
- Volatile flag:
TSVSettingsWindow._bPopulatingis markedvolatilebut used for UI state management during event handling—this pattern may have race conditions in edge cases.
Data Type Mismatches
- Mixed type usage:
DDASChannel.Serialize()writesuint