8.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T11:47:07.484549+00:00 | zai-org/GLM-5-FP8 | 1 | ce57e1c33a0387ff |
EQX Import Parsers Documentation
1. Purpose
This module provides parsing functionality for EQX (Equipment Exchange) format files, enabling import of sensor data and test setup configurations into the DTS system. It consists of three main components: EQXSensorsParser for parsing sensor definitions and calibrations, EQXTestSetupParser for constructing test setups with associated groups and channels, and EQXGroupImport for handling group creation and sensor-to-group mapping logic. The module bridges the proprietary EQX XML format with the internal ImportObject data model.
2. Public Interface
EQXTestSetupParser
Constructor:
public EQXTestSetupParser(
IImportNotification importNotification,
EqxImportOptions eqxImportOptions,
IGroupImport groupImport,
EquipmentExchange.EQXSensorDatabase eqxSensorDatabase,
bool createDynamicGroups)
Public Methods:
public override void Parse(ref ImportObject importObject)
Parses the EQX file specified by FileName (inherited from ParseVariantBase) and populates the importObject with test setup data, groups, and sensors. Validates that the file contains test setup data (checks GroupNameTestObjectLookup). Aborts with a critical error if no test setup data is present.
EQXGroupImport
Implements: IGroupImport
Public Properties:
public ParseParameters ParseParameters { get; set; }
Public Methods:
public Tuple<TestTemplate, List<IGroup>> CreateGroups(
List<SensorData> sensors,
Dictionary<string, List<TsetSetupImportSensorInfo>> groupSensorLookup,
TestTemplate testTemplate,
bool createDynamicGroups,
List<IGroup> staticGroups,
Action<double> setProgress)
Creates groups and populates a TestTemplate from sensor data. Returns a tuple containing the configured test template and list of static groups. Returns null if groupSensorLookup is null or empty. Groups are sorted by sensor count (descending), then by name (ascending) for tie-breaking.
public Dictionary<string, List<TsetSetupImportSensorInfo>> GetGroupSensorLookup(
List<SensorData> sensors,
Dictionary<string, string> sensorGroupNameLookup,
Dictionary<string, List<string>> groupNameSensorListLookup)
Builds a lookup dictionary mapping group names to sensor information. Mutually exclusive: either sensorGroupNameLookup or groupNameSensorListLookup should be populated (per FB 30358).
EQXSensorsParser
Constructor:
public EQXSensorsParser(
IImportNotification importNotification,
User user,
EqxImportOptions eqxImportOptions,
EquipmentExchange.EQXSensorDatabase eqxSensorDatabase)
Constants:
const float MAX_EQX_VERSION_SUPPORT = 1.5F;
Public Properties:
public bool ImportCreateDynamicGroups { get; set; }
public bool EQXUseSerialNumberFieldForSN { get; set; }
public bool UseZeroForUnfiltered { get; set; }
Public Methods:
public override void Parse(ref ImportObject importObject)
Parses the EQX file for sensor data. Validates XML structure and EQX format version (must be ≤ 1.5). Populates importObject with sensors, calibrations, and sensor model lookups.
3. Invariants
-
EQX Version Constraint:
EQXSensorsParseronly supports EQX files withDataFormatEdition≤MAX_EQX_VERSION_SUPPORT(1.5). Files with higher versions trigger an error and abort parsing. -
Test Setup Presence:
EQXTestSetupParser.Parse()requiresGroupNameTestObjectLookupto be non-null and non-empty. If empty, the import aborts with a critical error (Import_EQXFileNotForTestSetup). -
Null Argument Handling: Both
Parse()methods throwArgumentNullExceptionifimportObjectis null.EQXTestSetupParser.Parse()returns early (no-op) ifFileNameis null or empty. -
Calibration Sorting: In
FixCalibrations(), calibrations are sorted before the first one is assigned to a sensor. This implies calibrations have a defined sort order (likely by date or version). -
Group Ordering: In
EQXGroupImport.CreateGroups(), groups are sorted by sensor count (descending), then alphabetically by name for equal counts. -
Mutually Exclusive Lookups: Per FB 30358,
GetGroupSensorLookup()expects eithersensorGroupNameLookupORgroupNameSensorListLookupto be populated, not both. -
Sensor Uniqueness in Groups: In
CreateGroups(), aHashSet<string>(sensorSerialHash) ensures each sensor serial number is only counted once per group fortestGroupChannels.
4. Dependencies
Direct Dependencies (Imports):
EQXTestSetupParser:
DataPROWin7.DataModel-ImportObject,ImportError,ImportSeverityError,TestTemplate,SensorDataDTS.Common.Import.ImportOptions-EqxImportOptionsDTS.Common.Import.Parsers-ParseVariantBaseDTS.Common.Interface.Groups.GroupList-IGroupImport,IGroupDTS.Common.SharedResource.Strings-StringResourcesDTS.Common.Utilities.Logging-APILoggerDTS.Common.Utils-GroupHelperDTS.SensorDB-EquipmentExchange.EQXSensorDatabaseSystem.Xml.Linq- XML parsing
EQXGroupImport:
DataPROWin7.DataModel-TestTemplate,SensorData,TsetSetupImportSensorInfoDTS.Common.Classes.Groups- Group-related classesDTS.Common.Classes.Sensors-GroupChannelDTS.Common.Interface.Groups.GroupList-IGroupImport,IGroupDTS.Common.Interface.Channels-IGroupChannelDTS.Common.Storage-DbOperationsDTS.SensorDB- Sensor database types
EQXSensorsParser:
DTS.Common.Enums-BridgeType,SquibMeasurementType,ExcitationVoltageOptionsDTS.Common.Import.ImportOptions-EqxImportOptionsDTS.Common.Import.Parsers-ParseVariantBaseDTS.Common.Storage-DbOperationsDTS.Common.Classes.Sensors-FactorySensorModel,SensorsCollectionDTS.Common.Interface.Sensors-ISensorDataDTS.Common.SharedResource.Strings-StringResourcesDTS.Slice.Users-UserDTS.SensorDB-EquipmentExchange.EQXSensorDatabase
Consumers:
- The module is designed to be consumed by the DTS import infrastructure via
ParseVariantBaseinheritance pattern. EQXGroupImportimplementsIGroupImport, suggesting it's injected into consumers that depend on that interface.
5. Gotchas
-
Calibration Reset Bug (Case 44105):
NormalizeSensorIds()inGroupHelpercan reset sensor calibrations.EQXTestSetupParser.AssignGroupsToTestSetup()callsFixCalibrations()afterNormalizeSensorIds()to restore them. This is a known workaround documented in the source. -
Duplicate Sensor Addition: In
EQXSensorsParser.ParseSensor(), sensors are added toimportObjectvia bothAddSensorLookup()andAddSensor(). The comment "this is for compatability for import test setups" suggests legacy behavior being maintained. -
EID Preservation (Case 18467): If an EQX file has a null
IDModuleString, the parser attempts to preserve the existing EID from the sensor database to avoid wiping it out. -
Excitation Errors Not Reported:
GetExcitationErrors()collects excitation validation errors, but the method includes a//TODO Report the errorscomment, indicating these errors may not be surfaced to users. -
Silent XML Parsing Failure:
ParseSetupName()catches all exceptions and returnsstring.Emptywithout logging, making setup name extraction failures invisible. -
Static Group Mutation:
EQXGroupImport.CreateGroups()modifies thestaticGroupslist parameter in-place (callsstaticGroups.Add(newGroup)) rather than returning a new collection. -
Progress Callback Frequency: In
EQXSensorsParser.ParseSensor(), progress updates only occur every 10 iterations (if (0 == currentDone % 10)), which may cause UI staleness for small imports. -
Zero Method Hardcoded Index: In
CreateGroups(), zero method properties are accessed viaMethods[0]without bounds checking, assuming at least one method exists inZeroMethods.Methods.