16 KiB
16 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:56:14.475389+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | a79ee819003fd838 |
DAS Service Layer Documentation
1. Purpose
This module provides core data structures and helper utilities for the DAS (Data Acquisition System) service layer within the DTS.DASLib.Service namespace. It defines the foundational data models used to represent hardware state, configuration, diagnostics, and data payloads exchanged between the service layer and higher-level components. These classes serve as the contract for data flow during DAS operations such as configuration, data acquisition, diagnostics, and flash programming, enabling consistent representation of hardware metadata and runtime state across the system.
2. Public Interface
Classes
ConfigurationConstants
- Nested Enum:
VerifyConfig_ErrorsDefaultHardwareFilterRateOutOfRange: Represents a configuration validation error where the hardware filter rate is outside acceptable bounds.
StaticInformation
- Constructor:
StaticInformation(double[] _NominalRanges)- Stores a reference to the provided array of nominal ranges (e.g., expected sensor voltage ranges).
- Property:
NominalRanges(double[])- Read-only array of nominal range values.
NewDataData
- Constructor:
NewDataData(short[][][] data, ulong[] sns, ulong[] timeStamps, ulong[] sequenceNumbers)- Initializes all properties with provided values.
- Properties:
datas(short[][][]): Three-dimensional array of acquired data samples.SampleNumbers(ulong[]): Per-sample sequence identifiers.TimeStamps(ulong[]): Timestamps for each sample.SequenceNumbers(ulong[]): Sequence numbers for ordering samples.
SampleData
- Constructor:
SampleData(short[][] data, ulong sampleNumber, ulong timeStamp, ulong sequenceNumber)- Initializes all properties with provided values.
- Properties:
Data(short[][]): Two-dimensional array of channel data for one sample (channels × values).SampleNumber(ulong): Hardware sample counter value.TimeStamp(ulong): Timestamp associated with this sample.SequenceNumber(ulong): Sequence number for ordering samples.
ModuleDiagnosticsResult
- Properties (all
float):TemperatureLocation1PrethroughTemperatureLocation4Pre: Pre-flash-erase temperatures at four locations.TemperatureLocation1PostthroughTemperatureLocation4Post: Post-flash-erase temperatures at four locations.
FlashEraseStatus
- Properties:
LastError(DFConstantsAndEnums.CommandStatus): Last error encountered during flash erase;StatusNoErrorindicates success.PercentComplete(float): Progress percentage (0.0–100.0) of the current flash erase operation.
TriggerCheckResult
- Properties (all
bool):IsStatusGood: Overall diagnostic status of the DAS.IsStartRecordActive: Whether the start record line is currently active.HasStartRecordBeenActive: Whether the start record line has been active since arming.IsTriggered: Whether the trigger line is currently active.HasTriggered: Whether the trigger line has been active since arming.
TOMModule
- Nested Enum:
TomTriggerTypeNONE: Trigger type unknown.BUS_ONLY: Triggered only by rack bus.PANEL_ONLY: Triggered only by panel trigger.BUS_PANEL: Triggered only when both rack bus and panel triggers are active.
- Properties:
TriggerType(TomTriggerType): Gets/sets the trigger type.
- Constructors:
TOMModule(): Default constructor.TOMModule(int moduleArrayIdx, IDASCommunication _OwningDAS): Initializes with module index and owning DAS communication interface.
Exception Classes
BusyException: Thrown when a service call is made while the service is already processing another request.TriggerShortedException: Thrown when a trigger line short condition is detected.StartShortedException: Thrown when a start record line short condition is detected.NoDiagnosticsAvailable: Thrown when diagnostic data is requested but none exists for the channel (e.g., diagnostics not yet run).TooManyDiagnosticsAvailable: Thrown when multiple diagnostic results are returned for a single channel (unexpected).
EID
- Properties:
ID(string): 16-character hexadecimal string representing the sensor Electronic ID.Blob(byte[]): Optional raw binary blob associated with the ID.
- Constructors:
EID(): Initializes with empty ID and null blob.EID(string _id): Initializes with ID string.EID(string _id, byte[] _blob): Initializes with ID and blob.
- Methods:
IsValid(): Returnstrueif ID is non-empty, 16 characters, not blank (0000000000000000), in hex format, and CRC8 check passes.CompareTo(EID eid)/CompareTo(string eidStr): Case-insensitive lexicographic comparison of IDs.
EIDReader
- Constants:
BLANK_ID:"0000000000000000"(blank EID value).
- Static Methods:
SupportsQueryOneWireID(ICommunication comm): ReturnsfalseforEthernetTsrAir/WinUSBTsrAir;trueotherwise.IsBlankID(string id): ReturnstrueifidequalsBLANK_ID.RetriveEIDs(ICommunication comm, byte DASChannelNumber, int idType): Retrieves EIDs for a channel with retry logic; returnsnullif none found or invalid.RetriveEIDs(ICommunication comm, int moduleIndex): Retrieves EIDs for a module index with retry logic; returnsnullif none found or invalid.RetrieveEIDsG5(ICommunication comm): Retrieves EIDs for all G5 modules; returnsEID[][].
ServiceCallbackData
- Nested Classes:
DiagnosticNewData: Contains channel number, action type (Actionsenum), and result object for diagnostic callbacks.Actionsenum:MeasureBridgeMv,MeasureShunt,ScaleFactorMv,FactoryExcitation,MeasureExcitation,MeasureOffset,CalSignalCheck,FinalOffset,MeasureNoise,RemoveOffset,ShuntCheck,QueryModules,MeasureVoltages,TestChannelRun,TestChannelRead,MeasureInternalOffset,MeasureFinalInternalOffset.
TiltNewData: ContainsTiltData(double[]) andAccelData(double[]).TemperatureData: ContainsChannel1,Channel2(int),Timestamps(DateTime[]),Sensor1,Sensor2(double[]).UARTNewData: ContainsDataOffset(ulong) andUARTData(byte[]).
- Properties:
Status(CallbackStatus): One ofProgressReport,NewData,Timeout,Success,Failure,Canceled,InvalidParameters.ErrorMessage(string): Error message ifStatus == Failure.ErrorException(Exception): Exception object ifStatus == Failure, elsenull.ProgressValue(int): Progress percentage (0–100) ifStatus == ProgressReport.UserData(object): User-provided state object.DataSamples(SampleData[]): Collection of non-contiguous sample blocks.NewDiagnosticData,NewTiltData,NewUARTData,NewTemperatureData: Accessors for respective data types.ByteData(byte[]): Raw byte data payload.
- Methods:
AddSampleData(short[][] data, ulong sampleNumber, ulong timeStamp, ulong sequenceNumber): Appends a newSampleDatato internal list.GetSampleData(int index): ReturnsSampleDataat given index.GetNumberOfSamples(): Returns count of stored sample blocks.
XMLHelper
- Fields:
InvariantCulture:CultureInfofor culture-independent parsing.
- Static Methods (all take
XmlReader/XmlWriter):GetString,TryGetString: Reads element text;TryGetStringreturnsdefaultValueon failure.GetDouble,TryGetDouble: Parses element text asdouble.GetFloat: Parses element text asfloat.GetInt,TryGetInt: Parses element text asint.GetInt64: Parses element text aslong.GetUInt,GetUInt64: Parses element text asuint/UInt64.GetOptionalDouble: Reads element; returnsnullifxsi:nil="true".GetBool: Parses element text asbool.PutString,PutInt,PutInt64,PutUInt,PutUInt64,PutDouble,PutOptionalDouble,PutBool: Writes corresponding XML elements.
ConfigurationData
- Properties:
Modules(IDASModule[]): Array of modules in the DAS.IDs(IEID[]): EIDs for the entire DAS (ignored during XML serialization).TestID,TestSetupUniqueId,InstanceID,Description: Test/event metadata.ClearSetup(bool): Defaults tofalse.DisplayOrder(int[]): Channel display ordering; defaults to[-1].DasDisplayOrder(int): DAS display order; defaults to-1.UDPReceiveAddress(string): UDP multicast address; defaults to"UDP://239.1.2.10:8401".
- Methods:
NumberOfConfiguredChannels(): Counts channels whereIsConfigured == true.NumberOfChannels(): Counts all channels (configured or not).NumberOfDownloadChannels(): Counts non-UART/non-StreamOut channels.GetDisplayOrder(uint channelIdx): ReturnsDisplayOrder[channelIdx]or-1if out of bounds.Serialize(string file, ConfigurationData config): Serializes to XML file.Serialize(ConfigurationData config): Serializes to XML string.SerializeBin(ConfigurationData config): Serializes to binary.DeserializeFromString(string SerializedText): Deserializes XML string toConfigurationData.Deserialize(string file): Deserializes XML file toConfigurationData.SetConfiguration(IDASCommunication das, string xml, int fileStore): Stores XML config in database (DASFactoryDb.Config.SetConfiguration).
- Constants:
DIAGNOSTIC_FILESTORE = 0,EVENT_FILE_STORE = 1: File store identifiers.
InfoResult
- Nested Class:
Module(implementsIInfoResultModule)SerialNumber,FirmwareVersion(string)OwningInfoResult(InfoResult)ModuleArrayIndex(int)NumberOfChannels(uint)SupportedSampleRates(uint[])SampleRate2AAFrequency(Dictionary<uint, float>)MaxEventStorageSpaceInBytes(ulong?)NumberOfBytesPerSampleClock(uint?)MaxRecordingSamples(double)CalibrationDate(DateTime?)RackIsUnreadable(bool)TypeOfModule(DFConstantsAndEnums.ModuleType)SupportedModes(DFConstantsAndEnums.RecordingMode[])IsProgrammable(bool)
- Properties:
Modules(IInfoResultModule[]): Array of modules.ActiveExternalTilts(List<ExternalTilt>): List of active external tilt sensors.OwningDAS(IDASCommunication): Reference to owning DAS communication interface.MaxNumberOfModules(uint)MaxEventStorageSpaceInBytes(ulong?)NumberOfBytesPerSampleClock(uint?)DeviceStreamingOnly(bool?)NumberOfBridgeChannels(int): Hardcoded to3.BatteryID(IEID)HasBattery(bool):trueifBatteryIDis non-null, non-empty, and not blank.CalibrationDate(DateTime?): Returns earliest module calibration date or1970-01-01if invalid.
- Mapping Methods:
MapDASChannelNumber2RealtimeChannelNumber(int channelNumber): Maps DAS channel to real-time channel (module-type dependent).MapDASChannelNumber2ModuleArrayIndex(int channelNumber): Maps DAS channel to module array index.MapDASChannelNumber2ModuleDeviceID(int channelNumber): Maps DAS channel to module device ID (channelNumber / 3 + 1).MapDASChannelNumber2ModuleChannelNumber(int channelNumber): Maps DAS channel to module-local channel number.MapModuleArrayIndexAndChannelNum2DASChannel(int moduleArrayIdx, int channelNumber): Inverse mapping.
- Static Methods:
SetDASInfo(IDASCommunication das): Stores DAS info in database.SetDASInfo(IDASCommunication das, IInfoResult dasInfo, bool bSetInDb): Updatesdas.DASInfoand optionally stores in DB.InsertDASInfo(IDASCommunication das, IInfoResult dasInfo): Inserts DAS info into database.
3. Invariants
- EID Format: All
EID.IDstrings must be exactly 16 hexadecimal characters. Validation inEID.IsValid()enforces:- Non-empty and non-null.
- Length = 16.
- Not equal to
EIDReader.BLANK_ID("0000000000000000"). - Hexadecimal format (via
HexEncoding.InHexFormat). - CRC8 check passes (first byte = CRC of remaining 15 bytes using
CRCTable).
- SampleData Consistency: Each
SampleDatainstance must haveDataarray with dimensions[channels][values], wherechannelsmatches the module's channel count, andSampleNumber,TimeStamp,SequenceNumberare monotonically increasing within a contiguous block. - ConfigurationData Serialization:
Modulesmust be non-null and contain validIDASModuleinstances.IDsis ignored during XML serialization ([XmlIgnore]).
- FlashEraseStatus Progress:
PercentCompletemust be in range[0.0, 100.0]. - TriggerCheckResult Semantics:
HasStartRecordBeenActiveandHasTriggeredare cumulative flags set only after arming; they are not reset until re-arming.
4. Dependencies
Dependencies on this module:
DTS.Common.Interface.DASFactory: Interfaces likeIDASCommunication,ICommunication,IDASModule,IEID,IInfoResult,IModuleDiagnosticsResult,ITriggerCheckResult.DTS.Common.Enums.DASFactory:DFConstantsAndEnums(e.g.,CommandStatus,ModuleType,RecordingMode).DTS.Common.Utilities:HexEncoding,APILogger,RunTestVariables.DASFactoryDb:DbWrapper,Configfor database persistence (SetConfiguration,DASInfoInsert, etc.).DTS.DASLib.Command.SLICE: SLICE commands likeQueryOneWireID,ReadSensorIDs,RackIDX.System.Xml: XML serialization (XmlSerializer,XmlReader,XmlWriter).System: Core types (Exception,DateTime,CultureInfo, etc.).
Dependencies of this module:
DTS.DASLib.Servicenamespace: All classes are internal to this namespace; no external consumers are implied by source.DTS.DASLib.Command.SLICE: Used byEIDReaderfor hardware ID queries.
5. Gotchas
EIDReader.RetriveEIDsreturnsnullinstead of empty array: Explicitly avoids returning empty arrays to prevent downstream consumers (e.g., calstation) from indexingids[0]on an empty collection. This is a known design trade-off.EID.IsValid()CRC computation: CRC is calculated over bytes 2–15 (skipping first byte), but the first byte is used as the expected CRC. Ensure correct byte ordering.SampleData.Datashape: Theshort[][]structure implies[channel][value], but firmware behavior varies:- G8 and older: 1 value per channel per poll.
- Newer firmware: Multiple values per channel per poll.
InfoResult.NumberOfBridgeChannelsis hardcoded to3: This may break for non-G5 modules with different channel counts per module.ConfigurationData.DeserializedFromStringreturnsnullon failure: Callers must handlenullexplicitly; no exception is thrown for invalid XML (only logged).XMLHelperusesInvariantCulture: Parsing fails if XML contains locale-specific formatting (e.g., commas for decimals).TOMModule.TriggerTypedefault isNONE: Uninitialized modules will reportNONE, which may not reflect actual hardware configuration.FlashEraseStatus.LastErrortype: UsesDFConstantsAndEnums.CommandStatus, but no specific error codes are defined in this source file—consumers must reference that enum.ServiceCallbackData.DataSamplesis a copy:DataSamplesreturns a copy (_Data.ToArray()); modifications to the returned array do not affect internal state.