Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Events/DTS.Viewer/Reports/PowerSpectralDensity.md

74 lines
4.7 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Events/DTS.Viewer/Reports/PowerSpectralDensity/PSDReportSettingsChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/Reports/PowerSpectralDensity/PSDReportGRMSValuesUpdatedEvent.cs
generated_at: "2026-04-16T03:27:06.629572+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "bc3a14258ff7c95a"
---
# PowerSpectralDensity
## Documentation: Power Spectral Density (PSD) Report Events
---
### 1. **Purpose**
This module defines Prism-based pub/sub events used to communicate state changes and data updates within the Power Spectral Density (PSD) report generation and display subsystem. Specifically, it enables decoupled notification of changes to PSD report configuration settings (`PSDReportSettingsChangedEvent`) and updates to GRMS (Root Mean Square of acceleration) summary values per channel (`PSDReportGRMSValuesUpdatedEvent`). These events facilitate reactive UI updates and model synchronization without tight coupling between view models and data models in the DTS Viewer application.
---
### 2. **Public Interface**
#### `PSDReportSettingsChangedEvent`
- **Type**: `class` inheriting from `PubSubEvent<PSDReportSettingsChangedEventArg>`
- **Behavior**: A Prism event used to publish notifications when PSD report settings have been modified. Subscribers receive an instance of `PSDReportSettingsChangedEventArg` containing the updated settings model and the originating view model.
#### `PSDReportSettingsChangedEventArg`
- **Type**: `class`
- **Properties**:
- `Model`: `IPSDReportSettingsModel` — The updated PSD report settings model.
- `ParentVM`: `IBaseViewModel` — The view model that triggered or owns the settings change.
#### `PSDReportGRMSValuesUpdatedEvent`
- **Type**: `class` inheriting from `PubSubEvent<PSDReportGRMSValuesUpdatedEventArg>`
- **Behavior**: A Prism event used to publish notifications when GRMS summary values (per channel) have been recalculated or updated. Subscribers receive an instance of `PSDReportGRMSValuesUpdatedEventArg` containing the new GRMS values and the originating view model.
#### `PSDReportGRMSValuesUpdatedEventArg`
- **Type**: `class`
- **Properties**:
- `Values`: `IChannelGRMSSummary[]` — Array of GRMS summary values, one per channel.
- `ParentVM`: `IBaseViewModel` — The view model responsible for the update.
---
### 3. **Invariants**
- **Event argument nullability**: Neither `Model` (in `PSDReportSettingsChangedEventArg`) nor `Values` (in `PSDReportGRMSValuesUpdatedEventArg`) is explicitly guaranteed to be non-null in the source. However, since they are public setters on reference types, callers are expected to provide valid instances when raising the events.
- **ParentVM requirement**: `ParentVM` is present in both argument types but is not validated for null. It is assumed that the publisher always sets `ParentVM` to the relevant view model context.
- **Ordering**: No ordering guarantees are specified or implied for event delivery; subscribers must not rely on event sequence unless enforced externally.
---
### 4. **Dependencies**
#### Dependencies *of* this module:
- `DTS.Common.Base` — Provides `IBaseViewModel`.
- `DTS.Common.Interface` — Provides:
- `IPSDReportSettingsModel`
- `IChannelGRMSSummary`
- `Prism.Events` — Provides `PubSubEvent<T>` base class.
#### Dependencies *on* this module:
- Any module/view model involved in PSD report configuration or GRMS calculation (e.g., report view models, data processing services) likely subscribes to or publishes these events. However, no explicit consumers are visible in the provided source.
---
### 5. **Gotchas**
- **No validation or immutability**: The argument classes expose public setters for all properties, meaning subscribers could inadvertently mutate the event args. There is no indication of immutability or defensive copying.
- **Ambiguous scope of `ParentVM`**: While `ParentVM` is included, its semantics (e.g., whether it is the *originator*, *owner*, or *context* of the change) are not documented in this file. Consumers must infer usage from surrounding code.
- **Array mutability risk**: `Values` is exposed as `IChannelGRMSSummary[]`, a mutable array. Subscribers may modify the array contents, potentially causing side effects if the same instance is reused.
- **Missing documentation of event semantics**: The source does not clarify whether events are *synchronous*, *thread-affine*, or *throttled*. Behavior depends on Prisms default `PubSubEvent` behavior (synchronous, UI-thread aware if subscribed on UI thread), but this is not explicit here.
- **None identified from source alone.** *(Note: The above are inferred based on common pitfalls with Prism events and public mutable properties, not explicit warnings in the source.)*