9.2 KiB
9.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T04:59:11.131587+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 45f7e783788f3070 |
Hardware
Documentation: DAS Hardware Abstraction Layer (Version 57)
1. Purpose
This module provides a version-specific abstraction layer for DAS (Data Acquisition System) hardware configuration and metadata within the DatabaseExport subsystem of the DataPRO system. It enables serialization of DAS settings (e.g., sample rate, AAF, trigger timing) into the legacy database schema (tblTestSetupDASSettings, tblDAS, tblDASChannel) and supports hardware discovery, comparison, and channel management. The classes (DASSettings, HardwareChannel, DASHardware, DASHardwareList) serve as DTOs and adapters for interacting with historical database structures, preserving compatibility with Version 57 schema while abstracting underlying Hardware and ISOHardwareChannel objects.
2. Public Interface
DASSettings
- Properties
string DASSerialNumber { get; set; }— Serial number of the DAS device associated with the test settings.double SampleRate { get; set; }— Sampling rate (Hz) configured for the test.int ExcitationWarmupTimeMS { get; set; }— Warm-up time (milliseconds) for excitation voltage before data acquisition.double HardwareAAF { get; set; }— Hardware anti-aliasing filter cutoff frequency (Hz).double PreTriggerSeconds { get; set; }— Duration (seconds) of data captured before a trigger event.double PostTriggerSeconds { get; set; }— Duration (seconds) of data captured after a trigger event.bool StatusLineCheck { get; set; }— Flag indicating whether status line monitoring is enabled.bool BatteryCheck { get; set; }— Flag indicating whether battery voltage monitoring is enabled.double InputVoltageMin { get; set; }— Minimum acceptable input voltage (volts).double InputVoltageMax { get; set; }— Maximum acceptable input voltage (volts).double BatteryVoltageMin { get; set; }— Minimum acceptable battery voltage (volts).double BatteryVoltageMax { get; set; }— Maximum acceptable battery voltage (volts).
HardwareChannel
- Constructors
HardwareChannel(HardwareChannel copy)— Deep-copies channel data (includingSensor).HardwareChannel(ISOHardwareChannel channel, DASHardware hardware)— Initializes from anISOHardwareChanneland its parentDASHardware.
- Properties
DASHardware Hardware { get; }— Parent DAS hardware instance.int ChannelNumber { get; }— Zero-based channel index (ChannelIdxfromISOHardwareChannel).SensorData Sensor { get; set; }— Sensor configuration for this channel (nullable).TestObjectChannel TestObjectChannel { get; set; }— Logical test object channel mapped to this hardware channel.
- Methods
ISOHardwareChannel GetISOChannel()— Returns the underlyingISOHardwareChannelinstance.int CompareTo(HardwareChannel right)— Compares channels first byDASDisplayOrder, then byChannelIdx.string GetId()— Returns a unique ID in the format{HardwareId}x{1-based ChannelNumber}.bool IsSupportedBridgeType(Test.Module.Channel.Sensor.BridgeType bridgeType)— Checks ifbridgeTypeis supported by this channel (via bitwise AND withSupportedBridges).
DASHardware
- Properties
string SerialNumber { get; set; }— DAS serial number (from_hardware.SerialNumber).string Connection { get; set; }— Network address (e.g., IP) for the DAS (from_hardware.IPAddress).DateTime CalDate { get; }— Calibration date (read-only, from_hardware.CalDate).HardwareChannel[] Channels { get; set; }— Sorted array of channels (sorted byCompareToin setter).bool LocalOnly { get; set; }— Flag indicating local-only operation (from_hardware.LocalOnly).
- Methods
Hardware GetHardware()— Returns the underlyingHardwareinstance.int GetHardwareTypeInt()— Returns_hardware.DASTypeas an integer.HardwareTypes GetHardwareTypeEnum()— CastsDASTypetoHardware.HardwareTypesenum.long GetMaxMemoryLong()— Returns_hardware.MaxMemory.Dictionary<string, string> GetValues()— Serializes DAS metadata (e.g., serial, type, firmware, sample rates, channel types) into a dictionary keyed byDbOperations.DAS.Fieldsenum values.Dictionary<string, string> GetChannelValues(HardwareChannel channel)— Serializes channel metadata (e.g.,ChannelIdx,SupportedBridges,DASDisplayOrder) into a dictionary keyed byDbOperations.DAS.DASChannelFieldsenum values.bool IsDummy()— ReturnstrueifSerialNumbercontains"Dummy".
- Inherited from
DbTimeStampBaseoverride string LookupTable => "tblDAS"— Database table name for persistence.override ConstraintHelper[] GetConstraints()— Returns a constraint forSerialNumber(used for DB lookups).
DASHardwareList (Singleton)
- Methods
static DASHardwareList GetList()— Returns the singleton instance (lazy-initialized viaPopulateHardware).DASHardware GetHardware(string id)— Retrieves DAS by ID (hardware ID or serial number).DASHardware GetHardware(string id, bool bThrowExceptionIfChanged, out bool changed)— Retrieves DAS; if ID format includes a type suffix (e.g.,SN_123) and the hardware type has changed, throwsHardwareTypeChangedException(ifbThrowExceptionIfChanged=true) or setschanged=true.DASHardware[] Hardware { get; }— Returns all non-prototype DAS instances.
- Nested Exception
HardwareTypeChangedException : Exception— Thrown when hardware type mismatch is detected during lookup.
3. Invariants
- Channel Ordering:
HardwareChannel.CompareToenforces ordering byDASDisplayOrderfirst, thenChannelIdx. - Channel Array Consistency: Setting
DASHardware.Channelssorts the array internally and raisesOnPropertyChangedfor bothChannelsandChannelCount. - Hardware ID Format:
HardwareChannel.GetId()uses1 + ChannelNumber(1-based indexing in ID, 0-based inChannelNumber). - Prototype Exclusion:
DASHardwareList.GetAllHardware()filters out hardware withPosition == "Prototype". - Serial Number Uniqueness:
DASHardwareListuses_hardware.ContainsKey(h.GetHardware().GetId())for deduplication during population. - Dummy Detection:
IsDummy()checks for substring"Dummy"inSerialNumber(case-sensitive).
4. Dependencies
- Internal Dependencies
Hardware(fromDatabaseExport.Hardwarenamespace) — Core data model for DAS hardware metadata.ISOHardwareChannel— Encapsulates channel-level metadata (e.g.,ChannelIdx,SupportedBridges).DbOperations.DAS.Fields/DbOperations.DAS.DASChannelFields— Enumerations defining database column names (used inGetValues/GetChannelValues).DbTimeStampBase— Base class for time-stamped database entities (providesLookupTable,GetConstraints,DbTimeStamp).SensorData— Sensor configuration (used inHardwareChannel).Test.Module.Channel.Sensor.BridgeType— Bridge type enum (used inIsSupportedBridgeType).
- External Dependencies
System.Collections.Generic,System.Linq,System.Data.SqlDbType— Standard .NET libraries.System.IComparable<T>— Implemented byHardwareChannelandDASHardware.
5. Gotchas
CompareToNull Handling:HardwareChannel.CompareToreturns0fornullinput (non-standard behavior; typicallynullcomparisons should return1).GetHardware(string id)Ambiguity: Lookup prioritizes hardware ID (e.g.,"DAS_123") over serial number, but falls back to serial if ID fails. If the ID contains_(e.g.,"SN_123"), it truncates to"SN"for serial matching, risking incorrect matches.ChannelsSetter Sorts In-Place: The setter sorts the input list and replaces_channels, but does not validate channel uniqueness or consistency with_hardware.ISOChannels.IsDummy()Substring Match:IsDummy()usesContains("Dummy"), which may yield false positives (e.g.,"MyDummyDAS").DASHardwareListSingleton Initialization: Thread-safety is not guaranteed (no locking inGetList()).- Hardcoded Prototype Filter: Prototype exclusion uses a magic string
"Prototype"(comment notes/*DbOperations.DAS.PROTOTYPE_POSITION*/suggests a constant should be used). GetChannelValuesField Names: UsesDbOperations.DAS.DASChannelFieldsenum values directly as keys; mismatches here would cause DB schema errors.- No Validation in
DASSettings: Properties lack validation (e.g., negativeSampleRateorPreTriggerSecondsallowed).
None identified beyond these source-observable quirks.