4.1 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T11:29:51.864320+00:00 | zai-org/GLM-5-FP8 | 1 | e94d77a26e8f0798 |
Documentation: DTS.Common.Import
1. Purpose
The DTS.Common.Import namespace provides the infrastructure for parsing and importing test configuration data (sensors, calibrations, groups, test setups) into the system. It defines ImportObject as the central data transfer object that accumulates state during the import process. The module includes orchestration processors for handling files (CSV and XML), utility classes for data normalization and calibration logic, and notification mechanisms to report progress and errors to the UI or calling application.
2. Public Interface
Classes
ImportObject
The primary state container for an import operation. It holds collections of sensors, calibrations, hardware, groups, and lookup dictionaries.
- Properties:
SourceFormat: Gets or sets theImportFormatsenum value.TestSetupImportFileFormat: Gets or sets theImportFileFormat(Single, Multiple, No TestSetup).
- Methods:
AddSensor(SensorData sensorData)/AddSensors(IEnumerable<SensorData> sensorsData): Adds sensors to the import list.AddCalibration(SensorCalibration sensorCalibration)/AddCalibrations(...): Adds calibration records.AddTestSetup(TestTemplate testTemplate)/AddTestSetups(...): Adds test setups.AddError(ImportError d)/AddErrors(IEnumerable<ImportError> d): Registers import errors.AssignParseParameters(ParseParameters parseParameters): Assigns parameters used during parsing.GetSensorLookup(): Returns aIReadOnlyDictionary<int, ISensorData>mapped byDatabaseId. Logs duplicates toSystem.Diagnostics.Trace.GetImportFileFormat(): ReturnsImportFileFormatbased on the count of test setups.
ParseProcessor
Orchestrates the parsing of files using a list of IParseVariant implementations.
- Constructor:
ParseProcessor(ImportObject importObject, IEnumerable<string> fileNames, IEnumerable<IParseVariant> parseVariants) - Methods:
Process(): Iterates throughfileNamesandparseVariants, executingvariant.Parse(ref _importObject). Returns the modifiedImportObject.
XMLParseProcessor
Orchestrates XML file parsing with progress notification and cancellation support.
- Constructor:
XMLParseProcessor(ImportObject importObject, IImportNotification importNotification, IEnumerable<string> fileNames, Func<bool> isCancelled, bool skipNormalizing) - Properties:
UIItems: List ofIUIItemsused by the parser factory.
- Methods:
Process(): InvokesXmlParserFactory.CreateXMLParsers, executes parsing, and reports progress viaIImportNotification. Progress is calculated based on the sum of counts of various imported entities (Calibrations, Sensors, Groups, etc.).
CalibrationImport
Implements ICalibrationImport to manipulate sensor calibration data.
- Methods:
CheckForExcitationCalibration(SensorCalibration sc, ...): Adds a newCalibrationRecordif the excitation type does not match the first record.AddLinearCalRecordIfNeeded(SensorCalibration sc, ...): If only one record exists, adds a second linear record and adjustsIsProportional/RemoveOffsetflags.AddLinearZeroMethodIfNeeded(SensorCalibration sc, ...): Adds a secondZeroMethodif only one exists.
CsvUtil
Static utility class for CSV file handling.
- Methods:
CreateCsvReader(string filename): Creates aCsvReaderwrapping aStreamReaderfor the given file.