init
This commit is contained in:
17
docs/ai/Common/DTS.Common.DataModel/Classes.md
Normal file
17
docs/ai/Common/DTS.Common.DataModel/Classes.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Enums.cs
|
||||
generated_at: "2026-04-17T16:11:03.088050+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0de057f879229b98"
|
||||
---
|
||||
|
||||
# Classes
|
||||
|
||||
### Purpose
|
||||
This module defines core enumeration types used throughout the DTS data model layer. It provides standardized options for export formats, ISO channel sensor compatibility validation levels, and strictness modes for data operations. These enums serve as shared constants across the application.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`IsoChannelSensorCompatibilityLevels`** (enum)
|
||||
129
docs/ai/Common/DTS.Common.DataModel/Classes/Arming.md
Normal file
129
docs/ai/Common/DTS.Common.DataModel/Classes/Arming.md
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Arming/Arming.cs
|
||||
generated_at: "2026-04-17T15:43:00.640638+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f820a35e3a0ae97a"
|
||||
---
|
||||
|
||||
# Documentation: Arming Class
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `Arming` class orchestrates the complete arming sequence for Data Acquisition System (DAS) devices. It manages configuration application, flash memory clearing, pre-arm validation (including level trigger checks), and the final arm execution. This class serves as the primary controller for transitioning DAS hardware from an idle state to an armed, trigger-ready state in test measurement scenarios.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `Arming()`
|
||||
**Signature:** `public Arming()`
|
||||
|
||||
Default constructor. Initializes a new instance with a `Configuration` object.
|
||||
|
||||
---
|
||||
|
||||
### `SetConfigAndFlashClear`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public bool SetConfigAndStartFlashClear(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
Dictionary<string, int> dasSampleRateList,
|
||||
double duration,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction,
|
||||
ServiceBase.ServiceCallbackErrorEventHandler onError)
|
||||
```
|
||||
|
||||
**Behavior:** Entry point for the arming workflow. Configures DAS modules with test parameters (post-trigger duration, pre-trigger seconds, number of events, wake-up motion timeout), applies configuration via `Configuration.SetConfig()`, and initiates the flash clear sequence. Returns `true` on success, `false` on failure.
|
||||
|
||||
---
|
||||
|
||||
### `SoftwareTrigger`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public void SoftwareTrigger(List<IDASCommunication> dasList)
|
||||
```
|
||||
|
||||
**Behavior:** Sends a software trigger command to all DAS devices in the list. Executes within the `DASHardware.GetArmStatusLock`. Logs failures via `APILogger.Log()`.
|
||||
|
||||
---
|
||||
|
||||
### `DisarmAsync`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public void DisarmAsync(List<IDASCommunication> dasList)
|
||||
```
|
||||
|
||||
**Behavior:** Public entry point for disarming DAS devices. Delegates to `DisarmSync()` internally (despite the async naming).
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Thread Safety:** All hardware operations (`FlashErase`, `PrepareArmFunc`, `ArmNowFunc`, `SoftwareTrigger`, `DisarmSync`) execute within a lock on `DASHardware.GetArmStatusLock`.
|
||||
- **Pre-trigger Calculation:** Pre-trigger seconds is always calculated as `TSRAIR.TSRAIR_MAX_PRE_TRIGGER_SAMPLES / sampleRate` for each DAS.
|
||||
- **Flash Clear Prerequisite:** Flash memory must be successfully erased before proceeding to `PrepareArmFunc`.
|
||||
- **Level Trigger Validation:** If `currentTest.LevelTriggerChannels.Count > 0`, the system checks for already-level-triggered channels and fails if any are detected.
|
||||
- **Failure Propagation:** Any failure during the arming sequence results in `false` return and invocation of the `onError` callback.
|
||||
- **Disarm on Partial Failure:** If some devices arm successfully while others fail, all devices are disarmed for safety (per FogBugz 4527).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
| Dependency | Usage |
|
||||
|------------|-------|
|
||||
| `DTS.Common.Interface.DASFactory.IDASCommunication` | DAS device abstraction |
|
||||
| `DTS.Common.Utilities.Logging.APILogger` | Logging |
|
||||
| `DTS.DASLib.Service.ArmingService` | Service layer for arming operations |
|
||||
| `DTS.DASLib.Service.ServiceBase` | Callback infrastructure |
|
||||
| `DTS.Common.SharedResource.Strings.StringResources` | Localized error messages |
|
||||
| `DTS.Common.DataModel.Common.StatusHelpers` | Progress reporting helpers |
|
||||
| `DTS.Common.DataModel.Common.DASHardware` | Hardware lock singleton |
|
||||
| `DTS.Common.Enums.TSRAIRGo.TSRAIRGoStatus` | Status type enums |
|
||||
| `DTS.Common.Constant.DASSpecific.TSRAIR` | Constants including `TSRAIR_MAX_PRE_TRIGGER_SAMPLES` |
|
||||
| `DTS.Common.DataModel.Classes.TSRAIRGo.Configuration` | Configuration application |
|
||||
|
||||
### Data Types Referenced:
|
||||
- `DataModel.TestTemplate` - Test configuration container
|
||||
- `AnalogInputDASChannel` - Channel type with `AlreadyLevelTriggered` property
|
||||
- `ArmStatus` - Arm state tracking object
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
### Namespace Mismatch
|
||||
The file path indicates `DTS.Common.DataModel` but the namespace is declared as `DataPROWin7.DataModel.Classes`. This may cause confusion or require external aliasing.
|
||||
|
||||
### Misleading Async Naming
|
||||
`DisarmAsync()` is **not asynchronous**—it calls `DisarmSync()` which blocks on a `ManualResetEvent`. The naming is misleading.
|
||||
|
||||
### Magic Numbers
|
||||
- `ARM_NOW_TIMEOUT = 30000` (30 seconds)
|
||||
- `600000` (10 minutes) passed to `ReadyForArm()`
|
||||
- `50` ms polling interval used throughout
|
||||
- Hardcoded `30000` and `dasList.Count > 1` in `PreparedArmNowFunc` with a TODO comment: `"///////////fix the 30000 and 1 (at least)"`
|
||||
|
||||
### Historical Bug Fixes Referenced
|
||||
- **FB 26980:** Override `mod.NumberOfEvents` to ensure correct value
|
||||
- **39345:** Don't hang if Flash Erase fails
|
||||
- **4527:** Disarm all devices if any fail during arm (safety measure)
|
||||
- **15630:** Limit `EnableFaultChecking` to single unit at a time for TDAS with rack
|
||||
- **15267:** Stop on ERR response from TDAS ARM RF
|
||||
|
||||
### Unused Code Path
|
||||
In `ArmNowFunc()`, there is an empty conditional block:
|
||||
```csharp
|
||||
if (Common.SerializedSettings.StoreTestHistoryInDb)
|
||||
{
|
||||
//add code here?
|
||||
}
|
||||
```
|
||||
This suggests incomplete implementation.
|
||||
|
||||
### Polling Pattern
|
||||
The code uses a busy-wait polling pattern with `ManualResetEvent.WaitOne(50, false)` in multiple places. This is not ideal for performance but appears intentional for the hardware communication layer.
|
||||
70
docs/ai/Common/DTS.Common.DataModel/Classes/Configuration.md
Normal file
70
docs/ai/Common/DTS.Common.DataModel/Classes/Configuration.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Configuration/Configuration.cs
|
||||
generated_at: "2026-04-17T15:42:37.313288+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bbafb2fe040fef50"
|
||||
---
|
||||
|
||||
# Documentation: Configuration Class
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `Configuration` class is responsible for configuring Data Acquisition System (DAS) hardware devices by applying voltage threshold settings, resetting hardware lines, and persisting configuration files. It serves as a bridge between test templates and physical DAS hardware, ensuring devices are properly configured for either diagnostic or armed operational modes. The class handles the complete configuration lifecycle including threshold application, hardware line reset, configuration upload, and local file backup.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `Configuration()` (Constructor)
|
||||
**Signature:** `public Configuration()`
|
||||
|
||||
Default parameterless constructor. Performs no initialization.
|
||||
|
||||
---
|
||||
|
||||
### `SetConfig`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public void SetConfig(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
bool calledDuringDiagnostics,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction)
|
||||
```
|
||||
|
||||
**Behavior:** Configures all DAS devices in `dasList` with voltage thresholds and hardware settings. The method:
|
||||
1. Acquires a lock on `DASHardware.GetArmStatusLock`
|
||||
2. Sets minimum/maximum valid input and battery voltage thresholds for each DAS
|
||||
3. Applies either diagnostic or armed voltage thresholds based on `calledDuringDiagnostics` parameter
|
||||
4. Resets hardware lines via `ConfigurationService.ResetHardwareLines`
|
||||
5. Calls `ConfigurationService.SetConfiguration` with multiple parameters including AAF rates and DSP settings
|
||||
6. Copies configuration files to the test directory via `CopyGlobalConfigsToLocalFolder`
|
||||
|
||||
---
|
||||
|
||||
### `ErrorCallback`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static DialogResult ErrorCallback(string errorString, string units)
|
||||
```
|
||||
|
||||
**Behavior:** Static callback method that logs configuration errors via `APILogger.Log` and returns `DialogResult.OK`. The `units` parameter is not used in the implementation.
|
||||
|
||||
---
|
||||
|
||||
### `CopyGlobalConfigsToLocalFolder` (Private)
|
||||
**Signature:**
|
||||
```csharp
|
||||
private void CopyGlobalConfigsToLocalFolder(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList)
|
||||
```
|
||||
|
||||
**Behavior:** Copies DAS and module configuration XML files from the current directory's `Constants.DAS_CONFIGS` subfolder to the test directory. Creates the destination directory if it does not exist. Catches and logs exceptions without re-throwing.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Thread Safety:** All configuration operations within `SetConfig` are protected by a lock on `DASHardware.GetArmStatusLock`.
|
||||
- **Voltage Threshold Ordering:** The code does not explicitly validate that minimum thresholds are less than maximum thresholds.
|
||||
- **Configuration File Naming:** DAS config files are named `{OwningDAS}.xml`; module config files are named `{SerialNumber}.xml`.
|
||||
- **Callback Completion:** Both `ResetHardwareLines` and `SetConfiguration` operations block
|
||||
240
docs/ai/Common/DTS.Common.DataModel/Classes/Diagnostics.md
Normal file
240
docs/ai/Common/DTS.Common.DataModel/Classes/Diagnostics.md
Normal file
@@ -0,0 +1,240 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Diagnostics/Diagnostics.cs
|
||||
generated_at: "2026-04-17T15:43:31.698963+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7b5c8f5df247c453"
|
||||
---
|
||||
|
||||
# Documentation: Diagnostics Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module manages diagnostic operations and hardware configuration for Data Acquisition System (DAS) devices in a test environment. It handles the complete lifecycle of test setup configuration including: exporting test setups to XML, storing configurations on DAS hardware, configuring individual channel types (analog, squib, TOM digital, CAN), managing level trigger settings, and preparing hardware for diagnostic runs. The module serves as the bridge between test template definitions and the actual hardware configuration required to execute tests.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `LevelTriggerCapableChannel`
|
||||
|
||||
A wrapper class for managing level trigger configuration on hardware channels.
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public LevelTriggerCapableChannel(
|
||||
HardwareChannel hwch,
|
||||
SensorData sd,
|
||||
SensorCalibration sc,
|
||||
IGroup group,
|
||||
IGroupChannel groupChannel)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `HardwareChannel` | `HardwareChannel` | Read-only access to the underlying hardware channel |
|
||||
| `DASOrModuleSerialNumber` | `string` | Returns module serial number for TDAS_Pro_Rack/TDAS_LabRack, otherwise hardware serial number |
|
||||
| `LessThanValue` | `double` | Threshold value for "less than" trigger (default: 0D) |
|
||||
| `GreaterThanValue` | `double` | Threshold value for "greater than" trigger (default: 0D) |
|
||||
| `IsLessThanThresholdEnabled` | `bool` | Enables/disables less-than threshold trigger |
|
||||
| `IsGreatherThanThresholdEnabled` | `bool` | Enables/disables greater-than threshold trigger (note: typo in property name) |
|
||||
| `InsideUpperBoundValue` | `double` | Upper bound for inside-window trigger |
|
||||
| `InsideLowerBoundValue` | `double` | Lower bound for inside-window trigger |
|
||||
| `OutsideUpperBoundValue` | `double` | Upper bound for outside-window trigger |
|
||||
| `OutsideLowerBoundValue` | `double` | Lower bound for outside-window trigger |
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public DTS.Common.ISO.LevelTriggerChannel ToISOLevelTriggerChannel()
|
||||
```
|
||||
Converts this configuration to an ISO-compatible `LevelTriggerChannel` object. TSR Air High G channels receive special handling for trigger enablement.
|
||||
|
||||
```csharp
|
||||
public void FromISOLevelTriggerChannel(DTS.Common.ISO.LevelTriggerChannel channel)
|
||||
```
|
||||
Populates this object's properties from an ISO `LevelTriggerChannel`. TSR Air High G channels have inverted logic for threshold enablement.
|
||||
|
||||
---
|
||||
|
||||
### Class: `Diagnostics`
|
||||
|
||||
Main class for diagnostic operations and configuration management.
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public Diagnostics()
|
||||
```
|
||||
|
||||
**Public Methods:**
|
||||
|
||||
```csharp
|
||||
public bool Reset(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
Dictionary<string, int> dasSampleRateList,
|
||||
DASHardware[] hardware,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction,
|
||||
DTS.Slice.Users.User currentUser)
|
||||
```
|
||||
Initiates a reset operation. Marks all DAS as unclean, attempts partial connection, and returns `true` if data has never been downloaded, `false` otherwise.
|
||||
|
||||
```csharp
|
||||
public void ContinueReset(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
Dictionary<string, int> dasSampleRateList,
|
||||
DASHardware[] hardware,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction,
|
||||
DTS.Slice.Users.User currentUser)
|
||||
```
|
||||
Continues the reset process by updating configuration and running diagnostics.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfig(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> ldas,
|
||||
bool clearDiagnostics,
|
||||
DASHardware[] allHardware,
|
||||
DTS.Slice.Users.User currentUser)
|
||||
```
|
||||
Main configuration orchestration method. Sets DAS order indices, builds channel lookups, and configures all DAS devices.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigDAS(
|
||||
IDASCommunication das,
|
||||
DTS.Slice.Users.User currentUser,
|
||||
SortOutConfigParams soParams,
|
||||
ReportErrorsDelegate reportErrors = null)
|
||||
```
|
||||
Configures a single DAS device, iterating through all modules and channels.
|
||||
|
||||
```csharp
|
||||
public static bool SortOutConfigAnalog(
|
||||
AnalogInputDASChannel dasChannel,
|
||||
string key,
|
||||
int moduleChannelNumber,
|
||||
IDASCommunication das,
|
||||
DASHardware h,
|
||||
IDASModule mod,
|
||||
SortOutConfigParams soParams,
|
||||
ReportErrorsDelegate ReportErrors = null)
|
||||
```
|
||||
Configures analog input channels. Returns `false` if calibration cannot be found. Sets extensive properties including sensitivity, engineering units, excitation, level triggers, and IEPE configuration.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigCAN(
|
||||
IDASChannel c,
|
||||
int moduleChannelNumber,
|
||||
SortOutConfigParams soParams)
|
||||
```
|
||||
Configures CAN input channels with FD settings, bitrates, and file type.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigSquib(
|
||||
ref int currentChannelIdx,
|
||||
IDASModule mod,
|
||||
string key,
|
||||
ref int moduleChannelNumber,
|
||||
IDASChannel c,
|
||||
IDASCommunication das,
|
||||
SortOutConfigParams soParams)
|
||||
```
|
||||
Configures squib output channels. Handles both Voltage (VO) and Current (CU) channels as a pair. Throws `NotSupportedException` if both channels are not present.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigTOMDigitalChannel(
|
||||
IDASChannel c,
|
||||
string key,
|
||||
int moduleChannelNumber,
|
||||
SortOutConfigParams soParams)
|
||||
```
|
||||
Configures TOM digital output channels with delay, duration, and output mode settings.
|
||||
|
||||
**Delegate:**
|
||||
```csharp
|
||||
public delegate void ReportErrorsDelegate(List<string> errors);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Class: `SortOutConfigParams` (nested in `Diagnostics`)
|
||||
|
||||
Parameter container for configuration operations.
|
||||
|
||||
**Public Members:**
|
||||
| Member | Type | Description |
|
||||
|--------|------|-------------|
|
||||
| `TestTemplate` | `DataModel.TestTemplate` | The test template being configured |
|
||||
| `FilterLookup` | `Dictionary<string, double>` | Lookup for filter settings |
|
||||
| `AllHardware` | `DASHardware[]` | Array of all hardware (setter appears truncated) |
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public int GetHardwareChannelToAbsoluteDisplayOrderCount()
|
||||
public bool ContainsHardwareChannelDisplayOrder(string key)
|
||||
public int GetHardwareChannelAbsoluteDisplayOrder(string key)
|
||||
public int GetMaxAbsoluteDisplayOrder()
|
||||
public void AddGroupChannels(IGroupChannel[] channels)
|
||||
public void SetAbsoluteDisplayOrderFromIndex(string key, IGroupChannel ch)
|
||||
public HardwareChannel GetHardwareChannel(string key)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Channel Key Format**: Channel keys are constructed as `"{DASId}_{ChannelNumber}"` and must be unique within a test setup.
|
||||
|
||||
2. **Squib Channel Pairing**: Squib channels must exist as adjacent pairs (Voltage then Current). The method throws `NotSupportedException` with message "require both VO and CU channels" if the second channel is missing.
|
||||
|
||||
3. **Calibration Requirement**: `SortOutConfigAnalog` returns `false` if no valid calibration can be found for the sensor's supported excitation types.
|
||||
|
||||
4. **TSR Air High G Special Handling**:
|
||||
- Greater-than and less-than threshold triggers are always disabled for TSR Air High G channels
|
||||
- Trigger outside bounds is always enabled for TSR Air High G channels
|
||||
|
||||
5. **IEPE Configuration**: If a channel's IEPE status disagrees with the sensor's bridge type, the system attempts to reprogram the DAS. If reprogramming fails, errors are reported via the `ReportErrors` delegate.
|
||||
|
||||
6. **DAS Inclusion**: DAS devices not part of the current test have all their channels disabled via `DisableChannel()`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `DTS.Common.Classes.Hardware` - `DASHardware`, `HardwareChannel`
|
||||
- `DTS.Common.Interface.DASFactory` - `IDASCommunication`, `IDASModule`, `IDASChannel`
|
||||
- `DTS.Common.Interface.Channels` - Channel interfaces
|
||||
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`, `IGroupChannel`
|
||||
- `DTS.DASLib.Service` - `ConfigurationService`, `ServiceBase`
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger`
|
||||
- `DTS.Slice.Users.UserSettings` - `SerializedSettings`, `Defaults`
|
||||
- `DTS.SensorDB` - `SensorData`, `SensorCalibration`, `SensorModel`
|
||||
- `DTS.Common.Classes.Sensors` - Sensor-related classes
|
||||
- `DTS.Common.Classes.Groups` - `GroupChannel`
|
||||
- `DTS.Common.Enums` - Various enumerations
|
||||
- `DTS.Common.ISO` - ISO-related data structures
|
||||
- `DataPROWin7.Common` - `StatusHelpers`, `ExportTestSetup`
|
||||
|
||||
**What depends on this module:**
|
||||
- Cannot be determined from source alone (no callers visible in this file)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Typo in Property Name**: `IsGreatherThanThresholdEnabled` contains a typo ("Greather" instead of "Greater"). This is part of the public API and cannot be changed without breaking compatibility.
|
||||
|
||||
2. **TSR Air Go Timeout**: The constant `TSRAIRGO_QUERYCONFIG_TIMEOUT` is set to 150000ms (2.5 minutes), which is significantly longer than standard query timeouts.
|
||||
|
||||
3. **Legacy TOM Filter Behavior**: When `SerializedSettings.UseLegacyTOMCFC` is true and sample rate exceeds `TestObjectHelper.TDC_LEGACY_TOM_CUTOFF_SPS`, squib channels use a hardcoded legacy filter frequency (`TestObjectHelper.TDC_LEGACY_TOM_HIGH_FILTER`).
|
||||
|
||||
4. **Filter Class ISO Default**: If `sensor.FilterClassIso` is `"?"`, it is silently replaced with `"P"` (Prefiltered > CFC 1000).
|
||||
|
||||
5. **Squib Description Suffix Handling**: If a squib description ends with ".1", the paired current channel's description is modified to end with ".2".
|
||||
|
||||
6. **Non-Linear Calibration Gain Selection**: For non-linear sensors, the code performs "guesswork" to select an appropriate input range, explicitly noting in comments that it ignores "a whole bunch of problems, like negative or inverted outputs."
|
||||
|
||||
7. **File Truncated**: The source file is truncated mid-method (`SetHard...`), indicating there may be additional public members not visible in the provided source.
|
||||
108
docs/ai/Common/DTS.Common.DataModel/Classes/Export.md
Normal file
108
docs/ai/Common/DTS.Common.DataModel/Classes/Export.md
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Export/ExportHeader.cs
|
||||
- Common/DTS.Common.DataModel/Classes/Export/ExportTestSetup.cs
|
||||
generated_at: "2026-04-17T15:42:08.031759+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ef0e1195e993a581"
|
||||
---
|
||||
|
||||
# Documentation: Export Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data export functionality for test configurations. `ExportHeader` represents a selectable column header for export operations, implementing property change notification for UI binding. `ExportTestSetup` is a static utility class that aggregates test-related entities (tests, groups, sensors, hardware, calibrations, and ISO details) into dictionaries and serializes them to XML format for file export or data transfer.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ExportHeader Class
|
||||
|
||||
**Namespace:** `DataPROWin7.DataModel.Classes.Export`
|
||||
**Implements:** `IExportHeader`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `ExportHeader()` | Initializes a new instance with default values. |
|
||||
| Constructor | `ExportHeader(string headerName)` | Initializes with the specified `headerName`. |
|
||||
| Constructor | `ExportHeader(string headerName, bool isSelected)` | Initializes with `headerName` and `isSelected` state; chains to the headerName constructor. |
|
||||
| Property | `string HeaderName { get; set; }` | Gets or sets the header name; raises `PropertyChanged` on set. |
|
||||
| Property | `bool IsSelected { get; set; }` | Gets or sets selection state; defaults to `false`; raises `PropertyChanged` on set. |
|
||||
| Event | `PropertyChangedEventHandler PropertyChanged` | Event raised when a property value changes. |
|
||||
| Method | `void OnPropertyChanged(string propertyName = null)` | Protected method that invokes the `PropertyChanged` event. |
|
||||
|
||||
---
|
||||
|
||||
### ExportTestSetup Class
|
||||
|
||||
**Namespace:** `DataPROWin7.DataModel.Classes`
|
||||
**Modifiers:** `public static`
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| PrepareForExport | `void PrepareForExport(DataModel.TestTemplate t, Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, IGroup> includedGroups, Dictionary<string, DataModel.DASHardware> includedDAS, Dictionary<string, SensorData> includedSensors, HashSet<int> sensorsAlreadyAdded, Dictionary<string, SensorModel> includedSensorModels, Dictionary<string, SensorCalibration[]> includedCalibration, Dictionary<string, DTS.Common.ISO.CustomerDetails> includedCustomerDetails, Dictionary<string, DTS.Common.ISO.TestEngineerDetails> includedTestEngineerDetails, Dictionary<string, DTS.Common.ISO.LabratoryDetails> includedLabDetails, bool savingRunningTest, bool savingTTSImport)` | Populates the provided dictionaries with all entities referenced by the test template `t`, including sensors, hardware, groups, calibrations, and ISO-related details. Handles embedded and non-embedded groups. |
|
||||
| ExportToFile | `string ExportToFile(Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, IGroup> includedGroups, Dictionary<string, DataModel.DASHardware> includedDAS, Dictionary<string, SensorData> includedSensors, Dictionary<string, SensorModel> includedSensorModels, Dictionary<string, SensorCalibration[]> includedCalibration, Dictionary<string, DTS.Common.ISO.CustomerDetails> includedCustomerDetails, Dictionary<string, DTS.Common.ISO.TestEngineerDetails> includedTestEngineerDetails, Dictionary<string, DTS.Common.ISO.LabratoryDetails> includedLabDetails, Dictionary<string, DTS.Slice.Users.User> includedUsers, Dictionary<string, string> includedGlobalSettings, string exportFile, string originalImportFile, bool bUseFirstUseDate = true)` | Serializes all provided dictionaries to XML format using `TopLevelFields` enum ordering. Returns the XML string; writes to `exportFile` if non-null. Returns empty string on exception. |
|
||||
| PrepareForExportFields | `void PrepareForExportFields(DataModel.TestTemplate t, Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, DataModel.DASHardware> includedDAS)` | Simplified preparation that only extracts tests and DAS hardware; does not process sensors, calibrations, or ISO details. Removes DAS entries from `t.DASSampleRateList` if not in `includedDAS`. |
|
||||
| ExportToFileFields | `string ExportToFileFields(Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, DataModel.DASHardware> includedDAS, string originalImportFile)` | Simplified export that only writes `DASList` and `TestSetups` elements to XML. Returns empty string on exception. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Dictionary Key Uniqueness:** All `included*` dictionary parameters must use unique keys appropriate to their type (e.g., `SerialNumber` for sensors/hardware, `Name` for tests/groups/customers).
|
||||
- **Thread Affinity:** `PrepareForExport` and `PrepareForExportFields` access `Application.Current.Dispatcher` for retrieving non-embedded groups; they handle both UI thread and background thread scenarios via `CheckAccess()` and `ManualResetEvent`.
|
||||
- **Sensor Deduplication:** `sensorsAlreadyAdded` (a `HashSet<int>`) is used to prevent duplicate sensor entries across multiple groups or channels within a single export operation.
|
||||
- **Calibration Exclusion:** Sensors flagged as `IsTestSpecificDigitalOutput`, `IsTestSpecificSquib`, or `IsTestSpecificDigitalIn` are excluded from `includedCalibration` but still added to `includedSensors`.
|
||||
- **XML Element Ordering:** `ExportToFile` and `ExportToFileFields` iterate over `TopLevelFields` enum values, ensuring consistent element ordering in output XML.
|
||||
- **Static Group Validation:** If an embedded group's `StaticGroupId` references a non-existent or mismatched static group, `embeddedGroup.StaticGroupId` is set to `null` and processing continues.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Imports (this module depends on):
|
||||
|
||||
| Namespace | Purpose |
|
||||
|-----------|---------|
|
||||
| `DTS.Common.Interface.ExportData` | `IExportHeader` interface |
|
||||
| `DTS.Common.Interface.Groups.GroupList` | `IGroup`, `IGroupListViewModel` |
|
||||
| `DTS.SensorDB` | `SensorsCollection`, `SensorData`, `SensorCalibration`, `SensorModel`, `SensorModelCollection` |
|
||||
| `DTS.Common.Interface.Sensors` | `ISensorData` |
|
||||
| `DTS.Common.Interface.Channels` | `IGroupChannel` |
|
||||
| `DTS.Common.Interface.DataRecorders` | `IDASHardware` |
|
||||
| `DTS.Common.Storage` | `DbOperations` |
|
||||
| `DTS.Common.ISO` | `CustomerDetails`, `TestEngineerDetails`, `LabratoryDetails`, `Hardware` |
|
||||
| `DTS.Common.Utils` | `FileUtils` |
|
||||
| `DTS.Common.Utilities.Logging` | `APILogger` |
|
||||
| `DTS.Common.Enums.DBExport` | `TopLevelFields` enum |
|
||||
| `DTS.Slice.Users` | `User` class |
|
||||
| `Prism.Ioc` | `ContainerLocator` |
|
||||
| `Unity` | `IUnityContainer` |
|
||||
| `System.Windows` | `Application` for dispatcher access |
|
||||
| `System.Xml` | `XmlWriter` for XML serialization |
|
||||
| `System.ComponentModel` | `INotifyPropertyChanged` pattern |
|
||||
|
||||
### Dependents (inferred):
|
||||
|
||||
- Callers of `ExportTestSetup.PrepareForExport*` and `ExportTestSetup.ExportToFile*` methods (exact modules unclear from source alone).
|
||||
- Consumers of `ExportHeader` for UI data binding scenarios.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Unused Parameter:** The `savingRunningTest` parameter in `PrepareForExport` is never referenced in the method body. Its intended purpose is unclear from source alone.
|
||||
|
||||
2. **Dispatcher Blocking:** Both `PrepareForExport` and `PrepareForExportFields` use `ManualResetEvent.WaitOne()` to block when called from a non-UI thread while waiting for dispatcher operations. This could cause deadlocks if the UI thread is blocked waiting on the calling thread.
|
||||
|
||||
3. **Namespace Mismatch:** The namespace `DataPROWin7.DataModel.Classes.Export` and `DataPROWin7.DataModel.Classes` suggests legacy naming (referencing "Win7") that may not reflect current platform targets.
|
||||
|
||||
4. **Partial Export Handling:** `ExportToFileFields` does not write to a file despite accepting `originalImportFile`; it only returns the XML string. Contrast with `ExportToFile` which writes to `exportFile` when non-null.
|
||||
|
||||
5. **Null Return Ambiguity:** `GetDAS` returns `null` if no matching DAS is found in `dasList`. Callers do not appear to null-check the result before accessing properties (e.g., `h.SerialNumber`), which could cause `NullReferenceException`.
|
||||
|
||||
6. **Early Exit in PrepareForExport:** The method returns early if `!savingTTSImport`, skipping the final loop that adds all sensors with calibrations. This conditional behavior may be unexpected.
|
||||
|
||||
7. **Empty Calibration Handling:** When `SensorCalibration.GetCalibrationsBySerialNumber` returns null or empty, the sensor is still added to `includedSensors` but calibration data is omitted. A `Trace.WriteLine` diagnostic is emitted in one code path but not others.
|
||||
173
docs/ai/Common/DTS.Common.DataModel/Classes/Hardware.md
Normal file
173
docs/ai/Common/DTS.Common.DataModel/Classes/Hardware.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Hardware/DASSettings.cs
|
||||
- Common/DTS.Common.DataModel/Classes/Hardware/DASHardwareList.cs
|
||||
- Common/DTS.Common.DataModel/Classes/Hardware/BatteryAndInputVoltageDefaults.cs
|
||||
generated_at: "2026-04-17T15:37:11.649380+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "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.
|
||||
39
docs/ai/Common/DTS.Common.DataModel/Classes/TSRAIRGo.md
Normal file
39
docs/ai/Common/DTS.Common.DataModel/Classes/TSRAIRGo.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TSRAIRGo/TSRAIRGoStatus.cs
|
||||
generated_at: "2026-04-17T16:44:00.741985+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b413c3f7dc7c89c9"
|
||||
---
|
||||
|
||||
# Documentation: TSRAIRGoStatus.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines the `TSRAIRGoStatus` class, which serves as a container for the `StatusTypes` enum. This enum represents the complete lifecycle states for a TSRAIRGo hardware device (likely a Data Acquisition System or "DAS"), covering hardware discovery, connection establishment, health validation, arming/streaming operations, and data retrieval. It exists to provide a standardized, localized set of status codes that can be displayed to users via resource lookup keys.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `TSRAIRGoStatus`
|
||||
- **Namespace:** `DTS.Common.DataModel.Classes.TSRAIRGo`
|
||||
- **Description:** A non-inheritable container class (implicit sealed) that exposes a single nested enum. The class itself has no instance members or methods.
|
||||
|
||||
### Enum: `TSRAIRGoStatus.StatusTypes`
|
||||
- **Signature:** `public enum StatusTypes`
|
||||
- **Type Converter:** `EnumDescriptionTypeConverterShared` (applied via `[TypeConverter]` attribute)
|
||||
- **Description:** Defines 49 discrete status states for TSRAIRGo device lifecycle management. Each value (except three noted below) is decorated with a `[Description]` attribute containing a resource lookup key for UI localization.
|
||||
|
||||
**Enum Values (grouped by operational domain):**
|
||||
|
||||
| Value | Description Attribute | Notes |
|
||||
|-------|----------------------|-------|
|
||||
| **Discovery/Connection** | | |
|
||||
| `UNKNOWN` | `"Table_NA"` | Default/unknown state |
|
||||
| `PING_FAILED` | `"HardwareDiscoveryControl_PingFailed"` | |
|
||||
| `PINGING` | `"AutoDetectDASControl_Pinging"` | |
|
||||
| `PING_SUCCESS` | `"AutoDetectDASControl_Ping_Good"` | |
|
||||
| `CONNECT_FAILED` | `"HardwareDiscoveryControl_FailedToConnect"` | |
|
||||
| `CONNECTING` | `"AutoDetectDASControl_Connecting"` | |
|
||||
| `QUERY_FAILED` | `"AutoDetectDASControl_QueryFailed"` | |
|
||||
| `
|
||||
59
docs/ai/Common/DTS.Common.DataModel/Classes/TestMetaData.md
Normal file
59
docs/ai/Common/DTS.Common.DataModel/Classes/TestMetaData.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TestMetaData/CustomerDetails.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestMetaData/LabratoryDetails.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestMetaData/TestEngineerDetails.cs
|
||||
generated_at: "2026-04-17T15:40:07.281803+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cadfbac004011276"
|
||||
---
|
||||
|
||||
# Documentation: Test Metadata Data Models
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides UI-facing data model wrappers for test metadata entities—`CustomerDetails`, `LabratoryDetails`, and `TestEngineerDetails`—that encapsulate underlying `DTS.Common.ISO` data objects. These classes implement property change notification via `BasePropertyChanged` to support WPF data binding, track modification state through a `_blank` flag, and expose static list management classes for CRUD operations against the ISO persistence layer. The module serves as an adapter between raw ISO data objects and the presentation layer.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `CustomerDetails` (class, inherits `BasePropertyChanged`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Fields` | `public enum Fields` | Enum values: `Name`, `CustomerName`, `CustomerTestRefNumber`, `ProjectRefNumber`, `CustomerOrderNumber`, `CustomerCostUnit` |
|
||||
| `Name` | `public string Name { get; set; }` | Gets/sets `_customerDetails.Name`; sets `_blank = false` on set; raises `OnPropertyChanged` |
|
||||
| `CustomerName` | `public string CustomerName { get; set; }` | Gets/sets `_customerDetails.CustomerName` |
|
||||
| `CustomerTestRefNumber` | `public string CustomerTestRefNumber { get; set; }` | Gets/sets `_customerDetails.CustomerTestRefNumber` |
|
||||
| `ProjectRefNumber` | `public string ProjectRefNumber { get; set; }` | Gets/sets `_customerDetails.ProjectRefNumber` |
|
||||
| `CustomerOrderNumber` | `public string CustomerOrderNumber { get; set; }` | Gets/sets `_customerDetails.CustomerOrderNumber` |
|
||||
| `CustomerCostUnit` | `public string CustomerCostUnit { get; set; }` | Gets/sets `_customerDetails.CustomerCostUnit` |
|
||||
| `LocalOnly` | `public bool LocalOnly { get; }` | Returns `_customerDetails.LocalOnly` |
|
||||
| `LastModified` | `public DateTime LastModified { get; }` | Returns `_customerDetails.LastModified` |
|
||||
| `LastModifiedBy` | `public string LastModifiedBy { get; }` | Returns `_customerDetails.LastModifiedBy` |
|
||||
| `Version` | `public int Version { get; }` | Returns `_customerDetails.Version` |
|
||||
| `IsBlank` | `public bool IsBlank()` | Returns `_blank` field |
|
||||
| `HasBlankName` | `public bool HasBlankName()` | Returns `true` if `Name == StringResources.TestTemplate_EmptyListName` |
|
||||
| `CustomerDetails()` | `public CustomerDetails()` | Default constructor; initializes new `DTS.Common.ISO.CustomerDetails` with `Name` set to `StringResources.TestTemplate_EmptyListName` |
|
||||
| `CustomerDetails(DTS.Common.ISO.CustomerDetails)` | `public CustomerDetails(DTS.Common.ISO.CustomerDetails customerDetails)` | Copy constructor; sets `_blank = false` |
|
||||
| `GetISOCustomer` | `public DTS.Common.ISO.CustomerDetails GetISOCustomer()` | Returns the wrapped ISO object |
|
||||
| `ToString` | `public override string ToString()` | Returns `Name` |
|
||||
|
||||
### `CustomerDetailsList` (class, inherits `BasePropertyChanged`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Delete` | `public static void Delete(CustomerDetails customer)` | Calls `customer.GetISOCustomer().Delete(ApplicationProperties.CurrentUser.UserName)` |
|
||||
| `Delete` | `public static void Delete(CustomerDetails[] customers)` | Iterates and calls `Delete` on each |
|
||||
| `GetAllCustomers` | `public static CustomerDetails[] GetAllCustomers()` | Retrieves all customers via `DTS.Common.ISO.CustomerDetails.GetAllCustomerDetails()`, wraps them, sorts by `Name` (ordinal comparison) |
|
||||
| `DeleteAll` | `public static void DeleteAll()` | Calls `DTS.Common.ISO.CustomerDetails.DeleteCustomerDetails()` |
|
||||
| `GetCustomerDetail` | `public static CustomerDetails GetCustomerDetail(string name)` | Returns `null` if name is null/empty; otherwise retrieves via `DTS.Common.ISO.CustomerDetails.GetCustomerDetails(name)` |
|
||||
| `AddCustomer` | `public static void AddCustomer(CustomerDetails customer)` | Calls `customer.GetISOCustomer().Commit(ApplicationProperties.CurrentUser.UserName)` |
|
||||
|
||||
### `LabratoryDetails` (class, inherits `BasePropertyChanged`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Tags` | `public enum Tags` | Enum values: `LabratoryName`, `Labr
|
||||
161
docs/ai/Common/DTS.Common.DataModel/Classes/TestObject.md
Normal file
161
docs/ai/Common/DTS.Common.DataModel/Classes/TestObject.md
Normal file
@@ -0,0 +1,161 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TemplateChannelUI.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestObjectTemplateCollection.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestObjectList.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestTestObject.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestObjectTemplate.cs
|
||||
generated_at: "2026-04-17T15:35:53.685336+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "03815d4f910aa842"
|
||||
---
|
||||
|
||||
# Test Object Data Model Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data model layer for managing test objects and their templates within the DataPRO/DTS system. It implements a hierarchy of classes that handle test object configuration, template management with channel definitions, and the relationship between test objects and their associated templates. The module supports both standalone test object definitions and test-specific variants (`TestTestObject`) that include additional runtime settings such as position assignments, timing parameters (excitation warmup, pre/post trigger), and the ability to convert templates to embedded copies for test isolation.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### TemplateChannelUI
|
||||
|
||||
A GUI wrapper class for template channels, providing property change notification for UI binding.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TemplateChannelUI(DTS.Common.ISO.TestObjectTemplateChannel channel)` | Initializes the wrapper with an ISO template channel |
|
||||
| Channel | `DTS.Common.ISO.TestObjectTemplateChannel Channel { get; set; }` | Gets or sets the wrapped ISO template channel, raising property change notifications |
|
||||
|
||||
### TestObjectTemplateCollection
|
||||
|
||||
A singleton collection manager for test object templates.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| TemplateCollection | `static TestObjectTemplateCollection TemplateCollection { get; }` | Lazy-initialized singleton instance accessor |
|
||||
| SysBuiltTestObjectTemplate | `TestObjectTemplate SysBuiltTestObjectTemplate { get; }` | Returns a static readonly system-built template |
|
||||
| GetTemplate | `TestObjectTemplate GetTemplate(string templateId)` | Retrieves a template by ID from the ISO database; returns `null` if not found |
|
||||
|
||||
### TestObjectList
|
||||
|
||||
A thread-safe singleton list that holds test object groups.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| TestObjectsList | `static TestObjectList TestObjectsList { get; }` | Thread-safe singleton instance accessor using lock pattern |
|
||||
| Add | `void Add(TestObject to, bool bNotify)` | Adds a test object, sets `LastModifiedBy` to current user, sets `LastModified` to `DateTime.Now`, commits the object, and optionally notifies listeners |
|
||||
| UpdateAll | `void UpdateAll()` | Raises `OnPropertyChanged("TestObjects")` to notify all listeners |
|
||||
| Tags | `enum Tags { TestObjects }` | Tag enumeration for property change notification |
|
||||
|
||||
### TestTestObject
|
||||
|
||||
A test object belonging to a test, with test-specific settings. Inherits from `TestObject` and implements `IComparable<TestTestObject>`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TestTestObject(TestObject obj)` | Creates from a base `TestObject` |
|
||||
| Constructor | `TestTestObject(TestTestObject obj)` | Copy constructor with metadata |
|
||||
| Constructor | `TestTestObject(TestTestObject obj, bool convertToEmbedded)` | Copy constructor with optional embedded conversion and metadata |
|
||||
| Constructor | `TestTestObject(TestObject obj, bool convertToEmbedded)` | Creates with optional embedded template conversion |
|
||||
| Position | `DTS.Common.ISO.MMEPositions Position { get; set; }` | Gets or sets the group position; setting cascades position to all required sensors with serial numbers |
|
||||
| TestObject | `DTS.Common.ISO.MMETestObjects TestObject { get; set; }` | Gets or sets the ISO test object reference; cascades to all sensors |
|
||||
| ExcitationWarmupTimeMS | `int ExcitationWarmupTimeMS { get; set; }` | Excitation warmup time in milliseconds |
|
||||
| TargetSampleRate | `double TargetSampleRate { get; set; }` | Target sample rate |
|
||||
| PreTriggerSeconds | `double PreTriggerSeconds { get; set; }` | Pre-trigger duration in seconds |
|
||||
| PostTriggerSeconds | `double PostTriggerSeconds { get; set; }` | Post-trigger duration in seconds |
|
||||
| GroupPositionComboBoxVisible | `Visibility GroupPositionComboBoxVisible { get; set; }` | Controls visibility of position combo box |
|
||||
| GroupPositionButtonVisible | `Visibility GroupPositionButtonVisible { get; set; }` | Controls visibility of position button |
|
||||
| AvailablePositions | `DTS.Common.ISO.MMEPositions[] AvailablePositions { get; }` | Gets available positions from ISO database |
|
||||
| AvailableGroupPositions | `DTS.Common.ISO.MMEPositions[] AvailableGroupPositions { get; }` | Gets positions including synthetic "(channel defaults)" entry |
|
||||
| AddedGroups | `TestObject[] AddedGroups { get; set; }` | Array of added test object groups |
|
||||
| ChannelTypes | `string[] ChannelTypes { get; }` | Gets unique channel types including "(no channels)" placeholder |
|
||||
| DisplayOrder | `int DisplayOrder { get; set; }` | Sort order, defaults to -1 |
|
||||
| IsAdd | `bool IsAdd { get; set; }` | Flag indicating add operation |
|
||||
| SetTestObject | `void SetTestObject(string s)` | Sets internal test object string and raises property change |
|
||||
| SetPosition | `void SetPosition(string s)` | Sets internal position string and updates visibility states |
|
||||
| Rename | `void Rename(string oldName, string newName)` | Renames serial number, original serial number, original template, test setup name, and generates new GUID-based template names |
|
||||
| CompareTo | `int CompareTo(TestTestObject other)` | Compares by `DisplayOrder`, falling back to base comparison on tie |
|
||||
| ChannelDefaultsKey | `const string ChannelDefaultsKey = "#"` | Key for channel defaults position |
|
||||
| UserSetKey | `const string UserSetKey = "@"` | Key for user-set position |
|
||||
|
||||
### TestObjectTemplate
|
||||
|
||||
A template definition for test objects with channel configurations. Implements `IComparable<TestObjectTemplate>`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TestObjectTemplate()` | Default constructor; initializes empty strings and first available test object |
|
||||
| Constructor | `TestObjectTemplate(DTS.Common.ISO.TestObjectTemplate template, ref ISO13499FileDb db)` | Creates from ISO template |
|
||||
| Constructor | `TestObjectTemplate(DTS.Common.ISO.TestObjectTemplate template, ref ISO13499FileDb db, List<MMETestObjects> testObjects)` | Creates from ISO template with provided test objects list |
|
||||
| Constructor | `TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)` | Copy constructor |
|
||||
| TemplateName | `string TemplateName { get; set; }` | Template name identifier |
|
||||
| TemplateDescription | `string TemplateDescription { get; set; }` | Human-readable description |
|
||||
| TemplateParent | `string TemplateParent { get; set; }` | Parent template reference |
|
||||
| TestObject | `MMETestObjects TestObject { get; set; }` | Associated ISO test object; setting updates available test object types |
|
||||
| TestObjectType | `string TestObjectType { get; set; }` | Type of test object; setting rebuilds all channels from database |
|
||||
| TestObjectTypeIndex | `int TestObjectTypeIndex { get; set; }` | Index into `AvailableTestObjectTypes` |
|
||||
| AvailableTestObjectTypes | `string[] AvailableTestObjectTypes { get; set; }` | Available types for the current test object |
|
||||
| TemplateAllChannels | `TestObjectTemplateChannel[] TemplateAllChannels { get; set; }` | All template channels (wraps UI channels) |
|
||||
| TemplateAllUIChannels | `TemplateChannelUI[] TemplateAllUIChannels { get; set; }` | UI-wrapped channel collection |
|
||||
| RequiredChannels | `List<TestObjectTemplateChannel> RequiredChannels { get; set; }` | List of required channels |
|
||||
| Embedded | `bool Embedded { get; set; }` | Whether template is embedded; syncs with underlying ISO template |
|
||||
| OriginalTemplateName | `string OriginalTemplateName { get; set; }` | Original name for embedded templates |
|
||||
| SysBuilt | `bool SysBuilt { get; set; }` | System-built flag |
|
||||
| IsLocalOnly | `bool IsLocalOnly { get; set; }` | Local-only flag |
|
||||
| LastModifiedBy | `string LastModifiedBy { get; set; }` | User who last modified; defaults to "N/A" |
|
||||
| LastModified | `DateTime LastModified { get; set; }` | Last modification timestamp; defaults to `SqlDateTime.MinValue` |
|
||||
| MarkChanged | `void MarkChanged(string tag)` | Raises property change for specified tag |
|
||||
| AssignOrders | `void AssignOrders()` | Assigns display orders to channels with -1 order |
|
||||
| ToISOTestObjectTemplate | `DTS.Common.ISO.TestObjectTemplate ToISOTestObjectTemplate()` | Converts to ISO template object |
|
||||
| CompareTo | `int CompareTo(TestObjectTemplate rhs)` | Compares by `TemplateName` using ordinal comparison |
|
||||
| ToString | `override string ToString()` | Returns `OriginalTemplateName` if embedded, otherwise `TemplateName` |
|
||||
| ReadXML | `static DTS.Common.ISO.TestObjectTemplate ReadXML(System.Xml.XmlElement root, Dictionary<long, MMEPossibleChannels> importChannels)` | Reads template from XML element |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Singleton Access**: `TestObjectTemplateCollection.TemplateCollection` and `TestObjectList.TestObjectsList` must be accessed through their static properties, never instantiated directly.
|
||||
- **Position Keys**: `TestTestObject._position` must be either `"#"` (channel defaults), `"@"` (user-set), or a valid position string from `AvailablePositions`.
|
||||
- **Embedded Template Names**: When a template is converted to embedded (`convertToEmbedded = true`), both `TemplateName` and `SerialNumber` are replaced with `Guid.NewGuid().ToString()`.
|
||||
- **Display Order Assignment**: Channels with `DisplayOrder == -1` are considered unassigned and will be assigned incremental orders starting from the current maximum + 1.
|
||||
- **Thread Safety**: `TestObjectList` uses a lock object for singleton access; `TestObjectTemplateCollection` uses `volatile` keyword but no lock.
|
||||
- **Property Synchronization**: Setting `Embedded` or `OriginalTemplateName` on `TestObjectTemplate` also sets the value on the underlying `_template` object if not null.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Base` - `BasePropertyChanged` base class for property change notification
|
||||
- `DTS.Common.ISO` - ISO 13499 data types including `TestObjectTemplateChannel`, `TestObjectTemplate`, `TestObject`, `MMEPositions`, `MMETestObjects`, `MMEPossibleChannels`, `ISO13499FileDb`
|
||||
- `DTS.Common.Utilities.Logging` - Logging utilities
|
||||
- `DTS.Common.DataModel` - Additional data model components
|
||||
- `System.Windows` - `Visibility` enum for UI state management
|
||||
- `System.Xml` - XML serialization support
|
||||
- `System.Data.SqlTypes` - `SqlDateTime` for default timestamp values
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone; the namespace `DataPROWin7.DataModel` suggests consumption by DataPRO Win7 UI components.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Method Name Typo**: `CommonCustructorItems` in `TestTestObject` is misspelled (should be "Constructor"). This is referenced in multiple constructors.
|
||||
|
||||
2. **Incomplete Thread Safety**: `TestObjectTemplateCollection` uses `volatile` on `_testObjectCollection` but does not use a lock in the singleton getter, unlike `TestObjectList` which uses a proper lock pattern. This could lead to race conditions.
|
||||
|
||||
3. **Template Property Reset Workaround**: In `TestTestObject.CommonCustructorItems`, there is a comment: "UGH, something resets the template properties. just change them back for now to the right values :/". This indicates a known but unresolved issue where template properties are being unexpectedly modified.
|
||||
|
||||
4. **TODO Comment**: Both `GroupPositionComboBoxVisible` and `GroupPositionButtonVisible` getters contain commented-out code with the note "TODO Remove Non-ISO Mode code", suggesting incomplete removal of legacy functionality.
|
||||
|
||||
5. **Static Readonly Field Usage**: `_sysBuiltTestObjectTemplate` in `TestObjectTemplateCollection` is declared `static readonly` but never initialized in any visible constructor or static constructor, meaning it will always be `null`.
|
||||
|
||||
6. **XML Field Handling**: `ProcessChannelXMLNode` silently skips channels that don't have both `MMEChannelId` and `MMEChannelType` fields, and silently skips if the channel cannot be found in the database or import dictionary.
|
||||
|
||||
7. **Position Cascading**: Setting `Position` on `TestTestObject` automatically modifies the `Position` property of all required sensors with non-empty serial numbers. This side effect may not be obvious to consumers.
|
||||
148
docs/ai/Common/DTS.Common.DataModel/Classes/TestTemplate.md
Normal file
148
docs/ai/Common/DTS.Common.DataModel/Classes/TestTemplate.md
Normal file
@@ -0,0 +1,148 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/ICachedContainer.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/HardwareInclusionInstruction.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/TSRAIRGoTestSetup.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/DownloadEvent.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/BuildTestSetup.cs
|
||||
generated_at: "2026-04-17T15:34:34.420183+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f665cac25ac2572f"
|
||||
---
|
||||
|
||||
# Documentation: TestTemplate Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data model components for test template configuration and execution within the DTS (Data Acquisition System) application. It defines interfaces for hardware/sensor caching, classes for managing hardware inclusion rules, test setup construction from XML or template sources, download event configuration, and specialized test setup singletons. The module serves as a bridge between raw configuration data (XML or database templates) and the runtime test execution environment.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ICachedContainer` (Interface)
|
||||
**Namespace:** `DataPROWin7.DataModel.Classes.TestTemplate`
|
||||
|
||||
| Method | Return Type | Description |
|
||||
|--------|-------------|-------------|
|
||||
| `GetCachedHardware(string serialNumber)` | `DASHardware` | Retrieves cached hardware by serial number. |
|
||||
| `GetCachedSensor(string serialNumber)` | `SensorData` | Retrieves cached sensor data by serial number. |
|
||||
| `GetCalibrations(string serialNumber)` | `SensorCalibration[]` | Retrieves calibration array for a sensor by serial number. |
|
||||
| `GetAllCachedHardware()` | `IISOHardware[]` | Retrieves all cached hardware items. |
|
||||
|
||||
---
|
||||
|
||||
### `HardwareInclusionInstruction` (Class)
|
||||
**Namespace:** `DataPROWin7.DataModel`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `HardwareId` | `public string HardwareId { get; }` | Read-only hardware identifier. |
|
||||
| `Actions` | `public enum Actions { Remove, Add }` | Enumeration defining inclusion action. `Remove` excludes hardware that would otherwise be included; `Add` includes hardware not in groups. |
|
||||
| `Action` | `public Actions Action { get; }` | Read-only action to perform. |
|
||||
| Constructor | `public HardwareInclusionInstruction(string hardwareId, Actions action)` | Creates new instruction with specified hardware ID and action. |
|
||||
| Copy Constructor | `public HardwareInclusionInstruction(HardwareInclusionInstruction copy)` | Creates a copy of an existing instruction. |
|
||||
|
||||
---
|
||||
|
||||
### `TSRAIRGoTestSetup` (Class)
|
||||
**Namespace:** `DTS.Common.DataModel.Classes.TestTemplate`
|
||||
**Base Class:** `DataPROWin7.DataModel.TestTemplate`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `TEST_NAME` | `public const string TEST_NAME = "TSRAIR_GO_TEST"` | Constant test name identifier. |
|
||||
| `Name` | `public override string Name { get; set; }` | Returns `TEST_NAME`; setter is no-op. |
|
||||
| `GetInstance` | `public static TSRAIRGoTestSetup GetInstance(int userId, bool useCache = true)` | Retrieves singleton instance. If cached instance exists and `useCache` is true, returns cached instance. Otherwise, loads template from `TestTemplatesList` or creates new from user defaults. |
|
||||
|
||||
---
|
||||
|
||||
### `DownloadEvent` (Class)
|
||||
**Namespace:** `DataPROWin7.DataModel`
|
||||
**Implements:** `IDownloadEvent`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public DownloadEvent()` | Initializes with `EventNumber = 0`, `IsEnabled = true`, `IsDefault = true`, `IsReadonly = true`. |
|
||||
| Constructor | `public DownloadEvent(bool isDefault = false)` | Initializes with specified `isDefault` value. |
|
||||
| Constructor | `public DownloadEvent(int eventNumber = 0, bool isDefault = false)` | Initializes with specified event number and default flag. |
|
||||
| `EventNumber` | `public int EventNumber { get; set; }` | Event number; setter updates `EventNumberDisplay`. |
|
||||
| `IsEnabled` | `public bool IsEnabled { get; set; }` | Whether event is enabled. |
|
||||
| `IsDefault` | `public bool IsDefault { get; }` | Read-only default flag. |
|
||||
| `EventNumberDisplay` | `public string EventNumberDisplay { get; set; }` | Formatted display string using `DTS.Common.Constants.EventNumber` format. |
|
||||
| `TestItem` | `public string TestItem { get; set; }` | Stores `<TestSetup>:<TestId>:("<All or ROI">)` for export (per issue 43387). |
|
||||
| `DTSFile` | `public string DTSFile { get; set; }` | Stores .DTS file path for export (per issue 43387). |
|
||||
| `IsReadonly` | `public bool IsReadonly { get; set; }` | Whether event is read-only. |
|
||||
| `EventLength` | `public TimeSpan EventLength { get; set; }` | Total time available for download event. |
|
||||
| `ShouldDisplayLength` | `public bool ShouldDisplayLength { get; set; }` | Whether `EventLength` should be displayed. |
|
||||
| `PropertyChanged` | `public event PropertyChangedEventHandler PropertyChanged` | INotifyPropertyChanged event. |
|
||||
|
||||
---
|
||||
|
||||
### `BuildTestSetup` (Class)
|
||||
**Namespace:** `DataPROWin7.DataModel`
|
||||
**Implements:** `IBuildTestSetup`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public BuildTestSetup(string dasSerialNumber, string testSetupName, ExportFileXMLClass exportFileXML)` | Constructs from XML configuration. Extracts test setup fields from `exportFileXML.TestSetupsOuter[0].TestSetups[0]`. |
|
||||
| Constructor | `public BuildTestSetup(string dasSerialNumber, string testSetupName, TestTemplate testTemplate)` | Constructs from `TestTemplate` object. Uses `StringResources.DefaultTestSetupName` if `testSetupName` is whitespace. |
|
||||
| `DASSerialNumber` | `public string DASSerialNumber { get; set; }` | DAS device serial number. |
|
||||
| `SetupName` | `public string SetupName { get; set; }` | Test setup name. |
|
||||
| `SetupDescription` | `public string SetupDescription { get; set; }` | Test setup description. |
|
||||
| `Groups` | `public List<GroupXMLClass> Groups { get; set; }` | List of groups with channels. |
|
||||
| `LevelTriggers` | `public List<LevelTriggerXMLClass> LevelTriggers { get; set; }` | List of level trigger configurations. |
|
||||
| `PropertyChanged` | `public event PropertyChangedEventHandler PropertyChanged` | INotifyPropertyChanged event. |
|
||||
|
||||
**Additional Properties (all `string` type):** `AutomaticMode`, `AutomaticModeDelay`, `WarnOnBatteryFail`, `ViewRealtime`, `RecordingMode`, `SamplesPerSecond`, `PreTriggerSeconds`, `PostTriggerSeconds`, `NumberOfEvents`, `WakeUpMotionTimeout`, `ScheduledStartDateTime`, `IntervalBetweenEventStartsMinutes`, `StartWithEvent`, `WakeUpWithMotion`, `StrictDiagnostics`, `RequireConfirmationOnErrors`, `AllowSensorIdToBlankChannel`, `PerformArmChecklist`, `CheckInputVoltage`, `CheckBatteryVoltage`, `CheckSquibResistance`, `CheckSensorIds`, `CheckStartEventLines`, `CheckTiltSensor`, `CheckTemperature`, `ExcitationWarmupTimeMS`, `RequireAllUnitsPassArmCheckList`, `ROIDownload`, `ViewROIDownload`, `DownloadAll`, `RealtimeCharts`, `ROIStart`, `ROIEnd`, `ViewDownloadAll`, `Export`, `ExportFolder`, `DownloadFolder`, `CommonStatusLine`, `UploadData`, `UploadDataFolder`, `UseLabDetails`, `UseCustomerDetails`, `AllowMissingSensors`, `LastModified`, `LastModifiedBy`, `PostTestDiagnostics`, `UserTags`, `CalibrationBehavior`, `SuppressMissingSensorsWarning`, `NotAllChannelsRealTime`, `NotAllChannelsViewer`, `TriggerCheckStep`, `QuitTestWithoutWarning`, `UseTestEngineerDetails`, `AutoArm`, `Streaming`, `MeasureSquibResistances`.
|
||||
|
||||
**Export Format Properties (all `string` type):** `ExportCh10FilteredEUDesired`, `ExportChryslerDDASDesired`, `ExportCSVADCDesired`, `ExportCSVFilteredDesired`, `ExportCSVMVDesired`, `ExportCSVUnfilteredDesired`, `ExportDiademADCDesired`, `ExportASCDesired`, `ExportHDFADCDesired`, `ExportHDFMVDesired`, `ExportHDFUnfilteredDesired`, `ExportISOFilteredDesired`, `ExportISOUnfilteredDesired`, `ExportRDFADCDesired`, `ExportTDASADCDesired`, `ExportTDMSADCDesired`, `ExportToyotaUnfilteredDesired`, `ExportTSVFilteredDesired`, `ExportTSVUnfilteredDesired`, `ExportXLSXFilteredDesired`, `ExportXLSXUnfilteredDesired`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`TSRAIRGoTestSetup`**: The singleton instance (`_setup`) is protected by `MY_LOCK` for thread safety. The `Name` property always returns `TEST_NAME` regardless of setter calls.
|
||||
- **`HardwareInclusionInstruction`**: `HardwareId` and `Action` are immutable after construction (read-only properties).
|
||||
- **`DownloadEvent`**: `IsDefault` is read-only after construction. Setting `EventNumber` automatically updates `EventNumberDisplay` with format `"{Constants.EventNumber} {value:00}"`.
|
||||
- **`BuildTestSetup`**: All configuration properties are stored as `string` types regardless of original data types (e.g., booleans, integers, enums are converted to strings).
|
||||
- **`BuildTestSetup`**: When constructing from `TestTemplate`, if `testSetupName` is null or whitespace, `StringResources.DefaultTestSetupName` is used.
|
||||
- **`BuildTestSetup`**: Export format decoding via `DecodeExportFormats` uses bitwise AND operations against `SupportedExportFormatBitFlags` enum values.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (from imports):
|
||||
|
||||
| Module | Depends On |
|
||||
|--------|------------|
|
||||
| `ICachedContainer` | `DTS.Common.Interface.DASFactory.Diagnostics` (for `DASHardware`), `DTS.SensorDB` (for `SensorData`, `SensorCalibration`) |
|
||||
| `TSRAIRGoTestSetup` | `DTS.Slice.Users.UserSettings` (for `TestSetupDefaults`), `DataPROWin7.DataModel.TestTemplateList` |
|
||||
| `DownloadEvent` | `DTS.Common.Interface.DownloadEvent` (for `IDownloadEvent`), `System.ComponentModel` |
|
||||
| `BuildTestSetup` | `DTS.Common.Interface.BuildTestSetup` (for `IBuildTestSetup`), `DTS.Common.XMLUtils` (for `ExportFileXMLClass`, `GroupXMLClass`, `LevelTriggerXMLClass`, `ChannelXMLClass`, `HardwareListXMLClass`), `DTS.Common.Enums` (for `SupportedExportFormatBitFlags`), `DTS.Common.SharedResource.Strings` (for `StringResources`), `DTS.Common.Constants` |
|
||||
|
||||
### Inferred Dependents:
|
||||
- Modules consuming `IBuildTestSetup`, `IDownloadEvent`, or `ICachedContainer` interfaces depend on this module.
|
||||
- Code that creates test setups from templates or XML files depends on `BuildTestSetup`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`BuildTestSetup` stores all values as strings**: Despite source data being typed (int, bool, enum, TimeSpan), all properties in `BuildTestSetup` are `string`. Parsing/conversion is required when consuming these values.
|
||||
|
||||
2. **`BuildTestSetup` XML constructor assumes specific structure**: The constructor accesses `exportFileXML.TestSetupsOuter[0].TestSetups[0]` without null checks. If the XML structure differs, this will throw.
|
||||
|
||||
3. **`TSRAIRGoTestSetup.Name` setter is a no-op**: The setter `{ set {; } }` silently ignores assignments, which could cause confusion if code attempts to modify the name.
|
||||
|
||||
4. **`ParseSettings` uses magic number keys**: Settings are parsed using string prefixes like `"0="`, `"1="`, etc. The mapping between numbers and settings is not documented outside this method.
|
||||
|
||||
5. **`GetExports` has inconsistent case handling**: Export format string matching uses mixed case (e.g., `"csvunfiltered"` vs `"ChryslerDDAS"` vs `"CSVADC"`). The switch statement is case-sensitive.
|
||||
|
||||
6. **`DownloadEvent.EventNumberDisplay` references external constant**: The format string uses `DTS.Common.Constants.EventNumber`—the value of this constant is not visible in this source.
|
||||
|
||||
7. **`HardwareInclusionInstruction` comment mentions "dasless groups"**: The XML comment indicates this class exists to support groups without DAS hardware, but the mechanism for how this integrates with the broader system is not shown.
|
||||
|
||||
8. **`BuildTestSetup` has many commented-out property mappings**: Both constructors contain numerous commented assignments (e.g., `//InvertTrigger`, `//ViewDiagnostics`, `//ExportSomatFilteredDesired`). These may represent deprecated or unimplemented features.
|
||||
89
docs/ai/Common/DTS.Common.DataModel/Common.md
Normal file
89
docs/ai/Common/DTS.Common.DataModel/Common.md
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Common/StatusHelpers.cs
|
||||
- Common/DTS.Common.DataModel/Common/TestObjectHelper.cs
|
||||
- Common/DTS.Common.DataModel/Common/ChannelHelper.cs
|
||||
- Common/DTS.Common.DataModel/Common/TestSetupCollection.cs
|
||||
generated_at: "2026-04-17T15:36:25.187144+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5be6ced2d64c64b8"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.DataModel.Common
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides utility classes and helpers for managing test configurations, channel naming, status reporting, and test setup collections within the DTS data model layer. It serves as a common utility layer that bridges the data model with UI concerns (progress reporting), database operations (test setup persistence), and hardware abstraction (channel/sensor information). The module centralizes test setup caching with CRC-based staleness detection and provides formatting utilities for channel identification in warning messages.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### StatusHelpers
|
||||
|
||||
**Delegate:**
|
||||
```csharp
|
||||
public delegate void SetProgressValueDelegate(IDASCommunication idas, double progressValue, TSRAIRGoStatus.StatusTypes? status);
|
||||
```
|
||||
A delegate type for setting progress values on DAS communication objects.
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public static void SetStatus2(IDASCommunication das, int progressValue, TSRAIRGoStatus.StatusTypes? status, SetProgressValueDelegate setProgressValue)
|
||||
```
|
||||
Invokes the provided delegate with the given DAS object, progress value, and status. This is a pass-through method that delegates the actual status-setting logic to the caller-provided callback.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectHelper
|
||||
|
||||
**Constants:**
|
||||
```csharp
|
||||
public const double TDC_LEGACY_TOM_CUTOFF_SPS = 8000;
|
||||
```
|
||||
The sample rate breakpoint (8000 SPS) for TDC software filters on TOM channels. Above this threshold, CFC 1000 filter is used; at or below, TDC uses 1/5 of SPS.
|
||||
|
||||
```csharp
|
||||
public const double TDC_LEGACY_TOM_HIGH_FILTER = 1650D;
|
||||
```
|
||||
The default filter value (CFC1000) in TDC for TOM channels recorded at sample rates greater than 8000 SPS.
|
||||
|
||||
---
|
||||
|
||||
### ChannelHelper (static class)
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public static string GetWarningChannelName(IGroupChannel groupChannel)
|
||||
```
|
||||
Constructs a formatted warning channel name string. The format depends on `TestSetupOrder`:
|
||||
- If `TestSetupOrder >= 0`: uses `TestSetupOrder` as prefix
|
||||
- Otherwise: uses `GroupChannelOrder` as prefix
|
||||
|
||||
If `GetChannelName(SerializedSettings.ISOViewMode)` returns a non-empty name, appends `'name'`. Otherwise, appends `''` followed by `Sensor` (if `SensorValid`) and `Hardware` (if `HardwareValid`) in parentheses.
|
||||
|
||||
---
|
||||
|
||||
### TestSetupCollection
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
public static List<string> TestSetupIds { get; }
|
||||
```
|
||||
Returns a copy of the test setup ID list. Thread-safe via `TestSetupListLock`.
|
||||
|
||||
```csharp
|
||||
public static object TestSetupListLock { get; }
|
||||
```
|
||||
A static lock object for thread-safe access to internal collections. Initialized to `new object()`.
|
||||
|
||||
```csharp
|
||||
public static TestTemplate[] TestSetups { get; }
|
||||
```
|
||||
Returns a copy of the actual test templates array. Thread-safe via `TestSetupListLock`.
|
||||
|
||||
```csharp
|
||||
public static string[] TestSetupList { get; }
|
||||
```
|
||||
Returns an array of test setup names. Lazily initializes the internal list if null or empty. Filters templates by `IsComplete ==
|
||||
44
docs/ai/Common/DTS.Common.DataModel/Common/DbWrappers.md
Normal file
44
docs/ai/Common/DTS.Common.DataModel/Common/DbWrappers.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Common/DbWrappers/DASGet.cs
|
||||
- Common/DTS.Common.DataModel/Common/DbWrappers/TestSetupHardwareGet.cs
|
||||
generated_at: "2026-04-17T16:08:07.411025+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ada752c59bd61df1"
|
||||
---
|
||||
|
||||
# DbWrappers
|
||||
|
||||
### Purpose
|
||||
This module provides wrapper classes for retrieving and sanitizing Data Acquisition System (DAS) and Test Setup Hardware records from the database. It exists to centralize data repair logic—specifically addressing legacy data integrity issues (referenced as FB 17777)—ensuring that invalid or missing database values (such as `NaN` or `0`) are corrected to sensible defaults before being returned to the caller.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`DASGet` (inherits `DASDBRecord`)**
|
||||
* `DASGet()`: Default constructor.
|
||||
* `DASGet(IDASDBRecord record)`: Constructor that wraps an existing record. It automatically repairs `MaxAAFRate` if it is `NaN` by setting it to `MaxSampleRate / 5`.
|
||||
* `int Type { get; set; }`: Alias for `DASType`.
|
||||
* `bool Reprogrammable { get; set; }`: Alias for `IsProgrammable`.
|
||||
* `bool Reconfigurable { get; set; }`: Alias for `IsReconfigurable`.
|
||||
* `List<DASGet> DASGet_Wrapper(string serialNumber = null, string position = null)`: Retrieves a list of DAS records from the database via `DbOperations.DASGet`. It wraps the results in `DASGet` instances, triggering the data repair logic in the constructor.
|
||||
|
||||
**`TestSetupHardwareGet` (inherits `TestSetupHardwareRecord`)**
|
||||
* `TestSetupHardwareGet()`: Default constructor.
|
||||
* `TestSetupHardwareGet(ITestSetupHardwareRecord copy)`: Copy constructor.
|
||||
* `bool AddOrRemove { get; set; }`: Alias for `AddDAS` that raises `OnPropertyChanged`.
|
||||
* `List<TestSetupHardwareGet> TestSetupHardwareGet_Wrapper(int? testSetupId, Dictionary<int, IDASHardware> hardwareLookup)`: Retrieves hardware records for a specific test setup. It iterates through results to repair `AntiAliasFilterRate` if it is `0`. It accepts a lookup dictionary for performance but will fall back to database queries if the lookup is null or incomplete.
|
||||
|
||||
### Invariants
|
||||
* **MaxAAFRate Repair**: A `DASGet` instance will never have a `MaxAAFRate` of `NaN`; it will be defaulted to `MaxSampleRate / 5`.
|
||||
* **AntiAliasFilterRate Repair**: A `TestSetupHardwareGet` instance returned by the wrapper should never have an `AntiAliasFilterRate` of `0`, unless the hardware type is explicitly excluded from repair (e.g., `HardwareTypes.DIM`, `HardwareTypes.TDAS_Pro_Rack`).
|
||||
* **Filter Rate Logic**: The `RepairAntiAliasFilterRate` method defaults to `SLICE` type settings for undefined hardware types.
|
||||
|
||||
### Dependencies
|
||||
* **Dependencies**: `DTS.Common.Interface.DataRecorders`, `DTS.Common.Storage` (uses `DbOperations` static class), `DTS.Common.Classes.Hardware`, `DTS.Common.Enums.Hardware`, `DTS.Common.Classes.TestSetups`, `DataPROWin7.Common` (uses `SerializedSettings`), `DTS.Common.ISO.Hardware`.
|
||||
* **Dependents**: Unknown from source alone, but likely consumed by Test Setup management or Data Import logic.
|
||||
|
||||
### Gotchas
|
||||
* **Performance Issue**: In `TestSetupHardwareGet_Wrapper`, if `hardwareLookup` is null, the method calls `GetDASTypeEnumFromId` for every record. This method instantiates `DASGet` and calls `DASGet_Wrapper()`, which queries the database *inside* the loop. This creates an N+1 query problem.
|
||||
* **Hardcoded Logic**: `RepairAntiAliasFilterRate` contains a switch statement with specific hardware types. Adding new hardware types requires updating this method to ensure correct behavior.
|
||||
* **Namespace Incons
|
||||
38
docs/ai/Common/DTS.Common.DataModel/Properties.md
Normal file
38
docs/ai/Common/DTS.Common.DataModel/Properties.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:11:03.088988+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b69162c3aa548b10"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata configuration for the `DTS.Common.Calculations` library. It is a standard .NET Framework assembly information file that defines versioning, copyright, and COM interoperability settings. The internal assembly title is "HeadInjuryCriterion", suggesting this library provides calculations related to head injury criteria (likely for impact testing/analysis).
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are exposed. This file only contains assembly-level attributes:
|
||||
- `AssemblyTitle`: "HeadInjuryCriterion"
|
||||
- `AssemblyVersion`: "1.0.0.0"
|
||||
- `AssemblyFileVersion`: "1.0.0.0"
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: "a83e3800-290f-4513-9756-d37168152099"
|
||||
|
||||
### Invariants
|
||||
- The assembly version is fixed at "1.0.0.0" in source; actual deployed versions may differ if built with wildcard versioning.
|
||||
- COM visibility is disabled for all types in this assembly.
|
||||
|
||||
### Dependencies
|
||||
**This module depends on:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this module:** Unclear from source alone—this is a leaf configuration file with no exports.
|
||||
|
||||
### Gotchas
|
||||
- The assembly title "HeadInjuryCriterion" does not match the module path "DTS.Common.Calculations". This naming inconsistency may cause confusion when searching for the library by name. The actual purpose of the library cannot be determined from this file alone.
|
||||
|
||||
---
|
||||
96
docs/ai/Common/DTS.Common.DataModel/StateMachines.md
Normal file
96
docs/ai/Common/DTS.Common.DataModel/StateMachines.md
Normal file
@@ -0,0 +1,96 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/StateMachines/OverallArmStatusStateMachine.cs
|
||||
generated_at: "2026-04-17T15:42:56.746110+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5d72a0ae768f3eb3"
|
||||
---
|
||||
|
||||
# Documentation: OverallArmStatusStateMachine
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `OverallArmStatusStateMachine` class manages the lifecycle and state transitions for a Data Acquisition System's (DAS) arm status. It encapsulates complex state logic for recording operations, data downloading, flash clearing, and various waiting states (trigger, schedule, interval). The class uses the Stateless library to define valid state transitions and notifies subscribers via an event when state changes occur. This state machine appears to be part of a larger test/recording system where equipment must be armed, configured, and monitored through various operational phases.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
```csharp
|
||||
public OverallArmStatusStateMachine()
|
||||
```
|
||||
Initializes the state machine by resolving an `IEventAggregator` from the Prism container and calling the private `Initialize()` method. The initial state is set to `ArmStateMachineStates.States.CheckingForDAS`.
|
||||
|
||||
### Enum: Triggers
|
||||
```csharp
|
||||
public enum Triggers
|
||||
```
|
||||
Defines 35 trigger values that cause state transitions, including:
|
||||
- `bFillingBuffer`, `CheckingForData`, `ConfigurationIsSet`, `DASNotFound`, `DataNeverDownloaded`, `Disarm`, `DoneRecording`, `Downloading`, `DownloadCleaningUp`, `DownloadFinished`, `Error`, `Faulted`, `FlashClear`, `GettingEventInfo`, `IDLE`, `IntervalRecording`, `NoDataToDownload`, `NonIntervalRecording`, `PostTestProcessing`, `ReadyForDownload`, `Rearming`, `Recording`, `RunButton`, `Streaming`, `WaitingForTrigger`, `WaitingForSchedule`, `WaitingForInterval`
|
||||
- Single-character values: `a`, `c`, `d`, `e`, `h`, `n`, `rr`, `tt`, `uu`, `yy`
|
||||
|
||||
### Event: OverallStatusStateChange
|
||||
```csharp
|
||||
public event OverallStatusStateChangeDelegate OverallStatusStateChange;
|
||||
```
|
||||
Event raised when the state machine transitions to a new state. The delegate signature is:
|
||||
```csharp
|
||||
public delegate void OverallStatusStateChangeDelegate(ArmStateMachineStates.States previousState, ArmStateMachineStates.States nextState);
|
||||
```
|
||||
|
||||
### Method: GetDASStatus
|
||||
```csharp
|
||||
public ArmStateMachineStates.States GetDASStatus()
|
||||
```
|
||||
Returns the current state stored in `CurrentOverallStatusState`.
|
||||
|
||||
### Method: FireTrigger
|
||||
```csharp
|
||||
public void FireTrigger(Triggers trigger, ArmStateMachineStates.States state)
|
||||
```
|
||||
Fires a trigger with an associated state parameter. Uses a switch statement to map triggers to their corresponding `TriggerWithParameters` instances and calls `overallArmStatusStateMachine.Fire()`. Catches and logs any exceptions without re-throwing.
|
||||
|
||||
**Handled triggers in switch:** `DASNotFound`, `NoDataToDownload`, `DataNeverDownloaded`, `DoneRecording`, `FlashClear`, `WaitingForTrigger`, `WaitingForSchedule`, `WaitingForInterval`, `Recording`, `PostTestProcessing`, `CheckingForData`, `GettingEventInfo`, `ReadyForDownload`, `Error`, `Streaming`, `Disarm`, `Rearming`
|
||||
|
||||
**Note:** `PostTestProcessing` trigger fires `DoneRecordingTrigger` internally.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The state machine always starts in `ArmStateMachineStates.States.CheckingForDAS`.
|
||||
- `CurrentOverallStatusState` is only updated via `SetOverallStatus()` and only when the new state differs from the current state.
|
||||
- State transitions are constrained by the Stateless configuration; invalid triggers will cause the Stateless library to throw (caught silently in `FireTrigger`).
|
||||
- `SetOverallStatus()` is only called from `OnEntryFrom` handlers configured in the state machine.
|
||||
- The `IEventAggregator` must be registered in the Prism container at construction time.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies
|
||||
- **Stateless** - Third-party state machine library used for state transition management
|
||||
- **Prism.Ioc** - `ContainerLocator` for service resolution
|
||||
- **Prism.Events** - `IEventAggregator` interface (resolved but not used in visible code)
|
||||
- **DTS.Common.Enums.TSRAIRGo** - Provides `ArmStateMachineStates.States` enum
|
||||
- **DTS.Common.Utilities.Logging** - `APILogger` for logging state transitions and errors
|
||||
|
||||
### Internal Dependencies
|
||||
- `ArmStateMachineStates.States` - External enum defining all possible states (referenced but not defined in this file)
|
||||
|
||||
### Consumers
|
||||
- Unknown from source alone; consumers would subscribe to `OverallStatusStateChange` event and call `FireTrigger()`.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Unused cryptic trigger values**: The `Triggers` enum contains unexplained single-character values (`a`, `c`, `d`, `e`, `h`, `n`, `rr`, `tt`, `uu`, `yy`) that are never referenced elsewhere in the code.
|
||||
|
||||
2. **Unimplemented trigger handling**: Several triggers in the enum are not handled in the `FireTrigger` switch statement, including: `bFillingBuffer`, `ConfigurationIsSet`, `DownloadCleaningUp`, `DownloadFinished`, `Faulted`, `IntervalRecording`, `NonIntervalRecording`, `RunButton`, and the single-character triggers. Firing these will silently do nothing (fall through to `default`).
|
||||
|
||||
3. **Error trigger not configured**: The `ErrorTrigger` field is initialized but no state configures transitions using it. Firing `Triggers.Error` will likely cause a Stateless exception (caught and logged silently).
|
||||
|
||||
4. **PostTestProcessing fires wrong trigger**: The `Triggers.PostTestProcessing` case fires `DoneRecordingTrigger` instead of a dedicated trigger. This appears to be a workaround or potential bug.
|
||||
|
||||
5. **Unused graph generation**: The `Initialize()` method generates a UML dot graph string but stores it in a local variable that is never used or exposed.
|
||||
|
||||
6. **Silent failure mode**: `FireTrigger()` catches all exceptions and only logs them; callers have no way to know if a trigger failed.
|
||||
|
||||
7. **Questionable parameter design**: As noted in the source comment, `FireTrigger` takes a `state` parameter, which the developer questioned: "why specify state here? shouldn't that be done based on current state/trigger?" This suggests potential confusion about the state machine's design intent.
|
||||
|
||||
8. **Unused IEventAggregator**: The `_eventAggregator` field is resolved but never used in the visible code.
|
||||
Reference in New Issue
Block a user