175 lines
7.9 KiB
Markdown
175 lines
7.9 KiB
Markdown
---
|
|
source_files:
|
|
- Common/DTS.Common.Import/Parsers/EQX/EQXTestSetupParser.cs
|
|
- Common/DTS.Common.Import/Parsers/EQX/EQXGroupImport.cs
|
|
- Common/DTS.Common.Import/Parsers/EQX/EQXSensorsParser.cs
|
|
generated_at: "2026-04-17T15:39:25.870361+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "605a991ac1639306"
|
|
---
|
|
|
|
# EQX Import Parsers Documentation
|
|
|
|
## 1. Purpose
|
|
|
|
This module provides parsing functionality for importing Equipment Exchange (EQX) format files into the DTS system. It consists of three main components: `EQXTestSetupParser` for importing test setup configurations including groups and channel assignments, `EQXSensorsParser` for importing sensor definitions and calibration data, and `EQXGroupImport` for processing group-to-sensor mappings during test setup creation. The module bridges the proprietary EQX XML format with the internal DTS data model, handling version compatibility, calibration assignments, and group hierarchy construction.
|
|
|
|
---
|
|
|
|
## 2. Public Interface
|
|
|
|
### EQXTestSetupParser
|
|
|
|
**Constructor:**
|
|
```csharp
|
|
public EQXTestSetupParser(
|
|
IImportNotification importNotification,
|
|
EqxImportOptions eqxImportOptions,
|
|
IGroupImport groupImport,
|
|
EquipmentExchange.EQXSensorDatabase eqxSensorDatabase,
|
|
bool createDynamicGroups)
|
|
```
|
|
Initializes the parser with notification services, import options, group import handler, sensor database reference, and a flag indicating whether dynamic groups should be created.
|
|
|
|
**Methods:**
|
|
|
|
```csharp
|
|
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. Validates that group name test object lookup exists; if not, adds a critical error and aborts. Assigns group lookups, creates test templates, fixes calibrations, assigns groups to test setup, and sets the `TestSetupImportFileFormat` on the import object.
|
|
|
|
---
|
|
|
|
### EQXGroupImport
|
|
|
|
**Implements:** `IGroupImport`
|
|
|
|
**Properties:**
|
|
|
|
```csharp
|
|
public ParseParameters ParseParameters { get; set; }
|
|
```
|
|
|
|
**Methods:**
|
|
|
|
```csharp
|
|
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 from the provided sensor data and group-sensor lookup. Returns a tuple containing the populated `TestTemplate` and list of static groups. Returns `null` if `groupSensorLookup` is null or empty. Groups are sorted by sensor count (descending), then by name (ascending). Each group is populated with `GroupChannel` objects containing sensor data, calibration info, squib settings, and digital I/O configuration.
|
|
|
|
```csharp
|
|
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 lists of `TsetSetupImportSensorInfo`. Handles two mutually exclusive input formats: `sensorGroupNameLookup` (sensor → group name) or `groupNameSensorListLookup` (group name → list of sensor serial numbers).
|
|
|
|
---
|
|
|
|
### EQXSensorsParser
|
|
|
|
**Constructor:**
|
|
```csharp
|
|
public EQXSensorsParser(
|
|
IImportNotification importNotification,
|
|
User user,
|
|
EqxImportOptions eqxImportOptions,
|
|
EquipmentExchange.EQXSensorDatabase eqxSensorDatabase)
|
|
```
|
|
|
|
**Constants:**
|
|
```csharp
|
|
const float MAX_EQX_VERSION_SUPPORT = 1.5F;
|
|
```
|
|
|
|
**Properties:**
|
|
```csharp
|
|
public bool ImportCreateDynamicGroups { get; set; }
|
|
public bool EQXUseSerialNumberFieldForSN { get; set; }
|
|
public bool UseZeroForUnfiltered { get; set; }
|
|
```
|
|
|
|
**Methods:**
|
|
|
|
```csharp
|
|
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). Delegates to `ParseSensor` for actual processing.
|
|
|
|
---
|
|
|
|
## 3. Invariants
|
|
|
|
- **EQX Version Compatibility:** The maximum supported EQX DataFormatEdition is `1.5F`. Files with higher versions will cause import rejection with an error message.
|
|
- **Null ImportObject Handling:** Both `EQXTestSetupParser.Parse()` and `EQXSensorsParser.Parse()` throw `ArgumentNullException` if `importObject` is null.
|
|
- **Empty FileName Handling:** Both parsers return immediately without processing if `FileName` is null or empty.
|
|
- **Group Lookup Mutual Exclusivity:** In `EQXGroupImport.GetGroupSensorLookup()`, either `sensorGroupNameLookup` OR `groupNameSensorListLookup` will be populated, but not both (per comment FB 30358).
|
|
- **Calibration Assignment:** In `FixCalibrations()`, calibrations are sorted and the first calibration (index 0) is assigned to each sensor.
|
|
- **Test Setup Uniqueness:** `EQXTestSetupParser.Parse()` returns early without creating a test setup if a test setup with the same name already exists in `importObject.TestSetups()`.
|
|
- **Group Sorting:** Groups are sorted by sensor count descending, then alphabetically by name ascending when equal.
|
|
- **Channel Order:** `GroupChannelOrder` and `TestSetupOrder` are 1-indexed (1 + sensor index).
|
|
|
|
---
|
|
|
|
## 4. Dependencies
|
|
|
|
### Direct Dependencies (Imports):
|
|
|
|
**EQXTestSetupParser:**
|
|
- `DataPROWin7.DataModel` - `ImportObject`, `ImportError`, `ImportSeverityError`, `TestTemplate`, `SensorData`
|
|
- `DTS.Common.Import.ImportOptions` - `EqxImportOptions`
|
|
- `DTS.Common.Import.Parsers` - `ParseVariantBase`
|
|
- `DTS.Common.Interface.Groups.GroupList` - `IGroupImport`, `IGroup`
|
|
- `DTS.Common.SharedResource.Strings` - `StringResources`
|
|
- `DTS.Common.Utilities.Logging` - `APILogger`
|
|
- `DTS.Common.Utils` - `GroupHelper`
|
|
- `DTS.SensorDB` - `EquipmentExchange.EQXSensorDatabase`
|
|
- `System.Xml.Linq` - XML parsing
|
|
|
|
**EQXGroupImport:**
|
|
- `DataPROWin7.DataModel` - `SensorData`, `TestTemplate`, `TsetSetupImportSensorInfo`
|
|
- `DTS.Common.Classes.Groups` - Group-related classes
|
|
- `DTS.Common.Classes.Sensors` - `GroupChannel`
|
|
- `DTS.Common.Interface.Groups.GroupList` - `IGroupImport`, `IGroup`
|
|
- `DTS.Common.Storage` - `DbOperations`
|
|
- `DTS.SensorDB` - Sensor database types
|
|
|
|
**EQXSensorsParser:**
|
|
- `DataPROWin7.DataModel` - `ImportObject`, `SensorData`
|
|
- `DTS.Common.Enums` - Enumerations including `BridgeType`, `ExcitationVoltageOptions`, `SquibMeasurementType`
|
|
- `DTS.Common.Import.ImportOptions` - `EqxImportOptions`
|
|
- `DTS.Common.Import.Parsers` - `ParseVariantBase`
|
|
- `DTS.Common.Storage` - `DbOperations`
|
|
- `DTS.Common.Classes.Sensors` - `FactorySensorModel`, `SensorsCollection`
|
|
- `DTS.Common.Interface.Sensors` - `ISensorData`
|
|
- `DTS.Common.SharedResource.Strings` - `StringResources`
|
|
- `DTS.Slice.Users` - `User`
|
|
- `DTS.SensorDB` - `EquipmentExchange.EQXSensorDatabase`
|
|
- `System.Xml.Linq` - XML parsing
|
|
|
|
### Consumers:
|
|
- The module is consumed by the DTS import system (exact consumers not visible in provided source).
|
|
|
|
---
|
|
|
|
## 5. Gotchas
|
|
|
|
### Calibration Reset Issue (FB 44105 / Historical Bug)
|
|
The comment in `EQXTestSetupParser.AssignGroupsToTestSetup()` references a bug where `GroupHelper.NormalizeSensorIds()` can reset calibrations for sensors. The workaround is calling `FixCalibrations(importObject)` immediately after normalization to restore calibrations from the import data.
|
|
|
|
### Duplicate Calibration Fix Calls
|
|
`FixCalibrations()` is called twice in `EQXTestSetupParser.Parse()`: once early in the method, and again inside `AssignGroupsToTestSetup()` after `NormalizeSensorIds()`. This is intentional due to the normalization side-effect noted above.
|
|
|
|
### EID Preservation (Bug 18467)
|
|
`EQXSensorsParser.ParseSensor()` contains special logic to preserve existing EID values when the EQX file has a NULL `IDModuleString`. Without this, importing an EQX file with missing IDModuleString would clear the EID on existing sensors.
|
|
|
|
### Null IDModule Handling
|
|
The method `SensorHasNullIDModule()` and `GetSensorNullIdModuleValue()` are called on `_eq |