Files

138 lines
7.8 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportMainViewGrid.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportResultsView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportSettingsView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportMainView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IChannelGRMSSummary.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportSettingsViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportResultsViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportSettingsModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Reports/PowerSpectralDensity/IPSDReportMainViewModel.cs
generated_at: "2026-04-16T03:09:28.143964+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "0edcef037628c1da"
---
# PowerSpectralDensity
## Documentation: Power Spectral Density (PSD) Report Module Interfaces
---
### 1. **Purpose**
This module defines the interface layer for the Power Spectral Density (PSD) report functionality within the DTS Viewer. It establishes contracts for views, view models, and models that collectively support configuration, results display, and main orchestration of PSD reports. The interfaces follow a layered MVVM pattern (Model-View-ViewModel), with clear separation between UI presentation (`IBaseView`-derived interfaces), state management (`IBaseViewModel`-derived interfaces), and data/configuration (`IBaseModel`-derived interfaces). The module enables users to configure filtering, windowing, and data range parameters, compute GRMS summaries per channel, and export results—while integrating with broader viewer regions and navigation contexts.
---
### 2. **Public Interface**
#### **Interfaces (View Layer)**
All implement `IBaseView`.
- `IPSDReportMainView`
Top-level view interface for the PSD report. Serves as the root container for the report UI.
- `IPSDReportMainViewGrid`
Sub-view interface representing the main grid area within the PSD report view.
- `IPSDReportSettingsView`
View interface for the settings panel where users configure filters, windowing, and data range.
- `IPSDReportResultsView`
View interface for the results panel displaying channel GRMS summaries and related outputs.
#### **Interfaces (ViewModel Layer)**
All implement `IBaseViewModel`.
- `IPSDReportMainViewModel`
Main orchestrator for the PSD report. Manages regions (navigation, graph, tests, legend, property), user permissions, zoom/keyboard interactions, and view modes.
**Key members**:
- `List<FrameworkElement> GetRegions()`
- `void ZoomReset()`, `void LeftKeyPress()`, `void RightKeyPress()`
- `Visibility SettingsVisibility { get; }`
- `string ConfigPath`, `bool DoesUserHaveEditPermission`, `bool CalibrationBehaviorSettableInViewer`, `ChannelCodeViewMode`, `CalibrationBehaviorSetting`
- `IPSDReportSettingsViewModel`
View model for settings. Binds to `IPSDReportSettingsView` and `IPSDReportSettingsModel`.
**Key members**:
- `void PublishChanges()`
- `IBaseView View { get; set; }`, `IBaseViewModel Parent { get; set; }`, `IPSDReportSettingsModel Model { get; set; }`
- `IPSDReportResultsViewModel`
View model for results. Exposes export commands and channel GRMS data.
**Key members**:
- `DelegateCommand ExportToPDFCommand { get; }`
- `DelegateCommand ExportToCSVCommand { get; }`
- `ObservableCollection<IChannelGRMSSummary> Results { get; set; }`
- `IBaseView View { get; set; }`, `IBaseViewModel Parent { get; set; }`
#### **Interfaces (Model Layer)**
All implement `IBaseModel`.
- `IPSDReportSettingsModel`
Holds configuration state for the PSD report.
**Key members**:
- `bool LowPassFilterEnabled`, `double LowPassFilterFrequency`, `PassFilterType LowPassFilterType`, `int LowPassFilterOrder`
- `bool HighPassFilterEnabled`, `double HighPassFilterFrequency`, `PassFilterType HighPassFilterType`, `int HighPassFilterOrder`
- `WindowWidth WindowWidth`, `WindowType WindowType`, `WindowAveragingType WindowAveragingType`, `double WindowOverlappingPercent`
- `bool ShowEnvelope`, `bool CanPublishChanges`, `bool ReadData`, `double DataStart`, `double DataEnd`
- `IPSDReportSettingsViewModel Parent { get; set; }`
#### **Data Interfaces**
- `IChannelGRMSSummary`
Represents a single channels GRMS summary.
**Properties**:
- `string ChannelName { get; set; }`
- `int SampleRate { get; set; }`
- `double GRMS { get; set; }`
Implements `IBaseClass`.
---
### 3. **Invariants**
- All view interfaces (`IPSDReport*View`) derive from `IBaseView`, ensuring consistent UI contract.
- All view model interfaces derive from `IBaseViewModel`, and all model interfaces derive from `IBaseModel`, enforcing layered architecture.
- `IPSDReportSettingsViewModel.Model` must be non-null and of concrete type `IPSDReportSettingsModel`.
- `IPSDReportResultsViewModel.Results` must be an `ObservableCollection<IChannelGRMSSummary>`; individual items must have non-null `ChannelName`.
- `IPSDReportMainViewModel` implements `ISelectedDataViewModel`, implying it participates in shared data selection context.
- `IPSDReportSettingsModel.CanPublishChanges` likely controls whether `PublishChanges()` may be invoked (though enforcement is not explicit in interface).
- `IPSDReportMainViewModel.SettingsVisibility` is read-only; its value is determined internally (e.g., by permissions or configuration).
---
### 4. **Dependencies**
#### **Internal Dependencies**
- **Base Layer**: All interfaces depend on `DTS.Common.Base` (`IBaseView`, `IBaseViewModel`, `IBaseModel`, `IBaseClass`).
- **Enums**:
- `PassFilterType`, `WindowWidth`, `WindowType`, `WindowAveragingType` (from `DTS.Common.Enums.Viewer.Reports`)
- `IsoViewMode`, `CalibrationBehaviors` (from `DTS.Common.Enums`)
- **Prism Framework**: `IPSDReportResultsViewModel` and `IPSDReportSettingsViewModel` depend on `Prism.Commands.DelegateCommand`.
- **WPF**: `IPSDReportMainViewModel` depends on `System.Windows.FrameworkElement`.
#### **External Dependencies**
- **Consumers**: Likely used by a viewer module (e.g., `DTS.Viewer`) that implements these interfaces for concrete views/view models.
- **No direct external libraries beyond Prism and WPF** are referenced in the interfaces themselves.
#### **Depended Upon**
- This modules interfaces are consumed by implementations of the PSD report feature (not visible here), likely in a separate implementation project (e.g., `DTS.Viewer.Reports.PSD`).
---
### 5. **Gotchas**
- **Namespace inconsistency**: `// ReSharper disable CheckNamespace` in `IPSDReportMainView.cs` suggests namespace alignment may be manually enforced or legacy; verify actual usage matches `DTS.Common.Interface`.
- **Missing implementation details**:
- `IPSDReportMainViewModel` has commented-out `bool Standalone { get; set; }` — behavior may be partially implemented or deprecated.
- `IPSDReportSettingsModel` exposes `ReadData`, `DataStart`, `DataEnd` but no clear validation (e.g., `DataStart < DataEnd`) is enforced in the interface.
- **Ambiguous `CanPublishChanges`**: Its purpose is unclear—likely used to gate `PublishChanges()` calls, but no contract or event is defined for when it changes.
- **No explicit error handling**: Interfaces do not define error states or validation failure mechanisms (e.g., invalid filter frequencies).
- **`GetRegions()` returns `List<FrameworkElement>`**: Assumes WPF-specific region management; may not be portable to other UI frameworks.
- **No versioning or extensibility markers**: Interfaces are sealed contracts; changes risk breaking downstream implementations.
*None identified beyond the above.*