This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
---
source_files:
- Common/DTS.Common.Serialization/Control/DAS/IFilterable.cs
- Common/DTS.Common.Serialization/Control/DAS/IFilter.cs
generated_at: "2026-04-17T16:08:03.377171+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9a73128b86fcf306"
---
# DAS
### 1. Purpose
This module defines the core interfaces for filtering data within a Data Acquisition System (DAS) channel architecture. It establishes the contract for filterable channels (`IFilterable`) and the filters themselves (`IFilter`), enabling a strategy pattern where different filter implementations can be applied to channel data. It handles filter management, caching controls, and the application of filtering algorithms to raw or channel-based data.
### 2. Public Interface
**`interface IFilterable`**
* `bool UseFilterCaching { get; set; }` - Gets or sets a flag to enable or disable filter caching.
* `List<IFilter> AvailableFilters { get; }` - Gets the list of `IFilter` objects available for this channel.
* `IFilter CurrentFilter { get; set; }` - Gets or sets the currently active filter.
* `double[] GetDataFilteredBy(IFilter filter, Event.Module.Channel.DataDisplayUnits displayUnits)` - Retrieves data filtered by the specified `filter` and converted to the specified `displayUnits`.
**`interface IFilter`**
* `string Name { get; }` - Returns the descriptive name of the filter.
* `bool IsCfc { get; }` - Indicates whether the filter represents a cardinal CFC (Channel Filter Class) value.

View File

@@ -0,0 +1,158 @@
---
source_files:
- Common/DTS.Common.Serialization/Control/Event/DasModuleAccessor.cs
- Common/DTS.Common.Serialization/Control/Event/DasChannelAccessor.cs
- Common/DTS.Common.Serialization/Control/Event/ChannelAccessor.cs
- Common/DTS.Common.Serialization/Control/Event/ModuleChannelAccessor.cs
- Common/DTS.Common.Serialization/Control/Event/DasModuleChannelAccessor.cs
- Common/DTS.Common.Serialization/Control/Event/TestInformation.cs
- Common/DTS.Common.Serialization/Control/Event/Event.cs
generated_at: "2026-04-17T15:34:59.374836+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e395c2fc0bedf773"
---
# Documentation: DTS.Slice.Control.Event
## 1. Purpose
This module provides the core `Event` class for the Slice Control subsystem, representing all information related to a data acquisition system (DAS) event. It serves as the primary data structure for managing test events, including their modules, channels, and associated metadata. The module provides multiple nested accessor classes for efficient lookup of modules and channels by DAS identifiers, and supports bidirectional conversion between Slice Control event representations and `DTS.Serialization.Test` objects for persistence and interchange.
---
## 2. Public Interface
### Event Class (`DTS.Slice.Control.Event`)
**Inheritance:** `Exceptional`, `Test.IConvertable`
#### Constructors
| Signature | Description |
|-----------|-------------|
| `Event()` | Default constructor. |
| `Event(string id, string description)` | Initializes with specified ID and description. |
| `Event(string id, string description, List<Module> modules)` | Initializes with ID, description, and module list. |
| `Event(Test test, Test.ReportErrors reportErrors)` | Initializes from a `DTS.Serialization.Test` object. |
| `Event(List<IDASCommunication> dases, EventInfoAggregate info)` | Initializes from a list of connected DAS devices; builds internal accessor structures. |
#### Properties
| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Id` | `string` | get/set | Event identifier string. |
| `Description` | `string` | get/set | Event description string. |
| `Guid` | `Guid` | get/set | Globally unique identifier; defaults to empty GUID. |
| `FaultFlags` | `UInt16` | get/set | Global fault flags; defaults to `0`. |
| `InceptionDate` | `DateTime` | get/private set | Creation date; defaults to `DateTime.Now`. |
| `Modules` | `List<Module>` | get/set | List of modules associated with this event. |
| `CalculatedChannels` | `List<Module.Channel>` | get/set | List of calculated channels. |
| `DasModules` | `DasModuleAccessor` | get/private set | Accessor for modules keyed by DAS ID. |
| `DasChannels` | `DasChannelAccessor` | get/private set | Accessor for channels keyed by DAS ID. |
| `DasModuleChannels` | `DasModuleChannelAccessor` | get/private set | Accessor for channels keyed by DAS ID/module number/channel number triplet. |
| `LastAbsoluteChannelNumberInEvent` | `int` | get | Highest absolute channel number in the event; returns `-1` if none found. |
| `TooLargeFor32BitVisualizationBytesPerSampleThreshold` | `double` | get/private set | Threshold for 32-bit visualization check; defaults to `2.0`. |
| `IsTooLargeFor32BitVisualization` | `bool` | get | Indicates if combined channel data exceeds 32-bit addressable memory. |
| `ContainsChannelsActiveInvalidZeroingWindows` | `bool` | get | Indicates if any channels have active but invalid zeroing windows. |
| `ChannelsWithActiveInvalidZeroingWindows` | `List<Module.Channel>` | get | List of channels with invalid zeroing window configurations. |
| `BaseSerializationDirectory` | `string` | get/set (static) | Base path for event serialization directories. |
#### Methods
| Signature | Description |
|-----------|-------------|
| `static bool IsG5(IDASCommunication idas)` | Returns `true` if DAS serial number starts with `"5M"`. |
| `static bool IsSlice6DBModule(Module module)` | Returns `true` if module description equals `"slice6db module"` (case-insensitive). |
| `Test ToDtsSerializationTest()` | Converts this event to a `DTS.Serialization.Test` object; purges unconfigured channels. |
| `void FromDtsSerializationTest(Test that, Test.ReportErrors reportErrors)` | Populates this event from a `DTS.Serialization.Test` object. |
| `static implicit operator Test(Event sliceControlEvent)` | Implicit conversion to `DTS.Serialization.Test`. |
| `static string GetEventSerializationDirectory(string eventId)` | Returns the serialization directory path for a given event ID. |
| `override bool Equals(object obj)` | Memberwise equality comparison. |
| `override int GetHashCode()` | Returns base hash code. |
---
### Nested Accessor Classes
#### DasModuleAccessor
```
Inherits: ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module>>
```
- **Constructor:** `DasModuleAccessor()`
- **Purpose:** Provides access to event modules by DAS ID/module number pair.
#### DasChannelAccessor
```
Inherits: ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module.Channel>>
```
- **Constructor:** `DasChannelAccessor()`
- **Purpose:** Provides access to event channels by DAS ID/channel number pair.
#### ChannelAccessor
```
Inherits: ExceptionalDictionary<int, Module.Channel>
```
- **Constructor:** `ChannelAccessor()`
- **Purpose:** Component of `DasModuleChannelAccessor`; maps channel numbers to channels.
#### ModuleChannelAccessor
```
Inherits: ExceptionalDictionary<int, ChannelAccessor>
```
- **Constructor:** `ModuleChannelAccessor()`
- **Purpose:** Component of `DasModuleChannelAccessor`; maps module numbers to `ChannelAccessor` instances.
#### DasModuleChannelAccessor
```
Inherits: ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, ModuleChannelAccessor>
```
- **Constructor:** `DasModuleChannelAccessor()`
- **Purpose:** Provides access to channels by DAS ID/module number/channel number triplet.
---
### TestInformation (Private Nested Class)
- **Access:** `private`
- **Inheritance:** `Exceptional`
- **Properties:** `Id` (string), `Description` (string)
- **Constructors:**
- `TestInformation()` — leaves properties uninitialized
- `TestInformation(string id, string description)`
---
## 3. Invariants
1. **GUID Default:** The `Guid` property initializes to `00000000-0000-0000-0000-000000000000` when unset.
2. **FaultFlags Default:** The `FaultFlags` property initializes to `0`.
3. **InceptionDate Default:** The `InceptionDate` property initializes to `DateTime.Now` at construction time.
4. **Visualization Threshold:** `TooLargeFor32BitVisualizationBytesPerSampleThreshold` defaults to `2.0` bytes per sample.
5. **Test ID Consistency:** When constructing from multiple DAS devices, all devices must report matching test IDs (case-insensitive comparison); otherwise an exception is thrown.
6. **Module Array Alignment:** The constructor maintains the invariant `DasModules[das.SerialNumber].Count - 1 == dasModule.ModuleArrayIndex` (enforced via `Debug.Assert`).
7. **Empty Slot Handling:** Empty slots in TDAS racks are filled with placeholder `Module` instances to maintain correct array indexing.
8. **Invalid Window Average Sentinel:** The constant `InvalidWindowAverage = short.MinValue` is used to detect uninitialized window averages.
---
## 4. Dependencies
### This Module Depends On
| Namespace/Assembly | Usage |
|--------------------|-------|
| `System` | Core types, `Guid`, `DateTime`, `InvalidOperationException` |
| `System.Collections.Generic` | `List<T>` collections |
| `System.Diagnostics` | `Debug.Assert` |
| `DTS.DASLib.Service` | `IDASCommunication`, `DASModule`, `DASChannel`, `EthernetTDAS`, `OutputSquibChannel` |
| `DTS.Serialization` | `Test` class, serialization types |
| `DTS.Common.Utilities` | `Exceptional` base class, `Exception`, `UserException` |
| `DTS.Common.Utilities.DotNetProgrammingConstructs` | `Property<T>` wrapper |
| `DTS.Common.Utilities.Logging` | `APILogger.Log` |
| `DTS.Serialization.StringResources` | Localized error strings (`Strings` class) |
| `DTS.Common.DAS.Concepts` | `DAS.Id`, `Test.Module.Channel.Sensor.ZeroMethodType` |
### Consumers (Inferred)
- Test serialization/deserialization systems (via

View File

@@ -0,0 +1,184 @@
---
source_files:
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableDasSerialNumberAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableSampleRateAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Module.cs
generated_at: "2026-04-17T15:39:09.615523+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "474439030090ef0a"
---
# Documentation: DTS.Slice.Control.Event.Module
## 1. Purpose
This module provides the `Event.Module` class, which represents a data acquisition system (DAS) module within a Slice Control event. It serves as a container for channel configurations, timing information, sensor readings (tilt and temperature), and metadata about the recording hardware. The module also provides a set of reviewable attributes (`ReviewableAttribute` subclasses) that expose specific module properties in a standardized format for review/display purposes, and implements bidirectional conversion between runtime objects and serialization formats.
---
## 2. Public Interface
### Event.Module Class
**Namespace:** `DTS.Slice.Control`
**Inheritance:** `Exceptional`, implements `Serialization.Test.Module.IConvertable`
#### Constructors
| Signature | Description |
|-----------|-------------|
| `Module()` | Default constructor. Initializes a new instance with empty channels list. |
| `Module(Event parentEvent)` | Initializes with a parent `Event` reference. |
| `Module(Serialization.Test.Module that, Event parent, Serialization.Test.ReportErrors reportErrors)` | Initializes from a serialization object, populating all properties from the source. |
#### Properties
| Property | Type | Description |
|----------|------|-------------|
| `ParentEvent` | `Event` | The parent `Event` containing this module. Has `SetParentEvent(Event e)` setter method. |
| `Channels` | `List<Channel>` | List of channels on this event module. |
| `Number` | `int` | Module number identifier. |
| `DasSerialNumber` | `string` | DAS serial number string. |
| `Description` | `string` | Module description. |
| `BaseSerialNumber` | `string` | Base serial number for this DAS. |
| `RequestedPreTriggerSeconds` | `double` | Requested pre-trigger duration in seconds. |
| `RequestedPostTriggerSeconds` | `double` | Requested post-trigger duration in seconds. |
| `PreTriggerSeconds` | `double` | Actual pre-trigger duration in seconds. |
| `PostTriggerSeconds` | `double` | Actual post-trigger duration in seconds. |
| `NumberOfSamples` | `UInt64` | Number of samples in this module. |
| `UnsubsampledNumberOfSamples` | `UInt64` | Number of unsubsampled samples. |
| `TriggerSampleNumbers` | `List<UInt64>` | Trigger sample numbers. |
| `UnsubsampledTriggerSampleNumbers` | `List<UInt64>` | Unsubsampled trigger sample numbers. |
| `StartRecordSampleNumber` | `UInt64` | Start record sample number. |
| `SampleRateHz` | `float` | Sample rate in Hz. |
| `StartRecordTimestampSec` | `double` | Start record timestamp (seconds component). |
| `StartRecordTimestampNanoSec` | `double` | Start record timestamp (nanoseconds component). |
| `TriggerTimestampSec` | `double` | Trigger timestamp (seconds component). |
| `TriggerTimestampNanoSec` | `double` | Trigger timestamp (nanoseconds component). |
| `PTPMasterSync` | `bool` | Whether PTP master sync is used. |
| `TiltSensorAxisXDegreesPre` / `TiltSensorAxisYDegreesPre` / `TiltSensorAxisZDegreesPre` | `double` | Pre-trigger tilt sensor axis values in degrees. |
| `TiltSensorAxisXDegreesPost` / `TiltSensorAxisYDegreesPost` / `TiltSensorAxisZDegreesPost` | `double` | Post-trigger tilt sensor axis values in degrees. |
| `TemperatureLocation1Pre` through `TemperatureLocation4Pre` | `float` | Pre-trigger temperature sensor values at 4 locations. |
| `TemperatureLocation1Post` through `TemperatureLocation4Post` | `float` | Post-trigger temperature sensor values at 4 locations. |
| `AaFilterRateHz` | `float` | Anti-aliasing filter rate in Hz. |
| `NominalExcitationVoltage` | `Test.Module.Channel.Sensor.ExcitationVoltageOption` | Nominal excitation voltage (default: `Volt5`). |
| `RecordingMode` | `Test.Module.RecordingMode` | Recording mode (default: `CircularBuffer`). |
#### Methods
| Signature | Description |
|-----------|-------------|
| `void SetPropertyValuesFrom(DASLib.Service.DASModule that)` | Copies trigger sample numbers, number of samples, and fault flags from a `DASModule` object. |
| `override bool Equals(object obj)` | Memberwise equality comparison of all major properties and child collections. |
| `override int GetHashCode()` | Returns base hash code. |
| `bool IsSlice6DBModule()` | Returns `true` if `Description` equals `"slice6db module"`. |
| `Serialization.Test.Module ToDtsSerializationTestModule(Serialization.Test parentTest)` | Converts this object to a `Serialization.Test.Module`. Only includes channels where `IsConfigured` is `true`. |
| `void FromDtsSerializationTestModule(Serialization.Test.Module that, Serialization.Test.ReportErrors reportErrors)` | Populates this object from a `Serialization.Test.Module`. Creates channels via `Channel.CreateChannel()`. |
---
### Event.Module.ReviewableAttribute Class
**Inheritance:** `Slice.Control.ReviewableAttribute` (abstract)
#### Constructors
| Signature | Description |
|-----------|-------------|
| `public ReviewableAttribute(Event.Module channel)` | **Throws `NotImplementedException`** wrapped in `Module.ReviewableAttribute.Exception`. Documented as "concrete class should implement this constructor." |
| `protected ReviewableAttribute(string name, DetermineValueString calculateValue)` | Protected constructor that passes name and value delegate to base class. |
---
### Event.Module.ReviewableDasSerialNumberAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableDasSerialNumberAttribute(Event.Module module)` | Initializes with name `"DAS Serial Number"` and a delegate returning `module.DasSerialNumber`. |
---
### Event.Module.ReviewableSampleRateAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableSampleRateAttribute(Event.Module module)` | Initializes with name `"Sample Rate"` and a delegate returning `module.SampleRateHz.ToString("N")`. |
---
### Event.Module.ReviewableTestDescriptionAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableTestDescriptionAttribute(Event.Module module)` | Initializes with name `"Test Description"` and a delegate returning `module.ParentEvent.Description`. |
---
### Event.Module.ReviewableHardwareFrequencyAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableHardwareFrequencyAttribute(Event.Module module)` | Initializes with name `"HW AAF"` and a delegate returning `module.AaFilterRateHz.ToString("N2")`. |
---
## 3. Invariants
1. **Parent-Child Relationship**: A `Module` must have a valid `ParentEvent` reference for operations that access parent properties (e.g., `ReviewableTestDescriptionAttribute` accesses `module.ParentEvent.Description`).
2. **Channel Filtering in Serialization**: `ToDtsSerializationTestModule()` only serializes channels where `IsConfigured` is `true`.
3. **Channel Numbering**: When populating from a serialization module, channels are assigned sequential absolute channel numbers starting from `ParentEvent.LastAbsoluteChannelNumberInEvent + 1`.
4. **Equality Semantics**: `Equals()` performs memberwise comparison including all properties and child collections (`Channels`, `TriggerSampleNumbers`, `UnsubsampledTriggerSampleNumbers`).
5. **ReviewableAttribute Constructor Contract**: The public constructor taking `Event.Module` is explicitly designed to throw; subclasses must use the protected constructor with name and delegate.
---
## 4. Dependencies
### This Module Depends On:
- `DTS.Common.DAS.Concepts`
- `DTS.Serialization.StringResources`
- `DTS.Common.Utilities`
- `DTS.Common.Utilities.DotNetProgrammingConstructs`
- `DTS.Common.Utilities.Logging` (for `APILogger`)
- `DTS.Utilities` (referenced in `ReviewableDasSerialNumberAttribute.cs` and `ReviewableSampleRateAttribute.cs`)
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Diagnostics`
- `DASLib.Service.DASModule` (external service type used in `SetPropertyValuesFrom`)
- `Slice.Control.ReviewableAttribute` (base class for `Event.Module.ReviewableAttribute`)
- `Slice.Control.Event` (parent container class)
- `Serialization.Test.Module` and related serialization types
### What Depends On This Module:
- Not explicitly shown in source, but `Channel` class is referenced extensively, implying `Event.Module.Channel` is a dependent nested class.
---
## 5. Gotchas
1. **ReviewableAttribute Constructor Throws by Design**: The public constructor `ReviewableAttribute(Event.Module channel)` always throws a `NotImplementedException`. This appears to be intentional guard code, but the pattern is unusual—subclasses should call the protected constructor directly.
2. **Inappropriate Exception Handling**: The `FromDtsSerializationTestModule()` method uses try/catch blocks around individual property assignments (e.g., `StartRecordTimestampSec`, `TriggerTimestampSec`, tilt sensor values, temperature values) with logging but no re-throw. This silently swallows errors and continues execution. Source contains TODO comments: `"//TODO: inappropriate using try/catch!!!"`.
3. **Incorrect Log Message**: In `FromDtsSerializationTestModule()`, the catch block for `TriggerTimestampNanoSec` logs `"failed to get TriggerTimestampSec"` instead of `"failed to get TriggerTimestampNanoSec"`.
4. **Wrong Property Assignment**: In `FromDtsSerializationTestModule()`, the line `TriggerTimestampNanoSec = that.StartRecordTimestampNanoSec` appears to copy from the wrong source property (should likely be `that.TriggerTimestampNanoSec`).
5. **Commented-Out Initialization**: In the default `Module()` constructor, the call to `InitializeReviewableAttributes` is commented out. It is unclear if this is intentional or dead code.
6. **Exception Swallowing in SetPropertyValuesFrom**: The method catches exceptions when reading `ParentEvent.FaultFlags` and silently ignores them with an empty catch block (`catch (System.Exception) { }`).
7. **Format String Inconsistency**: `ReviewableSampleRateAttribute` uses `"N"` format while `ReviewableHardwareFrequencyAttribute` uses `"N2"` format for numeric display.

View File

@@ -0,0 +1,66 @@
---
source_files:
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableShuntDeflectionAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableFilterFrequencyAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableIsoCodeAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableDescriptionAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableSerialNumberAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableUnitsAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableMinMaxEuAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableCfcAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableTargetShuntDeflectionAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableMeasuredShuntDeflectionAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableShuntDeflectionPercentageAttribute.cs
generated_at: "2026-04-17T15:31:14.276531+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "42e54499338ddc45"
---
# Documentation: DTS.Slice.Control.Event.Module.AnalogInputChannel Reviewable Attributes
## 1. Purpose
This module provides a collection of reviewable attribute classes for analog input channels within the DTS Slice Control event system. Each class encapsulates a specific channel property (e.g., shunt deflection, filter frequency, serial number, calibration values) that can be displayed or reviewed in a standardized format. These attributes follow a consistent pattern where each inherits from `Slice.Control.Event.Module.Channel.ReviewableAttribute` and uses a delegate-based deferred evaluation to retrieve formatted string values from channel data at runtime.
---
## 2. Public Interface
All classes are nested within `DTS.Slice.Control.Event.Module.AnalogInputChannel` and inherit from `Slice.Control.Event.Module.Channel.ReviewableAttribute`.
### ReviewableShuntDeflectionAttribute
```csharp
public ReviewableShuntDeflectionAttribute(Event.Module.Channel channel)
```
Captures the measured shunt deflection in millivolts. The delegate casts `channel` to `DTS.DAS.Concepts.DAS.Channel.IShuntAware` and returns `MeasuredShuntDeflectionMv` formatted as `"F1"`. Label: `"Shunt Deflection (mV)"`.
---
### ReviewableFilterFrequencyAttribute
```csharp
public ReviewableFilterFrequencyAttribute(Event.Module.Channel channel)
```
Captures the filter cutoff frequency. The delegate casts `channel.CurrentFilter` to `SaeJ211Filter` and returns `CutoffFrequencyHz` as an integer formatted with `"N"`. Label: `"Filter Frequency"`.
---
### ReviewableIsoCodeAttribute
```csharp
public ReviewableIsoCodeAttribute(Event.Module.Channel channel)
```
Captures the ISO code. The delegate casts `channel` to `AnalogInputChannel` and returns `IsoCode.ToString()`. Label: `"ISO Code"`.
---
### ReviewableDescriptionAttribute
```csharp
public ReviewableDescriptionAttribute(Event.Module.Channel channel)
```
Captures the channel description. The delegate returns `channel.ChannelDescriptionString`. Label: `"Description"`.
---
### ReviewableSerialNumberAttribute
```csharp
public ReviewableSerialNumberAttribute(Event

View File

@@ -0,0 +1,220 @@
---
source_files:
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/DataValues.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/ReviewableAttribute.NotApplicableException.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/Filter.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/ChannelDefaultSaeJ211Filter.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/CalculatedChannel.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/SaeJ211Filter.cs
generated_at: "2026-04-17T15:34:47.007360+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ba30fc370955c9dd"
---
# DTS.Slice.Control.Event.Module.Channel Documentation
## 1. Purpose
This module provides the channel-level data structures and filtering mechanisms for the DTS Slice Control Event system. It defines classes for storing channel data values (with optional memory-mapped file support for large datasets), implements SAE J211-compliant digital filters for signal processing, and provides a hierarchy of calculated channel types for derived data operations such as integration, differentiation, FFT analysis, and vector mathematics. The module exists to support data acquisition and analysis workflows within the larger DTS Slice framework.
---
## 2. Public Interface
### `Event.Module.Channel.DataValues`
A class representing a channel's data, inheriting from `Exceptional`.
**Constructors:**
- `DataValues()` — Initializes with memory-mapped file support enabled by default.
- `DataValues(bool useMemoryMappedFile)` — Initializes with explicit control over memory-mapped file usage.
**Properties:**
- `bool UseMemoryMappedFile { get; set; }` — Controls whether the class uses memory-mapped files instead of in-memory lists for data storage.
---
### `Event.Module.Channel.ReviewableAttribute.NotApplicableException`
An exception class for attempts to use a channel attribute that is not applicable to the associated channel. Inherits from `ApplicationException`.
**Constructors:**
- `NotApplicableException()`
- `NotApplicableException(string msg)`
- `NotApplicableException(string msg, System.Exception innerEx)`
---
### `Event.Module.Channel.Filter` (Abstract)
Abstract base class for channel filters. Implements `Exceptional` and `IFilter`.
**Abstract Properties:**
- `string Name { get; }` — Descriptive designation for the filter.
- `bool IsCfc { get; }` — Indicates whether the filter corresponds to a CFC (Channel Filter Class) value.
- `ChannelFilter Type { get; }` — The `ChannelFilter` designation for this filter.
- `double CutoffFrequencyHz { get; }` — The cutoff frequency in Hz.
**Abstract Methods:**
- `double[] Apply(Channel input, DataDisplayUnits displayUnits, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to a channel.
- `double[] Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to raw data.
- `string ToBaseString()` — Returns the base name without decoration (contrast with `ToString()`).
---
### `Event.Module.Channel.SaeJ211Filter`
Concrete implementation of SAE J211-based filters. Inherits from `Filter`.
**Constructors:**
- `SaeJ211Filter(SaeJ211Filter originalFilter)` — Copy constructor.
- `SaeJ211Filter(ChannelFilter originalType)` — Initializes from a `ChannelFilter` enum value. Throws `Exception` if `ChannelFilter.AdHoc` is passed.
- `SaeJ211Filter(double cutoffFrequencyHz)` — Initializes an ad hoc filter with a specific cutoff frequency.
**Properties:**
- `override bool IsCfc { get; }` — Returns `true` if the filter is CFC-compliant (not `Unfiltered` and not `AdHoc`).
- `override ChannelFilter Type { get; }` — Returns the best-fitting `ChannelFilter` value.
- `char IsoDescription { get; }` — Returns the ISO description character.
- `override double CutoffFrequencyHz { get; }` — The cutoff frequency.
- `ChannelFilter OriginalType { get; }` — The original filter type specified at construction.
- `override string Name { get; }` — The filter name (e.g., "1000Hz" for ad hoc, or the CFC description).
**Methods:**
- `override double[] Apply(Channel channel, DataDisplayUnits displayUnits, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to channel data.
- `override double[] Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to raw data.
- `override string ToString()` — Returns `Name`.
- `override string ToBaseString()` — Returns `Name`.
- `override bool Equals(object obj)` — Compares filters by name (case-insensitive).
- `override int GetHashCode()` — Returns hash based on lowercase name.
- `static Filter Parse(string serialization)` — Creates a filter from a string representation.
---
### `Event.Module.Channel.DefaultSaeJ211Filter`
A default wrapper for SAE J211 filters. Inherits from `SaeJ211Filter`.
**Constructors:**
- `DefaultSaeJ211Filter(SaeJ211Filter filter)` — Wraps an existing filter.
- `DefaultSaeJ211Filter(ChannelFilter filterType)` — Creates a filter from a `ChannelFilter` type.
- `DefaultSaeJ211Filter(double adHocFrequency)` — Creates an ad hoc filter with specified frequency.
**Properties:**
- `override string Name { get; }` — Returns `"Default (" + base.Name + ")"`.
**Methods:**
- `override string ToBaseString()` — Returns `base.Name`.
- `override string ToString()` — Returns `Name`.
---
### `Event.Module.Channel.CalculatedChannel` (Abstract)
Abstract base class for calculated/derived channels. Inherits from `Channel` and implements `IEngineeringUnitAware`.
**Nested Enum:**
- `Operation` — Values: `Integral`, `Derivative`, `HeadInjuryCriteria`, `FFT`, `ImportedCSV`, `Resultant`, `TSR`, `Scale`, `Offset`, `Sine`, `Cosine`.
**Nested Enum:**
- `XUnits` — Values: `msec`, `sec`, `Hz`, `samples`.
**Properties:**
- `Operation CalculationType { get; }` — The calculation type.
- `double[] X { get; }` — X-axis values.
- `double[] Y { get; }` — Y-axis values.
- `XUnits XAxis { get; }` — X-axis unit type.
- `string XUnitsString { get; }` — String representation of X units.
- `string EngineeringUnits { get; set; }` — Y-axis engineering units.
- `override bool SupportsADC { get; }` — Returns `false`.
- `override bool SupportsEU { get; }` — Returns `true`.
- `override bool SupportsmV { get; }` — Returns `false`.
- `override double ActualMaxRangeEu { get; }` — Returns `Y.Max()`.
- `override double ActualMinRangeEu { get; }` — Returns `Y.Min()`.
- `override double DataHalfRangeValueEu { get; }`, `DataMaxEu { get; }`, `DataMinEu { get; }`, `DataRangeEu { get; }` — Statistical properties of Y data.
- `override bool IsConfigured { get; set; }` — Always `true`; setter throws `NotSupportedException`.
**Constructor:**
- `CalculatedChannel(string name, XUnits xAxis, string yAxis, double[] xValues, double[] yValues, Operation calcType, int number, Module parentModule)`
**Methods that throw `NotSupportedException` or `NotImplementedException`:**
- `override void FromDtsSerializationTestModuleChannel(Serialization.Test.Module.Channel that)`
- `override void SetPropertyValuesFrom(DASLib.Service.DASChannel dasChannel)`
- `override void SetPropertyValuesFrom(DASLib.Service.DiagnosticsResult diagResults)`
- `override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(Serialization.Test.Module parentModule)`
- `override double ActualMaxRangeMv { get; }`
- `override double ActualMinRangeMv { get; }`
- `override double SensorCapacityEU { get; }`
- `override double DesiredRangeEU { get; }`
- `override List<double> GetUnfilteredDataMV()`
**Methods:**
- `override List<double> GetUnfilteredDataEu()` — Returns a copy of Y values.
- `override string ToString()` — Returns `ChannelDescriptionString` or `"N/A"`.
---
### Concrete Calculated Channel Types
All inherit from `CalculatedChannel` and have identical constructor signatures:
- `FFTCalculatedChannel` — Additional property: `double PeakFrequency { get; }`. Constructor includes extra `double peakFrequency` parameter.
- `IntegralCalculatedChannel`
- `DerivativeCalculatedChannel`
- `ScaleCalculatedChannel`
- `OffsetCalculatedChannel`
- `ResultantCalculatedChannel`
- `AdditiveVectorCalculatedChannel`
- `SineCalculatedChannel`
- `CosineCalculatedChannel`
---
## 3. Invariants
1. **Filter Type Consistency**: `SaeJ211Filter.Type` will never return `ChannelFilter.AdHoc` if the cutoff frequency exactly matches a CFC value; it will return the matching CFC type instead.
2. **CFC Compliance**: `SaeJ211Filter.IsCfc` returns `true` only when `Type` is neither `Unfiltered` nor `AdHoc`.
3. **Filter Equality**: Two `SaeJ211Filter` instances are considered equal if their `Name` properties match case-insensitively. Consequently, `GetHashCode()` is based on the lowercase name.
4. **Calculated Channel Data Immutability**: X and Y data arrays in `CalculatedChannel` are stored in `readonly List<double>` fields and exposed as copies via `ToArray()`.
5. **Calculated Channel Capabilities**: All `CalculatedChannel` derivatives have `SupportsADC = false`, `SupportsEU = true`, and `SupportsmV = false`.
6. **Parse Round-Trip**: `SaeJ211Filter.Parse()` can parse filter names produced by `ToString()`; unrecognized strings return an `Unfiltered` filter.
---
## 4. Dependencies
### This module depends on:
- `DTS.Common.Utilities` — Provides `Exceptional` base class, `Exception`, `Property<T>`, `APILogger`.
- `DTS.Common.Utilities.DotNetProgrammingConstructs` — Provides `Property<T>`.
- `DTS.Common.Utilities.SaeJ211` — Provides `FilterUtility`, `CfcValueAttributeCoder`, `DescriptionAttributeCoder<T>`, `IsoDescriptionAttributeCoder`.
- `DTS.Common.Utilities.Logging` — Provides `APILogger`.
- `DTS.Common.DAS.Concepts.DAS.Channel` — Provides `ChannelFilter`, `IFilter`, `IEngineeringUnitAware`.
- `DTS.Slice.Control.DAS.Channel` — Referenced in `Filter.cs`.
- `DASLib.Service` — Provides `DASChannel`, `DiagnosticsResult` (used in `CalculatedChannel`).
- `System` namespaces — Standard .NET types.
### What depends on this module:
- Cannot be fully determined from source alone, but the partial class structure (`Event.Module.Channel`) indicates this is part of a larger `DTS.Slice.Control` namespace hierarchy.
---
## 5. Gotchas
1. **Empty Memory-Mapped File Implementation**: In `DataValues.DataValues(bool useMemoryMappedFile)`, the `if (UseMemoryMappedFile)` block is empty. The feature appears to be a stub or incomplete implementation.
2. **Legacy TDC Filter Adjustment**: The `Apply` methods on filters accept a `bool bUseLegacyTDCSoftwareFilterAdjustment` parameter (referenced as "8747" in comments) that adjusts filtered data by one sample to match legacy TDC behavior. This may produce unexpected results if not understood.
3. **NotSupportedException on CalculatedChannel**: Many methods on `CalculatedChannel` throw `NotSupportedException` or `NotImplementedException`. These include serialization methods, mV-related properties, and some range properties. Callers must handle these exceptions.
4. **AdHoc Filter Construction Restriction**: `SaeJ211Filter(ChannelFilter originalType)` throws an `Exception` if passed `ChannelFilter.AdHoc`. Use the `SaeJ211Filter(double cutoffFrequencyHz)` constructor instead.
5. **Large Data Handling in Filter.Apply**: When filtering ADC data, the method checks for `ILargeDataAware.IsDataArraySized` and throws `DataTooBigForArrayException` if data is too large. This is a runtime consideration for large datasets.
6. **Commented-Out Code**: Significant blocks of code are commented out in `CalculatedChannel.cs`, including the entire `HICCalculatedChannel` class and `InitializeReviewableAttributes` implementations. This suggests incomplete features or tech debt.
7. **Filter Name Ambiguity**: `DefaultSaeJ211Filter.Name` returns `"Default (" + base.Name + ")"`, while `ToBaseString()` returns just `base.Name`. The `ToString()` returns the decorated name. Use `ToBaseString()` when the undecorated name is needed.