Files
DP44/enriched-qwen3-coder-next/DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts.md
2026-04-17 14:55:32 -04:00

8.7 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/Test.Module.Channel.Sensor.SensorUnits.cs
DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/Test.Module.Channel.Sensor.Bridge.cs
DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/DigitalInputScaleMultiplier.cs
DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/LinearizationFormula.cs
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: Forms enum; currently only ArbitraryLowAndHigh supported.
    • DefaultValue: double; value displayed when digital input = 0 (OFF).
    • ActiveValue: double; value displayed when digital input = 1 (ON); defaults to 1.0.
  • Constructors:
    • DigitalInputScaleMultiplier() → Initializes DefaultValue = 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 NotSupportedException on malformed input or unsupported format.
      • Uses InvariantCulture for numeric parsing.

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 (default true).
  • 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 _bIsValid flag (no getter exposed).
    • void FromSerializeString(string s, CultureInfo culture) → Parses serialized format: <Style>_<params>.
      • Supports styles: IRTraccDiagnosticsZero, IRTraccManual, IRTraccZeroMMmV, Polynomial, IRTraccAverageOverTime, IRTraccCalFactor.
      • Throws NotSupportedException for unknown styles or malformed data.
    • void FromSerializeString(string s) → Overload using InvariantCulture.
    • 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 like DigitalInput | TOMDigital may be valid.
  • DigitalInputScaleMultiplier:

    • Form must be ArbitraryLowAndHigh; no other forms are implemented.
    • DefaultValue and ActiveValue must be parseable as double; invalid values throw NotSupportedException.
  • LinearizationFormula:

    • _bIsValid is set only by FromSerializeString (via MarkValid internally); no public validation method exists.
    • FromSerializeString expects 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.Sensor being defined elsewhere (via partial class and //*** see ... *** comments).
    • NonLinearStyles enum is referenced but not defined in provided files; must be declared in another file (likely DASConcepts/NonLinearStyles.cs).
    • Uses System.ComponentModel.DescriptionAttribute for enum metadata (not used in logic, likely for UI).
  • 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 DescriptionAttribute for display names).
    • Serialization/deserialization layers for sensor metadata.

5. Gotchas

  • MMPerV naming 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).
  • _bIsValid is internal-only: No public IsValid() method is exposed despite the private _bIsValid field and commented-out IsValid() 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 to PolynomialSensitivity assignment—this may cause silent misinterpretation.
  • DigitalInputScaleMultiplier ignores null/empty input: FromDbSerializeString(null) returns silently (with comment //FIXME is this the right thing to do?), potentially masking errors.
  • BridgeType values 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, but FromDbSerializeString in DigitalInputScaleMultiplier splits on CultureInfo.InvariantCulture.TextInfo.ListSeparator (typically ','), which may conflict with decimal separators in some locales if not handled consistently upstream.
  • No validation of polynomial coefficients/exponents: FromPolynomialString does not enforce non-empty lists or valid exponents (e.g., negative exponents may be allowed).