6.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
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"formVperVperEU). NONEindicates 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.ExcitationVoltageOptionenum value to its associated voltage magnitude (in volts). - Uses an internal
VoltageMagnitudeAttributeCoder(not visible in source but referenced) to decode the magnitude. - Throws
ArgumentExceptionon failure (e.g., invalid enum or missing attribute).
- Converts a given
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 correspondingExcitationVoltageOptions.ExcitationVoltageOptionenum value. - Uses
VoltageMagnitudeAttributeCoder.EncodeAttributeValue()internally. - On failure (e.g., magnitude not supported), logs via
APILoggerand returnsExcitationVoltageOptions.ExcitationVoltageOption.Undefined.
- Converts a numeric voltage magnitude (e.g.,
Note
: The
ExcitationVoltageOptionstype and itsVoltageMagnitudeAttribute/VoltageMagnitudeAttributeCoderclasses are referenced but not defined in the provided source files. Their full definitions must be found elsewhere (e.g., inDTS.Common.Enumsor related files).
3. Invariants
SensUnitsenum values are exhaustive and mutually exclusive for sensitivity unit specification; no other unit types are defined in this module.GetExcitationVoltageMagnitudeFromEnumrequires a validExcitationVoltageOptions.ExcitationVoltageOptionfield with aVoltageMagnitudeAttribute; otherwise, it throws.GetExcitationVoltageEnumFromMagnitudeis permissive: it returnsUndefinedon 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.,
Volt5→5.0), and enforced byVoltageMagnitudeAttribute.
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(containsExcitationVoltageOptionstype).DTS.Common.Utilities.Logging(forAPILogger).
External Dependencies:
DTS.Common.Enums.ExcitationVoltageOptions— defines theExcitationVoltageOptionenum andVoltageMagnitudeAttribute(not included here).DTS.Common.Utilities.AttributeCoder<TEnum, TAttr, TVal>— base class used byVoltageMagnitudeAttributeCoder(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
ExcitationVoltageOptionstype and itsVoltageMagnitudeAttribute/VoltageMagnitudeAttributeCoderare 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
ExcitationVoltageOptionenum and related classes (VoltageMagnitudeAttribute,VoltageMagnitudeAttributeCoder) are commented out inExcitationVoltage.cs. This suggests possible deprecation or refactoring—do not assume active use unless confirmed by other files. - Error Handling Asymmetry:
GetExcitationVoltageMagnitudeFromEnumthrows on error, whileGetExcitationVoltageEnumFromMagnitudesilently returnsUndefined. This inconsistency may lead to unhandled exceptions if callers assume symmetric behavior. - No Validation on Magnitude Input:
GetExcitationVoltageEnumFromMagnitudedoes not validate input range (e.g., negative voltages), potentially returningUndefinedfor invalid values without clear indication of why. - Hardcoded Enum Values: The
SensUnitsenum 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
SensUnitsbehavior, but the excitation voltage handling is partially obscured by commented-out code and missing definitions.