14 KiB
14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T04:58:51.573580+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 56b13794f7fbf4fa |
Documentation: DatabaseExport Sensor Data Types (Version 57)
1. Purpose
This module defines data structures and types used to represent sensor configurations, calibration metadata, and related settings for legacy database version 57 in the DataPRO system. It provides strongly-typed classes to deserialize sensor and channel configuration data from database rows (System.Data.DataRow) and serialize them for persistence or exchange. These types serve as an abstraction layer between the raw database schema and higher-level application logic, enabling consistent handling of sensor metadata, digital I/O settings, calibration records, and ISO location codes across the system.
2. Public Interface
SensorRange
- Namespace:
DatabaseExport - Fields:
double Low { get; set; }double Medium { get; set; }double High { get; set; }
- Constructor:
SensorRange(double _low, double _medium, double _high)
Initializes all three range values.
LowHigh
- Namespace:
DatabaseExport - Fields:
double Low { get; set; }double High { get; set; }
- Constructor:
LowHigh(double _low, double _high)
Initializes low and high bounds.
SensorStatus
- Namespace:
DatabaseExport - Enum Values:
AvailableInUseOutForServiceOutForCalibrationRetired
ShuntMode
- Namespace:
DatabaseExport - Enum Values:
NoneEmulationInternalExternal
BridgeLeg
- Namespace:
DatabaseExport - Enum Values:
FirstSecondThirdFourth
CouplingModes
- Namespace:
DatabaseExport - Enum Values:
AC = 0DC
DigitalInputSetting
- Namespace:
DatabaseExport - Inherits:
SensorData - Constructors:
DigitalInputSetting()
Initializes with defaults viaSetDefaults.DigitalInputSetting(DigitalInputSetting copy)
Copy constructor; initializes with defaults after copying.
- Static Method:
static void SetDefaults(SensorData sd)
Sets default values for aSensorDatainstance:AxisNumber = 0NumberOfAxes = 1Capacity = 1(overwrites earlier2400)Bridge = Test.Module.Channel.Sensor.BridgeType.DigitalInputDisplayUnit = "V"BridgeResistance = double.NaNCheckOffset = falseManufacturer = "Generic"OffsetToleranceHigh = 2500OffsetToleranceLow = 2500Model = "Digital Input Setting"Shunt = ShuntMode.NoneMeasureExcitation = falseMeasureNoise = false
ZeroMethod
- Namespace:
DatabaseExport - Fields:
Test.Module.Channel.Sensor.ZeroMethodType Method { get; set; }double Start { get; set; }double End { get; set; }
- Constructors:
ZeroMethod(Test.Module.Channel.Sensor.ZeroMethodType zm, double _start, double _end)ZeroMethod(string zm)
Parses a comma-separated string:"MethodName,start,end"; throws no exception on failure—silently returns uninitialized if tokens < 3.ZeroMethod(ZeroMethod copy)
Deep copy.
- Methods:
string ToDbString()
Returns"Method,start,end"using default formatting.string ToSerializeString()
Returns"Method,start,end"usingInvariantCulturefor numbers.
DigitalOutputSetting
- Namespace:
DatabaseExport - Inherits:
SensorData - Properties:
string ChannelDescription { get; set; }
Getter returnsSerialNumber; setter updatesSerialNumberand raisesOnPropertyChanged("ChannelDescription").
- Constructors:
DigitalOutputSetting()
Initializes with defaults viaSetDefaults.DigitalOutputSetting(System.Data.DataRow dr)
Populates instance from database row. Supports fields fromDbOperations.DigitalOutputSettings.Fields:Version,OutputMode,LocalOnly,LimitDuration,LastModifiedBy,LastModified,DurationMSFloat,DelayMS,ChannelDescription,UserTagsDurationMSis ignored (marked obsolete).
- Static Method:
static void SetDefaults(SensorData sd)
Sets defaults:SupportedExcitation = [Volt5]Bridge = Test.Module.Channel.Sensor.BridgeType.TOMDigitalAxisNumber = 0,NumberOfAxes = 1Capacity = 1DisplayUnit = "V"BridgeResistance = double.NaNCheckOffset = falseManufacturer = "Generic"OffsetToleranceHigh = 2500OffsetToleranceLow = 2500Model = "Digital Output Setting"Shunt = ShuntMode.NoneMeasureExcitation = falseMeasureNoise = false
FilterClass
- Namespace:
DatabaseExport - Nested Enum:
FilterClassTypeNone = 0AdHoc = -1CFC10 = 17CFC60 = 100CFC180 = 300CFC600 = 1000CFC1000 = 1650
- Fields:
FilterClassType FClass { get; set; }double Frequency { get; set; }
- Constructors:
FilterClass(FilterClassType fc)
InitializesFClassandFrequency(e.g.,CFC60→Frequency = 100.0). Throws on unknown type.FilterClass(string fclass)
Parses string (e.g.,"100","CFC60","123.45"). Maps known numeric codes to enum values; falls back toAdHocwith parsed frequency.
- Methods:
override string ToString()
Returns"None","17 (CFC10)", etc., or numeric string forAdHoc.
SquibSetting
- Namespace:
DatabaseExport - Inherits:
SensorData - Properties:
string SquibDescription { get; set; }
Getter returnsSerialNumber; setter updatesSerialNumberand raisesOnPropertyChanged("SquibDescription").bool BypassCurrentFilter { get; set; }bool BypassVoltageFilter { get; set; }string ArticleId { get; set; }
Getter returnsId; setter updatesIdand raisesOnPropertyChanged("ArticleId").
- Constructors:
SquibSetting(System.Data.DataRow dr)
Populates fromtblTOMSquibChannels. Supports fields fromDbOperations.Squib.Fields:Version,SquibToleranceLow,SquibToleranceHigh,SquibOutputCurrent,SquibDescription,MeasurementType,LocalOnly,LimitDuration,LastModifiedBy,LastModified,ISOCode,FireMode,DurationMS,DelayMS,BypassVoltageFilter,BypassCurrentFilter,ArticleId,UserValue1,UserValue2,UserValue3,UserTags
- Static Method:
static void SetDefaults(SensorData sd)
Sets defaults:AxisNumber = 0,Capacity = 5,NumberOfAxes = 1Manufacturer = "Generic",Model = "Squib Setting"Shunt = ShuntMode.NoneCheckOffset = falseBridgeResistance = -1MeasureNoise = false,MeasureExcitation = falseBridge = Test.Module.Channel.Sensor.BridgeType.SQUIBSupportedExcitation = [Volt5]DisplayUnit = "V"Comment = SerialNumber(ifUserValue1is empty/whitespace)
IsoCode
- Namespace:
DatabaseExport - Fields:
string TestObject { get; set; }(1 char, index 0)string Position { get; set; }(1 char, index 1)string MainLocation { get; set; }(4 chars, indices 2–5)string FineLocation1 { get; set; }(2 chars, indices 6–7)string FineLocation2 { get; set; }(2 chars, indices 8–9)string FineLocation3 { get; set; }(2 chars, indices 10–11)string PhysicalDimension { get; set; }(2 chars, indices 12–13)string Direction { get; set; }(1 char, index 14)string FilterClass { get; set; }(1 char, index 15)
- Constructors:
IsoCode(string isoCode)
Normalizes input to 16 chars: truncates if >16, pads with'?'if <16.
- Properties:
string StringRepresentation { get; set; }
Getter returns full 16-char string; setter normalizes to 16 chars (truncates/pads with'0'if shorter).
CalibrationRecords
- Namespace:
DatabaseExport - Fields:
CalibrationRecord[] Records { get; set; }
- Constructors:
CalibrationRecords()
Initializes with one defaultCalibrationRecord.CalibrationRecords(CalibrationRecords copy)
Deep copy ofRecords.CalibrationRecords(string records)
Parses serialized string viaFromSerializedString.
- Methods:
void FromSerializedString(string s)
Splits on"__x__"(with fallback"___xx___"), constructsCalibrationRecords.string ToSerializedString(SensorCalibration sc)
Serializes eachCalibrationRecord, escapes"__x__"→"___xx___".
CalibrationRecord
- Namespace:
DatabaseExport - Fields:
double Sensitivity { get; set; }double ZeroPoint { get; set; }
Computed fromPoly.ZeroPositionIntercept / Poly.CalibrationFactorifPoly.CalibrationFactor ≠ 0; else returns stored_zeroPoint.LinearizationFormula Poly { get; set; }bool AtCapacity { get; set; } = falsestring EngineeringUnits { get; set; } = "g"Test.Module.Channel.Sensor.SensUnits SensitivityUnits { get; set; } = NONETest.Module.Channel.Sensor.ExcitationVoltageOption Excitation { get; set; } = Volt5int CapacityOutputIsBasedOn { get; set; } = 1
- Constructors:
CalibrationRecord()
InitializesPoly = new LinearizationFormula().CalibrationRecord(string s)
Parses viaFromString.CalibrationRecord(CalibrationRecord copy)
Deep copy.
- Methods:
string ToSerializedString(SensorCalibration parentCal)
Serializes fields (includingPoly) with escaping of list separators.void FromString(string s)
Parses serialized string.
3. Invariants
SensorRange: No explicit validation;Low,Medium,Highmay be anydouble.ZeroMethod: Parsing from string silently fails if fewer than 3 comma-separated tokens; no exception thrown.FilterClass: Constructor fromFilterClassTypethrowsSystem.Exceptionfor unknown types. Constructor from string may assignAdHocwith arbitrary frequency.IsoCode: All 16 positions are always populated; missing/short inputs are padded with'?', excess truncated. Setter forStringRepresentationpads with'0'(not'?') if shorter than 16.CalibrationRecord.ZeroPoint: Computed value takes precedence over stored_zeroPointifPoly.CalibrationFactor ≠ 0.SensorsCollection:- Singleton via
SensorsList(thread-safe vialock). GetSensorBySerialNumberexcludes sensors withBroken = true,DoNotUse = true, orNumberOfAxes > 1orAxisNumber > 0.AllSensorsDbexcludes multi-axis sensors but notBroken/DoNotUse.- Sensors loaded from
tblSensors,tblDigitalInputSetting,tblTOMSquibChannels,tblTOMDigitalChannelsinto a single_sensorDictionary.
- Singleton via
4. Dependencies
Internal Dependencies (Inferred from Source)
Test.Module.Channel.Sensornamespace:- Types used:
ZeroMethodType,BridgeType,ExcitationVoltageOption,SensUnits
- Types used:
DbOperationsnamespace:- Nested types:
DigitalOutputSettings.Fields,Squib.Fields,DigitalInputSettings.Fields - Methods:
GetCommand(),Connection.QueryDataSet(...)
- Nested types:
SensorDatabase class: Used byDigitalInputSetting,DigitalOutputSetting,SquibSetting. Not provided in source, but assumed to define common properties likeSerialNumber,Id,Version,LastModified,TagsBlobBytes,Broken,DoNotUse,UserValue1, etc.LinearizationFormula: Referenced byCalibrationRecord. Not provided in source.
External Dependencies
System(core types:Enum,Convert,StringBuilder,CultureInfo)System.Data(DataRow,DataSet,DBNull)System.Collections.Generic
What Depends on This Module?
SensorsCollection.SensorsListis used to load and cache all sensor configurations at runtime.DigitalInputSetting,DigitalOutputSetting,SquibSettingare instantiated from database rows during initialization.CalibrationRecordsandCalibrationRecordare used to serialize/deserialize calibration metadata.
5. Gotchas
DigitalInputSetting.SetDefaultssetsCapacity = 2400then immediately overwrites to1— likely a typo or legacy artifact.ZeroMethodconstructor from string silently ignores malformed input — no exception, no logging; returns partially initialized object.IsoCode.StringRepresentationsetter pads with'0', but constructor/partial setters pad with'?'— inconsistent default padding.CalibrationRecord.ZeroPointis computed only whenPoly.CalibrationFactor ≠ 0— stored_zeroPointmay be stale ifPolychanges.SensorsCollection.GetSensorBySerialNumberreturnsnullfor multi-axis sensors — even if valid — due to legacy restriction "Disable 6-axis sensor capability".FilterClassconstructor from string may assignAdHocfor unrecognized values — no validation that frequency is positive or meaningful.DigitalOutputSettingcopy constructor is commented out — no deep copy support for this type.CalibrationRecordsuses custom separators ("__x__"and"___xx___") — risk of collision if data contains these strings; escaping is manual and error-prone.SensorDatais not defined in provided sources — behavior of inherited properties (e.g.,Id,SerialNumber,TagsBlobBytes) must be inferred from usage.SquibSetting.Commentdefaults toSerialNumberifUserValue1is empty, butUserValue1is set from DB row — potential for unintended override.