8.7 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||
|---|---|---|---|---|---|---|---|---|
|
2026-04-16T04:29:46.893362+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 50ada406a17a3727 |
Documentation: Sensor & Linearization Concepts Module
1. Purpose
This module defines core data structures and enumerations used to represent sensor configuration and signal linearization behavior within the DatabaseImporter subsystem of the DTS DataPRO system. It provides strongly-typed representations of sensor sensitivity units (SensUnits), bridge configurations (BridgeType), digital input scaling (DigitalInputScaleMultiplier), and various linearization formulae (LinearizationFormula)—all derived from legacy database serialization formats. These constructs enable consistent interpretation and persistence of sensor metadata during database import operations, bridging historical DTS-specific formats with modern .NET type safety.
2. Public Interface
Test.Module.Channel.Sensor.SensUnits (enum)
- Definition:
public enum SensUnits - Values:
NONE = 0→ Polynomial sensor with no sensitivity units.mV = 1→ Sensitivity in millivolts at full-scale (Capacity EU).mVperV = 2→ Excitation-proportional sensitivity in mV/V at full-scale.mVperVperEU = 3→ Excitation-proportional sensitivity per engineering unit (mV/V/EU).mVperEU = 4→ Sensitivity in mV per engineering unit.
- Behavior: Encodes the unit type for sensor sensitivity; used to interpret sensitivity values in configuration.
Test.Module.Channel.Sensor.BridgeType (enum)
- Definition:
public enum BridgeType - Values (bitmask flags):
IEPE = 1 << 0→ IEPE (Integrated Electronics Piezo Electric) sensor setup.QuarterBridge = 1 << 1→ Quarter-bridge configuration.HalfBridge = 1 << 2→ Half-bridge configuration.FullBridge = 1 << 3→ Full-bridge configuration.DigitalInput = 1 << 4→ Digital input mode.SQUIB = 1 << 5→ Squib (pyrotechnic) output setup.TOMDigital = 1 << 6→ TOM (Test Output Module) digital output.HalfBridge_SigPlus = 1 << 7→ G5 half-bridge with signal-plus wiring.
- Behavior: Represents physical bridge/wiring topology; supports bitwise combinations.
DigitalInputScaleMultiplier (class)
- Definition:
public class DigitalInputScaleMultiplier - Properties:
Form:Formsenum; currently onlyArbitraryLowAndHighsupported.DefaultValue:double; value displayed when digital input = 0 (OFF).ActiveValue:double; value displayed when digital input = 1 (ON); defaults to1.0.
- Constructors:
DigitalInputScaleMultiplier()→ InitializesDefaultValue = 0.0.DigitalInputScaleMultiplier(DigitalInputScaleMultiplier copy)→ Copy constructor.
- Methods:
void FromDbSerializeString(string s)→ Parses serialized string (e.g.,"ArbitraryLowAndHigh,0.0,5.0") into object state.- Throws
NotSupportedExceptionon malformed input or unsupported format. - Uses
InvariantCulturefor numeric parsing.
- Throws
LinearizationFormula (class)
- Definition:
public class LinearizationFormula - Properties:
NonLinearStyle:NonLinearStyles(not defined in provided files; inferred from usage).PolynomialSensitivity:double; sensitivity for polynomial models.LinearizationExponent:double; exponent in power-law models.MMPerV:double; millimeters per volt (note: comment indicates variable name is inaccurate).MVAt0MM:double; millivolts at zero millimeters.Slope,Intercept:double; linear model parameters.CalibrationFactor:double; calibration coefficient.ZeroPositionIntercept:double; intercept at zero position.UsemVOverVForPolys:bool; flag for polynomial unit preference (defaulttrue).
- Constructors:
LinearizationFormula()→ Initializes default state (e.g.,_coefficients = [0,0,0,0],_exponents = [0,1,2,3]).LinearizationFormula(LinearizationFormula copy)→ Copy constructor.
- Methods:
void MarkValid(bool bValid)→ Sets internal_bIsValidflag (no getter exposed).void FromSerializeString(string s, CultureInfo culture)→ Parses serialized format:<Style>_<params>.- Supports styles:
IRTraccDiagnosticsZero,IRTraccManual,IRTraccZeroMMmV,Polynomial,IRTraccAverageOverTime,IRTraccCalFactor. - Throws
NotSupportedExceptionfor unknown styles or malformed data.
- Supports styles:
void FromSerializeString(string s)→ Overload usingInvariantCulture.- Private helper methods (called by
FromSerializeString):FromIRTraccCalFactorString,FromIRTraccDiagnosticZeroString,FromIRTraccManualString,FromIRTraccAverageOverTimeString,FromIRTraccZeroMMmVString,FromPolynomialString
→ Parse style-specific parameter strings (e.g.,"Slope x Exponent x Intercept").
3. Invariants
-
SensUnits:- Values are mutually exclusive and non-overlapping (no bitwise combinations).
NONE(0) is reserved for polynomial sensors lacking sensitivity units.
-
BridgeType:- Values are bitmask flags; multiple types may be combined via bitwise OR.
- Only one physical bridge type (e.g.,
QuarterBridge,HalfBridge,FullBridge) should be active per sensor, though combinations likeDigitalInput | TOMDigitalmay be valid.
-
DigitalInputScaleMultiplier:Formmust beArbitraryLowAndHigh; no other forms are implemented.DefaultValueandActiveValuemust be parseable asdouble; invalid values throwNotSupportedException.
-
LinearizationFormula:_bIsValidis set only byFromSerializeString(viaMarkValidinternally); no public validation method exists.FromSerializeStringexpects format<Style>_<param_string>; parsing fails if tokens are missing or malformed.- Polynomial parsing (
FromPolynomialString) has ambiguous behavior: if a token lacks'x', it may be interpreted as a special key ("S"or"mV") instead of coefficient/exponent.
4. Dependencies
-
Internal Dependencies:
- Relies on
Test.Module.Channel.Sensorbeing defined elsewhere (viapartial classand//*** see ... ***comments). NonLinearStylesenum is referenced but not defined in provided files; must be declared in another file (likelyDASConcepts/NonLinearStyles.cs).- Uses
System.ComponentModel.DescriptionAttributefor enum metadata (not used in logic, likely for UI).
- Relies on
-
External Dependencies:
System(core types,CultureInfo,double,List<T>,string).System.Globalization(InvariantCulture,NumberStyles).
-
Depended Upon By:
- Database import logic (e.g., parsing sensor configuration from legacy DB strings).
- UI components (via
DescriptionAttributefor display names). - Serialization/deserialization layers for sensor metadata.
5. Gotchas
MMPerVnaming is misleading: Comment explicitly states "THIS IS MM/V, (UI has already been updated, we need to update the variable name)"—the variable name does not match its meaning (millimeters per volt, not millivolts per volt)._bIsValidis internal-only: No publicIsValid()method is exposed despite the private_bIsValidfield and commented-outIsValid()method.- Polynomial parsing ambiguity: In
FromPolynomialString, tokens without'x'are treated as special keys ("S"/"mV"), but tokens with'x'but only one part (e.g.,"2") fall through toPolynomialSensitivityassignment—this may cause silent misinterpretation. DigitalInputScaleMultiplierignores null/empty input:FromDbSerializeString(null)returns silently (with comment//FIXME is this the right thing to do?), potentially masking errors.BridgeTypevalues use bit shifts: While designed for bitwise combination, the enum is not marked[Flags], so tools may not display combined values intuitively.- Culture sensitivity: All numeric parsing uses
InvariantCulture, butFromDbSerializeStringinDigitalInputScaleMultipliersplits onCultureInfo.InvariantCulture.TextInfo.ListSeparator(typically','), which may conflict with decimal separators in some locales if not handled consistently upstream. - No validation of polynomial coefficients/exponents:
FromPolynomialStringdoes not enforce non-empty lists or valid exponents (e.g., negative exponents may be allowed).