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

311 lines
10 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-16T11:38:29.974640+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f40aa120b967ad3e"
---
# DAS Concepts Module Documentation
## 1. Purpose
This module defines the core domain abstractions for a Data Acquisition System (DAS). It provides the foundational type hierarchy for representing DAS channels, their data containers, and various optional capabilities (metadata, calibration, triggering, decimation) that can be attached to channels via interfaces. The module serves as the conceptual model layer, establishing contracts and base types that concrete DAS implementations would extend.
---
## 2. Public Interface
### Classes
#### `Channel<DataType>` (Abstract)
**Namespace:** `DTS.DAS.Concepts.DAS`
**File:** `DAS.Channel.cs`
```csharp
public abstract class Channel<DataType> : Exceptional
```
- Abstract generic base class representing a DAS channel.
- Generic type parameter `DataType` defines the data type contained by channels of this DAS.
- Extends `Exceptional` from `DTS.Utilities`.
---
#### `Data<DatumType>` (Abstract)
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.Data.cs`
```csharp
public abstract class Data<DatumType> : ExceptionalList<DatumType>
```
- Abstract generic base class representing a list of channel data.
- Extends `ExceptionalList<DatumType>` from `DTS.Utilities`.
- **Constructors:**
- `protected Data()` — Default constructor.
- `protected Data(int capacity)` — Initializes with specified capacity.
- `protected Data(IEnumerable<DatumType> collection)` — Initializes from an existing collection.
---
#### `Id` (Sealed)
**Namespace:** `DTS.Common.DAS.Concepts.DAS`
**File:** `DAS.Id.cs`
```csharp
public sealed class Id : Exceptional, IComparable<Id>, IEquatable<Id>
```
- Represents a DAS identifier, encapsulating a string value.
- **Constructor:** `public Id(string value)`
- **Properties/Methods:**
- `public static implicit operator string(Id id)` — Implicit conversion to string.
- `public static implicit operator Id(string id)` — Implicit conversion from string.
- `public override bool Equals(object obj)` — Equality check; compares strings ordinally case-insensitive.
- `public bool Equals(Id that)` — Typed equality check.
- `public int CompareTo(Id that)` — IComparable implementation.
- `public override string ToString()` — Returns the underlying string value.
- `public override int GetHashCode()` — Returns hash of the string value.
- **Operators:** `==`, `!=`, `<`, `>`, `<=`, `>=` — All use case-insensitive string comparison.
---
### Interfaces
#### `IIsoCodeAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.IIsoCodeAware.cs`
```csharp
public interface IIsoCodeAware
{
string IsoCode { get; set; }
}
```
- Defines ISO code awareness with a string property.
---
#### `ISerialNumberAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.ISerialNumberAware.cs`
```csharp
public interface ISerialNumberAware
{
string SerialNumber { get; set; }
}
```
- Defines serial number awareness with a string property.
---
#### `IEngineeringUnitAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.IEngineeringUnitAware.cs`
```csharp
public interface IEngineeringUnitAware
{
string EngineeringUnits { get; set; }
}
```
- Defines engineering unit awareness with a string property.
---
#### `IInversionAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.IInversionAware.cs`
```csharp
public interface IInversionAware
{
bool IsInverted { get; set; }
}
```
- Defines inversion state awareness with a boolean property.
---
#### `ILinearized`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.IInversionAware.cs`
```csharp
public interface ILinearized
{
LinearizationFormula LinearizationFormula { get; set; }
}
```
- Defines linearization formula awareness. (Note: `LinearizationFormula` type is not defined in provided sources.)
---
#### `IVoltageInsertionAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DTS.DAS.Concepts.IVoltageInsertAware.cs`
```csharp
public interface IVoltageInsertionAware
{
double ExpectedGain { get; set; }
double MeasuredGain { get; set; }
}
```
- Defines shunt-check/voltage insertion awareness with gain properties.
---
#### `ILevelTriggerable`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.ILevelTriggerable.cs`
```csharp
public interface ILevelTriggerable
{
double? TriggerBelowThresholdEu { get; set; } // Set to null to deactivate
double? TriggerAboveThresholdEu { get; set; } // Set to null to deactivate
LevelTriggerTypes LevelTriggerType { get; set; }
}
```
- Defines level trigger capability with nullable threshold properties.
---
#### `IShuntAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.DAS.Concepts.IShuntAware.cs`
```csharp
public interface IShuntAware
{
double MeasuredShuntDeflectionMv { get; set; }
double TargetShuntDeflectionMv { get; set; }
}
```
- Defines shunt-check awareness with deflection values in millivolts.
---
#### `ICalSignalAware`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.DAS.Concepts.IShuntAware.cs`
```csharp
public interface ICalSignalAware
{
double MeasuredCalSignalMv { get; set; }
double TargetCalSignalMv { get; set; }
}
```
- Defines cal-signal awareness with values in millivolts.
---
#### `IDecimatable<out T>`
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.IDecimatable.cs`
```csharp
public interface IDecimatable<out T>
{
uint PointsPerPoint { get; set; }
DecimationMethod DecimationType { get; set; }
T[] ToDecimatedArray();
T this[long i] { get; } // Returns decimated value at index
}
```
- Defines decimation capability for DAS channels.
- The indexer returns values from the decimated set based on `PointsPerPoint` and `DecimationType`.
---
### Enumerations
#### `DecimationMethod`
**Namespace:** `DTS.DAS.Concepts.DAS` (in `DecimationMethod.cs`)
**Namespace:** `DTS.DAS.Concepts.DAS.Channel` (in `DAS.Channel.IDecimatable.cs`)
```csharp
public enum DecimationMethod
{
Point, // Use PointsPerPoint-th point as representative
Average, // Use average of PointsPerPoint values
PeakMagnitude // Use peak magnitude of PointsPerPoint values
}
```
- **Note:** This enum is defined in two files with different namespaces. See Gotchas.
---
#### `LevelTriggerTypes` (Flags)
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
**File:** `DAS.Channel.ILevelTriggerable.cs`
```csharp
[Flags]
public enum LevelTriggerTypes
{
NONE = 0x00,
OutsideWindow = 0x01,
InsideWindow = 0x02,
LessThan = 0x04,
GreaterThan = 0x08
}
```
- Bitwise combinable flags for level trigger types.
---
## 3. Invariants
1. **`Id` immutability:** The `value` field in `Id` is `readonly`; once constructed, the underlying string cannot be changed.
2. **Case-insensitive comparison:** All `Id` equality and comparison operations use `StringComparison.OrdinalIgnoreCase`.
3. **Null handling in `Id`:** The `Id` class handles null values gracefully in `GetHashCode()` (returns 0) and comparison operators.
4. **Abstract instantiation prevention:** Both `Channel<DataType>` and `Data<DatumType>` are abstract and cannot be instantiated directly.
5. **Decimation indexer contract:** Implementing `IDecimatable<T>` implies the indexer returns decimated values, not raw values.
6. **Trigger deactivation:** Setting `TriggerBelowThresholdEu` or `TriggerAboveThresholdEu` to `null` deactivates that trigger threshold.
---
## 4. Dependencies
### This Module Depends On:
| Dependency | Usage |
|------------|-------|
| `DTS.Utilities.Exceptional` | Base class for `Channel<DataType>` and `Id` |
| `DTS.Utilities.ExceptionalList<T>` | Base class for `Data<DatumType>` |
| `DTS.Common.Utilities` | Referenced in `DAS.Id.cs` (specific type usage unclear from source) |
| `System.Collections.Generic.IEnumerable<T>` | Used in `Data<DatumType>` constructor |
| `System.IComparable<T>` | Implemented by `Id` |
| `System.IEquatable<T>` | Implemented by `Id` |
| `System.FlagsAttribute` | Applied to `LevelTriggerTypes` |
### What Depends On This Module:
*Cannot be determined from the provided source files alone.*
---
## 5. Gotchas
1. **Duplicate `DecimationMethod` enum definition:** This enum is defined in two separate files:
- `DecimationMethod.cs` in namespace `DTS.Common.DAS.Concepts.DAS`
- `DAS.Channel.IDecimatable.cs` in namespace `DTS.DAS.Concepts.DAS.Channel`
This may cause ambiguity or require explicit namespace qualification.
2. **Namespace inconsistency across files:**
- `DAS.Channel.cs` uses `DTS.DAS.Concepts.DAS`
- `DAS.Id.cs` and `DecimationMethod.cs` use `DTS.Common.DAS.Concepts.DAS`
- Interface files use `DTS.DAS.Concepts.DAS.Channel`
This suggests possible refactoring history or assembly boundary issues.
3. **`ILinearized` placement:** The `ILinearized` interface is defined in `DAS.Channel.IInversionAware.cs` rather than its own file, breaking the one-type-per-file pattern used elsewhere. The referenced `LinearizationFormula` type is not defined in any provided source.
4. **Developer comments questioning design:** The `Id` class contains comments: *"DTM - why does this class exist? it's only encapsulating a string"* and *"why does this class even exist?"* — indicating possible tech debt or design uncertainty.
5. **XML comment mismatch in `IVoltageInsertionAware`:** The interface summary mentions "shunt-check awareness" but the properties are named `ExpectedGain` and `MeasuredGain`, which may be confusing.
6. **File naming inconsistency:** `DTS.DAS.Concepts.IVoltageInsertAware.cs` uses a different naming pattern than other interface files (missing the `DAS.Channel.` prefix and has a typo: "Insert" vs "Insertion" in the interface name).