Files
2026-04-17 14:55:32 -04:00

281 lines
16 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
source_files:
- Common/DTS.Common/Interface/DASFactory/Diagnostics/ITriggerCheck.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IOptimizationValues.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/ITCDiagnosticResults.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/ICanDiagnosticResults.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IDiagnosticMessagesDevice.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/ICanDiagnosticResult.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IArmCheckActions.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IModuleDiagnosticsResult.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/ITriggerCheckResult.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/ITCDiagnosticResult.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IArmCheckResults.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IDiagnos.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IDiagnosticActions.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IBaseInputValues.cs
- Common/DTS.Common/Interface/DASFactory/Diagnostics/IDiagnosticResult.cs
generated_at: "2026-04-16T03:11:30.898849+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "fef2c76ac2e14d1b"
---
# Diagnostic Interfaces Module Documentation
## 1. Purpose
This module defines a set of interfaces that collectively support diagnostics for the DAS (Data Acquisition System) factory environment. It provides structured contracts for capturing, storing, and managing diagnostic results across multiple subsystems—including analog channels, CAN bus, trigger logic, arm checks, and module-level diagnostics—while also supporting configuration of diagnostic actions and optimization parameters. The interfaces serve as a contract layer between diagnostic execution logic (likely in `DTS.DASLib.Service.DiagnosticsService`) and higher-level UI or orchestration components, enabling consistent data exchange for health monitoring, validation, and reporting.
## 2. Public Interface
### Interfaces
- **`ITriggerCheck`**
- `ITriggerCheckResult TriggerResult { get; set; }`
Gets or sets the result of the trigger check, encapsulating trigger and start-record line status.
- **`IOptimizationValues`**
- `float TransferSpeed { get; set; }`
Stores the current data transfer speed used for real-time optimization.
- **`ITCDiagnosticResults`**
- `ITCDiagnosticResult[] TCDiagnosticResults { get; }`
Gets the array of thermocouple diagnostic results.
- `void ClearTCDiagnosticResults()`
Clears the stored thermocouple diagnostic results.
- `void SetTCDiagnosticResults(ITCDiagnosticResult[] results)`
Sets the thermocouple diagnostic results.
- **`ICanDiagnosticResults`**
- `ICanDiagnosticResult[] CanDiagnosticResults { get; }`
Gets the array of CAN bus diagnostic results.
- `void ClearCanDiagnosticResults()`
Clears the stored CAN diagnostic results.
- `void SetDiagnosticResults(ICanDiagnosticResult[] results)`
Sets the CAN diagnostic results (note: method name mismatch with property name—uses `SetDiagnosticResults` instead of `SetCanDiagnosticResults`).
- **`IDiagnosticMessagesDevice`**
- `string[] GetFatalErrorFields()`
Returns an array of field names associated with fatal errors.
- `DiagnosticMessageRow[] GetCurrentDiagnosticMessages(string[] fields, bool failingOnly)`
Retrieves current diagnostic messages for specified fields; `failingOnly` filters to only failing messages.
- **`ICanDiagnosticResult`**
- `string ChannelName { get; set; }`, `int ChannelIndex { get; set; }`, `int Data { get; set; }`, `int ErrorFrame { get; set; }`, `double Load { get; set; }`, `int Overruns { get; set; }`, `DateTime LastUpdate { get; set; }`, `bool Active { get; set; }`
Properties describing CAN channel diagnostic state.
- `void Copy(ICanDiagnosticResult source)`
Copies diagnostic data from another `ICanDiagnosticResult`.
- **`IArmCheckActions`**
- Boolean properties indicating which arm checks should be performed:
`PerformBatteryVoltageCheck`, `PerformInputVoltageCheck`, `PerformSensorIdCheck`, `PerformEventLineCheck`, `PerformSquibResistanceCheck`, `PerformTiltSensorCheck`, `PerformTemperatureCheck`, `PerformClockSyncCheck`.
- **`IModuleDiagnosticsResult`**
- Properties for pre- and post-temperature readings at four locations (`TemperatureLocation{14}{Pre,Post}`), all `float`.
- **`ITriggerCheckResult`**
- `bool IsStatusGood { get; set; }`
Overall DAS status.
- `bool IsStartRecordActive { get; set; }`
Whether the start record line is currently active.
- `bool HasStartRecordBeenActive { get; set; }`
Whether the start record line was active *after arming*.
- `bool IsTriggered { get; set; }`
Whether the trigger line is currently active.
- `bool HasTriggered { get; set; }`
Whether the trigger line was active *after arming*.
- **`ITCDiagnosticResult`**
- `string ChannelName { get; set; }`, `int ChannelIndex { get; set; }`, `double? CurrentReading { get; set; }`
Thermocouple channel identification and current reading.
- `DiagnosticStatus Status { get; set; }`
Diagnostic status (type not defined in this file; assumed external).
- `ConnectionStatuses ConnectionStatus { get; set; }`
Connection status (enum defined in this file).
- `void Copy(ITCDiagnosticResult source)`
Copies data from another `ITCDiagnosticResult`.
- **`IArmCheckResults`**
- `Dictionary<int, string[]> SensorIds { get; set; }`
Maps module/channel IDs to sensor ID strings.
- `Dictionary<int, double> SquibResistances { get; set; }`
Squib resistance values per module/channel.
- `double?[] BatteryVoltage { get; set; }`
Battery voltage per module (nullable, supports multi-battery systems like TDAS Pro rack).
- `double? InputVoltage { get; set; }`, `bool? StartLineShorted { get; set; }`, `bool? EventLineShorted { get; set; }`
Input voltage and line short status.
- `short[] TiltSensorDataPre { get; set; }`, `double[] TiltDegrees { get; set; }`
Pre-processed tilt sensor data and converted degrees.
- `Dictionary<byte, short[]> IndexedTiltSensorDataPre { get; set; }`, `Dictionary<byte, double[]> IndexedTiltDegrees { get; set; }`
Indexed tilt data (by module ID?).
- `float[] TemperaturesPre { get; set; }`
Pre-processed temperature readings.
- `double[] Gains { get; set; }`, `double[] ZeroData { get; set; }`
Gain and zero calibration data.
- `IDictionary<InputClockSource, bool> InputClockLocks { get; set; }`
Clock lock status per input clock source.
- **`IDiagnos`**
- `IDiagnosticActions[] ChannelDiagnostics { get; set; }`
Diagnostic action configurations per channel.
- `void SetChannelDiagnosticActions(IDiagnosticActions[] actions, bool setInDb = true)`
Sets diagnostic actions, optionally persisting to DB.
- `IDiagnosticResult[] ChannelDiagnosticsResults { get; set; }`
Diagnostic results per channel.
- `void ClearChannelDiagnosticsResults(bool bClearDb = true)`
Clears diagnostic results, optionally from DB.
- `void SetChannelDiagnosticsResults(IDiagnosticResult[] results, bool setInDb)`
Sets diagnostic results, optionally persisting to DB.
- `IModuleDiagnosticsResult[] ModuleDiagnosticsResults { get; set; }`
Per-module diagnostic results.
- `IBaseInputValues BaseInput { get; set; }`
Base input power and voltage diagnostics.
- `IDictionary<InputClockSource, bool> DASClockSyncStatus { get; set; }`
Clock sync status per source.
- `bool ClockSyncInUTC { get; set; }`, `byte PTPDomainID { get; set; }`
Clock sync mode and PTP domain ID.
- `IArmCheckActions ArmCheckActions { get; set; }`, `IArmCheckResults ArmCheckResults { get; set; }`
Arm check configuration and results.
- `IOptimizationValues OptimizationValues { get; set; }`
Optimization settings (e.g., transfer speed).
- **`IDiagnosticActions`**
- `int DASChannelNumber { get; set; }`
Target DAS channel number.
- Boolean flags indicating which diagnostic actions to perform:
`MeasureExcitation`, `MeasureOffset`, `CheckDigitalState`, `MeasureInternalOffset`, `RemoveOffset`, `MeasureNoise`, `PerformShuntCheck`, `SquibFireCheck`, `PerformVoltageInsertCheck`, `PerformCalSignalCheck`, `MeasureBridgeResistance`.
- `bool AllActionsDisabled()`
Returns `true` if all diagnostic actions are disabled.
- **`IBaseInputValues`**
- `double InputMilliVolts { get; set; }`, `bool InputMilliVoltsValid { get; }`
Current input voltage in mV and validity flag.
- `double InputVoltage { get; set; }`, `double MinimumValidInputVoltage { get; set; }`, `double MaximumValidInputVoltage { get; set; }`
Input voltage and valid range.
- `double BatteryMilliVolts { get; set; }`, `bool BatteryMilliVoltsValid { get; }`, `double BatteryVoltage { get; set; }`
Battery voltage metrics.
- `double? BatterySoC { get; set; }`
Battery state of charge (percentage; `null` if not queried, `0` if unavailable).
- `double MinimumValidBatteryVoltage { get; set; }`, `double MaximumValidBatteryVoltage { get; set; }`
Valid battery voltage range.
- `bool BatteryIsCharging { get; set; }`
Charging status.
- `double TemperatureC { get; set; }`
Hardware-logged temperature in °C.
- Status strings: `BatteryVoltageStatus`, `InputVoltageStatus`, `StatusDisplayBattery`, `StatusDisplayInput`.
- Status colors: `BatteryVoltageStatusColor`, `InputVoltageStatusColor` (enum from `DFConstantsAndEnums`).
- `double ChargeCapacity { get; set; }`, `bool ChargeCapacityValid { get; }`
Battery charge capacity and validity.
- **`IDiagnosticResult`**
- `int DASChannelNumber { get; set; }`, `int EventNumber { get; set; }`
Channel and event context.
- Scaling factors: `double ScalefactorMilliVoltsPerADC { get; set; }`, `double ScalefactorEngineeringUnitsPerADC { get; set; }`.
- `double ExpectedExcitationMilliVolts { get; set; }`
Factory excitation value.
- `short GetExpectedDataZeroLevelADC(ZeroMethodType zeroMethod)`
Returns expected zero-level ADC for a given zeroing method.
- Measured values (nullable):
`MeasuredExcitationMilliVolts`, `NegativeExcitation`, `MeasuredOffsetMilliVolts`, `MeasuredInternalOffsetMilliVolts`, `MeasuredOffsetEngineeringUnits`, `AutoZeroPercentDeviation`, `FinalOffsetADC`, `RemovedOffsetADC`, `RemovedInternalOffsetADC`, `NoisePercentFullScale`, `MeasuredShuntDeflectionMv`, `MeasuredCalSignalMv`, `TargetCalSignalMv`, `MeasuredDurationMS`, `MeasuredDelayMS`, `TargetGain`, `MeasuredGain`, `QueriedGain`, `TargetShuntDeflectionMv`, `BridgeResistance`.
- `bool ShuntDeflectionFailed { get; set; }`, `bool CalSignalCheckFailed { get; set; }`
Boolean flags for test outcomes.
- `bool? SquibFirePassed`, `bool? SquibDurationPassed`, `bool? SquibDelayPassed`
Squib fire test results.
- `double[] SquibFireCurrentData`, `double[] SquibFireVoltageData`, `double[] SquibFireTimeAxis`
Raw squib fire test waveforms.
- `double SquibThreshold { get; set; }`, `double SquibVoltageScaler { get; set; }`, `double SquibCurrentScaler { get; set; }`
Squib test configuration and scaling.
- `short ZeroMVInADC { get; set; }`, `short WindowAverageADC { get; set; }`
Zero-level and window-averaged ADC values.
- `bool DigitalInputActiveState { get; set; }`
Digital input active state.
### Enumerations
- **`ConnectionStatuses`** (in `ITCDiagnosticResult.cs`)
- `NotTested`, `Connected`, `NotConnected`, `ModuleNotConnected`
Status values for sensor/module connection state.
- Annoted with `[Description(...)]` attributes for localization.
## 3. Invariants
- **`ITriggerCheckResult`**:
- `HasStartRecordBeenActive` and `HasTriggered` are *cumulative* since arming (not just current state).
- `IsStatusGood` reflects overall DAS health; its relationship to other flags is not defined but likely implies all checks passed.
- **`IDiagnosticResult`**:
- `ScalefactorMilliVoltsPerADC` and `ScalefactorEngineeringUnitsPerADC` are *mandatory* for scaling downloaded samples; must not be ignored.
- `WindowAverageADC == short.MinValue` indicates uninitialized/invalid data.
- Measured values (`Measured*`) may be `null` (or `0.0` interpreted as `null`) if not measured—consumers must check nullability.
- **`IBaseInputValues`**:
- `BatterySoC == 0` is valid (unavailable), but `null` means not queried.
- Voltage status strings and colors are derived from voltage values and ranges.
- **`IArmCheckResults`**:
- `BatteryVoltage` is an array to support multi-battery modules (e.g., TDAS Pro rack).
- Tilt sensor data is provided both as flat arrays and indexed dictionaries (likely per module).
- **`IDiagnos`**:
- `ChannelDiagnostics` and `ChannelDiagnosticsResults` must be aligned by index (i.e., `ChannelDiagnostics[i]` corresponds to `ChannelDiagnosticsResults[i]`).
- `OptimizationValues.TransferSpeed` is used for real-time optimization (per comment in `IDiagnos`).
## 4. Dependencies
### In this module:
- **`DTS.Common.Classes.DASFactory`** (via `IDiagnosticMessagesDevice.cs`)
Provides `DiagnosticMessageRow` type.
- **`DTS.Common.Converters`** (via `ITCDiagnosticResult.cs`)
Provides `EnumDescriptionTypeConverter` for `ConnectionStatuses`.
- **`DTS.Common.Enums.Sensors`** (via `IDiagnosticResult.cs`)
Provides `ZeroMethodType` (used in `GetExpectedDataZeroLevelADC`).
- **`DTS.Common.Enums.DASFactory`** (via `IBaseInputValues.cs`)
Provides `InputClockSource` and `DFConstantsAndEnums.VoltageStatusColor`.
### Inferred external dependencies:
- **`DTS.DASLib.Service.DiagnosticsService`**
Referenced in `IDiagnosticResult` XML comments for `Calibrate` method and `DiagnosticsActions` class.
- **`AnalogInputDasChannel`**
Referenced in `IDiagnosticResult` XML comments for offset limits.
- **`DiagnosticsActions`**
Referenced in `IDiagnosticResult` XML comments for `PerformShuntCheck`.
## 5. Gotchas
- **Method name mismatch in `ICanDiagnosticResults`**:
The interface defines `SetDiagnosticResults(ICanDiagnosticResult[] results)` instead of `SetCanDiagnosticResults`, which is inconsistent with the naming pattern of `ClearCanDiagnosticResults()` and the property `CanDiagnosticResults`.
- **Ambiguous null semantics**:
Multiple `double?` and `short?` properties in `IDiagnosticResult` and `IBaseInputValues` use `0.0` or `0` as a sentinel for "not measured" (e.g., `MeasuredExcitationMilliVolts`, `MeasuredOffsetMilliVolts`). Consumers must distinguish between actual zero values and null via explicit null checks or validity flags (e.g., `InputMilliVoltsValid`, `BatteryMilliVoltsValid`).
- **`NegativeExcitation` flag**:
Added to preserve legacy behavior for negative excitation reporting (see comment referencing issue #14233). This is a workaround for hardware quirks and should be preserved for backward compatibility.
- **`WindowAverageADC` sentinel value**:
`short.MinValue` indicates uninitialized/invalid data—consumers must check for this explicitly.
- **`IArmCheckResults.BatteryVoltage` is nullable array**:
`double?[]` implies per-module voltages, but null entries may occur if a module is absent or unmeasured.
- **`IDiagnos.SetChannelDiagnosticActions` and `SetChannelDiagnosticsResults`**:
Default `setInDb`/`bClearDb` parameters suggest optional persistence, but behavior when `false` is not specified (e.g., in-memory only?).
- **`ITCDiagnosticResult.ConnectionStatus` enum uses `[Description]` attributes**:
Consumers expecting localized strings must use the `EnumDescriptionTypeConverter` or equivalent to resolve descriptions.
- **No validation rules defined**:
Interfaces do not enforce constraints (e.g., `DASChannelNumber` range, `TransferSpeed` bounds). Validation is likely handled elsewhere.
- **Missing type definitions**:
Types like `DiagnosticStatus`, `DiagnosticMessageRow`, `ZeroMethodType`, `InputClockSource`, and `DFConstantsAndEnums.VoltageStatusColor` are referenced but not defined in this module—consumers must locate them in referenced assemblies.
- **`IDiagnosticResult` has many squib-related fields**:
Includes waveform arrays (`SquibFireCurrentData`, etc.) and flags—suggests a complex squib test implementation. Ensure consumers handle potentially large arrays appropriately.
None identified beyond the above.