58 lines
3.4 KiB
Markdown
58 lines
3.4 KiB
Markdown
---
|
|
source_files:
|
|
- Common/DTS.Common.Tests/ChannelTypeUtilityShould.cs
|
|
- Common/DTS.Common.Tests/NetworkUtilsShould.cs
|
|
- Common/DTS.Common.Tests/LinearizationFormulaShould.cs
|
|
- Common/DTS.Common.Tests/GroupChannelShould.cs
|
|
- Common/DTS.Common.Tests/FilterClassShould.cs
|
|
generated_at: "2026-04-16T11:33:05.077220+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "6d6fac19105f4e74"
|
|
---
|
|
|
|
# DTS.Common.Tests
|
|
|
|
## Documentation: DTS.Common Module
|
|
|
|
### 1. Purpose
|
|
The `DTS.Common` module provides core utility classes and data structures for handling sensor configuration, signal processing, and network communication within the DTS system. It centralizes logic for parsing sensor identifiers, linearizing raw sensor data using polynomial formulas, managing software filter channel configurations (ISO codes), and parsing network connection strings. This module serves as the foundational layer for sensor data interpretation and device connectivity.
|
|
|
|
### 2. Public Interface
|
|
|
|
#### Class: `DTS.Common.Classes.Sensors.ChannelTypeUtility`
|
|
A utility class for parsing sensor naming conventions.
|
|
* **`string ParseSensorKnownChannelType(string sensorName)`**
|
|
* Extracts a known channel type prefix from a sensor name string.
|
|
* Returns the string representation of the `KnownChannelTypes` enum if the prefix is valid.
|
|
* Returns `string.Empty` if the input is `null`, empty, has fewer than 2 characters, or if the 2-character prefix is not defined in `KnownChannelTypes`.
|
|
|
|
#### Class: `DTS.Common.Utils.NetworkUtils`
|
|
A utility class for network-related string parsing.
|
|
* **`bool TryParseConnectionString(string connectionString, out string ipAddress)`**
|
|
* Attempts to extract an IP address from a connection string.
|
|
* Returns `true` and populates `ipAddress` (excluding port) if a valid IP is found.
|
|
* Returns `false` if the connection string is `null` or does not contain a parseable IP address (e.g., a USB device path).
|
|
* Supports formats: `IP`, `IP:Port`, `protocol://IP:Port` (e.g., `http`, `udp`).
|
|
|
|
#### Class: `DTS.Common.Classes.Sensors.LinearizationFormula`
|
|
Handles the conversion of raw sensor values to Engineering Units (EU).
|
|
* **`double[] PolynomialCoefficients`** (Property)
|
|
* An array of doubles representing the coefficients for the linearization polynomial.
|
|
* **`NonLinearStyles NonLinearStyle`** (Property)
|
|
* Specifies the style of non-linear calculation. Defaults to `NonLinearStyles.Polynomial`.
|
|
* **`double GetLinearizedValue(double input, int decimalPlaces, bool? proportional)`**
|
|
* Calculates the linearized value based on the `PolynomialCoefficients`.
|
|
* `input`: The raw sensor value.
|
|
* `decimalPlaces`: Precision of the result (inferred from test context).
|
|
* `proportional`: A nullable boolean flag affecting the calculation logic. When `null` or `true`, the calculation differs from when it is `false`.
|
|
|
|
#### Class: `DTS.Common.Classes.Sensors.FilterClass`
|
|
Represents a software filter configuration and provides mapping logic between ISO codes, frequencies, and filter class types.
|
|
* **`FilterClassType FClass`** (Property)
|
|
* The type of the filter (e.g., `CFC1000`, `AdHoc`).
|
|
* **`double Frequency`** (Property)
|
|
* The frequency associated with the filter class.
|
|
* **`static FilterClass GetFilterClassFromString(string input)`**
|
|
* Parses a string (e.g., "CFC 1000", "600", "1700Hz", "None") into a `FilterClass` object.
|
|
* Returns |