189 lines
16 KiB
Markdown
189 lines
16 KiB
Markdown
|
|
---
|
|||
|
|
source_files:
|
|||
|
|
- DataPRO/IService/Classes/Channels/OutputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/AnalogOutputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/DigitalOutputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/InputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/AnalogInputDASChannelComparer.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/TimestampDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/StreamInputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/OutputTOMDigitalChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/CANInputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/UARTInputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/StreamOutputDASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/DASChannel.cs
|
|||
|
|
- DataPRO/IService/Classes/Channels/OutputSquibChannel.cs
|
|||
|
|
generated_at: "2026-04-16T04:00:36.696222+00:00"
|
|||
|
|
model: "Qwen/Qwen3-Coder-Next-FP8"
|
|||
|
|
schema_version: 1
|
|||
|
|
sha256: "3f93d07c4af5eba3"
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# DAS Channel Classes Documentation
|
|||
|
|
|
|||
|
|
## 1. Purpose
|
|||
|
|
|
|||
|
|
This module defines the class hierarchy for Data Acquisition System (DAS) channels, providing base and specialized classes for input and output channels used in the DTS DASLib.Service namespace. The classes model physical and logical channels in a DAS, supporting analog, digital, timestamp, CAN, UART, and streaming configurations. The hierarchy enables consistent channel management, serialization, and configuration across the system, with `DASChannel` as the root base class, `InputDASChannel` and `OutputDASChannel` as primary abstractions for directionality, and further derived classes for specific channel types (e.g., `AnalogInputDASChannel`, `CANInputDASChannel`, `OutputSquibChannel`). The module supports XML serialization for persistence and configuration, and includes validation logic via `IsConfigured()` overrides.
|
|||
|
|
|
|||
|
|
## 2. Public Interface
|
|||
|
|
|
|||
|
|
### Base Classes
|
|||
|
|
|
|||
|
|
- **`DASChannel`**
|
|||
|
|
Abstract base class for all DAS channels. Implements `IXmlSerializable`.
|
|||
|
|
- `DASChannel(DASModule owner, int channelNumber)` – Constructor with owner module and channel number.
|
|||
|
|
- `DASChannel()` – Parameterless constructor.
|
|||
|
|
- `virtual bool IsConfigured()` – Returns `false` by default; overridden in derived classes to indicate configuration state.
|
|||
|
|
- `virtual void WriteXml(XmlWriter writer)` / `ReadXml(XmlReader reader)` – XML serialization/deserialization.
|
|||
|
|
- `virtual void WriteXmlCRC32(XmlWriter writer)` – CRC32-specific serialization (subset of `WriteXml`).
|
|||
|
|
- `virtual void HandleElement(XmlReader reader)` – Handles XML element parsing; can be overridden.
|
|||
|
|
- `bool CanReProgram()` – Returns `true` if the channel’s module supports reprogramming (IEPE/analog switching).
|
|||
|
|
- `int Number { get; }` – Stack channel number (0-based) relative to the DAS, computed via `OwningModule.OwningDAS.DASInfo.MapModuleArrayIndexAndChannelNum2DASChannel(...)`.
|
|||
|
|
- Key properties: `ModuleChannelNumber`, `AbsoluteDisplayOrder`, `OwningModule`, `UnitConverision`, `ConfigurationMode`, `DiagnosticsMode`, `IsoChannelName`, `UserCode`, `UserChannelName`, `SetupEID`, `DataCollectionEID`, `SensitivityUnits`, `AtCapacity`, `CapacityOutputIsBasedOn`, `QualificationSamples`, `LevelTriggerT0AdjustmentSamples`, `UserValue1/2/3`, `IdType`.
|
|||
|
|
|
|||
|
|
- **`InputDASChannel : DASChannel`**
|
|||
|
|
Base class for all input channels.
|
|||
|
|
- `InputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `InputDASChannel()` – Parameterless constructor.
|
|||
|
|
|
|||
|
|
- **`OutputDASChannel : DASChannel`**
|
|||
|
|
Base class for all output channels.
|
|||
|
|
- `OutputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `OutputDASChannel()` – Parameterless constructor.
|
|||
|
|
|
|||
|
|
### Derived Input Channel Classes
|
|||
|
|
|
|||
|
|
- **`AnalogInputDASChannel`** *(not shown in source)*
|
|||
|
|
Not present in provided files; assumed to exist as base for analog inputs (e.g., used by `AnalogInputDASChannelComparer`).
|
|||
|
|
|
|||
|
|
- **`AnalogInputDASChannelComparer : IEqualityComparer<AnalogInputDASChannel>`**
|
|||
|
|
Custom equality comparer for `AnalogInputDASChannel` instances.
|
|||
|
|
- `bool Equals(AnalogInputDASChannel x, AnalogInputDASChannel y)` – Returns `true` if channels match on:
|
|||
|
|
`ModuleChannelNumber`, `OwningModule.ModuleArrayIndex`, `OwningModule.OwningDAS.SerialNumber`, `AbsoluteDisplayOrder`, and `UnitConverision`.
|
|||
|
|
Includes null checks for objects, `OwningModule`, and `OwningDAS`; also validates `SerialNumber` is non-null/non-empty.
|
|||
|
|
- `int GetHashCode(AnalogInputDASChannel analog)` – Hash code computed from same fields as `Equals`, with fallback to `0` if `SerialNumber` is null/empty.
|
|||
|
|
|
|||
|
|
- **`TimestampDASChannel : InputDASChannel`**
|
|||
|
|
Channel for sample timestamps (RTC).
|
|||
|
|
- `TimestampDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `TimestampDASChannel()` – Parameterless constructor.
|
|||
|
|
- `override bool IsConfigured()` – Always returns `true`.
|
|||
|
|
- `override string ToString()` – Returns fixed string based on `ModuleType()` and `ModuleChannelNumber`:
|
|||
|
|
- `"MARKER"`, `"SECONDS_HIGH"`, `"SECONDS_LOW"` for `EmbeddedClockSecondsAndMarker`
|
|||
|
|
- `"NANOSECONDS_HIGH"`, `"NANOSECONDS_LOW"`, `"RESERVED"` for `EmbeddedClockNanosAndPad`
|
|||
|
|
- Otherwise: `ModuleChannelNumber.ToString()`.
|
|||
|
|
- Constants: `MARKER`, `SEC_H`, `SEC_L`, `NANOS_H`, `NANOS_L`, `RSVD`.
|
|||
|
|
|
|||
|
|
- **`StreamInputDASChannel : InputDASChannel`**
|
|||
|
|
Channel for streaming input settings.
|
|||
|
|
- `StreamInputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `StreamInputDASChannel()` – Parameterless constructor.
|
|||
|
|
- `override bool IsConfigured()` – Returns `true` if `SerialNumber` is non-null/non-empty.
|
|||
|
|
- `override string ToString()` – Returns `"Stream{ModuleChannelNumber}"`.
|
|||
|
|
- `override void WriteXml(XmlWriter writer)` / `override void HandleElement(XmlReader reader)` – XML I/O for: `SerialNumber`, `HardwareChannelName`, `UDPAddress`.
|
|||
|
|
- Properties: `SerialNumber`, `HardwareChannelName`, `UDPAddress`.
|
|||
|
|
|
|||
|
|
- **`CANInputDASChannel : InputDASChannel`**
|
|||
|
|
Channel for CAN interface configuration.
|
|||
|
|
- `CANInputDASChannel(DASModule owner, int channelNumber)` – Constructor; initializes `SerialNumber` from `owner.SerialNumber()`.
|
|||
|
|
- `CANInputDASChannel()` – Parameterless constructor.
|
|||
|
|
- `override bool IsConfigured()` – Returns `true` if `SerialNumber` is non-null/non-empty.
|
|||
|
|
- `override string ToString()` – Returns `"CAN{ModuleChannelNumber}"`.
|
|||
|
|
- `override void WriteXml(XmlWriter writer)` / `override void HandleElement(XmlReader reader)` – XML I/O for: `SerialNumber`, `HardwareChannelName`, `IsFD`, `ArbBaseBitrate`, `ArbBaseSJW`, `DataBitrate`, `DataSJW`, `FileType`.
|
|||
|
|
- Properties: `SerialNumber`, `HardwareChannelName`, `IsFD`, `ArbBaseBitrate`, `ArbBaseSJW`, `DataBitrate`, `DataSJW`, `FileType`.
|
|||
|
|
|
|||
|
|
- **`UARTInputDASChannel : InputDASChannel`**
|
|||
|
|
Channel for UART interface configuration.
|
|||
|
|
- `UARTInputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `UARTInputDASChannel()` – Parameterless constructor.
|
|||
|
|
- `override bool IsConfigured()` – Returns `true` if `SerialNumber` is non-null/non-empty.
|
|||
|
|
- `override string ToString()` – Returns `"UART{ModuleChannelNumber}"`.
|
|||
|
|
- `override void WriteXml(XmlWriter writer)` / `override void HandleElement(XmlReader reader)` – XML I/O for: `SerialNumber`, `HardwareChannelName`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl`, `DataFormat`.
|
|||
|
|
Includes `try/catch` blocks for enum parsing with logging via `APILogger.Log`.
|
|||
|
|
- Properties: `SerialNumber`, `HardwareChannelName`, `BaudRate`, `DataBits`, `StopBits`, `Parity`, `FlowControl`, `DataFormat`.
|
|||
|
|
|
|||
|
|
### Derived Output Channel Classes
|
|||
|
|
|
|||
|
|
- **`AnalogOutputDASChannel : OutputDASChannel`**
|
|||
|
|
Base class for analog output channels.
|
|||
|
|
- `AnalogOutputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `AnalogOutputDASChannel()` – Parameterless constructor.
|
|||
|
|
|
|||
|
|
- **`DigitalOutputDASChannel : OutputDASChannel`**
|
|||
|
|
Base class for digital output channels.
|
|||
|
|
- `DigitalOutputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `DigitalOutputDASChannel()` – Parameterless constructor.
|
|||
|
|
|
|||
|
|
- **`StreamOutputDASChannel : OutputDASChannel`**
|
|||
|
|
Channel for streaming output settings.
|
|||
|
|
- `StreamOutputDASChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `StreamOutputDASChannel()` – Parameterless constructor.
|
|||
|
|
- `override bool IsConfigured()` – Returns `true` if `SerialNumber` is non-null/non-empty.
|
|||
|
|
- `override string ToString()` – Returns `"Stream{ModuleChannelNumber}"`.
|
|||
|
|
- `override void WriteXml(XmlWriter writer)` / `override void HandleElement(XmlReader reader)` – XML I/O for: `SerialNumber`, `HardwareChannelName`, `UDPProfileName`, `UDPTimeChannelId`, `UDPDataChannelId`, `IRIGTimeDataPacketIntervalMs`, `TMATSIntervalMs`, `UDPAddress`, `UDPTmNSConfig`.
|
|||
|
|
- Properties: `SerialNumber`, `HardwareChannelName`, `UDPProfileName`, `UDPTimeChannelId`, `UDPDataChannelId`, `IRIGTimeDataPacketIntervalMs`, `TMATSIntervalMs`, `UDPAddress`, `UDPTmNSConfig`.
|
|||
|
|
|
|||
|
|
- **`OutputTOMDigitalChannel : DigitalOutputDASChannel`**
|
|||
|
|
Base class for TOM (Test Output Module) digital channels (e.g., SQUIB-related).
|
|||
|
|
- `OutputTOMDigitalChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `OutputTOMDigitalChannel()` – Parameterless constructor.
|
|||
|
|
- `OutputTOMDigitalChannel(XmlReader reader)` – Constructor for deserialization.
|
|||
|
|
- `override bool IsConfigured()` – Returns `true` if `OutputMode != DigitalOutputModes.NONE` and `DigitalChannelDescription` is non-empty.
|
|||
|
|
- `override void WriteXml(XmlWriter writer)` / `override void WriteXmlCRC32(XmlWriter writer)` / `override void HandleElement(XmlReader reader)` – XML I/O for: `DelayMS`, `DurationMS`, `OutputMode`, `LimitDuration`, `DigitalChannelDescription`.
|
|||
|
|
- Properties: `OutputMode`, `DelayMS`, `LimitDuration`, `DurationMS`, `DigitalChannelDescription`, `LastModifiedBy`, `LastModified`, `LocalOnly`, `HardwareChannelName`, `Version`, `Date`.
|
|||
|
|
|
|||
|
|
- **`OutputSquibChannel : AnalogOutputDASChannel`**
|
|||
|
|
Channel for SQUIB (squib fire) output configuration. Implements `IComparable`.
|
|||
|
|
- `OutputSquibChannel(DASModule owner, int channelNumber)` – Constructor.
|
|||
|
|
- `OutputSquibChannel()` – Parameterless constructor.
|
|||
|
|
- `OutputSquibChannel(XmlReader reader)` – Constructor for deserialization.
|
|||
|
|
- `override bool IsConfigured()` – Returns `true` if `FireMode != SquibFireMode.NONE` and `SquibDescription` is non-empty.
|
|||
|
|
- `override string ToString()` – Returns `SquibDescription.Trim()` if non-empty; otherwise `base.ToString()`.
|
|||
|
|
- `int IComparable.CompareTo(object o)` – Compares by `SquibDescription`.
|
|||
|
|
- `override void WriteXml(XmlWriter writer)` / `override void WriteXmlCRC32(XmlWriter writer)` / `override void HandleElement(XmlReader reader)` – XML I/O for:
|
|||
|
|
`BypassCurrentFilter`, `BypassVoltageFilter`, `DelayMS`, `DurationMS`, `FireMode`, `ISOCode`, `MeasurementType`, `SquibDescription`, `ChannelId`, `ChannelName2`, `ChannelGroupName`, `HardwareChannelName`, `SquibFiredPassed`, `SquibFiredValid`, `SquibMeasuredOhms`, `SquibOutputCurrent`, `SquibToleranceHigh`, `SquibToleranceLow`, `LimitDuration`, `ScaleFactorMv`, `PreTestDataZeroLevelADC`, `SupportedSquibFireModes`, `SoftwareFilterFrequency`, `Sensor`, `SerialNumber`.
|
|||
|
|
- Properties: `SupportedSquibFireModes`, `Diagnostics`, `FireMode`, `MeasurementType`, `BypassCurrentFilter`, `BypassVoltageFilter`, `SquibToleranceLow`, `SquibToleranceHigh`, `SquibOutputCurrent`, `SquibMeasuredOhms`, `SquibFiredValid`, `SquibFiredPassed`, `DelayMS`, `DurationMS`, `SquibDescription`, `ISOCode`, `ChannelId`, `ChannelName2`, `HardwareChannelName`, `LimitDuration`, `ScaleFactorMv`, `PreTestDataZeroLevelADC`, `LocalOnly`, `LastModifiedBy`, `Sensor`, `SerialNumber`, `SoftwareFilterFrequency`.
|
|||
|
|
- Constants: `DEFAULT_MIN_FIRE_DURATION_MS`, `DEFAULT_MIN_FIRE_DELAY_MS`, `DEFAULT_DEFINEINTEST_FIRE_DELAY_FLAG`, `DEFAULT_MAX_FIRE_DURATION_MS`, `DEFAULT_MAX_FIRE_DELAY_MS`.
|
|||
|
|
|
|||
|
|
## 3. Invariants
|
|||
|
|
|
|||
|
|
- **Channel Ownership**: Every channel instance has an `OwningModule` (set via constructor or deserialization). `DASChannel.Number` depends on `OwningModule.OwningDAS` being non-null and `DASInfo`/`Modules` being initialized.
|
|||
|
|
- **Serialization Consistency**: `WriteXml` and `ReadXml` must be symmetric; `HandleElement` implementations must handle all XML tags written by `WriteXml`.
|
|||
|
|
- **Configuration State**: `IsConfigured()` must be deterministic and based on concrete configuration data (e.g., presence of `SerialNumber`, non-`NONE` `FireMode`, etc.). Default implementation returns `false`.
|
|||
|
|
- **Equality Semantics**: `AnalogInputDASChannelComparer` enforces that equality is based on a composite key: channel number, module index, DAS serial number, display order, and unit conversion. `GetHashCode` must match `Equals`.
|
|||
|
|
- **Timestamp Channels**: `TimestampDASChannel.IsConfigured()` always returns `true`, indicating it is always considered configured.
|
|||
|
|
- **String Constants**: Tag names used in XML I/O (e.g., `SERIALNUMBER_TAG`, `DELAYMS_TAG`) are `private const string` and must match exactly between `WriteXml` and `HandleElement`.
|
|||
|
|
- **Enum Parsing Safety**: `UARTInputDASChannel` and `OutputSquibChannel` wrap enum parsing in `try/catch` blocks with logging to prevent deserialization failure.
|
|||
|
|
|
|||
|
|
## 4. Dependencies
|
|||
|
|
|
|||
|
|
### Dependencies *of* this module:
|
|||
|
|
- **`DTS.DASLib.Service` namespace**:
|
|||
|
|
- `DASModule` (used in constructors and `OwningModule` property).
|
|||
|
|
- `DASInfo` (used in `DASChannel.Number` and `CanReProgram()`).
|
|||
|
|
- **External Libraries**:
|
|||
|
|
- `System`, `System.Xml`, `System.Collections.Generic`, `System.IO.Ports`, `System.Linq` (via LINQ in `AnalogInputDASChannelComparer`).
|
|||
|
|
- `DTS.Common.Enums.DASFactory` (`DFConstantsAndEnums`, `ModuleType`).
|
|||
|
|
- `DTS.Common.Enums` (`DigitalOutputModes`, `SquibFireMode`, `SquibMeasurementType`, `UartDataFormat`, `StopBits`, `Parity`, `Handshake`).
|
|||
|
|
- `DTS.Common.Interface.DASFactory.Config` (`IDASChannel`, `IEID`).
|
|||
|
|
- `DTS.Common.Interface.DASFactory.Diagnostics` (`IDiagnosticResult`).
|
|||
|
|
- `DTS.Common.Utilities.Logging` (`APILogger`).
|
|||
|
|
- `DTS.Common.Utilities` (`ArrayToString`).
|
|||
|
|
- `DTS.Common.Classes.Sensors` (`UDPStreamProfile`, `SensorConstants`).
|
|||
|
|
|
|||
|
|
### Dependencies *on* this module:
|
|||
|
|
- Any class that manages DAS channels (e.g., `DASModule`, `DAS`, `IDASCommunication`) depends on these channel types.
|
|||
|
|
- `AnalogInputDASChannelComparer` is explicitly noted as being used by `IDASCommunication` (per comment in source).
|
|||
|
|
|
|||
|
|
## 5. Gotchas
|
|||
|
|
|
|||
|
|
- **Typo in Property Name**: `UnitConverision` (instead of `UnitConversion`) is used consistently in `DASChannel` and XML I/O. This is likely a historical typo.
|
|||
|
|
- **`DASChannel.Number` May Throw**: The `Number` property can throw `ApplicationException` if `OwningModule`, `OwningDAS`, or `DASInfo` are null or improperly initialized.
|
|||
|
|
- **`CanReProgram()` Null Safety**: `CanReProgram()` performs multiple null checks; returns `false` if any link in the chain (`OwningModule`, `OwningDAS`, `DASInfo`, `Modules`) is null.
|
|||
|
|
- **`AnalogInputDASChannelComparer` Null Sensitivity**: `Equals` returns `false` if `OwningModule.OwningDAS.SerialNumber` is null/empty—even if other fields match. This may cause unexpected inequality for partially initialized channels.
|
|||
|
|
- **`OutputSquibChannel` Serialization of `ArticleId`**: In `WriteXmlCRC32` and `WriteXml`, `ArticleId` is written but ignored in `HandleElement` (commented as “why aren’t we using this id?”). This may indicate legacy or incomplete implementation.
|
|||
|
|
- **`TimestampDASChannel.ToString()` Relies on `ModuleType()`**: The `ToString()` override calls `OwningModule.ModuleType()`, but `ModuleType()` is not defined in the provided source—its implementation is assumed to be in `DASModule`.
|
|||
|
|
- **`OutputSquibChannel` Default Fire Delay Flag**: `DEFAULT_DEFINEINTEST_FIRE_DELAY_FLAG = -1` is a special sentinel value indicating delay must be defined in test setup; not documented in `IsConfigured()` or XML handling.
|
|||
|
|
- **`StreamOutputDASChannel.TMATSIntervalMs` Default**: Uses `StreamOutputRecord.DEFAULT_TMATS_INTERVAL_MS`, but `StreamOutputRecord` is not defined in the provided source.
|
|||
|
|
- **`AnalogInputDASChannel` Not Defined**: The comparer `AnalogInputDASChannelComparer` references `AnalogInputDASChannel`, but no such class is defined in the provided files—only `AnalogOutputDASChannel` is present. This suggests an omission or that `AnalogInputDASChannel` is defined elsewhere.
|
|||
|
|
- **`OutputTOMDigitalChannel` vs `OutputSquibChannel`**: Both are described as “base class for SQUIB channels” in comments, but `OutputSquibChannel` inherits from `AnalogOutputDASChannel`, while `OutputTOMDigitalChannel` inherits from `DigitalOutputDASChannel`. This may indicate
|