Files
2026-04-17 14:55:32 -04:00

11 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common.DataModel/Classes/Hardware/DASSettings.cs
Common/DTS.Common.DataModel/Classes/Hardware/DASHardwareList.cs
Common/DTS.Common.DataModel/Classes/Hardware/BatteryAndInputVoltageDefaults.cs
2026-04-17T15:37:11.649380+00:00 zai-org/GLM-5-FP8 1 c98b9bdc3b18b6bf

Hardware Data Model Documentation

Purpose

This module provides the data model layer for Data Acquisition System (DAS) hardware management within the DTS system. It encompasses three distinct concerns: DASSettings captures test-specific DAS configuration parameters (sample rates, trigger timing, voltage thresholds) for serialization into tblTestSetupDASSettings; DASHardwareList serves as a singleton registry for DAS hardware instances with caching and database persistence operations; and DasBatteryInputSettings/InputAndBatterySettings manage hardware-type-specific battery and input voltage threshold defaults with serialization support.


Public Interface

DASSettings (DataPROWin7.DataModel)

Constructors:

  • DASSettings() — Default parameterless constructor.
  • DASSettings(DASSettings setting) — Copy constructor that clones all property values from another instance.

Properties:

Property Type Description
DASSerialNumber string Serial number identifier for the DAS unit.
SampleRate double Data acquisition sample rate.
ExcitationWarmupTimeMS int Excitation warmup time in milliseconds.
HardwareAAF double Hardware Anti-Aliasing Filter setting.
PreTriggerSeconds double Pre-trigger duration in seconds.
PostTriggerSeconds double Post-trigger duration in seconds.
StatusLineCheck bool Flag indicating whether status line checking is enabled.
BatteryCheck bool Flag indicating whether battery checking is enabled.
InputVoltageMin double Minimum input voltage threshold.
InputVoltageMax double Maximum input voltage threshold.
BatteryVoltageMin double Minimum battery voltage threshold.
BatteryVoltageMax double Maximum battery voltage threshold.

DASHardwareList (DataPROWin7.DataModel.Classes.Hardware)

Static Properties:

  • Cache (bool) — Enables/disables cached data mode. Setting to false clears _cachedDASHardware.

Static Methods:

  • DASHardwareList GetList() — Returns the singleton instance, creating it if necessary.
  • DASHardware[] GetAllHardware() — Retrieves all DAS hardware, using cache if Cache is true.
  • List<int> GetEmbeddedModules(IDASHardware[] hardware, int id) — Returns module IDs for embedded hardware matching the given DAS ID.
  • Dictionary<string, double> GetEmbeddedModuleInfo(DASHardware[] hardware, int id) — Returns a dictionary of serial number to max sample rate for embedded modules.
  • void UnassociateParentDAS(string distributorSerialNumber) — Calls stored procedure sp_DASChildrenUnAssociate to unassociate child DAS units from a parent.

Instance Methods:

  • void ReloadAll() — Intended to repopulate hardware (currently commented out).
  • void SetCache(ICachedContainer container) — Sets an ICachedContainer for hardware caching.
  • void ClearCache() — Clears the _cachedHardware reference.
  • string GetDASSerialNumberFromId(int id) — Queries database for serial number by DAS ID using DbOperations.DASGet.
  • DASHardware GetHardware(int id) — Retrieves hardware by integer ID.
  • DASHardware GetHardware(string id, bool bUseCache = true) — Retrieves hardware by serial number string.
  • DASHardware[] GetHardware(string[] ids, bool bUseCache = true) — Retrieves multiple hardware instances by serial number array.
  • DASHardware GetHardware(string id, bool bThrowExceptionIfChanged, out bool changed, bool bUseCache = true) — Full retrieval method with change detection output parameter.
  • DASHardware GetHardware(string serialNumber, string ipaddress) — Retrieves hardware by serial number (ipaddress parameter is unused).
  • void UpdateMaxMemory(DASHardware h, long newMaxMemory) — Updates the MaxMemory property and persists to database.
  • DASHardware GetPrototypeHardware(string serial, int type) — Retrieves prototype hardware using DbOperations.DAS.PROTOTYPE_POSITION.
  • void Commit(DASHardware hardware, bool bExisting = false, bool bCheckExisting = true, bool Unassociate = true) — Persists hardware to database via DTS.Common.ISO.Hardware insertion or update.
  • void Delete(IHardware hardware) — Deletes hardware implementing IISOHardware.
  • void Delete(DASHardware hardware) — Deletes a DASHardware instance, unassociating children if pseudo-rack.
  • void Delete(IHardware[] hardware) — Batch delete for IHardware array.
  • void Delete(DASHardware[] hardware) — Batch delete for DASHardware array.

Nested Types:

  • HardwareTypeChangedException — Inner exception class extending Exception.
  • enum Tags — Contains Hardware value for property change notification.

DasBatteryInputSettings (DataPROWin7.DataModel.BatteryAndInputVoltageDefaults)

Nested Enum:

  • Settings — Enum defining 16 threshold types. Order is significant for serialization.

Constructors:

  • DasBatteryInputSettings(string s) — Deserializes from comma-separated string; parses values in enum order.
  • DasBatteryInputSettings(DasBatteryInputSettings copy) — Copy constructor.
  • DasBatteryInputSettings() — Default constructor initializing all thresholds to hardcoded defaults.

Properties: All 16 properties corresponding to Settings enum values, typed as double:

  • BatteryLowDiagnosticsThreshold, BatteryHighDiagnosticsThreshold
  • BatteryLowArmedThreshold, BatteryHighArmedThreshold
  • InputLowDiagnosticsThreshold, InputHighDiagnosticsThreshold
  • InputLowArmedThreshold, InputHighArmedThreshold
  • MinimumValidBatteryThreshold, MinimumValidInputThreshold
  • MaximumValidBatteryThreshold, MaximumValidInputThreshold
  • BatteryMediumDiagnosticsThreshold, BatteryMediumArmedThreshold
  • InputMediumDiagnosticsThreshold, InputMediumArmedThreshold

Instance Methods:

  • string ToSerializedString() — Serializes all settings to comma-separated string using invariant culture.
  • double GetValue(Settings setting) — Retrieves value from SettingsProperty dictionary.
  • void SetValue(Settings setting, double d) — Sets value in SettingsProperty dictionary.

InputAndBatterySettings (Static Class)

Static Methods:

  • void ClearCache() — Clears the internal _cache dictionary.
  • double GetValue(string DasType, DasBatteryInputSettings.Settings setting) — Gets threshold value by DAS type string.
  • double GetValue(HardwareTypes type, DasBatteryInputSettings.Settings setting) — Gets threshold value by HardwareTypes enum.
  • DasBatteryInputSettings GetDefaultSettingForHWType(HardwareTypes type) — Returns default settings for hardware type, caching if RunTestVariables.InRunTest and RunTestVariables.CacheVoltageSettingsInRunTest are true.
  • DasBatteryInputSettings GetSettingForHWType(HardwareTypes type) — Returns current settings for hardware type from Common.SerializedSettings.
  • void SetSettingForHWType(HardwareTypes type, DasBatteryInputSettings setting) — Persists settings to Common.SerializedSettings for the specified hardware type.

Invariants

  1. DASSettings: All property setters use SetProperty from BasePropertyChanged, implying property change notification is raised on every assignment regardless of value equality.

  2. DASHardwareList Singleton: The GetList() method returns a lazily-initialized singleton. The _list field is never reset to null except implicitly by the runtime.

  3. DASHardwareList Cache Consistency: When Cache is set to false, _cachedDASHardware is cleared. The _cachedHardware (instance) and _cachedDASHardware (static) are separate caching mechanisms.

  4. DasBatteryInputSettings Serialization Order: The Settings enum order must remain unchanged; serialization/deserialization relies on enum integer values as array indices.

  5. Hardware Type Mapping: Multiple HardwareTypes values map to the same settings (e.g., SLICE2_SIM and SLICE2_Base share settings; TDAS_Pro_Rack and TDAS_LabRack share settings).

  6. Commit Versioning: When updating existing hardware, h.Version is incremented by 1 before calling Update().


Dependencies

Direct Dependencies (Imports):

Module Depends On
DASSettings DTS.Common.Base (BasePropertyChanged)
DASHardwareList DTS.Common.Base, DTS.Common.DataModel, DTS.Common.Interface.DASFactory.Diagnostics, DTS.Common.Interface.DASFactory.Diagnostics.HardwareList, DTS.Common.Interface.DataRecorders, DTS.Common.Storage, System.Windows, DataPROWin7.DataModel.Classes.TestTemplate
BatteryAndInputVoltageDefaults DTS.Common.Enums, DTS.Common.Enums.Hardware, System.Configuration

External System Dependencies:

  • DbOperations — Database access layer for DAS queries and stored procedures.
  • DTS.Common.ISO.Hardware — ISO hardware abstraction for persistence operations.
  • Common.SerializedSettings — Persistent settings storage for battery/input thresholds.
  • RunTestVariables — Runtime configuration flags (InRunTest, CacheVoltageSettingsInRunTest).
  • ApplicationProperties.CurrentUser — Current user context for audit fields.

Gotchas

  1. DASHardwareList.GetHardware(string, string) Ignores IP Address: The ipaddress parameter in GetHardware(string serialNumber, string ipaddress) is passed but never used—the method simply calls GetHardware(serialNumber).

  2. ReloadAll() is a No-Op: The ReloadAll() method body is entirely commented out. Calling it has no effect.

  3. Cache Flag Scope Confusion: DASHardwareList has two separate caching mechanisms—static Cache property controls _cachedDASHardware, while instance method SetCache controls _cachedHardware. These operate independently.

  4. Hardware Type Settings Fallthrough: In GetSettingForHWType, several hardware types (e.g., DIM, SIM, TOM, Ribeye, SLICE_Base) fall through to defaults with comments indicating they're "not expected" to reach that code path. This may mask configuration errors.

  5. GetHardware ID Parsing: When using _cachedHardware, the id parameter is split on underscore (tokens = id.Split('_')) and only tokens[0] is used. This implies IDs may contain additional underscore-delimited metadata.

  6. Commit Order Dependency for SLICE6Db: The comment in Commit() notes that when committing hardware groups containing SLICE6Db, the parent must be committed before children to avoid association issues.

  7. Prototype Hardware CalDate Reset: GetPrototypeHardware explicitly sets CalDate = DateTime.MinValue for prototypes, which may affect calibration status checks elsewhere.

  8. DasBatteryInputSettings Default Constructor Throws on Unknown: The default constructor's switch statement throws NotSupportedException for any enum value not explicitly handled, making it fragile to enum extensions.