Files

253 lines
14 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common.DataModel/ApplicationProperties.cs
- Common/DTS.Common.DataModel/CollectDataProcess.cs
- Common/DTS.Common.DataModel/SysBuiltObjectType.cs
- Common/DTS.Common.DataModel/DataModelSettings.cs
- Common/DTS.Common.DataModel/DataFiles.cs
- Common/DTS.Common.DataModel/ChannelRepresentation.cs
- Common/DTS.Common.DataModel/DASFactory.cs
generated_at: "2026-04-16T14:15:08.439336+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d315c00965ab6aef"
---
# DTS.Common.DataModel Module Documentation
## 1. Purpose
This module provides the core data model and application-wide state management for the DTS data acquisition system. It contains global application properties, configuration settings, hardware abstraction for channel representation, data file management utilities, and the DAS (Data Acquisition System) factory wrapper for device discovery and communication. The module serves as a central hub connecting hardware abstraction, user context, ISO standards, and file system operations.
---
## 2. Public Interface
### ApplicationProperties (static class)
Global application state container.
| Property | Type | Description |
|----------|------|-------------|
| `CurrentUser` | `User` | Gets or sets the currently logged-in user. |
| `DASFactory` | `DASFactory` | Gets or sets the DAS factory instance for device management. |
| `CurrentView` | `User` | Gets or sets the current view context user. |
| `IsoDb` | `ISO13499FileDb` | Gets or sets the ISO 13499 database reference. |
| `LicenseValidationResult` | `ValidationResult` | Gets or sets the license validation result. |
| `CanCurrentUserCommitChannelCodes` | `bool` | Gets or sets whether the current user can commit channel codes. |
---
### CollectDataProcess : BasePropertyChanged
Represents a data collection process with visual properties.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `CollectDataProcess(string name, Color color)` | Initializes with name and background color. |
| `Name` | `string` | Gets or sets the process name. |
| `BackgroundColor` | `Color` | Gets or sets the background color. |
| `IsEnabled` | `bool` | Gets or sets whether the process is enabled. |
---
### SysBuiltObjectType
Container for Dynamic Groups of a given test object type (Vehicle 1, Vehicle 2, Sled, etc.).
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `SysBuiltObjectType(string testObjectType)` | Initializes with a test object type string. |
| `TestObject` | `MMETestObjects` | Gets or sets the test object via ISO database lookup. |
| `ISOTestObjectType` | `string` | Gets the ISO test object type text (L1). |
| `ToString()` | `override string` | Returns `TestObject.Text_L1`. |
---
### DataModelSettings (static class)
Configuration settings with default values.
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `UseISOCodeForDiadem200` | `bool` | `false` | ISO code setting for Diadem 200. |
| `SampleRateAAFilterRatio` | `byte` | `5` | Anti-aliasing filter ratio. |
| `SupportedSquibFireModes` | `string` | `"CAP,CONSTANT"` | Supported squib fire modes. |
| `ShowCompactHardware` | `bool` | `true` | Compact hardware display toggle. |
| `AllowedVoltageInsertionErrorPercent` | `double` | `1` | Allowed voltage insertion error percentage. |
| `AllowedExcitationErrorPercent` | `double` | `2` | Allowed excitation error percentage. |
| `AllowedShuntErrorPercent` | `double` | `5` | Allowed shunt error percentage. |
| `ShuntToleranceHighOhmPercent` | `double` | `10` | Shunt tolerance high ohm percentage. |
| `AllowedGainErrorPercent` | `double` | `2` | Allowed gain error percentage. |
| `AllowedGainErrorPercent_SLICE6andSLICE6A` | `double` | `5` | Gain error percentage for SLICE6/SLICE6A. |
| `AutoZeroPercentDeviationAllowed` | `double` | `5` | Auto-zero deviation allowance. |
| `ShuntToleranceHighOhmResistance` | `double` | `4000` | Shunt tolerance high ohm resistance. |
| `DownloadFolder` | `string` | `"..\\..\\Data"` | Default download folder path. |
| `RequireXCrashCompatibilityForISOExports` | `bool` | `true` | XCrash compatibility requirement. |
| `DisplayDuplicateUDPStreamOutWarning` | `bool` | `true` | Duplicate UDP stream warning toggle. |
| `SLICETurnOffAAFRealtime` | `bool` | `true` | SLICE anti-aliasing filter realtime toggle. |
| `UseTestChannelOrder` | `bool` | `false` | Test channel order usage. |
| `RealtimeSampleRateAAFilterRatio` | `byte` | `1` | Realtime sample rate AA filter ratio. |
| `ArmChecklistRequiredIfTOM` | `bool` | `true` | Arm checklist requirement for TOM. |
| `TestsRequireLevelTriggers` | `bool` | `false` | Level trigger requirement. |
| `CheckUnitsIntervalMillisecond` | `int` | `50` | Units check interval in milliseconds. |
| `SemaphoreDelay` | `double` | `10` | Semaphore delay value. |
| `SemaphoreSpots` | `int` | `3` | Number of semaphore spots. |
| `SLICEConcurrentSpots` | `int` | `999` | SLICE concurrent spots. |
| `SLICEConcurrentDelayMs` | `int` | `0` | SLICE concurrent delay in ms. |
| `MulticastAutoDiscoveryReceiveTimeoutMS` | `int` | `1500` | Multicast discovery timeout. |
| `LocalKeepAliveRetryIntervalMS` | `uint` | `1000` | Local keep-alive retry interval. |
| `LocalKeepAliveTimeOutMS` | `uint` | `5000` | Local keep-alive timeout. |
| `RemoteKeepAliveRetryIntervalSeconds` | `uint` | `5` | Remote keep-alive retry interval. |
| `RemoteKeepAliveSeconds` | `uint` | `60` | Remote keep-alive timeout. |
| `ReceiveBufferSizeBytes` | `int` | `65536` | Receive buffer size. |
| `SendBufferSizeBytes` | `int` | `65536` | Send buffer size. |
| `HeartbeatAsyncConnectTimeoutMS` | `int` | `10000` | Heartbeat async connect timeout. |
| `DefaultTDCSensorDatabaseFolder` | `string` | `"..\\SensorDatabase"` | Default TDC sensor database folder. |
| `DefaultTDCSensorDatabaseFile` | `string` | `"SensorDatabase.CSV"` | Default TDC sensor database file. |
| `TDCSensorDatabaseExportUseCurrentLocale` | `bool` | `false` | TDC export locale setting. |
| `TDCSensorDatabaseImportEncoding` | `string` | `"Shift-JIS"` | TDC import encoding. |
---
### DataFiles : BasePropertyChanged
Represents metadata for a test data file.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DataFiles(string expandCollapse, string testName, string id, string allOrROI, string lab, string customer, DateTime dateCreated, string description, string numberOfChannels, string testEngineer, bool isTSRAIR, string roiSuffix = "")` | Initializes all file metadata properties. |
| `LongString` | `string` | Gets or sets a long string representation. |
| `TestSelected` | `bool` | Gets or sets test selection state. |
| `ExpandCollapse` | `string` | Gets or sets expand/collapse state ("+", "-", or empty). |
| `TestId` | `string` | Gets or sets the test ID. |
| `TestName` | `string` | Gets or sets the test name. |
| `AllOrROI` | `string` | Gets or sets whether this is "All" or ROI data. |
| `Lab` | `string` | Gets or sets the lab name. |
| `Customer` | `string` | Gets or sets the customer name. |
| `DateCreated` | `DateTime` | Gets or sets the creation date. |
| `Description` | `string` | Gets or sets the description. |
| `NumberOfChannels` | `string` | Gets or sets the channel count. |
| `TestEngineer` | `string` | Gets or sets the test engineer name. |
| `ROISuffix` | `string` | Gets or sets the ROI suffix. |
| `DTSFile` | `string` | Gets or sets the DTS file location (populated in export tab). |
| `IsTSRAIR` | `bool` | Gets or sets whether this is a TSR AIR test. |
---
### DataFilesList : BasePropertyChanged
Manages collections of `DataFiles` with file system traversal.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DownloadFolder` | `string` | Field storing the download folder path. |
| `GetAllFiles(string testName)` | `DataFiles[]` | Returns all data files for a given test name by traversing folders. |
| `Contract(DataFiles df)` | `DataFiles[]` | Collapses the list, removing expanded items for the given test name. |
| `GetAllDataFiles()` | `DataFiles[]` | Returns top-level data file entries for all tests. |
| `DataFiles` | `DataFiles[]` | Gets or sets the data files list. |
| `DataFileList` | `static DataFilesList` | Singleton instance accessor. |
---
### ChannelRepresentation
Handles channel number conversion and display for various hardware types.
| Member | Signature | Description |
|--------|-----------|-------------|
| `ChannelTypeEnum` | `enum` | Values: `SQUIB`, `TOMDigital`, `DigitalInput`, `Other`. |
| Constructor | `ChannelRepresentation(DASHardware h, DASChannel c, int startingChannelNumber)` | Creates representation from DAS hardware and channel. |
| Constructor | `ChannelRepresentation(HardwareChannel c, int startingChannelNumber, IDASHardware[] hardwares = null)` | Creates representation from hardware channel. |
| `DASSerialNumber` | `string` | Gets or sets the DAS serial number. |
| `SerialNumber` | `string` | Gets or sets the module serial number. |
| `ChannelNumberString` | `string` | Gets the formatted channel number string with prefix. |
| `ChannelNumber` | `int` | Gets the numeric channel number. |
---
### DASFactory
Wrapper around `DTS.DASLib.DASFactory.DASFactory` for device discovery and management.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DASFactory()` | Initializes the factory, semaphores, and event handlers. |
| `StartMulticastAutoDiscovery()` | `void` | Starts auto-discovery process if not running. |
| `StopMulticastAutoDiscovery()` | `void` | Stops auto-discovery process. |
| `GetDiscoveredDevices()` | `IDiscoveredDevice[]` | Returns discovered devices. |
| `GetDASFactory()` | `IDASFactory` | Returns the underlying IDASFactory interface. |
| `TakeOwnership()` | `void` | Takes ownership of devices. |
| `DetachAllDevices(bool detachUSB = false)` | `void` | Detaches all devices; USB detaching is conditional. |
| `DisposeFactory()` | `void` | Disposes the underlying factory. |
| `TDASHostNames` | `string[]` | Gets or sets TDAS host names. |
| `SPFDHostNames` | `string[]` | Gets or sets SPFD host names. |
| `SDBHostNames` | `string[]` | Gets or sets SliceDB host names. |
| `AutoDiscoverMulticast()` | `SortableBindingList<IDiscoveredDevice>` | Performs multicast auto-discovery. |
| `DiscoveryThread(DFConstantsAndEnums.MultiCastDeviceClasses[] deviceFilter, CancellationToken ct, bool discoverParents = true)` | `void` | Background thread for continuous discovery. |
| `StartQATSListening()` | `void` | Starts QATS listening. |
| `StopQATSListening()` | `void` | Stops QATS listening. |
| `SendQATSRequest()` | `void` | Sends UDP QATS request. |
| `GetQATS()` | `IUDPQATSEntry[]` | Returns waiting QATS entries and clears the list. |
| `MulticastAutoDiscoveryReceiveTimeoutMS` | `int` | Gets or sets multicast discovery timeout. |
| `MulticastAutoDiscoveryAddress` | `string` | Gets or sets multicast address. |
| `MulticastAutoDiscoveryPort` | `int` | Gets or sets multicast transmit port. |
| `MulticastAutoDiscoveryResponsePort` | `int` | Gets or sets multicast response port. |
| `S6ConnectNewTimeout` | `double` | Gets or sets SLICE6 connect timeout. |
| `Refresh(bool wait)` | `void` | Refreshes device list; prevents overlapping refreshes. |
| `GetActiveDevices()` | `List<IDASCommunication>` | Returns list of active DAS communications. |
| `GetReportedConnections()` | `string[]` | Returns all reported connections from distributors. |
| `AutoDiscoverIfNecessary()` | `void` | Runs auto-discovery for SLICE6/SLICE6Db downstream MAC addresses. |
| `IsStreaming(IDASCommunication das)` | `static bool` | Returns true if DAS is streaming. |
| `IsInRealtime(IDASCommunication das)` | `static bool` | Returns true if unit is in realtime or streaming. |
| `AnyInRealtime(List<IDASCommunication> das)` | `static bool` | Returns true if any unit is in realtime or streaming. |
**Events:**
- `OnDeviceArrived` - `DASFactoryEventHandler`
- `OnFactoryChanged` - `DASFactoryEventHandler`
- `DiscoveredDAS` - `DiscoveredDASEventHandler`
---
## 3. Invariants
1. **ApplicationProperties singleton state**: All properties are static and globally accessible; consumers must ensure thread-safe access patterns.
2. **DataFilesList singleton**: The `DataFileList` property uses lazy initialization and returns a single shared instance.
3. **DASFactory refresh concurrency**: The `_bInRefresh` flag prevents overlapping refresh calls. If `Refresh` is called while already refreshing, the second call is logged but ignored.
4. **ChannelRepresentation hardware type handling**: The `ConvertChannelNumbers` method must receive valid `HardwareTypes` enum values; unknown types fall through to a default case that uses the starting channel number directly.
5. **DataFiles folder structure**: `GetFoldersWithData` expects folders containing both `.dts` and `.chn` files; folders missing either are excluded.
6. **SysBuiltObjectType ISO lookup**: The `TestObject` getter relies on `ApplicationProperties.IsoDb` being initialized; null `IsoDb` will cause runtime errors.
---
## 4. Dependencies
### This module depends on:
- `DTS.Slice.Users` - User types
- `DTS.Common.ISO` - ISO 13499 database types (`ISO13499FileDb`, `MMETestObjects`)
- `DTS.Common.Licensing.Messages` - `ValidationResult`
- `DTS.Common.Base` - `BasePropertyChanged` for MVVM support
- `DTS.Serialization` - File reading utilities
- `DTS.Common.Utilities.Logging` - `APILogger`
- `DTS.Common.SharedResource.Strings` - Localized string resources
- `DTS.Common.Utils` - Utility classes including `TestUtils`
- `DTS.Common.Converters` - `EnumDescriptionTypeConverter`
- `DTS.Common.Enums.Hardware` - `HardwareTypes` enum
- `DTS.Common.Enums.Sensors` - Sensor-related enums
- `DTS.Common.Interface.DataRecorders` - `IDASHardware`
- `DTS.Common.Interface.DASFactory` - `IDASFactory`, `IDiscoveredDevice`
- `DTS.Common.Enums.DASFactory` - `DFConstantsAndEnums`
- `DTS.Common.Constant.DASSpecific` - `SensorConstants`
- `DTS.DASLib.DASFactory` - Underlying DAS factory implementation
- `DTS.DASLib.Service` - DAS channel and communication types
- `DTS.DASLib.Command.TDAS` - TDAS command infrastructure
- `System.Windows.Media` - `Color` type
- `System.Xml.Linq` - XML parsing
### What depends on this module:
- Unclear from source alone; the module exposes public classes that appear designed for consumption by UI layers, test setup components, and data export functionality.
---
## 5. Gotchas
1. **Namespace inconsistency**: `CollectDataProcess`, `SysBuiltObjectType`, `DataFiles`, `DataFilesList`, and `DASFactory` are declared in namespace `DataPROWin7.DataModel` while the file path suggests `DTS.Common.DataModel`. This may cause confusion when importing.
2. **SysBuiltObjectType fallback value**: The `_