11 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||
|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:35:46.255556+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 353d00996507afad |
Documentation: DTS.Serialization.Iso.File Module
1. Purpose
This module implements the ISO 14967-compliant serialization format for test data, specifically for crash test and impact testing scenarios. It provides structured representations of test metadata, test objects (e.g., dummies, barriers), channels (sensor data), and custom properties, enabling export of test results in a standardized text-based format. The module resides within the DTS.Serialization.Iso namespace and extends a base Serialization.File class, integrating with a proprietary test plan abstraction (Common.ISO.TestPlan) to populate ISO fields and delegate writing to a dedicated Writer class.
2. Public Interface
DTS.Serialization.Iso.File
-
File(Common.ISO.TestPlan testplan)
Constructor. Initializes a new ISO file instance with the provided test plan. Callsbase("ISO"). -
bool ExportSummaryReport { get; set; } = false
Controls whether a summary report is included in the export. -
bool UseZeroForUnfiltered { get; set; } = false
Whentrue, unfiltered channel data is exported as0instead of omitting it. -
bool UseIsoCodeFilterMapping { get; set; }
Whentrue, the ISO code for a filter is determined by the software filter mapping for the channel. -
bool FilteredExport { get; set; } = false
Indicates whether the export is filtered. -
bool ExportISOChannelName { get; set; } = false
Controls whether the ISO channel name is exported. -
void AddChannel(string dasserial, int moduleNumber, int number, string description, FilteredData data)
Delegates to the exporter (Writer) to add a channel with the specified metadata and data. -
void ApplyTestPlan(Serialization.Test test)
Populates theTestInstanceproperties by iterating overCommon.ISO.TestPlan.IsoFieldsenum values and mapping each to corresponding fields onTestInstance. Special handling includes:- Parsing
Datewith fallback totest.InceptionDate. - Converting
ExtraPropertiesdictionary toList<ExtraProperty>. - Using
"NOVALUE"for null/empty values viaGetFieldString. - Throws
NotSupportedExceptionfor unsupported fields.
- Parsing
-
IWriter<Serialization.Test> Exporter { get; }
Lazily initializes and returns aWriterinstance configured with current settings (UseZeroForUnfiltered,UseIsoCodeFilterMapping, etc.). Throws a wrappedExceptionon failure. -
Test TestInstance { get; }
Returns theTestinstance associated with this file. Initialized with a defaultTest(). -
static string TestFileExtension { get; }
Returns".mme"(file extension for serialized test data). -
static string ChannelFileExtension { get; }
Returns".chn"(file extension for serialized channel data). -
Common.ISO.TestPlan GetTestPlan()
Returns the_testPlanfield passed at construction.
DTS.Serialization.Iso.File.Test
-
string DataFormatEditionNumber { get; set; }
Default:"1.6". Represents the ISO data format edition. -
string LaboratoryName,LaboratoryContactName,LaboratoryContactPhone, etc.
Standard ISO metadata fields (e.g., lab name, contact info, test reference numbers). All arestringproperties with associated label constants (e.g.,LaboratoryNameLabel = "Laboratory name"). -
string CustomerName,CustomerTestReferenceNumber,CustomerProjectReferenceNumber, etc.
Customer-related metadata fields. -
string TestEngineerName,TestEngineerPhone,TestEngineerFax,TestEngineerEmail
Test engineer contact fields. -
string Title { get; set; }
Title of the test. Ifnullor"NOVALUE", defaults totest.IdinApplyTestPlan. -
string NumberOfMedia { get; set; }
Default:"1/1". -
string Timestamp { get; set; }
Default: current time in"yyyy-MM-dd HH:mm:ss"format. -
string TestComment { get; set; }
Comment field for the test. -
string Type { get; set; }
Type of the test. -
DateTime Date { get; set; }
Date of the test. Initialized toDateTime.Now. -
string Subtype { get; set; }
Subtype of the test. -
string Regulation { get; set; }
Regulatory framework. -
string ReferenceTemperature { get; set; }
Reference temperature. -
string RelativeAirHumidity { get; set; }
Relative air humidity. -
int NumberOfTestObjects { get; }
ReturnsObjects.Count. -
List<Object> Objects { get; set; }
List of test objects (e.g., dummies, barriers). Initialized to empty list. -
List<Channel> Channels { get; set; }
List of channels (defined in other files, not included here). -
List<ExtraProperty> ExtraProperties { get; set; }
List of custom key-value properties. Initialized to empty list. -
string ToString()
Generates the ISO header section of the test file, including all metadata fields and extra properties, formatted aslabel: valuelines. UsesGetFieldStringto handle uninitialized values as"NOVALUE".
DTS.Serialization.Iso.File.Test.ExtraProperty
-
ExtraProperty(string key, string value)
Constructor. Initializes_Keyand_Valuewith provided values. -
string Key { get; set; }
Gets or sets the property key. Returnsnullif not initialized. -
string Value { get; set; }
Gets or sets the property value. Returnsnullif not initialized.
DTS.Serialization.Iso.File.Test.Object
-
string[] Comments { get; set; }
Array of comment strings. -
string Name,Type,Number,Velocity,Mass,Position,TestObjectImpactSide,Class,Code,Offset,BarrierWidth,BarrierHeight,YawAngle,ReferenceSystem,OriginX,OriginY,OriginZ,NumberOfLoadcells
All arestringproperties with associated label constants (e.g.,NameLabel = "Name of test object #"). Default values:"0.0"forVelocity,""forMass,"?"forPosition. -
int MmeNumber { get; set; }
Internal MME number for the object. Default:-1. -
string TestObject { get; set; }
Placeholder field (label:"Test Object #"). -
List<ExtraProperty> ExtraProperties { get; set; }
List of custom properties for this object. Initialized to empty list. -
string ToString()
Generates the ISO representation of the test object, including comments, metadata, and conditional barrier-specific fields (ifType == "B"). UsesGetFieldStringfor value extraction. Special handling forPositionandTestObjectImpactSide: if not"NOVALUE"or empty, extracts substring before'-'(e.g.,"L-1"→"L").
3. Invariants
NoValueconstant: The string"NOVALUE"is used to represent missing or uninitialized field values in the output.- Label formatting: All labels are right-padded to
SeparatorOffset(28 characters) before appendingSeparator(":"). GetFieldStringbehavior: Returns"NOVALUE"if the extractor returnsnull,string.Empty, or throws an exception.Property<T>initialization: All properties useProperty<T>wrappers with unique keys (namespace-qualified), default values, and immutability flags (truefor statics likeTestFileExtension,falsefor instance fields).ExtraPropertieshandling: InApplyTestPlan,ExtraPropertiesfromTestPlan(a dictionary) is converted to a list ofExtraPropertyinstances.Dateparsing: IfDateTime.TryParsefails forDatefield, falls back totest.InceptionDate.Type == "B"condition: Barrier-specific fields (BarrierWidth,OriginX, etc.) are only included inObject.ToString()ifType == "B".Position/TestObjectImpactSidesubstring extraction: Only performed if value is not"NOVALUE"and not empty; usesIndexOf('-') - 1as end index.
4. Dependencies
-
Imports/Usings:
DTS.Common.UtilitiesandDTS.Common.Utilities.DotNetProgrammingConstructs(forProperty<T>,Exceptionalbase class).DTS.Serialization.Iso.Report(forIWritable<Test>andIWriter<Test>).System,System.Collections.Generic,System.Linq,System.Text,System.Threading.Tasks.
-
Key Dependencies:
Common.ISO.TestPlan: Provides test metadata viaGetField(IsoFields)andExtraPropertiesdictionary.Serialization.File: Base class for file serialization.IWritable<Test>: Interface implemented byFile.IWriter<Test>: Writer interface (implemented byWriterclass, instantiated inExporter).FilteredData: Type for channel data (used inAddChannel).
-
Depended Upon:
Writerclass (inferred fromExporterproperty andAddChannelmethod).- Likely consumed by higher-level serialization logic (e.g., export UI or batch processor).
5. Gotchas
-
Substring index risk in
Object.ToString(): ThePositionandTestObjectImpactSidesubstring extraction (Substring(0, IndexOf('-') - 1)) will throwArgumentOutOfRangeExceptionif the value contains no'-'or if'-'is at index0or1. This is not guarded against in the source. -
Timestampdefault is non-deterministic:Timestampdefaults toDateTime.Now, which may cause non-reproducible exports if not explicitly set. -
ExtraPropertieskey collision: IfExtraPropertiesfromTestPlancontains duplicate keys, the last one wins in the list (no explicit deduplication). -
TestInstanceis lazily initialized but not thread-safe: TheTestInstanceproperty returns a shared instance; concurrent modifications could cause race conditions. -
NoValueis hardcoded:"NOVALUE"is used as a sentinel, but there is no validation to prevent user data from accidentally using this string. -
ApplyTestPlanthrowsNotSupportedException: Any unhandledIsoFieldsenum value causes a hard failure. This may break if the enum is extended. -
Property<T>null handling: Properties withIsValueInitialized == falsereturnnullfor reference types (e.g.,string,List<T>), butGetFieldStringtreatsnullas"NOVALUE". This is consistent but requires care when checking for presence. -
No explicit validation: No validation is performed on field values (e.g.,
Velocityis a string but expected to be numeric;Positioncodes like"L-1"are parsed but not validated).