pub struct MonitoredRegion {
pub name: String,
pub range: Range<usize>,
pub on_threshold: f32,
pub off_threshold: f32,
pub weight: f32,
}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.
Fields§
§name: StringName for identification
range: Range<usize>Dimension range
on_threshold: f32Energy threshold to enter active state (higher threshold)
off_threshold: f32Energy threshold to leave active state (lower threshold)
weight: f32Weight for convergence calculation
Implementations§
Source§impl MonitoredRegion
impl MonitoredRegion
Sourcepub fn new(name: impl Into<String>, range: Range<usize>, threshold: f32) -> Self
pub fn new(name: impl Into<String>, range: Range<usize>, threshold: f32) -> 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.
Sourcepub fn with_hysteresis(
name: impl Into<String>,
range: Range<usize>,
on_threshold: f32,
off_threshold: f32,
) -> Self
pub fn with_hysteresis( name: impl Into<String>, range: Range<usize>, on_threshold: f32, off_threshold: f32, ) -> Self
Sourcepub fn with_gap(self, gap: f32) -> Self
pub fn with_gap(self, gap: f32) -> Self
Set the hysteresis gap as a fraction (0.0 to 1.0).
off_threshold = on_threshold * (1.0 - gap)
pub fn with_weight(self, weight: f32) -> Self
Sourcepub fn hysteresis_gap(&self) -> f32
pub fn hysteresis_gap(&self) -> f32
Get the hysteresis gap as a fraction.
Trait Implementations§
Source§impl Clone for MonitoredRegion
impl Clone for MonitoredRegion
Source§fn clone(&self) -> MonitoredRegion
fn clone(&self) -> MonitoredRegion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MonitoredRegion
impl RefUnwindSafe for MonitoredRegion
impl Send for MonitoredRegion
impl Sync for MonitoredRegion
impl Unpin for MonitoredRegion
impl UnwindSafe for MonitoredRegion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more