Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common.DAS.Concepts/DAS.md
2026-04-17 14:55:32 -04:00

196 lines
9.9 KiB
Markdown

---
source_files:
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IIsoCodeAware.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.ISerialNumberAware.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IEngineeringUnitAware.cs
- Common/DTS.Common.DAS.Concepts/DAS/DecimationMethod.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IInversionAware.cs
- Common/DTS.Common.DAS.Concepts/DAS/DTS.DAS.Concepts.IVoltageInsertAware.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.ILevelTriggerable.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.Data.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.DAS.Concepts.IShuntAware.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IDecimatable.cs
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Id.cs
generated_at: "2026-04-16T13:24:05.408874+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f40aa120b967ad3e"
---
# Documentation: DTS.DAS.Concepts.DAS Module
## 1. Purpose
This module provides the core domain abstractions for a Data Acquisition System (DAS). It defines the foundational types for modeling DAS channels, their identifiers, data containers, and optional capabilities (such as decimation, level triggering, calibration awareness, and metadata properties). The module uses interfaces and abstract generic classes to establish a flexible, composable type system that can be extended by concrete implementations.
---
## 2. Public Interface
### Classes
#### `Channel<DataType>`
- **Namespace:** `DTS.DAS.Concepts.DAS`
- **Signature:** `public abstract class Channel<DataType> : Exceptional`
- **Description:** Abstract base class representing a DAS channel. Generic over `DataType`, which defines the type of data contained by channels of this DAS. Inherits from `Exceptional` (from `DTS.Utilities`).
#### `Data<DatumType>`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Signature:** `public abstract class Data<DatumType> : ExceptionalList<DatumType>`
- **Description:** Abstract base class representing a list of channel data. Inherits from `ExceptionalList<DatumType>`. Provides three protected constructors:
- `protected Data()` — Default constructor.
- `protected Data(int capacity)` — Initializes with specified capacity.
- `protected Data(IEnumerable<DatumType> collection)` — Initializes from an existing collection.
#### `Id`
- **Namespace:** `DTS.Common.DAS.Concepts.DAS`
- **Signature:** `public sealed class Id : Exceptional, IComparable<Id>, IEquatable<Id>`
- **Description:** Represents a DAS identifier, encapsulating a string value. Supports implicit bidirectional conversion to/from `string`. Comparison and equality operations are case-insensitive (`StringComparison.OrdinalIgnoreCase`).
- **Key Members:**
- `public Id(string value)` — Constructor.
- `public static implicit operator string(Id id)` — Converts `Id` to `string`.
- `public static implicit operator Id(string id)` — Converts `string` to `Id`.
- `public bool Equals(Id that)` — Case-insensitive equality check.
- `public int CompareTo(Id that)` — Case-insensitive comparison.
- `public override string ToString()` — Returns the underlying string value.
- `public override int GetHashCode()` — Returns hash of the underlying string (or 0 if null).
- Static comparison operators: `==`, `!=`, `<`, `>`, `<=`, `>=`.
---
### Interfaces
#### `IIsoCodeAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:** `string IsoCode { get; set; }`
- **Description:** Defines ISO code awareness for an object.
#### `ISerialNumberAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:** `string SerialNumber { get; set; }`
- **Description:** Defines serial number awareness for an object.
#### `IEngineeringUnitAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:** `string EngineeringUnits { get; set; }`
- **Description:** Defines engineering unit description awareness for an object.
#### `IInversionAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:** `bool IsInverted { get; set; }`
- **Description:** Defines inversion state awareness for an object.
#### `ILinearized`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:** `LinearizationFormula LinearizationFormula { get; set; }`
- **Description:** Defines linearization formula awareness. (Note: `LinearizationFormula` type is referenced but not defined in the provided sources.)
#### `IVoltageInsertionAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:**
- `double ExpectedGain { get; set; }` — Measured shunt deflection value.
- `double MeasuredGain { get; set; }` — Target shunt deflection value.
- **Description:** Defines voltage insertion (shunt-check) awareness.
#### `ILevelTriggerable`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:**
- `double? TriggerBelowThresholdEu { get; set; }` — "Trigger below" threshold; set to `null` to deactivate.
- `double? TriggerAboveThresholdEu { get; set; }` — "Trigger above" threshold; set to `null` to deactivate.
- `LevelTriggerTypes LevelTriggerType { get; set; }` — The level trigger type.
- **Description:** Defines level triggerability for a channel.
#### `IShuntAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:**
- `double MeasuredShuntDeflectionMv { get; set; }` — Measured shunt deflection in millivolts.
- `double TargetShuntDeflectionMv { get; set; }` — Target shunt deflection in millivolts.
- **Description:** Defines shunt-check awareness.
#### `ICalSignalAware`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:**
- `double MeasuredCalSignalMv { get; set; }` — Measured calibration signal in millivolts.
- `double TargetCalSignalMv { get; set; }` — Target calibration signal in millivolts.
- **Description:** Defines calibration signal awareness.
#### `IDecimatable<out T>`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Members:**
- `uint PointsPerPoint { get; set; }` — Number of points to squeeze into a single index point.
- `DecimationMethod DecimationType { get; set; }` — Decimation method to apply.
- `T[] ToDecimatedArray()` — Generates a decimated array using the current `DecimationMethod`.
- `T this[long i] { get; }` — Indexer returning values from the decimated set.
- **Description:** Defines decimation capability for a DAS channel. Covariant in `T` (`out T`).
---
### Enums
#### `DecimationMethod`
- **Namespace:** `DTS.Common.DAS.Concepts.DAS` (also defined in `DTS.DAS.Concepts.DAS.Channel`)
- **Values:**
- `Point` — Use the value of the `PointsPerPoint`-th point as the representative value.
- `Average` — Use the average of the `PointsPerPoint` values.
- `PeakMagnitude` — Use the peak magnitude value of the `PointsPerPoint` values.
- **Description:** Specifies how to determine the representative value for decimated data sets.
#### `LevelTriggerTypes`
- **Namespace:** `DTS.DAS.Concepts.DAS.Channel`
- **Signature:** `[Flags] public enum LevelTriggerTypes`
- **Values:**
- `NONE = 0x00`
- `OutsideWindow = 0x01`
- `InsideWindow = 0x02`
- `LessThan = 0x04`
- `GreaterThan = 0x08`
- **Description:** Bitwise flags for specifying level trigger behavior.
---
## 3. Invariants
- `Channel<DataType>` is abstract and cannot be instantiated directly; it must be subclassed.
- `Data<DatumType>` is abstract and cannot be instantiated directly; it must be subclassed.
- `Id` is sealed and cannot be inherited.
- `Id.value` is `readonly` — once constructed, the underlying string cannot be changed.
- `Id` equality and comparison operations are always case-insensitive (`StringComparison.OrdinalIgnoreCase`).
- `IDecimatable<out T>` is covariant in `T`, allowing assignment compatibility for derived types.
- `LevelTriggerTypes` is a flags enum; values can be combined with bitwise operations.
- Nullable thresholds (`TriggerBelowThresholdEu`, `TriggerAboveThresholdEu`) use `null` to indicate deactivation.
---
## 4. Dependencies
### This module depends on:
- `DTS.Utilities` — Provides `Exceptional` (base class for `Channel<DataType>`) and `ExceptionalList<DatumType>` (base class for `Data<DatumType>`).
- `DTS.Common.Utilities` — Provides `Exceptional` (base class for `Id`).
- `System` — For `IComparable<T>`, `IEquatable<T>`, `FlagsAttribute`, `StringComparison`.
- `System.Collections.Generic` — For `IEnumerable<T>`.
### What depends on this module:
- Not determinable from the provided sources alone. Consumers would typically be concrete DAS channel implementations, data processing pipelines, or configuration systems that implement these interfaces and extend these base classes.
---
## 5. Gotchas
1. **Duplicate `DecimationMethod` enum definition:** This enum is defined in two different namespaces:
- `DTS.Common.DAS.Concepts.DAS` (in `DecimationMethod.cs`)
- `DTS.DAS.Concepts.DAS.Channel` (in `DAS.Channel.IDecimatable.cs`)
This could cause ambiguity or require explicit namespace qualification when both namespaces are imported.
2. **Developer uncertainty about `Id` class:** The source contains a comment questioning the class's existence: `"DTM - why does this class exist? it's only encapsulating a string"` and `"why does this class even exist?"` in the XML documentation. This suggests possible tech debt or historical artifact.
3. **Misleading XML summary in `IVoltageInsertionAware`:** The file header comment references "shunt-check awareness," but the interface is named `IVoltageInsertionAware` and deals with gain values, not shunt deflection directly.
4. **Undocumented `LinearizationFormula` type:** The `ILinearized` interface references a `LinearizationFormula` type that is not defined in any of the provided source files. Its structure and behavior are unknown from the source alone.
5. **Namespace inconsistency:** Files use different namespace roots:
- `DTS.DAS.Concepts.DAS` (most files)
- `DTS.Common.DAS.Concepts.DAS` (`DecimationMethod.cs`, `DAS.Id.cs`)
This may cause confusion or require multiple `using` directives.