Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common.DAS.Concepts/Test/Module/Channel/Sensor.md
2026-04-17 14:55:32 -04:00

6.4 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-16T02:04:34.963354+00:00 Qwen/Qwen3-Coder-Next-FP8 1 00bbefe8072cdb62

Sensor

Documentation Page: Sensor Unit and Excitation Voltage Handling in DTS.Common.DAS.Concepts.Test.Module.Channel.Sensor


1. Purpose

This module provides supporting infrastructure for sensor channel configuration within the DTS DAS (Data Acquisition System) concepts framework—specifically, it defines the enumeration of sensitivity unit types (SensUnits) used to interpret sensor calibration data, and provides utility methods for converting between excitation voltage options and their numeric magnitudes (e.g., 2.0 V, 5.0 V). It exists to standardize how sensor sensitivity and excitation conditions are represented and transformed across the system, enabling consistent scaling and unit conversion for physical measurements.


2. Public Interface

All public members reside within the nested type hierarchy Test.Module.Channel.Sensor.

SensUnits Enum

  • Namespace: DTS.Common.DAS.Concepts.Test.Module.Channel.Sensor
  • Definition:
    public enum SensUnits
    {
        NONE = 0,
        mV = 1,
        mVperV = 2,
        mVperVperEU = 3,
        mVperEU = 4
    }
    
  • Behavior:
    • Represents the unit types for sensor sensitivity.
    • Each value has a [Description] attribute indicating its human-readable form (e.g., "mV/V/EU" for mVperVperEU).
    • NONE indicates a polynomial sensor (no sensitivity unit).
    • Values are mutually exclusive and exhaustive for sensitivity unit specification.

GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOptions.ExcitationVoltageOption target)

  • Namespace: DTS.Common.DAS.Concepts.Test.Module.Channel.Sensor
  • Signature:
    public static double GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOptions.ExcitationVoltageOption target)
    
  • Behavior:
    • Converts a given ExcitationVoltageOptions.ExcitationVoltageOption enum value to its associated voltage magnitude (in volts).
    • Uses an internal VoltageMagnitudeAttributeCoder (not visible in source but referenced) to decode the magnitude.
    • Throws ArgumentException on failure (e.g., invalid enum or missing attribute).

GetExcitationVoltageEnumFromMagnitude(double magnitude)

  • Namespace: DTS.Common.DAS.Concepts.Test.Module.Channel.Sensor
  • Signature:
    public static ExcitationVoltageOptions.ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(double magnitude)
    
  • Behavior:
    • Converts a numeric voltage magnitude (e.g., 5.0) to the corresponding ExcitationVoltageOptions.ExcitationVoltageOption enum value.
    • Uses VoltageMagnitudeAttributeCoder.EncodeAttributeValue() internally.
    • On failure (e.g., magnitude not supported), logs via APILogger and returns ExcitationVoltageOptions.ExcitationVoltageOption.Undefined.

Note

: The ExcitationVoltageOptions type and its VoltageMagnitudeAttribute/VoltageMagnitudeAttributeCoder classes are referenced but not defined in the provided source files. Their full definitions must be found elsewhere (e.g., in DTS.Common.Enums or related files).


3. Invariants

  • SensUnits enum values are exhaustive and mutually exclusive for sensitivity unit specification; no other unit types are defined in this module.
  • GetExcitationVoltageMagnitudeFromEnum requires a valid ExcitationVoltageOptions.ExcitationVoltageOption field with a VoltageMagnitudeAttribute; otherwise, it throws.
  • GetExcitationVoltageEnumFromMagnitude is permissive: it returns Undefined on failure instead of throwing, and always logs the failure.
  • Voltage magnitudes are assumed to be in volts (V).
  • The mapping between enum values and magnitudes is fixed and pre-defined (e.g., Volt55.0), and enforced by VoltageMagnitudeAttribute.

4. Dependencies

Internal Dependencies (within this module):

  • DTS.Common.DAS.Concepts.Test.Module.Channel.Sensor (nested class hierarchy).
  • System.ComponentModel (for [Description] attributes).
  • DTS.Common.Enums (contains ExcitationVoltageOptions type).
  • DTS.Common.Utilities.Logging (for APILogger).

External Dependencies:

  • DTS.Common.Enums.ExcitationVoltageOptions — defines the ExcitationVoltageOption enum and VoltageMagnitudeAttribute (not included here).
  • DTS.Common.Utilities.AttributeCoder<TEnum, TAttr, TVal> — base class used by VoltageMagnitudeAttributeCoder (not included here).

Dependents:

  • Any code that configures or interprets sensor sensitivity (e.g., calibration, scaling, or unit conversion logic in DAS modules).
  • Hardware abstraction layers that set or read excitation voltage settings.

5. Gotchas

  • Incomplete Source: The ExcitationVoltageOptions type and its VoltageMagnitudeAttribute/VoltageMagnitudeAttributeCoder are not defined in the provided files. Their behavior and supported enum values are inferred from usage and comments, but cannot be verified from this source alone.
  • Commented-Out Code: The ExcitationVoltageOption enum and related classes (VoltageMagnitudeAttribute, VoltageMagnitudeAttributeCoder) are commented out in ExcitationVoltage.cs. This suggests possible deprecation or refactoring—do not assume active use unless confirmed by other files.
  • Error Handling Asymmetry: GetExcitationVoltageMagnitudeFromEnum throws on error, while GetExcitationVoltageEnumFromMagnitude silently returns Undefined. This inconsistency may lead to unhandled exceptions if callers assume symmetric behavior.
  • No Validation on Magnitude Input: GetExcitationVoltageEnumFromMagnitude does not validate input range (e.g., negative voltages), potentially returning Undefined for invalid values without clear indication of why.
  • Hardcoded Enum Values: The SensUnits enum uses explicit integer values (0, 1, 2, …). Changing or inserting values may break serialization or persistence if values are stored externally (e.g., in config files or databases).

None identified from source alone for SensUnits behavior, but the excitation voltage handling is partially obscured by commented-out code and missing definitions.