Files
2026-04-17 14:55:32 -04:00

192 lines
9.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
source_files:
- Common/DTS.Common.Serialization/TestSetup/TestObject/Channel.cs
- Common/DTS.Common.Serialization/TestSetup/TestObject/DASHardware.cs
- Common/DTS.Common.Serialization/TestSetup/TestObject/DASHardware.DASChannel.cs
- Common/DTS.Common.Serialization/TestSetup/TestObject/TestObject.cs
generated_at: "2026-04-16T03:41:14.998508+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "5d62833ecdd15a59"
---
# Documentation: `TestObject` Serialization Model
## 1. Purpose
This module defines a set of strongly-typed, serializable data structures used to represent test setup metadata in the DTS (Dynamic Testing System) serialization framework. Specifically, it provides models for `TestObject`, `DASHardware` (Data Acquisition System hardware), and associated channel types (`TOChannel`, `DASChannel`). These classes encapsulate metadata about physical test objects (e.g., impact hammers, barriers), associated hardware (e.g., DAS units), and their channels (sensors), enabling structured storage, retrieval, and exchange of test configuration data. The classes are designed to support versioning, naming, and descriptive properties while leveraging a custom `Property<T>` wrapper for internal state management.
## 2. Public Interface
All classes are `partial` and nested inside `DTS.Serialization.TestSetup.TestObject`. They inherit from `Exceptional` (not shown, but assumed to provide exception-handling or logging infrastructure).
### `TestObject` Class
- **`TestObject()`**
Default constructor initializing all properties to `null` (except `Version`, initialized to `"1.0.0.0"` and list properties to empty lists).
- **`string NameOfTestObject { get; set; }`**
Human-readable name of the test object (e.g., `"Hammer A"`).
- **`string SerialNumber { get; set; }`**
Manufacturers serial number of the test object.
- **`string CodeOfTestObject { get; set; }`**
Internal or standardized code identifying the test object type.
- **`string ClassOfTestObject { get; set; }`**
Classification of the test object (e.g., `"Hammer"`, `"Barrier"`).
- **`string Location { get; set; }`**
Physical or logical location of the test object.
- **`string Version { get; set; }`**
Version string of the test object definition (default: `"1.0.0.0"`).
- **`List<TOChannel> Channels { get; set; }`**
List of `TOChannel` instances associated with this test object.
- **`List<DASHardware> DASHardwares { get; set; }`**
List of `DASHardware` instances linked to this test object.
- **`string BarrierHeight { get; set; }`**
Height of a barrier test object (if applicable).
- **`string BarrierWidth { get; set; }`**
Width of a barrier test object.
- **`string ImpactSideTestObject { get; set; }`**
Side of the test object used for impact (e.g., `"Top"`, `"Bottom"`).
- **`string DriverPositionObject { get; set; }`**
Position of the driver relative to the test object.
- **`string MassOfTestObject { get; set; }`**
Mass of the test object (string representation, e.g., `"5.2 kg"`).
- **`string Velocity { get; set; }`**
Velocity associated with the test object (e.g., impact velocity).
- **`string VelocityMeasurementUnit { get; set; }`**
Unit of measurement for `Velocity` (e.g., `"m/s"`).
- **`string Offset { get; set; }`**
Offset value (e.g., zero offset in measurement).
- **`string OriginX/Y/Z { get; set; }`**
3D coordinate origin (string values, likely in meters).
- **`string ReferenceSystem { get; set; }`**
Coordinate reference system (e.g., `"WGS84"`, `"Local"`).
- **`string RefNumberOfTestObject { get; set; }`**
Reference number or ID assigned to the test object.
- **`string NumberOfLoadCells { get; set; }`**
Number of load cells used in the test.
- **`string TargetSampleRate { get; set; }`**
Desired sample rate for data acquisition.
- **`string ExcitationWarmupMS { get; set; }`**
Warm-up time before excitation (in milliseconds).
- **`string Comment1/2/3 { get; set; }`**
Free-text comment fields.
- **`string YawAngle { get; set; }`**
Angular orientation (e.g., yaw in degrees).
- **`List<ExtraProperty> ExtraProperties { get; set; }`**
List of arbitrary key-value metadata (type `ExtraProperty` not defined here; assumed to be defined elsewhere).
> **Note**: The `TypeOfTestObject` property is commented out and not part of the public interface.
### `TOChannel` Class
- **`TOChannel()`**
Default constructor initializing `_version` to `"1.0.0.0"`; other fields to `null`.
- **`string Name { get; set; }`**
Name of the channel (e.g., `"Channel_1"`).
- **`string SensorName { get; set; }`**
Name of the sensor associated with this channel.
- **`string Version { get; set; }`**
Version of the channel definition (default: `"1.0.0.0"`).
### `DASHardware` Class
- **`DASHardware()`**
Default constructor initializing `_version` to `"1.0.0.0"`; other fields to `null`.
- **`List<DASChannel> DASChannels { get; set; }`**
List of `DASChannel` instances attached to this DAS hardware.
- **`string SampleRate { get; set; }`**
Sample rate configured for this DAS hardware (e.g., `"2000 Hz"`).
- **`string SerialNumber { get; set; }`**
Serial number of the DAS hardware unit.
- **`string Version { get; set; }`**
Version of the DAS hardware definition (default: `"1.0.0.0"`).
### `DASHardware.DASChannel` Class
- **`DASChannel()`**
Default constructor initializing `_version` to `"1.0.0.0"`; other fields to `null`.
- **`string Name { get; set; }`**
Name of the DAS channel (e.g., `"DAS_Ch1"`).
- **`string SensorName { get; set; }`**
Name of the physical sensor connected to this channel.
- **`string SerialNumber { get; set; }`**
Serial number of the sensor.
- **`string Location { get; set; }`**
Physical location of the sensor (e.g., `"Top Flange"`).
- **`string MeasurementUnits { get; set; }`**
Units of measurement for this channel (e.g., `"g"`, `"V"`).
- **`string NumberOfSamples { get; set; }`**
Number of samples recorded on this channel.
- **`string Version { get; set; }`**
Version of the DAS channel definition (default: `"1.0.0.0"`).
## 3. Invariants
- **Default `Version`**: All classes (`TestObject`, `TOChannel`, `DASHardware`, `DASChannel`) initialize their `Version` property to `"1.0.0.0"` in the constructor. This is the only guaranteed non-null default value.
- **List Properties**: All list properties (`Channels`, `DASHardwares`, `DASChannels`, `ExtraProperties`) are initialized to empty lists (`new List<T>()`) in their respective `Property<T>` declarations. They are never `null` unless explicitly set to `null` via setter.
- **String Properties**: All string properties are backed by `Property<string>` initialized with non-null default values (empty string `""`). However, the constructor sets them to `null` *before* the `Property<T>` default is applied, meaning:
- Immediately after construction, all string properties are `null`.
- The `Property<T>` default (`""`) is only used if the property is never explicitly set.
- **Namespace-based Property Keys**: Each `Property<T>` instance uses a key derived from `typeof(...).Namespace + "." + [ClassName].[PropertyName]`. This implies a strict naming convention for property metadata, but the key itself is internal and not exposed via the public API.
## 4. Dependencies
- **Internal Dependencies**:
- `DTS.Common.Utilities` and `DTS.Common.Utilities.DotNetProgrammingConstructs` namespaces (likely containing the `Exceptional` base class and `Property<T>` implementation).
- `System.Collections.Generic` for `List<T>` usage.
- **External Dependencies**:
- `ExtraProperty` (used in `TestObject.ExtraProperties`) is referenced but not defined in the provided files. Its definition must exist elsewhere in the codebase.
- `DASHardware.DASChannel` is defined in a separate file (`DASHardware.DASChannel.cs`) using `partial` class extension, indicating a split implementation (likely for maintainability or code generation).
- **Dependents**:
- This module is part of `DTS.Serialization`, implying usage by serialization/deserialization logic (e.g., XML/JSON converters, test setup loaders) not included here.
## 5. Gotchas
- **String vs. Typed Values**: All properties are `string`-typed, even for numeric or structured data (e.g., `SampleRate`, `OriginX`, `MassOfTestObject`). Consumers must parse or interpret these values themselves. No validation or type conversion is performed by the model.
- **Null vs. Empty String**: While `Property<T>` defaults to `""`, the constructor explicitly sets all string fields to `null`. This means:
- A newly constructed object has `null` for all string properties.
- An unset property remains `null` (not `""`), which may differ from expectations based on the `Property<T>` default.
- **No Validation**: No setters enforce constraints (e.g., `Version` format, non-empty `Name`). Validation must be handled externally.
- **Partial Class Fragmentation**: `DASHardware` and `DASChannel` are split across files (`DASHardware.cs` and `DASHardware.DASChannel.cs`). Developers must be aware of both files to see the full class definition.
- **Commented-Out Property**: `TypeOfTestObject` is commented out in `TestObject.cs`. Its absence may indicate legacy or deprecated functionality; do not rely on it.
- **Ambiguous Units**: Properties like `VelocityMeasurementUnit` and `MeasurementUnits` rely on string values without enforced unit standards (e.g., SI vs. imperial), risking misinterpretation without external documentation.
- **No Invariants Enforced on Lists**: While lists are initialized, there is no protection against adding `null` elements (e.g., `testObject.Channels.Add(null)` is allowed).