Files

184 lines
10 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableDasSerialNumberAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableSampleRateAttribute.cs
- Common/DTS.Common.Serialization/Control/Event/Module/Module.cs
generated_at: "2026-04-17T15:39:09.615523+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "474439030090ef0a"
---
# Documentation: DTS.Slice.Control.Event.Module
## 1. Purpose
This module provides the `Event.Module` class, which represents a data acquisition system (DAS) module within a Slice Control event. It serves as a container for channel configurations, timing information, sensor readings (tilt and temperature), and metadata about the recording hardware. The module also provides a set of reviewable attributes (`ReviewableAttribute` subclasses) that expose specific module properties in a standardized format for review/display purposes, and implements bidirectional conversion between runtime objects and serialization formats.
---
## 2. Public Interface
### Event.Module Class
**Namespace:** `DTS.Slice.Control`
**Inheritance:** `Exceptional`, implements `Serialization.Test.Module.IConvertable`
#### Constructors
| Signature | Description |
|-----------|-------------|
| `Module()` | Default constructor. Initializes a new instance with empty channels list. |
| `Module(Event parentEvent)` | Initializes with a parent `Event` reference. |
| `Module(Serialization.Test.Module that, Event parent, Serialization.Test.ReportErrors reportErrors)` | Initializes from a serialization object, populating all properties from the source. |
#### Properties
| Property | Type | Description |
|----------|------|-------------|
| `ParentEvent` | `Event` | The parent `Event` containing this module. Has `SetParentEvent(Event e)` setter method. |
| `Channels` | `List<Channel>` | List of channels on this event module. |
| `Number` | `int` | Module number identifier. |
| `DasSerialNumber` | `string` | DAS serial number string. |
| `Description` | `string` | Module description. |
| `BaseSerialNumber` | `string` | Base serial number for this DAS. |
| `RequestedPreTriggerSeconds` | `double` | Requested pre-trigger duration in seconds. |
| `RequestedPostTriggerSeconds` | `double` | Requested post-trigger duration in seconds. |
| `PreTriggerSeconds` | `double` | Actual pre-trigger duration in seconds. |
| `PostTriggerSeconds` | `double` | Actual post-trigger duration in seconds. |
| `NumberOfSamples` | `UInt64` | Number of samples in this module. |
| `UnsubsampledNumberOfSamples` | `UInt64` | Number of unsubsampled samples. |
| `TriggerSampleNumbers` | `List<UInt64>` | Trigger sample numbers. |
| `UnsubsampledTriggerSampleNumbers` | `List<UInt64>` | Unsubsampled trigger sample numbers. |
| `StartRecordSampleNumber` | `UInt64` | Start record sample number. |
| `SampleRateHz` | `float` | Sample rate in Hz. |
| `StartRecordTimestampSec` | `double` | Start record timestamp (seconds component). |
| `StartRecordTimestampNanoSec` | `double` | Start record timestamp (nanoseconds component). |
| `TriggerTimestampSec` | `double` | Trigger timestamp (seconds component). |
| `TriggerTimestampNanoSec` | `double` | Trigger timestamp (nanoseconds component). |
| `PTPMasterSync` | `bool` | Whether PTP master sync is used. |
| `TiltSensorAxisXDegreesPre` / `TiltSensorAxisYDegreesPre` / `TiltSensorAxisZDegreesPre` | `double` | Pre-trigger tilt sensor axis values in degrees. |
| `TiltSensorAxisXDegreesPost` / `TiltSensorAxisYDegreesPost` / `TiltSensorAxisZDegreesPost` | `double` | Post-trigger tilt sensor axis values in degrees. |
| `TemperatureLocation1Pre` through `TemperatureLocation4Pre` | `float` | Pre-trigger temperature sensor values at 4 locations. |
| `TemperatureLocation1Post` through `TemperatureLocation4Post` | `float` | Post-trigger temperature sensor values at 4 locations. |
| `AaFilterRateHz` | `float` | Anti-aliasing filter rate in Hz. |
| `NominalExcitationVoltage` | `Test.Module.Channel.Sensor.ExcitationVoltageOption` | Nominal excitation voltage (default: `Volt5`). |
| `RecordingMode` | `Test.Module.RecordingMode` | Recording mode (default: `CircularBuffer`). |
#### Methods
| Signature | Description |
|-----------|-------------|
| `void SetPropertyValuesFrom(DASLib.Service.DASModule that)` | Copies trigger sample numbers, number of samples, and fault flags from a `DASModule` object. |
| `override bool Equals(object obj)` | Memberwise equality comparison of all major properties and child collections. |
| `override int GetHashCode()` | Returns base hash code. |
| `bool IsSlice6DBModule()` | Returns `true` if `Description` equals `"slice6db module"`. |
| `Serialization.Test.Module ToDtsSerializationTestModule(Serialization.Test parentTest)` | Converts this object to a `Serialization.Test.Module`. Only includes channels where `IsConfigured` is `true`. |
| `void FromDtsSerializationTestModule(Serialization.Test.Module that, Serialization.Test.ReportErrors reportErrors)` | Populates this object from a `Serialization.Test.Module`. Creates channels via `Channel.CreateChannel()`. |
---
### Event.Module.ReviewableAttribute Class
**Inheritance:** `Slice.Control.ReviewableAttribute` (abstract)
#### Constructors
| Signature | Description |
|-----------|-------------|
| `public ReviewableAttribute(Event.Module channel)` | **Throws `NotImplementedException`** wrapped in `Module.ReviewableAttribute.Exception`. Documented as "concrete class should implement this constructor." |
| `protected ReviewableAttribute(string name, DetermineValueString calculateValue)` | Protected constructor that passes name and value delegate to base class. |
---
### Event.Module.ReviewableDasSerialNumberAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableDasSerialNumberAttribute(Event.Module module)` | Initializes with name `"DAS Serial Number"` and a delegate returning `module.DasSerialNumber`. |
---
### Event.Module.ReviewableSampleRateAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableSampleRateAttribute(Event.Module module)` | Initializes with name `"Sample Rate"` and a delegate returning `module.SampleRateHz.ToString("N")`. |
---
### Event.Module.ReviewableTestDescriptionAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableTestDescriptionAttribute(Event.Module module)` | Initializes with name `"Test Description"` and a delegate returning `module.ParentEvent.Description`. |
---
### Event.Module.ReviewableHardwareFrequencyAttribute Class
**Inheritance:** `Event.Module.ReviewableAttribute`
| Constructor | Description |
|-------------|-------------|
| `public ReviewableHardwareFrequencyAttribute(Event.Module module)` | Initializes with name `"HW AAF"` and a delegate returning `module.AaFilterRateHz.ToString("N2")`. |
---
## 3. Invariants
1. **Parent-Child Relationship**: A `Module` must have a valid `ParentEvent` reference for operations that access parent properties (e.g., `ReviewableTestDescriptionAttribute` accesses `module.ParentEvent.Description`).
2. **Channel Filtering in Serialization**: `ToDtsSerializationTestModule()` only serializes channels where `IsConfigured` is `true`.
3. **Channel Numbering**: When populating from a serialization module, channels are assigned sequential absolute channel numbers starting from `ParentEvent.LastAbsoluteChannelNumberInEvent + 1`.
4. **Equality Semantics**: `Equals()` performs memberwise comparison including all properties and child collections (`Channels`, `TriggerSampleNumbers`, `UnsubsampledTriggerSampleNumbers`).
5. **ReviewableAttribute Constructor Contract**: The public constructor taking `Event.Module` is explicitly designed to throw; subclasses must use the protected constructor with name and delegate.
---
## 4. Dependencies
### This Module Depends On:
- `DTS.Common.DAS.Concepts`
- `DTS.Serialization.StringResources`
- `DTS.Common.Utilities`
- `DTS.Common.Utilities.DotNetProgrammingConstructs`
- `DTS.Common.Utilities.Logging` (for `APILogger`)
- `DTS.Utilities` (referenced in `ReviewableDasSerialNumberAttribute.cs` and `ReviewableSampleRateAttribute.cs`)
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Diagnostics`
- `DASLib.Service.DASModule` (external service type used in `SetPropertyValuesFrom`)
- `Slice.Control.ReviewableAttribute` (base class for `Event.Module.ReviewableAttribute`)
- `Slice.Control.Event` (parent container class)
- `Serialization.Test.Module` and related serialization types
### What Depends On This Module:
- Not explicitly shown in source, but `Channel` class is referenced extensively, implying `Event.Module.Channel` is a dependent nested class.
---
## 5. Gotchas
1. **ReviewableAttribute Constructor Throws by Design**: The public constructor `ReviewableAttribute(Event.Module channel)` always throws a `NotImplementedException`. This appears to be intentional guard code, but the pattern is unusual—subclasses should call the protected constructor directly.
2. **Inappropriate Exception Handling**: The `FromDtsSerializationTestModule()` method uses try/catch blocks around individual property assignments (e.g., `StartRecordTimestampSec`, `TriggerTimestampSec`, tilt sensor values, temperature values) with logging but no re-throw. This silently swallows errors and continues execution. Source contains TODO comments: `"//TODO: inappropriate using try/catch!!!"`.
3. **Incorrect Log Message**: In `FromDtsSerializationTestModule()`, the catch block for `TriggerTimestampNanoSec` logs `"failed to get TriggerTimestampSec"` instead of `"failed to get TriggerTimestampNanoSec"`.
4. **Wrong Property Assignment**: In `FromDtsSerializationTestModule()`, the line `TriggerTimestampNanoSec = that.StartRecordTimestampNanoSec` appears to copy from the wrong source property (should likely be `that.TriggerTimestampNanoSec`).
5. **Commented-Out Initialization**: In the default `Module()` constructor, the call to `InitializeReviewableAttributes` is commented out. It is unclear if this is intentional or dead code.
6. **Exception Swallowing in SetPropertyValuesFrom**: The method catches exceptions when reading `ParentEvent.FaultFlags` and silently ignores them with an empty catch block (`catch (System.Exception) { }`).
7. **Format String Inconsistency**: `ReviewableSampleRateAttribute` uses `"N"` format while `ReviewableHardwareFrequencyAttribute` uses `"N2"` format for numeric display.