init
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/ITestSetupsView.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/ITestSetupsViewModel.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/ITestDASOrder.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/IROIPeriodChannelRecord.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/ITestSetupHardwareRecord.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/ITestSetupROIRecord.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/ICalculatedChannelRecord.cs
|
||||
- Common/DTS.CommonCore/Interface/TestSetups/IISFFile.cs
|
||||
generated_at: "2026-04-16T02:26:15.632629+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f7166919537b0724"
|
||||
---
|
||||
|
||||
# TestSetups
|
||||
|
||||
## Documentation: TestSetups Module
|
||||
|
||||
### 1. Purpose
|
||||
This module defines a set of interfaces that model test setup data structures and UI/viewmodel abstractions within the DTS (Data Acquisition and Test System) platform. It serves as the contract layer for representing hardware configuration (DAS, sensors), regions of interest (ROIs), calculated channels, and ISF (Instrumented Sensor File) format specifications. These interfaces enable decoupled data handling across layers—particularly for persistence, UI binding, and file I/O—while enforcing domain-specific constraints like channel ordering, ROI definitions, and sensor calibration metadata.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### Interfaces (No concrete implementations provided in source)
|
||||
|
||||
| Interface | Signature | Behavior |
|
||||
|-----------|-----------|----------|
|
||||
| `ITestSetupsView` | `interface ITestSetupsView : IBaseView` | Marker interface for the view layer in the test setups feature. Inherits from `IBaseView`. |
|
||||
| `ITestSetupsViewModel` | `interface ITestSetupsViewModel : IBaseViewModel` | Marker interface for the viewmodel layer in the test setups feature. Inherits from `IBaseViewModel`. |
|
||||
| `ITestDASOrder` | `interface ITestDASOrder` | Allows DAS (Data Acquisition System) instances to be ordered within a test setup. Defines a single property: `int DASIndex { get; set; }`. |
|
||||
| `IROIPeriodChannelRecord` | `interface IROIPeriodChannelRecord` | Represents a row in the `ROIPeriodChannels` database table. Properties: `int TestSetupROIId`, `string ChannelName`. |
|
||||
| `ITestSetupHardwareRecord` | `interface ITestSetupHardwareRecord` | Represents a row in the test setup hardware configuration table. Properties: `int DASId`, `int TestSetupId`, `bool AddDAS`, `int SamplesPerSecond`, `bool IsClockMaster`, `int AntiAliasFilterRate`, `byte PTPDomainId`. |
|
||||
| `ITestSetupROIRecord` | `interface ITestSetupROIRecord` | Represents a row in the `TestSetupROIs` database table. Properties: `int TestSetupROIId`, `int TestSetupId`, `string Suffix`, `double ROIStart`, `double ROIEnd`, `bool IsEnabled`, `bool IsDefault`. |
|
||||
| `ICalculatedChannelRecord` | `interface ICalculatedChannelRecord` | Represents a calculated channel record in the database. Properties: `string Name`, `string TestSetupName`, `int Id`, `Operations Operation`, `string CalculatedValueCode`, `string[] InputChannelIds`, `string CFCForInputChannels`, `string ChannelFilterClassForOutput`, `int TestSetupId`, `bool ViewInRealtime`, `int ClipLength`. |
|
||||
| `IISFFile` | `interface IISFFile` | Models an ISF file structure (used for sensor calibration/sensor definition files). Properties: `char[] HeaderLine1`, `char[] TestSetupName`, `short NumberOfRecords { get }`, `char[] TestType`, `char[] TestDivision`, `char[] TCFile`, `char[] HeaderLine2`, `char[] HeaderLine3`, `IISFSensorRecord[] Records`. Methods: `void AddRecord(IISFSensorRecord record)`, `void WriteToFile(string pathToFile)`, `void AddSensors(ISensorData[] sensors)`. |
|
||||
| `IISFSensorRecord` | `interface IISFSensorRecord` | Models a 4-record (320-byte) ISF sensor entry. Contains many fixed-width `char[]` fields with precise offsets (e.g., `DataChannelNumber` at char 7, length 5). Methods: `void SetDataChannelNumber(short value)`, `void SetCapacity(double)`, `double GetCapacity()`, `void SetSensitivity(double)`, `double GetSensitivity()`, `void SetBridgeResistance(double)`, `void SetC1(double)`, `double GetC1()`, `void SetC2(double)`, `void SetC3(double)`, `void SetSensorComment(string)`, `void Write(BinaryWriter)`, `void SetSensor(ISensorData)`. |
|
||||
| `Operations` (enum) | `enum Operations` | Defines supported calculated channel operations: `SUM`, `AVERAGE`, `IRTRACC3D`, `IRTRACC3D_ABDOMEN`, `IRTRACC3D_LOWERTHORAX`, `Resultant`, `HIC`. Each has a `[DescriptionResource]` attribute for localization. |
|
||||
| `ConstantsAndEnums` (nested abstract class) | `abstract class ConstantsAndEnums` | Defines constants and enums used by `IISFFile`: `RECORD_LENGTH = 80`, `ISFKnownChannelTypes` enum (`VS`, `VU`, `SB`, `TI`, `TC`, `CT`, `XP`, `P4`, `VF`, `NB`, `EX`). |
|
||||
|
||||
### 3. Invariants
|
||||
|
||||
- **ISF File Format Constraints**
|
||||
- All `char[]` fields in `IISFSensorRecord` have fixed lengths and byte offsets (e.g., `TestSetupName` starts at char 7, length 8; `NumberOfRecords` is 5 chars starting at char 15).
|
||||
- `RECORD_LENGTH` is strictly 80 bytes per record; sensor records consist of exactly 4 records.
|
||||
- `NumberOfRecords` is read-only and must reflect the count of `Records` in the file.
|
||||
- `Sensitivity` and `C1`/`C2`/`C3` fields store scaled values (e.g., sensitivity is stored as V/1000; polynomial coefficients are stored as /1000).
|
||||
- `TOMConfigurationName` defaults to `"STANDARD"`; other values are not currently supported.
|
||||
- `SensorType` must contain `"N/O"` or `"N/C"` for digital inputs.
|
||||
|
||||
- **Test Setup Data Invariants**
|
||||
- `ITestSetupROIRecord.IsEnabled` and `IsDefault` are boolean flags; only one ROI per test setup may be `IsDefault = true`.
|
||||
- `ITestSetupHardwareRecord.IsClockMaster` indicates which DAS provides timing; only one DAS per test setup should be master.
|
||||
- `InputChannelIds` in `ICalculatedChannelRecord` is a CSV-separated list encoded as `string[]` (note: type mismatch between description and property type—see *Gotchas*).
|
||||
- `ClipLength` applies only to certain `Operations` (e.g., max over a clip), but no enforcement is present in the interface.
|
||||
|
||||
- **Naming & IDs**
|
||||
- `TestSetupId` appears consistently across `ITestSetupHardwareRecord`, `ITestSetupROIRecord`, and `ICalculatedChannelRecord` as the foreign key to a test setup.
|
||||
- `TestSetupROIId` is the primary key for ROIs and referenced by `IROIPeriodChannelRecord.TestSetupROIId`.
|
||||
|
||||
### 4. Dependencies
|
||||
|
||||
- **Internal Dependencies**
|
||||
- `DTS.Common.Base`: All view/viewmodel interfaces (`IBaseView`, `IBaseViewModel`) are defined here.
|
||||
- `DTS.Common.Enums.DASFactory.DFConstantsAndEnums`: Referenced in `ITestSetupHardwareRecord` (e.g., for PTP domain IDs).
|
||||
- `DTS.Common.Interface.Sensors`: `IISFFile` depends on `ISensorData` (from this namespace).
|
||||
- `System.ComponentModel`: Used for `TypeConverter` attribute on `Operations` enum.
|
||||
- `System.IO`: Used for `BinaryWriter` in `IISFSensorRecord.Write`.
|
||||
|
||||
- **External Dependencies**
|
||||
- No external (non-DTS) libraries are imported beyond .NET base types.
|
||||
- Localization resources (e.g., `"CalculatedChannel_Sum"`) are referenced via `[DescriptionResource]` but not defined in this module.
|
||||
|
||||
### 5. Gotchas
|
||||
|
||||
- **Type Mismatch in `ICalculatedChannelRecord.InputChannelIds`**
|
||||
The property is declared as `string[]`, but the XML comment states it is a "CSV separated list of channel ids". This suggests the implementation likely stores a *single* CSV string (e.g., `"1,2,3"`), not an array. Developers must clarify whether this is a documentation error or if the array is used for intermediate processing.
|
||||
|
||||
- **ISF Record Field Offsets Are Implicit**
|
||||
Offsets and lengths of `char[]` fields are only documented in comments (e.g., `"starts at character 15, 5 characters long"`). There is no runtime validation or helper to enforce these constraints—implementations must manually parse/write at exact byte positions.
|
||||
|
||||
- **`NumberOfRecords` Is Read-Only but Must Be Updated**
|
||||
`IISFFile.NumberOfRecords` is read-only, yet `AddRecord` must update it. This implies the implementation must internally track and expose the count, but the interface does not enforce consistency (e.g., if `Records` array is modified directly).
|
||||
|
||||
- **`ISFKnownChannelTypes.TI`/`TC` Are Non-Analog**
|
||||
The enum includes `TI` and `TC` as known channel types, but comments note they are "not analog (TOM)". Implementations must handle these as special cases (e.g., digital triggers), not standard analog channels.
|
||||
|
||||
- **`SetSensorComment` Aggregates Three Fields**
|
||||
`SetSensorComment(string)` writes to `CommentPart1`, `CommentPart2`, and `CommentPart3` (total 70 chars: 15+40+15). There is no truncation or padding behavior specified—implementations must decide how to handle overflow/underflow.
|
||||
|
||||
- **No Validation on `ROIStart`/`ROIEnd`**
|
||||
`ITestSetupROIRecord` does not enforce `ROIStart < ROIEnd` or that values are non-negative. Invalid ranges may propagate to downstream logic.
|
||||
|
||||
- **`PTPDomainId` Is `byte`**
|
||||
While `byte` is appropriate for PTP domain IDs (0–255), no validation ensures the value is within valid range for the target PTP implementation.
|
||||
Reference in New Issue
Block a user