6.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T15:59:59.064474+00:00 | zai-org/GLM-5-FP8 | 1 | 163b7877035d65a4 |
TDMCSVImport Documentation
1. Purpose
TDMCSVImport is a parser that converts TDM (Test Data Management) CSV sensor configuration files into DTS.SensorDB.SensorData objects. It handles the mapping between CSV column labels and internal system enums, performs data validation, applies default values for missing/invalid fields, and transforms measurement types, filter settings, and calibration parameters into the system's sensor data model. The class exists to support legacy TDM CSV file formats in the sensor database import workflow.
2. Public Interface
Enum: TDMCSVImport.TAGS
Defines all recognized CSV column identifiers used in TDM sensor import files.
Values:
SENSOR_CSV_LABEL_SERIAL_NO,SENSOR_CSV_LABEL_COMMENT,SENSOR_CSV_LABEL_EID,SENSOR_CSV_LABEL_CALDATE,SENSOR_CSV_LABEL_MANUFACTURER,SENSOR_CSV_LABEL_SENSOR_TYPE,SENSOR_CSV_LABEL_UNITS,SENSOR_CSV_LABEL_CAPACITY_EU,SENSOR_CSV_LABEL_MEASUREMENT_TYPE,SENSOR_CSV_LABEL_EXCITATION_VOLTS,SENSOR_CSV_LABEL_SENSITIVITY,SENSOR_CSV_LABEL_SENSITIVITY_UNITS,SENSOR_CSV_LABEL_INVERT,SENSOR_CSV_LABEL_USE_SHUNT_CAL,SENSOR_CSV_LABEL_BRIDGE_RESISTANCE_OHMS,SENSOR_CSV_LABEL_ZMO_MV,SENSOR_CSV_LABEL_ZMO_UPDATE_MV,SENSOR_CSV_LABEL_ZMO_TOLERANCE_MV,SENSOR_CSV_LABEL_REMOVE_ZMO_OFFSET,SENSOR_CSV_LABEL_TEST_DEVICE,SENSOR_CSV_LABEL_TEST_DEVICE_TYPE,SENSOR_CSV_LABEL_CODE,SENSOR_CSV_LABEL_JCODE,SENSOR_CSV_LABEL_FILTER_TYPE,SENSOR_CSV_LABEL_FILTER_FREQUENCY,SENSOR_CSV_LABEL_RANGE_0,SENSOR_CSV_LABEL_RANGE_1,SENSOR_CSV_LABEL_RANGE_2,SENSOR_CSV_LABEL_RANGE_3,SENSOR_CSV_LABEL_TOYOTA_CALC_1,SENSOR_CSV_LABEL_TOYOTA_CALC_2,SENSOR_CSV_LABEL_TOYOTA_CALC_3,SENSOR_CSV_LABEL_ZERO_METHOD,SENSOR_CSV_LABEL_ZERO_INITIAL_EU,SENSOR_CSV_LABEL_ZERO_TIME_START_MSEC,SENSOR_CSV_LABEL_ZERO_TIME_END_MSEC,SENSOR_CSV_LABEL_FLAGS,UNKNOWN
Method: LabelToTag
public static TAGS LabelToTag(string label)
Converts a CSV column header string to its corresponding TAGS enum value. Throws NotSupportedException for unrecognized labels.
Method: GetSensor
public static DTS.SensorDB.SensorData GetSensor(
string[] tokens,
TAGS[] tagOrder,
ref List<string> errors,
Dictionary<string, string> sensorTypeToDimension)
Parses a single CSV row into a SensorData object.
Parameters:
tokens- Array of string values from a single CSV rowtagOrder- Array ofTAGSindicating which column each token corresponds to (must be parallel totokens)errors- Reference to a list that will collect parsing error/warning messagessensorTypeToDimension- Dictionary mapping sensor type strings to physical dimension strings
Returns: A populated SensorData object with Calibration initialized.
Behavior:
- Iterates through tokens in parallel with
tagOrder - Strips leading
=and surrounding"characters from token values - Parses each field according to its tag type
- Applies default values for missing/invalid capacity (defaults to 1) and units (defaults to "g")
- Sets
UUIDto the serial number value
3. Invariants
-
Parallel Array Assumption:
tokensandtagOrderarrays must have corresponding indices; iteration stops at the shorter length (i < tokens.Length && i < tagOrder.Length). -
Invariant Culture Parsing: All numeric parsing uses
CultureInfo.InvariantCultureexcept forSENSOR_CSV_LABEL_SENSITIVITYwhich uses current culture. -
Calibration Initialization: The returned
SensorDataalways hassd.Calibrationinitialized to a newSensorCalibrationinstance. -
UUID Assignment:
sd.UUIDis always set equal tosd.SerialNumberat the end of parsing. -
Minimum Capacity: If
Capacity < 1, it is forced to1with an error message added. -
Default Display Unit: If
DisplayUnitis null or whitespace, it defaults to"g"with an error message added. -
Excitation Voltage Default: An excitation voltage of
0is treated as5.0(for "Voltage Insertion" mode).
4. Dependencies
This Module Depends On:
DTS.Common.Classes.Sensors- ProvidesSensorConstantsDTS.Common.DAS.Concepts- ProvidesExcitationVoltageOptions,FilterClass,FilterClassType,NonLinearStyles,InitialOffsets,InitialOffsetDTS.Common.Enums- ProvidesShuntModeDTS.Common.Enums.Sensors- ProvidesZeroMethodTypeDTS.SensorDB- ProvidesSensorData,SensorCalibrationSystem.Data.SqlTypes- Used forSqlDateTime.MinValueas fallback date
What Depends On This Module:
- Unclear from source alone - No direct consumers are visible in this file.
5. Gotchas
-
Misleading Class Name/Comment: The class is named
TDMCSVImportbut the XML doc comment states it "handles logic of TDM CSV export" — this appears to be a documentation error. -
FIR100 Filter Not Supported:
FILTERTYPE_FIR100is converted toFilterClassType.CFC180with an error message added; the comment notes "FIR100 not supported by SLICE code currently?" -
Unused Fields: Several fields are parsed but not utilized:
SENSOR_CSV_LABEL_ZMO_MV- Parsed but no action takenSENSOR_CSV_LABEL_ZMO_UPDATE_MV- Parsed but no action takenSENSOR_CSV_LABEL_TEST_DEVICE- Marked "not currently used"SENSOR_CSV_LABEL_TEST_DEVICE_TYPE- Marked "not currently used"SENSOR_CSV_LABEL_RANGE_3- Case body is commented out entirely
-
Inconsistent Date Parsing: Dates with
/separator expectMM/DD/YYYYformat, while dates with-separator expectYYYY-MM-DDformat. Double-slash//is replaced with single/. -
Sensitivity Parsing Inconsistency:
SENSOR_CSV_LABEL_SENSITIVITYusesdouble.TryParse(sItem.Trim(), out d)without specifyingNumberStylesorCultureInfo, unlike all other numeric fields which useInvariantCulture. -
Quarter Bridge Not Supported: The XML comment notes "the existing TDM code doesn't appear to consider 1/4 bridge."
-
Toyota Calc Values:
calc1,calc2,calc3are concatenated intoUserValue3using the invariant culture's list separator, but the purpose is unclear from this file alone. -
IRTRACC Special Handling:
MEASTYPE_IRTRACCtriggers special calibration setup includingNonLinear = trueand specific polynomial coefficients (LinearizationExponent = -75D / 175D,MMPerV = 1000D / dSensitivity), and sets sensitivity to 0.