11 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T03:44:55.174600+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 75b4cd844b9f7d36 |
EquipmentExchange
Documentation: CrashDesignerTestSetup Module
1. Purpose
This module defines the data model and XML deserialization logic for importing test setup configurations generated by CrashDesigner (a proprietary crash testing application). Its primary role is to parse an XML file conforming to a specific schema (with root <TestSetupDefinition>) into a strongly-typed object graph (CrashDesignerTestSetup), enabling downstream components to access test metadata, channel groupings, and data acquisition (DAQ) hardware configuration in a structured manner. It also provides a utility method (GetEqxElectricalMethod) to map equipment bridge types to internal sensor configuration flags used elsewhere in the system.
2. Public Interface
CrashDesignerTestSetup Class
-
string Name { get; set; }
The name of the test setup, extracted from theNameattribute of the<TestSetupDefinition>XML element. -
static void GetEqxElectricalMethod(string eqxBridge, out bool isProportional, out DTS.Common.Enums.Sensors.SensorConstants.BridgeType bridgeType)
Maps a string-based equipment bridge identifier (eqxBridge) to internal sensor configuration flags.isProportional:truefor passive bridges (e.g.,FullBridge,HalfBridge,QuarterBridge),falsefor active sensors (e.g.,Active,ActiveSensor,HalfBridgeActive,QuarterBridgeActive).bridgeType: One ofDTS.Common.Enums.Sensors.SensorConstants.BridgeType(FullBridge,HalfBridge,QuarterBridge,IEPE).- Special case:
"PiezoInput"→IEPE,isProportional = true.
-
static CrashDesignerTestSetup ReadXML(string importFile)
Loads and deserializes an XML file (importFile) into aCrashDesignerTestSetupinstance.- Requires root element
<TestSetupDefinition>withNameattribute. - Delegates parsing of
<General>,<ChannelGroups>, and<DataAcquisitionUnit>sub-elements to respectiveReadXmlmethods. - Logs unknown XML elements via
Trace.WriteLine.
- Requires root element
Nested Classes & Methods
-
GeneralSection- Properties:
DateGenerated,GeneratorName,Description,TestType,PreTriggerTime,PostTriggerTime,OutputDataDirectory,TestSetupGroup(string array). void ReadXml(XmlElement root): Parses child elements corresponding toGeneralSection.Fieldsenum values.PreTriggerTimeReadout→PreTriggerTimePostTriggerTimeReadout→PostTriggerTimeTestSetupGroup→ appends to internal list (multiple allowed).- Uses invariant culture for numeric/date parsing; logs failures.
- Properties:
-
ChannelGroupsSectionGroup[] Groups { get; }: Array ofGroupobjects.void ReadXml(XmlElement root): Parses<Group>child elements.
-
Group- Properties:
Name,Id,Parent,Description. bool HasProperty(string key)/string GetProperty(string key)/void SetProperty(string key, string value): Key-value store for arbitrary properties.KnownFormatsenum: Lists 30+ standardized property keys (e.g.,ISOTitle,TestDate,CustomerName,Velocity,Mass,ImpactSide) with[Description]attributes matching their XML element names.static Group ReadXml(XmlElement root): ParsesId,Parentattributes,<Name>,<Description>, and<Property Name="..." Value="...">elements.
- Properties:
-
DataAcquisitionSectionDataAcquisitionUnit[] DataAcquisitionUnits { get; }: Array of DAQ units.void ReadXml(XmlElement element): Parses a single<DataAcquisitionUnit>element (note: despite the name, only one unit is supported per XML file per current implementation).
-
DataAcquisitionUnit- Properties: Extensive hardware metadata (e.g.,
Name,Type,SerialNr,Manufacturer,SampleFrequencyHz,AnalogInputChannelCount,Trigger,Enabled,DataBaseUID, etc.). TriggerSection Trigger { get; }: Nested class withTriggerMode,RecBus,T0Bus,Filter.AnalogInChannelSection AnalogChannels { get; }: Contains parsed analog input channels.static DataAcquisitionUnit ReadXml(XmlElement root): Parses all DAQ-specific XML elements.- Uses
GetDoublehelper (returnsNaNon parse failure). - Handles nested
<Trigger>and<AnalogInChannel>elements.
- Uses
- Properties: Extensive hardware metadata (e.g.,
-
TriggerSectionvoid ReadXml(XmlElement root): Parses<TriggerMode>,<RecBus>,<T0Bus>,<Filter>elements.
-
AnalogInChannelSectionAnalogInChannel[] Channels { get; }: Array of analog channels.void ReadXml(XmlElement element): Parses a single<AnalogInChannel>element.
-
AnalogInChannel- Properties: 50+ fields covering channel configuration, sensor details, calibration, and signal conditioning (e.g.,
Enabled,Id,GroupId,ChannelName,BridgeType,Sensitivity,ExcitationVoltage,OffsetFlag,ShuntPosFlag,NextCalibrationDate,PhysicalUnit,Direction,InvertFlag,CalculatedGain,SensorStatusUsable,VoltageEngineeringUnit). static AnalogInChannel ReadXml(XmlElement root): Parses all channel XML elements.- Uses
GetDatehelper (returnsDateTime.MinValueon parse failure). - Bug/Quirk: In
ShuntPosMaxToleranceVparsing, incorrectly assigns toShuntGainPosinstead ofShuntPosMaxToleranceV(see Gotchas).
- Uses
- Properties: 50+ fields covering channel configuration, sensor details, calibration, and signal conditioning (e.g.,
-
static DateTime GetDate(string text)
Helper for parsingDateTimefrom XML text (invariant culture,DateTimeStyles.None). ReturnsDateTime.MinValueon failure. -
static double GetDouble(string text)
Helper for parsingdoublefrom XML text (invariant culture,NumberStyles.Any). Returnsdouble.NaNon failure.
3. Invariants
-
XML Structure:
- Root element must be
<TestSetupDefinition>with aNameattribute. - Valid child elements under
<TestSetupDefinition>are strictly:<General>,<ChannelGroups>,<DataAcquisitionUnit>. Unknown elements are logged but ignored. <General>supports only elements defined inGeneralSection.Fieldsenum.<ChannelGroups>must contain one or more<Group>elements.<DataAcquisitionUnit>must contain exactly one<DataAcquisitionUnit>element (per currentReadXmlimplementation).<AnalogInChannel>elements are parsed individually and appended to the channel list.
- Root element must be
-
Data Parsing:
- Numeric/date fields use
CultureInfo.InvariantCulturefor parsing. - Failure to parse numeric/date fields results in default values (
0,DateTime.MinValue,double.NaN) and aTrace.WriteLinewarning. Groupproperties are stored in a dictionary; unknown keys are preserved.AnalogInChannel.Enabled,DataConversionEnabled, etc., default tofalseif attribute/element missing.
- Numeric/date fields use
-
Object State:
General,ChannGroups,DataAcquisitionare initialized to non-null instances (via property initializers).Group.Groups,DataAcquisitionUnits,AnalogChannels.Channelsarrays are lazily populated viaReadXml.
4. Dependencies
-
External Types:
System.Xml.XmlDocument,System.Xml.XmlElement,System.Xml.XmlNodeSystem.ComponentModel.DescriptionAttribute(used inGroup.KnownFormats)DTS.Common.Enums.Sensors.SensorConstants.BridgeType(referenced inGetEqxElectricalMethod)
-
Module Dependencies:
- This module depends on the
DTS.Commonassembly (forBridgeTypeenum). - Used by: Downstream components consuming
CrashDesignerTestSetupobjects (e.g., test execution, DAQ configuration, reporting). - Notable: The
DataAcquisitionSectionclass has a commented-out propertypublic DataAcquisitionSection DataAcquisitionUnit { get; set; }, suggesting a design change or legacy artifact.
- This module depends on the
5. Gotchas
-
Shunt Parsing Bug:
InAnalogInChannel.ReadXml, theShuntPosMaxToleranceVcase incorrectly assigns toShuntGainPosinstead ofShuntPosMaxToleranceV:case "ShuntPosMaxToleranceV": analog.ShuntGainPos = GetDouble(element.InnerText); break; // WRONG!This will overwrite
ShuntGainPosand leaveShuntPosMaxToleranceVat its default (0).
Impact: Shunt calibration tolerance data may be corrupted. -
Single DAQ Unit Assumption:
DataAcquisitionSection.ReadXmlonly processes one<DataAcquisitionUnit>element (appends to_unitslist once), despite the XML schema potentially supporting multiple. This may cause data loss if the input file contains multiple<DataAcquisitionUnit>elements. -
Ambiguous
PreTriggerTimeReadout/PostTriggerTimeReadout:
The XML element names (PreTriggerTimeReadout,PostTriggerTimeReadout) do not match the property names (PreTriggerTime,PostTriggerTime). This could confuse developers unfamiliar with the enum mapping. -
KnownFormatsEnum Mismatch:
TheKnownFormatsenum uses[Description]attributes (e.g.,[Description("ISO Title")]), but XML parsing forGroupproperties relies onelement.LocalNamematching the enum name (e.g.,ISOTitle), not the description. This is correct per current code but may be error-prone. -
GetEqxElectricalMethodBehavior:"Active"and"ActiveSensor"both setisProportional = false, but the distinction is not documented."PiezoInput"is the only case that setsbridgeType = IEPE; other active bridges useFullBridge/HalfBridge/QuarterBridgewithisProportional = false.
-
No Validation:
The class performs no semantic validation (e.g., checkingSampleFrequencyHzis withinMinSampleFrequencyHz/MaxSampleFrequencyHz, orGroupIdreferences exist). Invalid data may propagate silently. -
Missing
DataAcquisitionUnitProperty:
The commented-out propertypublic DataAcquisitionSection DataAcquisitionUnit { get; set; }suggests confusion betweenDataAcquisitionSection(container) andDataAcquisitionUnit(item). The current design usesDataAcquisition.DataAcquisitionUnits(array), which is correct, but the commented line may indicate historical instability. -
No Error Handling for XML Load:
ReadXMLcallsdoc.Load(importFile)without try/catch. File I/O errors (e.g., missing file, malformed XML) will throw unhandled exceptions. -
Culture Sensitivity:
While numeric/date parsing uses invariant culture, string comparisons (e.g.,element.LocalName == "General") are case-sensitive and culture-sensitive. XML element names must match exactly (e.g.,"General", not"general").