Files
DP44/enriched-qwen3-coder-next/Common/DTS.CommonCore/Interface/DataRecorders.md

410 lines
15 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/DataRecorders/IHardwareChannel.cs
- Common/DTS.CommonCore/Interface/DataRecorders/IDASDBRecord.cs
- Common/DTS.CommonCore/Interface/DataRecorders/IDASHardware.cs
- Common/DTS.CommonCore/Interface/DataRecorders/IDASChannelDBRecord.cs
generated_at: "2026-04-16T02:27:19.835700+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "bca3af738f7131f7"
---
# Documentation: Data Recorder Interfaces Module
## 1. Purpose
This module defines core interfaces for representing hardware data acquisition systems (DAS), their channels, and their database-backed metadata in the TTS (Test Tracking System) ecosystem. It serves as the foundational abstraction layer between the application logic and physical hardware or database records, enabling consistent handling of diverse hardware types (e.g., TDAS racks, G5 modules, TSRAIR devices, SLICE controllers) and their capabilities (e.g., analog sensing, squib firing, digital I/O, UART, clocks). The interfaces decouple hardware discovery, configuration, and diagnostics from implementation details, supporting both runtime hardware interaction (`IDASHardware`, `IHardwareChannel`) and persistent storage (`IDASDBRecord`, `IDASChannelDBRecord`).
## 2. Public Interface
### `IHardwareChannel`
Represents a single physical channel on a DAS device.
- **`IDiagnosticResult Diagnostics { get; }`**
Returns diagnostic results for this channel if available; `null` otherwise.
- **`bool IsSupportedBridgeType(SensorConstants.BridgeType bridgeType)`**
Returns `true` if the channel supports the specified bridge type (e.g., IEPE, quarter, half, full bridge).
- **`int ChannelNumber { get; }`**
Gets the physical channel index (0-based or 1-based depending on hardware).
- **`string GetId()`**
Returns a unique identifier string for this channel (implementation-specific format).
- **`bool IsAnalog { get; }`**
Returns `true` if the channel supports analog sensors.
- **`bool IsSquib { get; }`**
Returns `true` if the channel supports squib firing.
- **`bool IsDigitalOut { get; }`**
Returns `true` if the channel supports digital outputs.
- **`bool IsDigitalIn { get; }`**
Returns `true` if the channel supports digital inputs.
- **`bool IsUart { get; }`**
Returns `true` if the channel supports UART I/O.
- **`bool IsStreamIn { get; }`**
Returns `true` if the channel supports stream input.
- **`bool IsStreamOut { get; }`**
Returns `true` if the channel supports stream output.
- **`bool IsClock { get; }`**
Returns `true` if the channel supports real-time clock functionality.
- **`bool IsTSRAIR { get; }`**
Returns `true` if this channel belongs to a TSRAIR device.
- **`bool IsTSRAIRModule { get; }`**
Returns `true` if this channel belongs to a TSRAIR module.
- **`IDASHardware GetParentDAS()`**
Returns the parent DAS device (`IDASHardware`) this channel is part of.
- **`string ModuleSerialNumber { get; set; }`**
Gets or sets the serial number of the module this channel resides on.
- **`bool IsSupportedExcitation(ExcitationVoltageOptions.ExcitationVoltageOption excitation)`**
Returns `true` if the specified excitation voltage (e.g., 2V, 5V, 10V) is supported.
- **`bool IsG5()`**
Returns `true` if the channels module serial number starts with `"5M"`.
- **`string ToString(IDASHardware[] hardwares)`**
Returns a human-readable string representation of the channel, potentially using the provided `hardwares` array for context.
---
### `IDASDBRecord`
Represents a DAS device record in the database.
- **`int DASId { get; set; }`**
Primary key ID of the DAS record.
- **`string SerialNumber { get; set; }`**
Hardware serial number.
- **`int DASType { get; set; }`**
Numeric type identifier for the DAS (e.g., 1 = TDAS, 2 = G5).
- **`int MaxModules { get; set; }`**
Maximum number of modules supported by this DAS.
- **`long MaxMemory { get; set; }`**
Maximum storage capacity in bytes.
- **`double MaxSampleRate { get; set; }`**
Maximum supported sample rate (Hz).
- **`double MinSampleRate { get; set; }`**
Minimum supported sample rate (Hz).
- **`string FirmwareVersion { get; set; }`**
Firmware version string.
- **`DateTime CalDate { get; set; }`**
Calibration date.
- **`int ProtocolVersion { get; set; }`**
Protocol version used by the hardware.
- **`DateTime LastModified { get; set; }`**
Timestamp of last database modification.
- **`string LastModifiedBy { get; set; }`**
User who last modified the record.
- **`int Version { get; set; }`**
Record version number (for concurrency control).
- **`bool LocalOnly { get; set; }`**
Deprecated; indicates if record should remain local only.
- **`DateTime LastUsed { get; set; }`**
Timestamp of last use.
- **`string LastUsedBy { get; set; }`**
User who last used the hardware.
- **`string Connection { get; set; }`**
Connectivity status for Hardware Scan (e.g., `"Ethernet"`, `"Serial"`).
- **`int Channels { get; set; }`**
Total number of channels on this DAS.
- **`string Position { get; set; }`**
Physical location string (e.g., `"Rack A, Slot 3"`).
- **`int[] ChannelTypes { get; set; }`**
Array of channel type identifiers (e.g., `0` = analog, `1` = digital).
- **`bool IsProgrammable { get; set; }`**
Indicates if the DAS is programmable.
- **`bool IsReconfigurable { get; set; }`**
Indicates if the DAS can be reconfigured.
- **`bool IsModule { get; set; }`**
Indicates if this hardware is a standalone unit (`false`) or a rack/module (`true`).
- **`int PositionOnDistributor { get; set; }`**
Position index on a distributor bus.
- **`int PositionOnChain { get; set; }`**
Position index in a daisy-chain.
- **`int Port { get; set; }`**
Communication port number.
- **`string ParentDAS { get; set; }`**
Serial number of parent DAS (for modules).
- **`DateTime? FirstUseDate { get; set; }`**
First use date after calibration; `null` if unused since calibration or `IsFirstUseValid == false`.
- **`int? TestId { get; set; }`**
Test ID if this is stand-in hardware used only in a test.
- **`int? GroupId { get; set; }`**
Group ID if this is stand-in hardware used only in a group.
- **`bool StandIn { get; set; }`**
`true` if this is dummy/stand-in hardware (no real data collection).
- **`double MaxAAFRate { get; set; }`**
Maximum anti-aliasing filter rate (Hz).
- **`bool IsFirstUseValid { get; set; }`**
`true` if `FirstUseDate` is tracked and valid for this hardware.
---
### `IDASHardware`
Represents a live DAS hardware instance in the application (e.g., during Hardware Scan).
- **`bool IsStandIn()`**
Returns `true` if this is a stand-in (dummy) DAS.
- **`bool IsFirstUseValid { get; }`**
Returns `true` if `FirstUseDate` is tracked.
- **`DateTime? FirstUseDate { get; }`**
First use date after calibration; `null` if unused or `IsFirstUseValid == false`.
- **`bool IsPseudoRack()`**
Returns `true` if this DAS is a pseudo-rack (likely a logical grouping).
- **`int DASId { get; }`**
Database ID of the DAS.
- **`string SerialNumber { get; set; }`**
Hardware serial number.
- **`string SerialNumberFamily { get; set; }`**
Family name or prefix of the serial number.
- **`string EIDFound { get; set; }`**
EID (Electronic ID) status or value.
- **`string BatteryVoltageStatus { get; set; }`**
Battery voltage status string (e.g., `"OK"`, `"Low"`).
- **`System.Windows.Media.SolidColorBrush BatteryVoltageColor { get; set; }`**
UI color for battery status.
- **`string InputVoltageStatus { get; set; }`**
Input voltage status string.
- **`System.Windows.Media.SolidColorBrush InputVoltageColor { get; set; }`**
UI color for input voltage status.
- **`string ParentDAS { get; set; }`**
Serial number of parent DAS (for modules).
- **`string Connection { get; set; }`**
Connectivity status for Hardware Scan.
- **`IHardwareChannel[] GetIHardwareChannels()`**
Returns all channels on this DAS.
- **`bool IsSLICEEthernetController { get; }`**
Returns `true` if this DAS is a SLICE Ethernet Controller.
- **`bool IsTDASRack()`**
Returns `true` if this DAS is a TDAS rack.
- **`bool IsG5()`**
Returns `true` if this DAS is a G5 device (serial starts with `"5M"`).
- **`bool IsTSRAIR()`**
Returns `true` if this DAS is a TSRAIR device.
- **`bool IsTSRAIRModule()`**
Returns `true` if this DAS is a TSRAIR module.
- **`double GetMinSampleRateDouble()`**
Returns the minimum sample rate supported by this DAS.
- **`double GetMaxSampleRateDouble()`**
Returns the maximum sample rate supported by this DAS.
- **`bool IsModule()`**
Returns `true` if this hardware is a module (not standalone). Used to control visibility in Hardware Scan.
- **`string LastModifiedBy { get; set; }`**
User who last modified the hardware record.
- **`DateTime LastModified { get; set; }`**
Timestamp of last modification.
- **`HardwareTypes DASTypeEnum { get; set; }`**
Enumerated type of the DAS (e.g., `HardwareTypes.TDAS`, `HardwareTypes.G5`).
---
### `IDASChannelDBRecord`
Represents a channel record in the database.
- **`string HardwareId { get; set; }`**
Composite ID for the parent hardware (`serialnumber_dastype`).
- **`int DaschannelId { get; set; }`**
Primary key of the channel record.
- **`int? Dasid { get; set; }`**
Foreign key to `IDASDBRecord.DASId`.
- **`int ChannelIdx { get; set; }`**
Physical channel index on the DAS.
- **`int SupportedBridges { get; set; }`**
Bitmask of supported bridge types:
- Bit 0: IEPE
- Bit 1: Quarter bridge
- Bit 2: Half bridge
- Bit 3: Full bridge
- Bit 4: Digital input
- Bit 5: Squib fire
- Bit 6: Digital output
- Bit 7: Half bridge signal plus (G5)
- Bit 8: Real-time clock
- Bit 9: UART
- **`int SupportedExcitations { get; set; }`**
Bitmask of supported excitation voltages:
- Bit 0: Invalid/undefined
- Bit 1: 2V
- Bit 2: 2.5V
- Bit 3: 3V
- Bit 4: 5V
- Bit 5: 10V
- Bit 6: 1V
- **`int DASDisplayOrder { get; set; }`**
Logical display order (may differ from `ChannelIdx`).
- **`bool LocalOnly { get; set; }`**
Deprecated; indicates if record should remain local.
- **`int SupportedDigitalInputModes { get; set; }`**
Bitmask for digital input modes (if `SupportedBridges` includes digital input):
- Bit 0: Invalid
- Bit 1: TLH (Transition low-to-high)
- Bit 2: THL (Transition high-to-low)
- Bit 3: CCNO (Contact closure, normally open)
- Bit 4: CCNC (Contact closure, normally closed)
- **`int SupportedSquibFireModes { get; set; }`**
Bitmask for squib fire modes (if `SupportedBridges` includes squib fire):
- Bit 0: Invalid
- Bit 1: Capacitor discharge
- Bit 2: Constant current
- Bit 3: AC discharge
- **`int SupportedDigitalOutputModes { get; set; }`**
Bitmask for digital output modes (if `SupportedBridges` includes digital output):
- Bit 0: 5V low-to-high (FVLH)
- Bit 1: 5V high-to-low (FVHL)
- Bit 2: CCNO
- Bit 3: CCNC
- **`string ModuleSerialNumber { get; set; }`**
Serial number of the module this channel belongs to.
- **`int SettingId { get; set; }`**
ID of the channel configuration setting.
- **`int ModuleArrayIndex { get; set; }`**
Index of the module among modules on the DAS.
---
## 3. Invariants
- **Channel Type Consistency**:
For `IHardwareChannel`, the boolean flags (`IsAnalog`, `IsSquib`, etc.) must be mutually consistent with `IsSupportedBridgeType()` results. For example, if `IsSquib == true`, then `IsSupportedBridgeType(SensorConstants.BridgeType.Squib)` must return `true`.
- **Excitation Support Consistency**:
`IsSupportedExcitation()` must align with the `SupportedExcitations` bitmask in `IDASChannelDBRecord`. For instance, if `SupportedExcitations` has bit 4 (5V) set, then `IsSupportedExcitation(ExcitationVoltageOptions.ExcitationVoltageOption.V5)` must return `true`.
- **Bridge Type Bitmask Semantics**:
`SupportedBridges` in `IDASChannelDBRecord` and `IsSupportedBridgeType()` in `IHardwareChannel` must use the same bridge type definitions (`SensorConstants.BridgeType` enum).
- **G5 Detection Consistency**:
`IsG5()` in `IHardwareChannel` and `IDASHardware` both check for serial number prefix `"5M"`; this behavior must be consistent across implementations.
- **First Use Date Validity**:
`FirstUseDate` is only meaningful if `IsFirstUseValid == true`. If `IsFirstUseValid == false`, `FirstUseDate` must be `null`.
- **Module Hierarchy**:
`IDASHardware.IsModule()` and `IDASDBRecord.IsModule` must agree on whether the hardware is a module. `IDASHardware.ParentDAS` and `IDASDBRecord.ParentDAS` must refer to the same parent.
- **Channel Indexing**:
`ChannelIdx` in `IDASChannelDBRecord` and `ChannelNumber` in `IHardwareChannel` refer to the same physical channel index on the hardware.
---
## 4. Dependencies
### This Module Depends On:
- **`DTS.Common.Enums`**
- `SensorConstants.BridgeType` (for `IsSupportedBridgeType`)
- `ExcitationVoltageOptions.ExcitationVoltageOption` (for `IsSupportedExcitation`)
- `HardwareTypes` (for `IDASHardware.DASTypeEnum`)
- **`DTS.Common.Interface.DASFactory.Diagnostics`**
- `IDiagnosticResult` (for `IHardwareChannel.Diagnostics`)
- **`System`**
- `DateTime`, `Array`, `Attribute` classes (`[Key]`, `[Column]`)
- **`System.ComponentModel.DataAnnotations`**
- `[Key]`, `[Column]` attributes for `IDASChannelDBRecord`
- **`System.Windows.Media`**
- `SolidColorBrush` (for `IDASHardware` battery/input voltage colors)
### This Module Is Used By:
- **Hardware discovery/scanning logic** (e.g., `IDASHardware`, `IHardwareChannel`)
- **Database persistence layers** (e.g., `IDASDBRecord`, `IDASChannelDBRecord`)
- **Configuration and setup UIs** (e.g., `DASDisplayOrder`, `Connection`, `Position`)
- **Diagnostics and validation tools** (e.g., `Diagnostics`, `IsFirstUseValid`, `FirstUseDate`)
- **Test setup and channel mapping logic** (e.g., `ChannelIdx`, `ModuleArrayIndex`, `SettingId`)
---
## 5. Gotchas
- **`LocalOnly` is deprecated**:
Both `IDASDBRecord` and `IDASChannelDBRecord` include `LocalOnly`, but the documentation explicitly states it is deprecated. Do not rely on this property for new logic.
- **`DASDisplayOrder` may differ from `ChannelIdx`**:
The documentation warns that display order and physical channel order may not match for some hardware (e.g., channel interleaving). Always use `DASDisplayOrder` for UI ordering.
- **`IsModule()` semantics differ between `IDASHardware` and `IDASDBRecord`**:
In `IDASHardware`, `IsModule()` controls visibility in Hardware Scan (e.g., hides Slice bridges). In `IDASDBRecord`, `IsModule` indicates whether the hardware is a module vs