14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:33:19.361594+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | ea5a7a11d2e6d80b |
Documentation: DAS Hardware and Configuration Data Models
1. Purpose
This module provides core data models and utility classes for managing Data Acquisition System (DAS) hardware configuration and settings within the DataPROWin7 system. It defines structured representations of DAS hardware components (DASHardware, referenced indirectly), their specific settings (DASSettings), and battery/input voltage thresholds (DasBatteryInputSettings), enabling serialization to/from the database (tblTestSetupDASSettings), caching for performance optimization during bulk operations, and type-specific default configuration retrieval. The module serves as the data layer abstraction for DAS hardware state and configuration across test setup, validation, and execution workflows.
2. Public Interface
DASSettings (in DataPROWin7.DataModel namespace)
-
DASSettings()
Default constructor. Initializes an empty instance. -
DASSettings(DASSettings setting)
Copy constructor. Copies all property values from the providedsettinginstance. -
string DASSerialNumber { get; set; }
Serial number of the DAS device. Serialized totblTestSetupDASSettings. -
double SampleRate { get; set; }
Sample rate in Hz. Serialized totblTestSetupDASSettings. -
int ExcitationWarmupTimeMS { get; set; }
Excitation warm-up time in milliseconds. Serialized totblTestSetupDASSettings. -
double HardwareAAF { get; set; }
Hardware Anti-Aliasing Filter (AAF) setting. Serialized totblTestSetupDASSettings. -
double PreTriggerSeconds { get; set; }
Duration of pre-trigger buffer in seconds. Serialized totblTestSetupDASSettings. -
double PostTriggerSeconds { get; set; }
Duration of post-trigger buffer in seconds. Serialized totblTestSetupDASSettings. -
bool StatusLineCheck { get; set; }
Flag indicating whether status line monitoring is enabled. Serialized totblTestSetupDASSettings. -
bool BatteryCheck { get; set; }
Flag indicating whether battery voltage checks are enabled. Serialized totblTestSetupDASSettings. -
double InputVoltageMin { get; set; }
Minimum acceptable input voltage threshold. Serialized totblTestSetupDASSettings. -
double InputVoltageMax { get; set; }
Maximum acceptable input voltage threshold. Serialized totblTestSetupDASSettings. -
double BatteryVoltageMin { get; set; }
Minimum acceptable battery voltage threshold. Serialized totblTestSetupDASSettings. -
double BatteryVoltageMax { get; set; }
Maximum acceptable battery voltage threshold. Serialized totblTestSetupDASSettings.
Note
: All properties use
SetProperty(inherited fromBasePropertyChanged) for change notification.
DASHardwareList (in DataPROWin7.DataModel.Classes.Hardware namespace)
-
static bool Cache { get; set; }
Enables/disables database caching. Whentrue, hardware lookups use in-memory cache instead of querying the database. Setting tofalseclears_cachedDASHardware. -
static DASHardwareList GetList()
Returns the singleton instance ofDASHardwareList. Does not auto-populate hardware (commented-outPopulateHardware()call). -
void ReloadAll()
Placeholder method (implementation commented out). Intended to reload hardware list. -
void SetCache(ICachedContainer container)
Sets the_cachedHardwarefield for use inGetHardware(string, bool, out bool, bool). -
void ClearCache()
Clears_cachedHardware. -
string GetDASSerialNumberFromId(int id)
Retrieves the serial number for a given DAS ID by queryingDbOperations.DASGet. Returns empty string if not found. -
DASHardware GetHardware(int id)
RetrievesDASHardwareby ID usingGetDASSerialNumberFromId(id)→GetHardware(string). -
DASHardware GetHardware(string id, bool bUseCache = true)
RetrievesDASHardwareby serial number (or key like"SN_type"), optionally using cache. -
DASHardware[] GetHardware(string[] ids, bool bUseCache = true)
Batch retrieval ofDASHardwareinstances. -
DASHardware GetHardware(string id, bool bThrowExceptionIfChanged, out bool changed, bool bUseCache = true)
Core retrieval logic. Checks_cachedHardwareand_cachedDASHardwareif caching is enabled. Falls back toDTS.Common.ISO.Hardware.GetAllDAS(id, null). Setschanged = falseunconditionally. -
class HardwareTypeChangedException : Exception
Exception type declared but never thrown in source. -
DASHardware GetHardware(string serialNumber, string ipaddress)
Ignoresipaddressand delegates toGetHardware(serialNumber). -
void UpdateMaxMemory(DASHardware h, long newMaxMemory)
UpdatesMaxMemoryon the underlyingDTS.Common.ISO.Hardwareobject and callsUpdate(). -
DASHardware GetPrototypeHardware(string serial, int type)
Retrieves prototype hardware using key"{serial}_{type}"andDbOperations.DAS.PROTOTYPE_POSITION. SetsCalDate = DateTime.MinValue. -
static DASHardware[] GetAllHardware()
Retrieves all DAS hardware viaDTS.Common.ISO.Hardware.GetAllDAS(). Caches result ifCache == true. -
static List<int> GetEmbeddedModules(IDASHardware[] hardware, int id)
Returns list ofDASIds of modules whoseConnectionstarts with the serial number of the hardware identified byid. -
static Dictionary<string, double> GetEmbeddedModuleInfo(DASHardware[] hardware, int id)
Returns dictionary mapping serial numbers of embedded modules to theirGetMaxSampleRateDouble()values. -
enum Tags { Hardware }
Tag used inOnPropertyChangedcalls. -
void Commit(DASHardware hardware, bool bExisting = false, bool bCheckExisting = true, bool Unassociate = true)
PersistsDASHardwarestate to database viaDTS.Common.ISO.Hardware.- If
Unassociate == trueandIsPseudoRack(), callsUnassociateParentDAS. - If
bCheckExisting == true, setsbExistingbased onDASHardware.GetDataBaseID. - Inserts if
!bExisting, otherwise updates with incrementedVersion. - Raises
OnPropertyChanged(Tags.Hardware.ToString()).
- If
-
void Delete(IHardware hardware)
Deletes viaIISOHardware.Delete()if supported. -
void Delete(DASHardware hardware)
Deletes underlyingISO.Hardware, and ifIsPseudoRack(), callsUnassociateParentDAS. -
void Delete(IHardware[] hardware)/void Delete(DASHardware[] hardware)
Batch deletion helpers. -
static void UnassociateParentDAS(string distributorSerialNumber)
Executes stored proceduresp_DASChildrenUnAssociateto remove child associations for the given distributor.
DasBatteryInputSettings (in DataPROWin7.DataModel.BatteryAndInputVoltageDefaults namespace)
-
enum Settings
Ordered list of 14 battery/input voltage thresholds. Order matters for serialization:BatteryLowDiagnosticsThresholdBatteryHighDiagnosticsThresholdBatteryLowArmedThresholdBatteryHighArmedThresholdInputLowDiagnosticsThresholdInputHighDiagnosticsThresholdInputLowArmedThresholdInputHighArmedThresholdMinimumValidBatteryThresholdMinimumValidInputThresholdMaximumValidBatteryThresholdMaximumValidInputThresholdBatteryMediumDiagnosticsThresholdBatteryMediumArmedThresholdInputMediumDiagnosticsThresholdInputMediumArmedThreshold
-
Properties (14 total)
Each has aget/setthat wrapsGetValue(Settings)/SetValue(Settings, double). -
Dictionary<Settings, double> SettingsProperty { get; }
Internal storage for settings. -
DasBatteryInputSettings(string s)
Parses comma-separated string into settings (assumes order matchesSettingsenum). Usesdouble.TryParse(..., CultureInfo.InvariantCulture). -
DasBatteryInputSettings(DasBatteryInputSettings copy)
Copy constructor. -
DasBatteryInputSettings()
Initializes with hardcoded defaults (e.g.,BatteryLowArmedThreshold = 6.8,InputHighArmedThreshold = 15.3, etc.). ThrowsNotSupportedExceptionfor unknown settings. -
string ToSerializedString()
Serializes settings inSettingsenum order to comma-separated string. -
double GetValue(Settings setting)
Returns value forsetting. ThrowsNotSupportedExceptionif missing. -
void SetValue(Settings setting, double d)
Sets value forsetting.
InputAndBatterySettings (static class, same namespace)
-
static Dictionary<HardwareTypes, DasBatteryInputSettings> _cache
Cache of settings per hardware type. -
static void ClearCache()
Clears_cache. -
static double GetValue(string DasType, DasBatteryInputSettings.Settings setting)
ParsesDasTypetoHardwareTypes, then callsGetValue(HardwareTypes, Settings). Returnsdouble.NaNon parse failure. -
static DasBatteryInputSettings GetDefaultSettingForHWType(HardwareTypes type)
Returns default settings fortypefromCommon.SerializedSettings.*_PowerSetting_Defaultfields. Caches ifRunTestVariables.InRunTest && CacheVoltageSettingsInRunTest. ThrowsNotSupportedExceptionif type unsupported. -
static void SetSettingForHWType(HardwareTypes type, DasBatteryInputSettings setting)
Assignssettingto correspondingCommon.SerializedSettings.*_PowerSettingfield. -
static DasBatteryInputSettings GetSettingForHWType(HardwareTypes type)
Returns current (possibly overridden) settings fortypefromCommon.SerializedSettings.*_PowerSettingfields. Caches if applicable. ThrowsNotSupportedExceptionif type unsupported. -
static double GetValue(HardwareTypes type, DasBatteryInputSettings.Settings setting)
ReturnsGetSettingForHWType(type).GetValue(setting).
3. Invariants
-
DASSettings- All properties are nullable (no validation constraints enforced in class).
- Serialization format is fixed: properties map directly to columns in
tblTestSetupDASSettings. - Property names match exactly those used in
SetPropertycalls (case-sensitive).
-
DASHardwareListCacheflag controls whether_cachedDASHardwareis populated/used. SettingCache = falseclears_cachedDASHardware.GetHardware(string, bool, out bool, bool)always setschanged = false; thebThrowExceptionIfChangedparameter is unused.CommitassumesDASHardwarewraps a validDTS.Common.ISO.Hardwareinstance.UnassociateParentDASis called only for pseudo-rack hardware duringCommitorDelete.
-
DasBatteryInputSettingsSettingsenum order must not change without updating serialization logic (ToSerializedString, constructor from string).- Default constructor initializes all 14 settings; missing cases throw
NotSupportedException. GetValue/SetValueassume key exists; missing keys throwNotSupportedException.
4. Dependencies
Imports/References (from source):
DTS.Common.Base→ ProvidesBasePropertyChanged.DTS.Common.ISO.Hardware→ Core hardware data model (GetAllDAS,Hardware,HardwareChannel).DTS.Common.Storage→DbOperations,DbOperationsEnum.StoredProcedure.DTS.Common.Interface.DASFactory.Diagnostics,DTS.Common.Interface.DataRecorders,DTS.Common.Interface.DASFactory.Diagnostics.HardwareList→ Interfaces for hardware diagnostics and storage.System,System.Linq,System.Collections.Generic,System.Windows,System.Configuration→ Standard libraries.DataPROWin7.DataModel.Classes.TestTemplate→ Test template classes.DTS.Common.Enums,DTS.Common.Enums.Hardware→HardwareTypesenum.Common.SerializedSettings→ Static class holding default/overridden settings per hardware type.RunTestVariables→ Controls caching behavior during run tests.
Inferred Usage:
DASSettingsis serialized totblTestSetupDASSettings(database table).DASHardwareListinteracts withDASHardware(not shown here but referenced).InputAndBatterySettingsrelies onCommon.SerializedSettingsandRunTestVariablesfor runtime configuration.
5. Gotchas
-
DASHardwareList.GetHardware(...)always setschanged = false
Despite having anout bool changedparameter and aHardwareTypeChangedExceptiontype, the implementation never detects changes or throws the exception. -
DASHardwareList.GetHardware(string id, bool bThrowExceptionIfChanged, out bool changed, bool bUseCache)ignoresbThrowExceptionIfChanged
The parameter is unused in the method body. -
DASHardwareList.GetHardware(string serialNumber, string ipaddress)discardsipaddress
Only usesserialNumber. -
DASHardwareList.Commitassumeshardware.GetHardware()is non-null
No null-check before accessinghardware.GetHardware()properties. -
DASHardwareList.UnassociateParentDASis called only for pseudo-rack hardware
Logic depends onIsPseudoRack()(not defined here), but no validation ensures this condition is checked correctly. -
DasBatteryInputSettingsserialization order is fragile
Constructor from string assumes exact enum order; reorderingSettingswill break deserialization. -
InputAndBatterySettings._cacheis shared globally
ClearCache()affects all callers; caching behavior depends onRunTestVariablesflags. -
DASSettingscopy constructor copies private fields directly
No deep-copy or validation; mutable reference types (if added later) could cause side effects. -
DASHardwareList.GetAllHardware()may return stale data ifCache = true
Once cached,_cachedDASHardwarepersists untilCacheis set tofalse. -
No validation of numeric ranges
Properties likeSampleRate,PreTriggerSeconds, or voltage thresholds accept anydouble/intwithout bounds checking. -
GetEmbeddedModules/GetEmbeddedModuleInfousehardware.First(...).SerialNumberwithout null-check
If no hardware matchesDASId == id,First()throwsInvalidOperationException.