Files
DP44/docs/ai/DataPRO/IService/Classes/Diagnostics.md
2026-04-17 14:55:32 -04:00

119 lines
5.7 KiB
Markdown

---
source_files:
- DataPRO/IService/Classes/Diagnostics/OptimizationValues.cs
- DataPRO/IService/Classes/Diagnostics/DiagnosticActions.cs
- DataPRO/IService/Classes/Diagnostics/DiagnosticsResultActions.cs
- DataPRO/IService/Classes/Diagnostics/DiagnosticsResult.cs
generated_at: "2026-04-17T15:38:51.449636+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "34ce6d811e6f9b1a"
---
# Diagnostics Module Documentation
## 1. Purpose
This module provides data structures and operations for managing diagnostic tests and results for Data Acquisition System (DAS) channels. It enables pre-recording validation of sensor configurations by measuring excitation voltages, offsets, noise floors, shunt deflections, bridge resistance, and squib firing characteristics. The module bridges in-memory diagnostic state with persistent database storage, supporting analog input channels, digital input channels, and output squib channels.
---
## 2. Public Interface
### `OptimizationValues` (Class)
**Namespace:** `DTS.DASLib.Service.Classes.Diagnostics`
**Implements:** `IOptimizationValues`
| Property | Type | Description |
|----------|------|-------------|
| `TransferSpeed` | `float` | Gets or sets the transfer speed value. |
---
### `DiagnosticsActions` (Class)
**Namespace:** `DTS.DASLib.Service`
**Implements:** `IDiagnosticActions`
Holds instructions for diagnosing a single DAS channel.
#### Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `DASChannelNumber` | `int` | `0` | The DAS channel number for these diagnostic instructions. |
| `MeasureExcitation` | `bool` | `false` | Whether to measure excitation voltage applied to the sensor. |
| `MeasureOffset` | `bool` | `false` | Whether to measure the sensor's offset from zero. |
| `CheckDigitalState` | `bool` | `false` | Whether to check open/closed/low/high state of a digital input channel. |
| `MeasureInternalOffset` | `bool` | `false` | Whether to measure internal offset. |
| `RemoveOffset` | `bool` | `false` | Whether firmware should compensate for sensor offset. |
| `MeasureNoise` | `bool` | `false` | Whether to measure noise floor as percentage of full scale. |
| `PerformShuntCheck` | `bool` | `false` | Whether to perform an emulated shunt check. |
| `SquibFireCheck` | `bool` | `false` | Whether to run a squib fire check on the channel. |
| `PerformVoltageInsertCheck` | `bool` | `false` | Whether to perform a voltage insertion gain check (SLICE Pro). |
| `PerformCalSignalCheck` | `bool` | `false` | Whether to perform a calibration signal check. |
| `MeasureBridgeResistance` | `bool` | `false` | Whether to measure the resistance of the bridge. |
#### Methods
```csharp
public DiagnosticsActions()
```
Initializes a new instance with all diagnostic actions disabled and `DASChannelNumber` set to 0.
```csharp
public bool AllActionsDisabled()
```
Returns `true` if all diagnostic actions are disabled; otherwise `false`.
```csharp
public static void SetChannelDiagnosticActions(IDASCommunication unit, IDiagnosticActions[] actions, bool setInDb)
```
Assigns the diagnostic actions array to `unit.ChannelDiagnostics`. If `setInDb` is `true` and the database is connected, clears all existing diagnostic actions for the unit and inserts the new actions into the database.
---
### `DiagnosticsResultActions` (Static Class)
**Namespace:** `DTS.DASLib.Service.Classes.Diagnostics`
Provides static methods for managing diagnostic results on DAS units.
#### Methods
```csharp
public static void ClearChannelDiagnosticsResults(IDASCommunication unit, bool bClearDb = true)
```
Clears `unit.ChannelDiagnosticsResults` and `unit.ChannelDiagnostics` by initializing them to empty arrays. If `bClearDb` is `true` and the database is connected, clears existing diagnostics from the database for the unit.
```csharp
public static void SetChannelDiagnosticsResults(IDASCommunication unit, IDiagnosticResult[] results, bool setInDb)
```
Assigns `results` to `unit.ChannelDiagnosticsResults`. If `setInDb` is `true` and the database is connected, iterates through results and inserts them into the database based on channel type:
- `AnalogInputDASChannel` with `DigitalInputChannel == true``InsertDiagnosticsResultDigital`
- `AnalogInputDASChannel` with `DigitalInputChannel == false``InsertDiagnosticsResultAnalog`
- `OutputSquibChannel``InsertDiagnosticsResultsSquib`
---
### `DiagnosticsResult` (Class)
**Namespace:** `DTS.DASLib.Service`
**Implements:** `IDiagnosticResult`
Holds diagnostic results for a single DAS channel.
#### Key Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `DASChannelNumber` | `int` | — | The channel number from which diagnostics are returned. |
| `EventNumber` | `int` | — | The event number this diagnostic is relevant for. |
| `ScalefactorMilliVoltsPerADC` | `double` | `1` | Scale factor to convert raw ADC values to millivolts. |
| `ScalefactorEngineeringUnitsPerADC` | `double` | `1` | Scale factor to convert ADC values to engineering units. |
| `ExpectedExcitationMilliVolts` | `double` | — | Factory excitation value (mandatory). |
| `MeasuredExcitationMilliVolts` | `double?` | — | Measured excitation voltage in mV. |
| `NegativeExcitation` | `bool` | — | Flag indicating if measured excitation was negative. |
| `MeasuredOffsetMilliVolts` | `double?` | — | Sensor offset from zero in mV. |
| `MeasuredInternalOffsetMilliVolts` | `double?` | — | Measured internal offset in mV. |
| `AutoZeroPercentDeviation` | `double?` | — | Deviation from zero during auto-zero (stored as absolute value). |
| `FinalOffsetADC` | `short?` | — | Offset remaining after offset removal. |
| `RemovedOffsetADC` | `int?` | — | Amount of offset removed. |
| `RemovedInternalOffsetADC