--- source_files: - DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Model/PSDReportSettingsModel.cs generated_at: "2026-04-16T13:39:22.438752+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "b9213b8d6a0e210e" --- # Documentation: PSDReportSettingsModel ## 1. Purpose `PSDReportSettingsModel` is a data model class that encapsulates configuration settings for Power Spectral Density (PSD) report generation. It stores filter parameters (low-pass and high-pass), windowing configuration, and data range settings. The class implements `INotifyPropertyChanged` via `BasePropertyChanged` to support MVVM data binding and notifies a parent view model of changes through the `IPSDReportSettingsModel` interface. --- ## 2. Public Interface ### Properties | Property | Type | Default Value | Description | |----------|------|---------------|-------------| | `Parent` | `IPSDReportSettingsViewModel` | `null` | Reference to the parent view model. Setter includes equality check to avoid redundant assignments. | | `CanPublishChanges` | `bool` | `true` | Controls whether property changes trigger `Parent.PublishChanges()` notification. | | `LowPassFilterEnabled` | `bool` | `false` | Enables/disables low-pass filter. Setting this sets `ReadData = true`. | | `LowPassFilterFrequency` | `double` | `2000` | Low-pass filter cutoff frequency in Hz. | | `LowPassFilterType` | `PassFilterType` | `PassFilterType.Butterworth` | Type of low-pass filter algorithm. | | `LowPassFilterOrder` | `int` | `8` | Order of the low-pass filter. | | `HighPassFilterEnabled` | `bool` | `false` | Enables/disables high-pass filter. | | `HighPassFilterFrequency` | `double` | `5` | High-pass filter cutoff frequency in Hz. | | `HighPassFilterType` | `PassFilterType` | `PassFilterType.Butterworth` | Type of high-pass filter algorithm. | | `HighPassFilterOrder` | `int` | `8` | Order of the high-pass filter. | | `WindowWidth` | `WindowWidth` | `WindowWidth.FortyNinetySix` | Width of the analysis window. | | `WindowType` | `WindowType` | `WindowType.Hanning` | Window function type for spectral analysis. | | `WindowAveragingType` | `WindowAveragingType` | `WindowAveragingType.Averaging` | Averaging method for window processing. | | `WindowOverlappingPercent` | `double` | `50` | Percentage of overlap between consecutive windows. | | `ShowEnvelope` | `bool` | `false` | Controls whether envelope is displayed. | | `IsSaved` | `bool` | *(unclear)* | Read-only property. Initialization/setter not visible in source. | | `ReadData` | `bool` | `false` | Flag indicating data should be re-read. | | `DataStart` | `double` | `0D` | Start position for data range. | | `DataEnd` | `double` | `0D` | End position for data range. | ### Methods | Method | Signature | Description | |--------|-----------|-------------| | `OnPropertyChanged` | `override void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event and conditionally calls `Parent.PublishChanges()` unless the property is `CanPublishChanges`, `Parent`, or `ReadData`. | ### Events | Event | Type | Description | |-------|------|-------------| | `PropertyChanged` | `PropertyChangedEventHandler` | Override of base event; raised when any property value changes. | --- ## 3. Invariants 1. **Change Notification Behavior**: All property changes except `CanPublishChanges`, `Parent`, and `ReadData` will call `Parent?.PublishChanges()` if `CanPublishChanges` is `true`. 2. **ReadData Side Effect**: Setting any of the following properties automatically sets `ReadData = true` before the property value is updated: - `LowPassFilterEnabled`, `LowPassFilterFrequency`, `LowPassFilterType`, `LowPassFilterOrder` - `HighPassFilterEnabled`, `HighPassFilterFrequency`, `HighPassFilterType`, `HighPassFilterOrder` - `WindowWidth`, `WindowType`, `WindowAveragingType`, `WindowOverlappingPercent`, `ShowEnvelope` - `DataStart`, `DataEnd` 3. **Parent Assignment Guard**: The `Parent` setter will not raise `OnPropertyChanged` if `_parent != null && _parent.Equals(value)` is true. 4. **CanPublishChanges Default**: Initialized to `true`, meaning change notifications are published by default. --- ## 4. Dependencies ### This Module Depends On - `DTS.Common.Enums.Viewer.Reports` — Provides `PassFilterType`, `WindowWidth`, `WindowType`, `WindowAveragingType` enums - `DTS.Common.Interface` — Provides `IPSDReportSettingsModel` and `IPSDReportSettingsViewModel` interfaces - `Common.Base.BasePropertyChanged` — Base class providing `SetProperty` method and `INotifyPropertyChanged` infrastructure (namespace not fully qualified in source) ### Consumers - Any module referencing `IPSDReportSettingsModel` (exact consumers not determinable from this source alone) --- ## 5. Gotchas 1. **IsSaved Property Has No Visible Setter**: The `IsSaved` property has only a getter defined with no backing field or initializer visible. Its value source is unclear from this source alone—it may be computed elsewhere or require partial class definition. 2. **Parent Setter Equality Logic**: The condition `if (_parent != null && _parent.Equals(value))` means: - If `_parent` is `null`, the assignment proceeds even if `value` is also `null` - This differs from typical null-coalescing patterns and may result in redundant `OnPropertyChanged` calls when setting `Parent` to `null` multiple times 3. **ReadData Set Before SetProperty**: For filter and window properties, `ReadData = true` is set *before* calling `SetProperty`. This means `ReadData` will be `true` by the time `OnPropertyChanged` fires for the original property, which could affect any listeners checking `ReadData` during change notification. 4. **CanPublishChanges Does Not Set ReadData**: Unlike other boolean flags like `LowPassFilterEnabled`, setting `CanPublishChanges` does not set `ReadData = true`. This is intentional but inconsistent with other property behaviors.