--- source_files: - Common/DTS.Common/Classes/DTS.Viewer/Reports/ChannelGRMSSummary.cs generated_at: "2026-04-16T03:19:18.243942+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "8f994977a8bca5be" --- # Reports ### **1. Purpose** The `ChannelGRMSSummary` class serves as a data model for representing summary statistics of a single channel in a GRMS (G-RMS, or root-mean-square acceleration) analysis report. It encapsulates the channel’s name, its sampling rate, and the computed GRMS value, while implementing `INotifyPropertyChanged` to support data binding in UI frameworks (e.g., WPF). This class enables consistent, observable reporting of GRMS metrics across the DTS Viewer application. --- ### **2. Public Interface** - **`ChannelName`** (`string`, read-write property) Gets or sets the human-readable name of the channel (e.g., `"Ch1-Accel"`). Used for identification in reports. - **`SampleRate`** (`int`, read-write property) Gets or sets the sample rate (in Hz) used to acquire or process the channel data. Must be a non-negative integer (enforced by caller; not validated internally). - **`GRMS`** (`double`, read-write property) Gets or sets the computed root-mean-square acceleration value (typically in *g* units) for the channel over a specified time interval. - **`PropertyChanged`** (`event PropertyChangedEventHandler`) Event fired when a property value changes. Raised by `OnPropertyChanged`. - **`OnPropertyChanged(string propertyName)`** (`void` method) Invokes the `PropertyChanged` event for the specified property name. Used to notify bound UI elements of updates. **Note:** Does *not* validate that `propertyName` corresponds to an actual property; caller must ensure correctness. --- ### **3. Invariants** - **No internal validation**: The class does not enforce constraints on `SampleRate` (e.g., positivity) or `GRMS` (e.g., non-negativity). Invalid values may be assigned silently. - **Property names must match exactly**: `OnPropertyChanged` relies on the caller passing the *exact* property name (e.g., `"GRMS"`, not `"grms"` or `"G rms"`); mismatches will cause silent UI update failures. - **Thread-safety**: The class provides no explicit thread-safety guarantees. `PropertyChanged` invocation is not atomic and may throw if subscribers are removed mid-invocation (though `?.` mitigates null reference exceptions). --- ### **4. Dependencies** - **Depends on**: - `System.ComponentModel` (for `INotifyPropertyChanged` via `PropertyChangedEventHandler` and `PropertyChangedEventArgs`) - `DTS.Common.Interface` (for the `IChannelGRMSSummary` interface—implementation of which this class satisfies) - **Implements**: - `IChannelGRMSSummary` (interface defined in `DTS.Common.Interface`; exact contract not visible in this file but assumed to declare `ChannelName`, `SampleRate`, `GRMS`, and `PropertyChanged`/`OnPropertyChanged` members) - **Used by**: - Presumably UI components (e.g., WPF `DataGrid`, `ListView`) bound to GRMS summary reports. - Report generation or data aggregation logic that populates/updates channel summaries (e.g., a class computing GRMS from time-series data). --- ### **5. Gotchas** - **No null-check on `propertyName` in `OnPropertyChanged`**: Passing `null` will cause `PropertyChanged?.Invoke(...)` to throw a `NullReferenceException` (since `new PropertyChangedEventArgs(null)` is valid, but the event handler may not expect it). - **No validation on numeric properties**: `SampleRate` could be negative or zero; `GRMS` could be negative or `NaN`. Callers must ensure values are physically meaningful. - **Interface implementation is implicit**: The class does not explicitly declare `IChannelGRMSSummary` in its definition (e.g., `: IChannelGRMSSummary`), but the source comment implies it implements the interface. Verify the interface definition in `DTS.Common.Interface` for exact contract requirements (e.g., read-only vs. read-write properties). - **No documentation of units**: While `GRMS` is assumed to be in *g*, and `SampleRate` in Hz, the source provides no explicit unit annotations—rely on external documentation or conventions. *None identified beyond the above.*