Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Enums/Sensors.md
2026-04-17 14:55:32 -04:00

320 lines
13 KiB
Markdown

---
source_files:
- Common/DTS.Common/Enums/Sensors/SensorChangeTypes.cs
- Common/DTS.Common/Enums/Sensors/SensorStatus.cs
- Common/DTS.Common/Enums/Sensors/PossibleFilters.cs
- Common/DTS.Common/Enums/Sensors/LinearizationFormula.cs
- Common/DTS.Common/Enums/Sensors/CalibrationEnforcement.cs
- Common/DTS.Common/Enums/Sensors/SensitivityInspection.cs
- Common/DTS.Common/Enums/Sensors/CalibrationBehaviors.cs
- Common/DTS.Common/Enums/Sensors/InitialOffsetTypes.cs
- Common/DTS.Common/Enums/Sensors/FilterClassType.cs
- Common/DTS.Common/Enums/Sensors/ZeroMethodType.cs
- Common/DTS.Common/Enums/Sensors/CSVImportTags.cs
- Common/DTS.Common/Enums/Sensors/SensorConstants.cs
generated_at: "2026-04-16T03:20:17.284188+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "fb4f3c61e14ed27e"
---
# Sensor Enums and Constants Documentation
## 1. Purpose
This module defines core enumerations and static constants used throughout the DTS system to represent sensor metadata, configuration, calibration behavior, filtering, and import/export semantics. It serves as the canonical source of truth for sensor-related data types, ensuring consistency across data import/export (especially CSV), channel configuration, calibration enforcement, and system behavior validation. The enums and constants support legacy compatibility, versioned CSV schema evolution, and domain-specific requirements (e.g., GM-ISF, TSR AIR, IR-TRACC).
## 2. Public Interface
### Enumerations
#### `SensorChangeTypes`
- **`OffsetTolerance`**: Represents a change type related to sensor offset tolerance.
#### `SensorStatus`
- **`Available`**: Sensor is available for use.
- **`InUse`**: Sensor is currently in use.
- **`OutForService`**: Sensor is out for service.
- **`OutForCalibration`**: Sensor is out for calibration.
- **`Retired`**: Sensor is retired and no longer usable.
#### `PossibleFilters`
- **`All`**: Include all channel/sensor types.
- **`Analog`**: Analog channels.
- **`Squib`**: Squib channels.
- **`DigitalIn`**: Digital input channels.
- **`DigitalOut`**: Digital output channels.
- **`UART`**: UART channels.
- **`StreamOut`**: Stream output channels.
- **`StreamIn`**: Stream input channels.
- **`CAN`**: CAN channels.
#### `NonLinearStyles`
- **`IRTraccManual`**
- **`IRTraccDiagnosticsZero`**
- **`IRTraccZeroMMmV`**
- **`IRTraccAverageOverTime`**
- **`Polynomial`**
- **`IRTraccCalFactor`**
#### `NonLinearSLICEWareStyles`
- **`Manual`**
- **`DiagnosticZeroMMmV`**
- **`ZeroMMmV`**
- **`AverageOverTime`**
- **`Polynomial`**
#### `CalibrationEnforcement`
- **`None`**: No calibration enforcement.
- **`NonLinear`**: Enforce non-linear calibration.
- **`Linear`**: Enforce linear calibration.
#### `SensitivityInspectionType`
- **`NotSet`**: Inspection status not set (value `0`).
- **`Required`**: Inspection required (value `1`).
- **`Cleared`**: Inspection cleared (value `2`).
#### `CalibrationBehaviors`
- **`LinearIfAvailable`**: Prefer linear calibration if available.
- **`NonLinearIfAvailable`**: Prefer non-linear calibration if available.
- **`UseBothIfAvailable`**: Use both linear and non-linear calibrations if available.
#### `InitialOffsetTypes`
- **`None`**: No initial offset (value `0`).
- **`EU`**: Offset specified in engineering units (EU) (value `1`).
- **`EUAtMV`**: Offset specified in EU at a specific mV (value `2`).
- **`LHS`**: Left-hand side offset (value `3`).
- **`RHS`**: Right-hand side offset (value `4`).
- **`FRONTAL`**: Frontal offset (value `5`).
#### `FilterClassType`
- **`None`**: No filter (code `P` unless `UseZeroForUnfiltered` is true, then `0`) (value `0`).
- **`AdHoc`**: Ad-hoc filter (value `-1`).
- **`Unfiltered`**: Unfiltered (code `0`) (value `-2`).
- **`CFC10`**: 17 Hz cutoff (code `17`) (value `17`).
- **`CFC60`**: 100 Hz cutoff, code `D` (value `100`).
- **`CFC180`**: 300 Hz cutoff, code `C` (value `300`).
- **`CFC600`**: 1000 Hz cutoff, code `B` (value `1000`).
- **`CFC1000`**: 1650 Hz cutoff, code `A` (value `1650`).
#### `ZeroMethodType`
- **`AverageOverTime`**: Calculate zero using average over time (value `0`).
- **`UsePreEventDiagnosticsZero`**: Calculate zero using pre-event diagnostics (value `1`).
- **`None`**: No software zero (injected value) (value `2`).
#### `OriginalZeroMethodType`
- **`AverageOverTime`**
- **`UsePreCalZero`**
- **`None`**
#### `CSVImportTags.Tags`
A large set of tags used for CSV import/export, each annotated with `[Display(Name = "...")]` and `[Version(n)]`. Key examples:
- **`DatabaseReferenceNumber`** (v0)
- **`SensorSN`** (v0)
- **`ChannelName`** (v0)
- **`FilterClass`** (v0)
- **`SoftwareZeroReference`** (v0)
- **`Version`** (v1)
- **`InitialOffset`** (v2)
- **`ZeroMethod`** (v2)
- **`DASSerialNumber`** (v4)
- **`ClockMasterInputType`** (v5)
- **`PTPDomainId`** (v6)
Static methods:
- **`IsSensorTag(int version)`**: Returns `true` if `version` is in `{0, 2, 3, 4}`.
- **`GetVersionTags(int version)`**: Returns array of `Tags` valid for given `version`.
- **`GetStringForTag(Tags tag)`**: Returns display string for `tag`.
- **`GetTagForString(string s)`**: Returns `Tags` for display string `s`; `Tags.Unknown` if not found.
- **`GetVersionForTag(Tags t)`**: Returns version `int` for `tag`; `int.MaxValue` if not annotated.
#### `SensorConstants.SensorSettings`
Enum of sensor configuration settings (used internally, not for serialization):
- **`Range`, `CFC`, `Polarity`, `Position`, `LimitDuration` (deprecated), `Duration` (deprecated), `Delay` (deprecated), `OutputMode`, `SQMode`, `DIMode`, `DefaultValue`, `ActiveValue`**
- **`SquibLimitDuration`, `SquibDuration`, `SquibDelay`, `DigitalOutLimitDuration`, `DigitalOutDuration`, `DigitalOutDelay`, `SquibCurrent`**
- **`ZeroMethod`, `ZeroMethodStart`, `ZeroMethodEnd`, `UserValue1`, `UserValue2`, `UserValue3`, `InitialOffset`, `FilterClass`**
- **`UartBaudRate`, `UartDataBits`, `UartStopBits`, `UartParity`, `UartFlowControl`, `UartDataFormat`**
- **`StreamOutUDPProfile`, `StreamOutUDPAddress`, `StreamOutUDPTimeChannelId`, `StreamOutUDPDataChannelId`, `StreamOutUDPTmNSConfig`, `StreamOutIRIGTimeDataPacketIntervalMs`**
- **`StreamInUDPAddress`, `ACCouplingEnabled`, `BridgeType`**
#### `SensorConstants.SensorType`
- **`Analog`**
- **`DigitalIn`**
- **`DigitalOut`**
- **`Squib`**
- **`Clock`**
- **`UART`**
- **`StreamOut`**
- **`StreamIn`**
- **`Thermocoupler`**
#### `SensorConstants.SensUnits`
- **`NONE`**: Polynomial sensor (value `0`)
- **`mV`**: Sensitivity in mV (value `1`)
- **`mVperV`**: Sensitivity in mV/V (value `2`)
- **`mVperVperEU`**: Sensitivity in mV/V/EU (value `3`)
- **`mVperEU`**: Sensitivity in mV/EU (value `4`)
#### `SensorConstants.BridgeType`
Bitmask enum:
- **`IEPE`** (`1 << 0`)
- **`QuarterBridge`** (`1 << 1`)
- **`HalfBridge`** (`1 << 2`)
- **`FullBridge`** (`1 << 3`)
- **`DigitalInput`** (`1 << 4`)
- **`SQUIB`** (`1 << 5`)
- **`TOMDigital`** (`1 << 6`)
- **`HalfBridge_SigPlus`** (`1 << 7`)
- **`RTC`** (`1 << 8`)
- **`UART`** (`1 << 9`)
- **`StreamOut`** (`1 << 10`)
- **`StreamIn`** (`1 << 11`)
- **`Thermocoupler`** (`1 << 12`)
- **`CAN`** (`1 << 13`)
Static helpers:
- **`ConvertIntToBridgeType(int bridge)`**: Maps integer to `BridgeType`.
- **`ConvertBridgeToInt(BridgeType bridge)`**: Maps `BridgeType` to integer (legacy DB storage).
#### `SensorConstants.SensorCalPolicy`
- **`AllowAlways`**: Allow sensors regardless of calibration status.
- **`DONT_ALLOW`**: Reject out-of-cal sensors.
#### `SensorConstants.CouplingModes`
- **`AC`** (`0`)
- **`DC`**
### Constants (Static Fields)
#### Global Settings (Runtime Cache)
- **`UseInitSignalTOM`**: `bool`, default `false`.
- **`UseSensorFirstUseDate`**: `bool`, default `false`.
- **`DontAllowDataCollectionIfOverused`**: `bool`, default `false`.
- **`AllowInspectBeforeUse`**: `bool`, default `false`.
- **`UsageRemainingForWarning`**: `int`, default `5`.
- **`DefaultMaxUsageAllowed`**: `int`, default `2500`.
- **`UseISOCodeFilterMapping`**: `bool`, default `true`.
- **`DefaultZeroMethodType`**: `ZeroMethodType`, default `AverageOverTime`.
- **`DefaultZeroMethodStart`**: `double`, default `-0.05`.
- **`DefaultZeroMethodEnd`**: `double`, default `-0.02`.
- **`DefaultRangeHiG`**: `double`, default `400`.
- **`DefaultRangeLowG`**: `double`, default `64`.
- **`DefaultRangeLowGDisplay`**: `double`, default `50`.
- **`DefaultRangeARS`**: `double`, default `2000`.
- **`DefaultRangeTemperature`**: `double`, default `85`.
- **`DefaultRangeHumidity`**: `double`, default `100`.
- **`DefaultRangePressure`**: `double`, default `16`.
- **`SensorCalOutOfDateWarningPeriodDays`**: `int`, default `14`.
- **`SensorCalPolicyCurrent`**: `SensorCalPolicy`, default `DONT_ALLOW`.
- **`DisableAutoSense`**: `bool`, default `false`.
- **`DefaultBridgeOffsetMVTolLow/High`**: `-100` / `100`.
- **`DefaultIEPEOffsetMVTolLow/High`**: `-2000` / `2000`.
#### IR-TRACC Constants
- **`δThorax`**: `15.65`
- **`δAbdomen`**: `0`
- **`D0Thorax`**: `141.8`
- **`D0Abdomen`**: `150.9`
- **`δThoraxLower`**: `-15.65`
- **`D0ThoraxLower`**: `141.8`
#### Unit Strings
- **`VOLTAGE_INSERTION_UNIT`**: `"mV"`
- **`TSRAIR_ACCEL_UNIT`**: `"g"`
- **`TSRAIR_ARS_UNIT`**: `"deg/sec"`
- **`TSRAIR_TEMPERATURE_UNIT`**: `"C"`
- **`TSRAIR_HUMIDITY_UNIT`**: `"%"`
- **`TSRAIR_PRESSURE_UNIT`**: `"PSI"`
- **`DEGREES`**: `"deg"`
- **`DEGREE_ANGLE`**: `"deg-ang"`
- **`POTUnits`**: `new[] { "deg", "deg-ang" }`
#### Bridge Resistance Limits
- **`MIN_BRIDGE_RESISTANCE_OHMS`**: `1`
- **`MAX_BRIDGE_RESISTANCE_OHMS`**: `32000`
#### Sensor Defaults
- **`SENSOR_FIRST_USE_DEFAULT`**: `false`
- **`ALLOW_INSPECT_BEFORE_USE_DEFAULT`**: `false`
- **`SENSOR_OVERUSE_DEFAULT`**: `false`
- **`SENSOR_USAGE_REMAINING_FOR_WARNING_DEFAULT`**: `5`
- **`SENSOR_DEFAULT_MAX_USAGE_DEFAULT`**: `2500`
- **`CAL_SENSOR_POLICY_DEFAULT`**: `DONT_ALLOW`
- **`CAL_SENSOR_POLICY_WARNING_DAYS_DEFAULT`**: `14`
#### Squib Defaults (Legacy)
- **`SQUIB_DELAY_CONSTANT`**: `0`
- **`SQUIB_LIMIT_DURATION_CONSTANT`**: `true`
- **`SQUIB_DURATION_CONSTANT`**: `10`
- **`SQUIB_LOW_TOLERANCE_CONSTANT`**: `1`
- **`SQUIB_HIGH_TOLERANCE_CONSTANT`**: `10`
- **`SQUIB_FIREMODE_CONSTANT`**: `SquibFireMode.CAP`
- **`SQUIB_CURRENT_CONSTANT`**: `1.5`
#### Digital Output Defaults (Legacy)
- **`DIGITALOUT_MODE_CONSTANT`**: `DigitalOutputModes.FVLH`
- **`DIGITALOUT_DELAY_CONSTANT`**: `0`
- **`DIGITALOUT_LIMITDURATION_CONSTANT`**: `true`
- **`DIGITALOUT_DURATION_CONSTANT`**: `10`
#### UART Defaults (Legacy)
- **`UART_DATABITS_CONSTANT`**: `8`
- **`UART_STOPBITS_CONSTANT`**: `StopBits.One`
- **`UART_PARITY_CONSTANT`**: `Parity.None`
- **`UART_FLOWCONTROL_CONSTANT`**: `Handshake.None`
- **`UART_DATAFORMAT_CONSTANT`**: `UartDataFormat.Binary`
#### Stream Defaults (Legacy)
- **`STREAMIN_ADDRESS_CONSTANT`**: `"UDP://239.1.2.10:8400"`
- **`STREAMOUT_PROFILE_CONSTANT`**: `UDPStreamProfile.CH10_PCM_128BIT_2HDR`
- **`STREAMOUT_ADDRESS_CONSTANT`**: `"UDP://239.1.2.10:8400"`
- **`STREAMOUT_TIME_CHID_CONSTANT`**: `1`
- **`STREAMOUT_DATA_CHID_CONSTANT`**: `3`
- **`STREAMOUT_TMNS_CONFIG_CONSTANT`**: `"(1,6,60,0,0,0,0,0)"`
- **`STREAMOUT_IRIG_TDP_INTERVAL_CONSTANT`**: `500`
#### Test-Specific Serial Number Prefixes
- **`TEST_SPECIFIC_DOUT`**: `"TSD_"`
- **`TEST_SPECIFIC_SQUIB`**: `"TSQ_"`
- **`TEST_SPECIFIC_DIN`**: `"TSI_"`
- **`TEST_SPECIFIC_EMB`**: `"TSA_"`
- **`TEST_SPECIFIC_THERMO`**: `"TST_"`
- **`TEST_SPECIFIC_EMB_CLK`**: `"TSC_"`
- **`TEST_SPECIFIC_UART`**: `"TSU_"`
- **`TEST_SPECIFIC_STREAM_OUT`**: `"TSS_"`
- **`TEST_SPECIFIC_STREAM_IN`**: `"TSN_"`
- **`TEST_SPECIFIC_CAN`**: `"TSF_"`
Static helper methods:
- **`IsTestSpecificDigitalOut(string sn)`**
- **`IsTestSpecificSquib(string sn)`**
- **`IsTestSpecificDigitalIn(string sn)`**
- **`IsTestSpecificEmbedded(string sn)`**
- **`IsTestSpecificThermoCouple(string sn)`**
- **`IsTestSpecificEmbeddedClock(string sn)`**
- **`IsTestSpecificStreamOut(string sn)`**
- **`IsTestSpecificStreamIn(string sn)`**
- **`IsTestSpecificUart(string sn)`**
- **`IsTestSpecificThermocoupler(string sn)`**
- **`IsTestSpecificCAN(string sn)`**
#### Other Constants
- **`LinearValuesSeparator`**: `"||"` (used for encoding added linear calibration with non-linear sensor)
- **`EditObjectSensorChannelDragFormat`**: `"EditObjectSensorsChannelTable.UserData []"`
- **`TSRAirTemperatureChannel`**: `9`
- **`TSRAirHumidityChannel`**: `10`
- **`TSRAirPressureChannel`**: `11`
- **`ARS2000`**, **`LowG64`**: `2000`, `64`
- **`HighG`**, **`LowG`**, **`ARS`**, **`Atm`**: `"-High g"`, `"-Low g"`, `"-ARS"`, `"-Atm"`
- **`IsTSRAirHighGChannel`, `IsTSRAirLowGChannel`, `IsTSRAirARSChannel`, `IsTSRAirAtmChannel`, `IsTSRAirHumidityChannel`**: Helper methods.
## 3. Invariants
- **CSV Import Versions**: Valid versions are `0` through `6`. Only versions `{0, 2, 3, 4}` are considered sensor tag versions (`IsSensorTag`).
- **`ZeroMethodType` ordering**: The values `0`, `1`, `2` are critical for legacy compatibility (e.g., GM-ISF import).
- **`BridgeType` bitmask**: Values are powers of two; `ConvertBridgeToInt` maps to legacy integer storage (e.g., `FullBridge``3`).
- **`SensitivityInspectionType` values**: `NotSet=0`, `Required=1`, `Cleared=2`.
- **`FilterClassType` codes**: Values map to SAE filter class codes (e.g., `CFC60``100` → code `D`).
- **`CalibrationEnforcement` and `CalibrationBehaviors`**: Must be used consistently with `NonLinearStyles` and `NonLinearSLICEWareStyles`.
- **`InitialOffsetTypes`**: Values `EU`, `EUAtMV`, `LHS`, `RHS`, `FRONTAL` are mutually exclusive and context-dependent.
- **`