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(...).
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.
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-NONEFireMode, 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).
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