Files
2026-04-17 14:55:32 -04:00

4.7 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common.DAS.Concepts/Test/Module/Channel/Sensor/SensorUnits.cs
Common/DTS.Common.DAS.Concepts/Test/Module/Channel/Sensor/ExcitationVoltage.cs
2026-04-16T11:39:55.789807+00:00 zai-org/GLM-5-FP8 1 00bbefe8072cdb62

Documentation: Test.Module.Channel.Sensor

1. Purpose

This module defines sensor-related concepts within the DAS (Data Acquisition System) domain model. Specifically, it provides an enumeration for sensitivity unit types (SensUnits) and utility methods for converting between excitation voltage enum values and their numeric magnitudes. The module is part of a larger nested class hierarchy representing test configuration concepts for channel/sensor setup.

2. Public Interface

Enum: Test.Module.Channel.Sensor.SensUnits

Defines all available sensitivity unit types for sensor configuration.

Member Value Description Attribute Purpose
NONE 0 "NONE" No Sensitivity Units (Polynomial Sensor)
mV 1 "mV" Sensitivity expressed in mV with output at Capacity EU
mVperV 2 "mV/V" Excitation proportional sensitivity expressed in mV/V with output at Capacity EU
mVperVperEU 3 "mV/V/EU" Excitation proportional sensitivity expressed in mV/V/EU
mVperEU 4 "mV/EU" Sensitivity expressed in mV/EU

Method: GetExcitationVoltageMagnitudeFromEnum

Signature:

public static double GetExcitationVoltageMagnitudeFromEnum(
    ExcitationVoltageOptions.ExcitationVoltageOption target)

Behavior: Converts an ExcitationVoltageOptions.ExcitationVoltageOption enum value to its associated numeric voltage magnitude (in volts) using a VoltageMagnitudeAttributeCoder. Throws ArgumentException if the conversion fails.


Method: GetExcitationVoltageEnumFromMagnitude

Signature:

public static ExcitationVoltageOptions.ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(
    double magnitude)

Behavior: Converts a numeric voltage magnitude to the corresponding ExcitationVoltageOptions.ExcitationVoltageOption enum value. On failure, logs the exception via APILogger.Log and returns ExcitationVoltageOptions.ExcitationVoltageOption.Undefined rather than throwing.

3. Invariants

  • The SensUnits enum values are explicitly assigned sequential integers starting at 0.
  • The Module class is declared sealed, preventing further inheritance.
  • The ExcitationVoltageOptions.ExcitationVoltageOption type (defined externally in DTS.Common.Enums) is expected to have an associated VoltageMagnitudeAttribute for each enum member that these methods can decode/encode.
  • The two conversion methods have asymmetric error handling: GetExcitationVoltageMagnitudeFromEnum throws on failure, while GetExcitationVoltageEnumFromMagnitude returns Undefined and logs.

4. Dependencies

This module depends on:

  • System - Core .NET types
  • System.ComponentModel - DescriptionAttribute used on enum members
  • DTS.Common.Enums - Provides ExcitationVoltageOptions.ExcitationVoltageOption and ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder
  • DTS.Common.Utilities - Likely provides the base AttributeCoder<TEnum, TAttribute, TValue> pattern (inferred from usage)
  • DTS.Common.Utilities.Logging - Provides APILogger for error logging

What depends on this module:

  • Cannot be determined from source alone. The partial class structure suggests other files extend Test, Test.Module, Test.Module.Channel, and Test.Module.Channel.Sensor.

5. Gotchas

  1. Commented-out code suggests refactoring: The ExcitationVoltage.cs file contains a fully commented-out ExcitationVoltageOption enum and related classes (VoltageMagnitudeAttribute, VoltageMagnitudeAttributeCoder). The active methods reference ExcitationVoltageOptions.ExcitationVoltageOption from DTS.Common.Enums, indicating this functionality was moved to a different namespace. The commented code may cause confusion about where the enum is actually defined.

  2. Asymmetric error handling: The two conversion methods handle errors differently. GetExcitationVoltageMagnitudeFromEnum throws an ArgumentException (wrapping the inner exception), while GetExcitationVoltageEnumFromMagnitude silently logs and returns Undefined. Callers must handle both throwing and non-throwing failure modes.

  3. Partial class structure: The Test, Module, Channel, and Sensor classes are all partial, spread across multiple files (indicated by comments like // *** see Test.cs ***). The full API surface requires examining all partial file definitions.