Files
DP44/enriched-qwen3-coder-next/DataPRO/IService/Classes/TDAS.md
2026-04-17 14:55:32 -04:00

9.8 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/IService/Classes/TDAS/TDASServiceSetupInfo.cs
DataPRO/IService/Classes/TDAS/TDASServiceSetupInfoLookup.cs
DataPRO/IService/Classes/TDAS/TDASConfig.cs
DataPRO/IService/Classes/TDAS/TDASModuleConfig.cs
2026-04-16T03:59:19.825998+00:00 Qwen/Qwen3-Coder-Next-FP8 1 4eeb90f6bf6e5cce

TDAS

Documentation: TDAS Configuration and Setup Info Classes

1. Purpose

This module provides data structures and configuration persistence for the TDAS (Test Data Acquisition System) service layer. It defines setup metadata (TDASServiceSetupInfo, TDASServiceSetupInfoLookup) used to configure acquisition parameters at runtime, and XML-serializable configuration classes (TDASConfig, TDASModuleConfig) that store per-module hardware and test settings to disk. These classes enable centralized management of DAS module configurations, channel definitions, and acquisition parameters across test sessions.

2. Public Interface

TDASServiceSetupInfo

  • Constructor:
    TDASServiceSetupInfo(string setupDescription, double? samplesPerSecond, float hardwareFilterRateHz, DFConstantsAndEnums.RecordingMode recordingMode, bool? checkoutMode)
    Initializes a new instance with fixed (non-lookup) acquisition parameters. All parameters are required; samplesPerSecond and checkoutMode are nullable.

  • Properties:

    • string SetupDescription Human-readable description of the setup.
    • double? SamplesPerSecond Fixed sample rate (Hz); nullable to allow optional specification.
    • float HardwareFilterRateHz Hardware anti-aliasing filter rate in Hz (non-nullable).
    • DFConstantsAndEnums.RecordingMode RecordingMode Recording mode enum value (e.g., continuous, triggered).
    • bool? CheckoutMode Optional flag indicating whether the setup is for hardware checkout.

TDASServiceSetupInfoLookup

  • Constructor:
    TDASServiceSetupInfoLookup(string setupDescription, Dictionary<string, double> sampleRateLookup, Dictionary<string, float> aafLookup, DFConstantsAndEnums.RecordingMode recordingMode, bool? checkoutMode)
    Initializes a lookup-based setup info where sample rate and filter rate vary by DAS unit (identified by string key, likely serial number).

  • Properties:

    • string SetupDescription Same as above.
    • Dictionary<string, double> SamplesPerSecondLookup Maps DAS identifier (e.g., serial number) to its sample rate.
    • Dictionary<string, float> HardwareFilterRateHzLookup Maps DAS identifier to its hardware filter rate.
    • DFConstantsAndEnums.RecordingMode RecordingMode Same as above.
    • bool? CheckoutMode Same as above.

TDASConfig

  • Constructor:
    TDASConfig() Default constructor.
    TDASConfig(string fileName, bool deleteIfPresent) Loads config from DASConfigs/<fileName> (relative to executing assembly directory). If deleteIfPresent is true, deletes existing file before proceeding; otherwise, attempts to deserialize.

  • Properties:

    • Dictionary<string, TDASModuleConfig> Modules Read-only dictionary of modules keyed by serial number.
    • string FileName Full path to the config file (read-only).
  • Methods:

    • void SetModule(TDASModuleConfig module) Adds or updates a module in _modules by SerialNumber.
    • TDASModuleConfig GetModule(TDASModuleConfig module) Retrieves module by SerialNumber; if missing, adds the provided module and returns it.
    • void ReadXml(XmlReader reader) Deserializes XML into _modules (expects <TDASConfig><Modules>...</Modules></TDASConfig> structure).
    • void WriteXml(XmlWriter writer) Serializes _modules to XML.
    • XmlSchema GetSchema() Returns null (per IXmlSerializable convention for schema-less types).

TDASModuleConfig

  • Constructor:
    TDASModuleConfig() Default constructor.
    TDASModuleConfig(string fileName) Loads module config from DASConfigs/<fileName>.

  • Properties:

    • string SerialNumber Unique identifier for the module.
    • string TestId Test identifier string.
    • string TestDescription Human-readable test description.
    • DFConstantsAndEnums.RecordingMode RecordingMode Recording mode (default: InvalidArmMode).
    • float AAFilterRateHz Anti-aliasing filter rate (default: 0).
    • double PreTriggerSeconds Pre-trigger hold time (default: 0).
    • double PostTriggerSeconds Post-trigger record time (default: 0).
    • string FirmwareVersion Module firmware version string.
    • UInt64? MaxEventStorageSpaceInBytes Optional max storage for event data.
    • int ModuleArrayIndex Zero-based index for module ordering (default: 0).
    • string FileName Full path to config file (read-only).
    • Dictionary<int, DASChannel> Channels Internal dictionary of channels keyed by ModuleChannelNumber (not exposed directly; accessed via SetChannel/GetChannel overloads).
  • Methods:

    • void SetChannel(OutputTOMDigitalChannel channel) / SetChannel(OutputSquibChannel channel) / SetChannel(AnalogInputDASChannel channel) Adds or updates channel by ModuleChannelNumber.
    • AnalogInputDASChannel GetChannel(AnalogInputDASChannel channel) / GetChannel(OutputSquibChannel channel) / GetChannel(OutputTOMDigitalChannel channel) Retrieves channel by ModuleChannelNumber; if missing, adds the provided channel and returns it.
    • void ReadXml(XmlReader reader) Deserializes XML into module properties and channels. Handles legacy configs (e.g., missing ModuleArrayIndex element).
    • void WriteXml(XmlWriter writer) Serializes module properties and channels to XML.
    • XmlSchema GetSchema() Returns null.
    • virtual void WriteElementStart(XmlWriter writer) Writes <TDASModule xsi:type="..."> with concrete type.
    • virtual void WriteElementEnd(XmlWriter writer) Closes the <TDASModule> element.

3. Invariants

  • TDASConfig:
    • _modules dictionary is keyed by TDASModuleConfig.SerialNumber; duplicates are overwritten by SetModule.
    • FileName is always an absolute path constructed relative to the executing assemblys directory under DASConfigs/.
  • TDASModuleConfig:
    • RecordingMode defaults to DFConstantsAndEnums.RecordingMode.InvalidArmMode (invalid state); must be explicitly set to a valid mode.
    • AAFilterRateHz, PreTriggerSeconds, PostTriggerSeconds default to 0.
    • MaxEventStorageSpaceInBytes is nullable; invalid values (negative or ≥ ulong.MaxValue) are logged and ignored.
    • ModuleArrayIndex defaults to 0; invalid values (negative or ≥ int.MaxValue) are logged and ignored.
    • Channel dictionaries use ModuleChannelNumber as the key; duplicate channel numbers overwrite existing entries.
  • XML Serialization:
    • TDASConfig expects <TDASConfig><Modules>...</Modules></TDASConfig>.
    • TDASModuleConfig expects <TDASModule>...</TDASModule> with child elements in a fixed order (e.g., SerialNumber, TestId, RecordingMode, etc.).
    • Channel serialization uses WriteElementStart/WriteElementEnd to include xsi:type for polymorphic deserialization.

4. Dependencies

  • Imports/Usings:
    • DTS.Common.DAS.Concepts Provides DASChannel, AnalogInputDASChannel, OutputSquibChannel, OutputTOMDigitalChannel.
    • DTS.Common.Enums.DASFactory Provides DFConstantsAndEnums.RecordingMode.
    • DTS.DASLib.Command.SLICE Referenced but not directly used in these classes (likely transitive dependency).
    • DTS.Common.Utilities.Logging Provides APILogger for error logging during XML deserialization.
    • Standard .NET libraries: System.Xml, System.IO, System.Collections.Generic, System.
  • Consumers:
    • TDASConfig and TDASModuleConfig are used by the TDAS service layer to persist/load configurations.
    • TDASServiceSetupInfo/TDASServiceSetupInfoLookup are likely used by higher-level configuration or initialization logic (e.g., service startup, test setup UI).
    • XML serialization implies integration with external tools or UIs that read/write config files.

5. Gotchas

  • TDASServiceSetupInfoLookup naming: The constructor parameter aafLookup is named inconsistently with the property HardwareFilterRateHzLookup; this may cause confusion.
  • GetModule/GetChannel behavior: Both methods add the provided object to the dictionary if missing, which can silently mutate state. Callers must ensure the input object is fully initialized.
  • XML deserialization robustness:
    • RecordingMode and numeric fields (AAFilterRateHz, PreTriggerSeconds, etc.) use try/catch + APILogger.Log for errors, but silently default to 0/InvalidArmMode on failure.
    • ModuleArrayIndex is wrapped in a try/catch block to handle legacy configs (missing element), but other elements lack this fallback.
  • Path construction: Config paths are hardcoded to DASConfigs/ under the assembly directory; this may not work in all deployment scenarios (e.g., ClickOnce, containerized).
  • Channel polymorphism: WriteElementStart uses GetType() to write xsi:type, but ReadXml relies on the type attribute to deserialize into OutputSquibChannel, OutputTOMDigitalChannel, or AnalogInputDASChannel. Mismatched types in XML will cause silent fallback to AnalogInputDASChannel.
  • No validation: No validation is performed on SetupDescription, SerialNumber, or TestId (e.g., empty strings allowed).
  • SamplesPerSecond vs SamplesPerSecondLookup: The nullable double? in TDASServiceSetupInfo vs. Dictionary<string, double> in TDASServiceSetupInfoLookup suggests two distinct use cases (single rate vs. per-DAS rates), but the distinction is not enforced programmatically.