Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common.DAS.Concepts/Test.md

177 lines
9.0 KiB
Markdown
Raw 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-16T13:23:48.867702+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f6582d95b5debe26"
---
# Documentation: DTS.DAS.Concepts.Test Module
## 1. Purpose
This module provides a hierarchical container structure for Data Acquisition System (DAS) concepts related to test configuration. It defines enumerations and utility classes for sensor configuration (bridge types, coupling modes, excitation voltages, sensitivity units, zero methods) and module recording modes. The structure follows a containment hierarchy of `Test``Module``Channel``Sensor`, where each level serves as a static container for related concepts rather than an instantiable object.
---
## 2. Public Interface
### Container Classes (Non-instantiable)
| Class | Location | Description |
|-------|----------|-------------|
| `Test` | namespace root | Partial class; outer container. See `Test.cs` (not provided). |
| `Test.Module` | nested in `Test` | Sealed partial class; container for module concepts. Private constructor. |
| `Test.Module.Channel` | nested in `Module` | Sealed partial class; container for channel concepts. Private constructor. |
| `Test.Module.Channel.Sensor` | nested in `Channel` | Sealed partial class; container for sensor concepts. Private constructor. |
### Enumerations
#### `Test.Module.Channel.Sensor.CouplingModes`
IEPE coupling modes.
- `AC` — Description: "AC"
- `DC` — Description: "AC/DC"
#### `Test.Module.Channel.Sensor.BridgeType`
Bridge/sensor types using bit-flag values.
- `IEPE` = `1 << 0` — Description: "IEPE"
- `QuarterBridge` = `1 << 1` — Description: "Quarter"
- `HalfBridge` = `1 << 2` — Description: "Bridge-Half"
- `FullBridge` = `1 << 3` — Description: "Bridge-Full"
- `DigitalInput` = `1 << 4` — Description: "DigitalInput"
- `SQUIB` = `1 << 5` — Description: "SQUIB"
- `TOMDigital` = `1 << 6` — Description: "TOMDigital"
#### `Test.Module.Channel.Sensor.SensUnits`
Sensitivity unit types.
- `NONE` = 0 — Description: "NONE" (Polynomial Sensor)
- `mV` = 1 — Description: "mV"
- `mVperV` = 2 — Description: "mV/V"
- `mVperVperEU` = 3 — Description: "mV/V/EU"
- `mVperEU` = 4 — Description: "mV/EU"
#### `Test.Module.Channel.Sensor.ZeroMethodType`
Zero calculation methods (explicit values for legacy compatibility).
- `AverageOverTime` = 0 — Description: "Average Over Time"
- `UsePreEventDiagnosticsZero` = 1 — Description: "Use Diagnostics Zero"
- `None` = 2 — Description: "Absolute Zero"
#### `Test.Module.Channel.Sensor.OriginalZeroMethodType`
Original version of zero method types (implicit values).
- `AverageOverTime` — Description: "Average Over Time"
- `UsePreCalZero` — Description: "Use Diagnostics Zero"
- `None` — Description: "Absolute Zero"
#### `Test.Module.RecordingMode`
Recording mode options.
- `InvalidArmMode` = 0 — Description: "Invalid arm mode"
- `CircularBuffer` = 1 — Description: "Circular buffer"
- `RecorderMode` = 2 — Description: "Recorder mode"
- `AutoCircularBufferMode` = 4 — Description: "Circular buffer Multiple-Events"
- `AutoRecorderMode` = 5 — Description: "Recorder mode Multiple-Events"
- `ImmediateMode` = 0x06 — Description: "Immediate mode"
- `HighPowerRecorderMode` = 0x07 — Description: "High Power mode"
- `LowPowerRecorderMode` = 0x08 — Description: "Low Power mode"
- `ContinuousRecorderMode` = 0x09 — Description: "Continuous mode"
- `HybridRecorderMode` = 0x0A — Description: "Hybrid mode"
- `MultiHybridRecorderMode` = 0x0B — Description: "Hybrid mode Multiple-Events"
#### `Test.Module.Channel.Sensor.ExcitationVoltageOption`
Excitation voltage options with associated magnitude attributes.
- `Undefined` = 1 — `[VoltageMagnitude(0.0)]` — Description: "Undefined"
- `Volt2` = 2 — `[VoltageMagnitude(2.0)]` — Description: "2.0"
- `Volt2_5` = 4 — `[VoltageMagnitude(2.5)]` — Description: "2.5"
- `Volt3` = 8 — `[VoltageMagnitude(3.0)]` — Description: "3.0"
- `Volt5` = 16 — `[VoltageMagnitude(5.0)]` — Description: "5.0"
- `Volt10` = 32 — `[VoltageMagnitude(10.0)]` — Description: "10.0"
- `Volt1` = 64 — `[VoltageMagnitude(1.0)]` — Description: "1.0"
### Public Methods
#### `Test.Module.GetRecordingModeFromString`
```csharp
public static RecordingMode GetRecordingModeFromString(string recordingMode)
```
Converts a string representation of a recording mode enumeration into its corresponding `RecordingMode` value. Throws `Exception` if parsing fails or input is invalid.
#### `Test.Module.Channel.Sensor.GetExcitationVoltageMagnitudeFromEnum`
```csharp
public static double GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOption target)
```
Extracts the numeric voltage magnitude from an `ExcitationVoltageOption` using the `VoltageMagnitudeAttribute`. Throws `Exception` on failure.
#### `Test.Module.Channel.Sensor.GetExcitationVoltageEnumFromMagnitude`
```csharp
public static ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(double magnitude)
```
Converts a voltage magnitude to the corresponding `ExcitationVoltageOption`. Throws `NotSupportedException` if no matching enum exists.
### Nested Classes
#### `Test.Module.Channel.Sensor.VoltageMagnitudeAttribute`
```csharp
[AttributeUsage(AttributeTargets.Field)]
public class VoltageMagnitudeAttribute : System.Attribute
```
Custom attribute for attaching a `double` magnitude value to enum fields.
- Constructor: `VoltageMagnitudeAttribute(double value)`
- Property: `Value` (readonly `double`)
#### `Test.Module.Channel.Sensor.VoltageMagnitudeAttributeCoder`
```csharp
public class VoltageMagnitudeAttributeCoder : AttributeCoder<ExcitationVoltageOption, VoltageMagnitudeAttribute, double>
```
Utility class for encoding/decoding voltage magnitude values to/from `ExcitationVoltageOption` enum values. Inherits from `AttributeCoder<TEnum, TAttribute, TValue>` (defined in `DTS.Utilities`).
---
## 3. Invariants
- **Non-instantiation**: `Module`, `Channel`, and `Sensor` classes have private constructors and are not intended for instantiation. They serve as static containers only.
- **Enum value stability**: `ZeroMethodType` enum values are explicitly defined (0, 1, 2) to maintain legacy compatibility with GM ISF imports. The order/values must not be changed.
- **Bit-flag pattern**: `BridgeType` enum uses bit-shifted values (`1 << n`), suggesting these may be used as flags for bitwise operations.
- **Non-contiguous enum values**: `ExcitationVoltageOption` uses non-contiguous values (1, 2, 4, 8, 16, 32, 64) that do not follow a simple bit-flag pattern.
- `RecordingMode` uses a mix of decimal and hexadecimal explicit values.
---
## 4. Dependencies
### Imports Used by This Module
- `System` — Core .NET types, `Exception`, `NotSupportedException`, `AttributeUsage`
- `System.ComponentModel``DescriptionAttribute` for enum display names
- `DTS.Utilities``AttributeCoder<TEnum, TAttribute, TValue>` base class
### External References
- `Test.cs` — Referenced in comments but not provided; likely contains the root `Test` partial class definition.
### Dependents
- Cannot be determined from source alone. Other modules likely consume these enums and utility methods for test configuration and sensor setup.
---
## 5. Gotchas
1. **Legacy enum compatibility**: The comment in `ZeroMethodType` explicitly warns that "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**: Two enums exist for zero methods (`ZeroMethodType` and `OriginalZeroMethodType`) with slightly different member names (`UsePreEventDiagnosticsZero` vs `UsePreCalZero`). The relationship between them and which should be used for new code is unclear from source alone.
3. **Incomplete documentation**: Several `RecordingMode` enum members have "???" in their XML documentation comments, indicating incomplete or missing descriptions:
- `ImmediateMode`
- `HighPowerRecorderMode`
- `LowPowerRecorderMode`
- `ContinuousRecorderMode`
- `HybridRecorderMode`
- `MultiHybridRecorderMode`
4. **Non-standard enum values**: `ExcitationVoltageOption` enum values (1, 2, 4, 8, 16, 32, 64) are powers of 2 but `Undefined` starts at 1 rather than 0, and the values don't align with typical bit-flag usage patterns.
5. **File name mismatch**: The file `Test.Module.Channel.Sensor.SensorUnits.cs` has a header comment referencing "Test.Module.Channel.Sensor.ExcitationVoltage.cs" — appears to be a copy-paste error.