Files

159 lines
9.0 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.Bridge.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.SensorUnits.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.ZeroMethod.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.RecordingMode.cs
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.ExcitationVoltage.cs
generated_at: "2026-04-16T11:38:00.583082+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f6582d95b5debe26"
---
# Documentation: DTS.DAS.Concepts.Test Module Hierarchy
## 1. Purpose
This module provides a hierarchical container structure for Data Acquisition System (DAS) test-related concepts, specifically defining configuration enums and types for hardware modules, channels, and sensors. It serves as a static type definitions library for sensor configurations (bridge types, coupling modes, excitation voltages, sensitivity units, zero methods) and recording modes. The architecture uses nested partial classes (`Test.Module.Channel.Sensor`) as organizational containers—none of which are instantiable—to group related enums and their associated helper methods within the `DTS.DAS.Concepts` namespace.
---
## 2. Public Interface
### Container Classes (Non-instantiable)
| Class | Location | Description |
|-------|----------|-------------|
| `Test` | `DTS.DAS.Concepts` | Outer partial class container |
| `Test.Module` | `DTS.DAS.Concepts` | Container for DTS generic module concepts; private constructor |
| `Test.Module.Channel` | `DTS.DAS.Concepts` | Container for DTS generic channel concepts; private constructor |
| `Test.Module.Channel.Sensor` | `DTS.DAS.Concepts` | Container for DTS generic sensor concepts; private constructor |
### Enums
#### `Test.Module.Channel.Sensor.CouplingModes`
IEPE coupling modes.
- `AC` — Description: "AC"
- `DC` — Description: "AC/DC"
#### `Test.Module.Channel.Sensor.BridgeType`
Sensor bridge configuration types. Values are bitwise flags.
- `IEPE` = `1 << 0` (1) — Sensor uses IEPE setup
- `QuarterBridge` = `1 << 1` (2) — Quarter bridge setup
- `HalfBridge` = `1 << 2` (4) — Half bridge setup
- `FullBridge` = `1 << 3` (8) — Full bridge setup
- `DigitalInput` = `1 << 4` (16)
- `SQUIB` = `1 << 5` (32)
- `TOMDigital` = `1 << 6` (64)
#### `Test.Module.Channel.Sensor.SensUnits`
Sensitivity unit types.
- `NONE` = 0 — No sensitivity units (Polynomial Sensor)
- `mV` = 1 — Sensitivity in mV with output at Capacity EU
- `mVperV` = 2 — Excitation proportional sensitivity in mV/V at Capacity EU
- `mVperVperEU` = 3 — Excitation proportional sensitivity in mV/V/EU
- `mVperEU` = 4 — Sensitivity in mV/EU
#### `Test.Module.Channel.Sensor.ZeroMethodType`
Zero calculation methods. **Explicit values are critical for legacy compatibility.**
- `AverageOverTime` = 0 — Calculate electrical zero using average over time
- `UsePreEventDiagnosticsZero` = 1 — Calculate zero using time in pre-event
- `None` = 2 — Calculate zero using injected value (Absolute Zero)
#### `Test.Module.Channel.Sensor.OriginalZeroMethodType`
Legacy version of zero method types (for compatibility, e.g., importing GM ISF).
- `AverageOverTime` — (implicit 0)
- `UsePreCalZero` — (implicit 1)
- `None` — (implicit 2)
#### `Test.Module.RecordingMode`
Recording mode options for modules.
- `InvalidArmMode` = 0 — Invalid mode
- `CircularBuffer` = 1 — Circular buffer mode (constant recording, trigger)
- `RecorderMode` = 2 — Recorder mode (start, trigger)
- `AutoCircularBufferMode` = 4 — Circular buffer with auto-rearm
- `AutoRecorderMode` = 5 — Recorder mode with auto-rearm
- `ImmediateMode` = `0x06`
- `HighPowerRecorderMode` = `0x07`
- `LowPowerRecorderMode` = `0x08`
- `ContinuousRecorderMode` = `0x09`
- `HybridRecorderMode` = `0x0A`
- `MultiHybridRecorderMode` = `0x0B`
#### `Test.Module.Channel.Sensor.ExcitationVoltageOption`
Excitation voltage options with associated magnitude attributes.
- `Undefined` = 1 — `[VoltageMagnitude(0.0)]`
- `Volt2` = 2 — `[VoltageMagnitude(2.0)]`
- `Volt2_5` = 4 — `[VoltageMagnitude(2.5)]`
- `Volt3` = 8 — `[VoltageMagnitude(3.0)]`
- `Volt5` = 16 — `[VoltageMagnitude(5.0)]`
- `Volt10` = 32 — `[VoltageMagnitude(10.0)]`
- `Volt1` = 64 — `[VoltageMagnitude(1.0)]`
### Static Methods
#### `Test.Module.GetRecordingModeFromString(string recordingMode) → RecordingMode`
Converts a string representation to its corresponding `RecordingMode` enum value. Throws `Exception` if parsing fails or input is invalid.
#### `Test.Module.Channel.Sensor.GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOption target) → double`
Extracts the numeric voltage magnitude from an `ExcitationVoltageOption` enum value by decoding the `VoltageMagnitudeAttribute`. Throws `Exception` on failure.
#### `Test.Module.Channel.Sensor.GetExcitationVoltageEnumFromMagnitude(double magnitude) → ExcitationVoltageOption`
Converts a voltage magnitude to the corresponding `ExcitationVoltageOption` enum. Throws `NotSupportedException` if no matching enum exists.
### Nested Types
#### `Test.Module.Channel.Sensor.VoltageMagnitudeAttribute`
Custom attribute for associating a numeric voltage magnitude with enum fields.
- **Property**: `Value` (double) — Returns the voltage magnitude.
- **Constructor**: `VoltageMagnitudeAttribute(double value)`
#### `Test.Module.Channel.Sensor.VoltageMagnitudeAttributeCoder`
Inherits from `AttributeCoder<ExcitationVoltageOption, VoltageMagnitudeAttribute, double>`. Used to encode/decode voltage magnitudes to/from `ExcitationVoltageOption` enum values.
- **Constructor**: `VoltageMagnitudeAttributeCoder()` — Initializes with extractor `attribute => attribute.Value`.
---
## 3. Invariants
1. **Non-instantiability**: `Test`, `Test.Module`, `Test.Module.Channel`, and `Test.Module.Channel.Sensor` are container classes with private constructors and cannot be instantiated.
2. **BridgeType bitwise flags**: `BridgeType` enum values are designed as bitwise flags (powers of 2), allowing combination via bitwise OR operations.
3. **ExcitationVoltageOption enum values are NOT bitwise flags**: Despite using powers of 2, these values represent mutually exclusive voltage options; the numeric values appear to be legacy bit positions rather than combinable flags.
4. **ZeroMethodType value stability**: The explicit integer values (0, 1, 2) for `ZeroMethodType` must remain unchanged for legacy compatibility with GM ISF imports.
5. **RecordingMode value gaps**: `RecordingMode` enum has non-contiguous values (e.g., 3 is missing between 2 and 4); code should not assume sequential ordering.
---
## 4. Dependencies
### This module depends on:
- `System` — For `Exception`, `NotSupportedException`, `Attribute` base class, `Enum.Parse`
- `System.ComponentModel` — For `DescriptionAttribute` used on enum members
- `DTS.Utilities` — For `AttributeCoder<TEnum, TAttribute, TValue>` base class (used by `VoltageMagnitudeAttributeCoder`)
### What depends on this module:
- **Unclear from source alone** — The source files contain no references to external consumers. The comment referencing "GM ISF" suggests integration with General Motors Import/Export functionality, but this is not visible in the provided sources.
---
## 5. Gotchas
1. **Legacy ZeroMethodType enum values are critical**: The comment in `Test.Module.Channel.Sensor.ZeroMethod.cs` explicitly warns: *"Lots of legacy compatibility (e.g. importing GM ISF) depends on the order/value of this enum."* Modifying these values will break backward compatibility.
2. **Duplicate zero method enums exist**: Both `ZeroMethodType` and `OriginalZeroMethodType` exist with slightly different member names (`UsePreEventDiagnosticsZero` vs `UsePreCalZero`). The relationship between them and which to use for new code is unclear from source alone.
3. **ExcitationVoltageOption enum values are non-sequential and start at 1**: The values (1, 2, 4, 8, 16, 32, 64) appear to be legacy bit positions but are not combinable flags. Code should not cast arbitrary integers to this enum.
4. **RecordingMode documentation gaps**: Several enum members (`ImmediateMode`, `HighPowerRecorderMode`, `LowPowerRecorderMode`, `ContinuousRecorderMode`, `HybridRecorderMode`, `MultiHybridRecorderMode`) have XML comments containing only `"???"`, indicating incomplete documentation.
5. **File header comment mismatch**: `Test.Module.Channel.Sensor.SensorUnits.cs` has a file header comment referencing `"Test.Module.Channel.Sensor.ExcitationVoltage.cs"` — appears to be a copy-paste error.
6. **Sensor class visibility inconsistency**: In `Test.Module.Channel.Sensor.cs`, the `Sensor` class is declared as `sealed partial class Sensor` (no explicit accessibility, defaulting to `private`), whereas in `Test.Module.Channel.Sensor.Bridge.cs` it is `public partial class Sensor`. This may cause compilation issues or indicate partial class visibility conflicts.