use crate::core::config::DsfbConfig;
#[derive(Debug, Clone, Copy)]
pub struct SensitivityPoint {
pub parameter: &'static str,
pub value: f64,
pub first_boundary: Option<u32>,
pub first_violation: Option<u32>,
}
pub const MAX_SWEEP_POINTS: usize = 11;
#[must_use]
pub fn sweep_values(min: f64, max: f64, count: usize) -> ([f64; MAX_SWEEP_POINTS], usize) {
let n = count.min(MAX_SWEEP_POINTS);
let mut values = [0.0; MAX_SWEEP_POINTS];
if n <= 1 {
values[0] = min;
return (values, 1);
}
let step = (max - min) / (n - 1) as f64;
let mut i = 0;
while i < n {
values[i] = min + step * i as f64;
i += 1;
}
(values, n)
}
#[must_use]
pub fn config_with_healthy_window(base: &DsfbConfig, hw: usize) -> DsfbConfig {
DsfbConfig { healthy_window: hw, ..*base }
}
#[must_use]
pub fn config_with_drift_window(base: &DsfbConfig, dw: usize) -> DsfbConfig {
DsfbConfig { drift_window: dw, ..*base }
}
#[must_use]
pub fn config_with_persistence(base: &DsfbConfig, pt: usize) -> DsfbConfig {
DsfbConfig { persistence_threshold: pt, ..*base }
}
#[must_use]
pub fn config_with_envelope_sigma(base: &DsfbConfig, sigma: f64) -> DsfbConfig {
DsfbConfig { envelope_sigma: sigma, ..*base }
}