pub struct MonitoredRegion {
pub name: String,
pub range: Range<usize>,
pub on_threshold: u64,
pub off_threshold: u64,
pub weight: u8,
}Expand description
A region being monitored for activity with hysteresis thresholds.
§Hysteresis
Two thresholds control state transitions to prevent chattering:
on_threshold: Energy must exceed this to become activeoff_threshold: Energy must drop below this to become quiet
When energy is between the thresholds, the previous state is maintained.
§Energy Units
Energy is sum of squared magnitudes: Σ(magnitude²) For 64 dims with all magnitudes at 128: 64 × 128² = 1,048,576 For 64 dims with all magnitudes at 255: 64 × 255² = 4,161,600
Fields§
§name: StringName for identification
range: Range<usize>Dimension range
on_threshold: u64Energy threshold to enter active state (higher threshold) Energy = sum of squared effective magnitudes (p×m×k)
off_threshold: u64Energy threshold to leave active state (lower threshold)
weight: u8Weight for convergence calculation (100 = 1.0×)
Implementations§
Source§impl MonitoredRegion
impl MonitoredRegion
Sourcepub fn new(name: impl Into<String>, range: Range<usize>, threshold: u64) -> Self
pub fn new(name: impl Into<String>, range: Range<usize>, threshold: u64) -> Self
Create a new monitored region with automatic hysteresis.
The off_threshold is set to 80% of the on_threshold by default, providing a 20% hysteresis gap to prevent chattering.
threshold: Energy threshold (sum of squared magnitudes)
Sourcepub fn with_hysteresis(
name: impl Into<String>,
range: Range<usize>,
on_threshold: u64,
off_threshold: u64,
) -> Self
pub fn with_hysteresis( name: impl Into<String>, range: Range<usize>, on_threshold: u64, off_threshold: u64, ) -> Self
Sourcepub fn with_gap(self, gap: u8) -> Self
pub fn with_gap(self, gap: u8) -> Self
Set the hysteresis gap as percentage (0-100).
off_threshold = on_threshold * (100 - gap) / 100
Sourcepub fn with_weight(self, weight: u8) -> Self
pub fn with_weight(self, weight: u8) -> Self
Set weight (100 = 1.0×, 150 = 1.5×)
Sourcepub fn hysteresis_gap(&self) -> u8
pub fn hysteresis_gap(&self) -> u8
Get the hysteresis gap as percentage.
Trait Implementations§
Source§impl Clone for MonitoredRegion
impl Clone for MonitoredRegion
Source§fn clone(&self) -> MonitoredRegion
fn clone(&self) -> MonitoredRegion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more