diff --git a/crates/mind-body/src/tempo/sim.rs b/crates/mind-body/src/tempo/sim.rs index 5e0a8ed..000cd2a 100644 --- a/crates/mind-body/src/tempo/sim.rs +++ b/crates/mind-body/src/tempo/sim.rs @@ -136,10 +136,11 @@ fn run(scenario: &Scenario, sensor: Sensor, gains: &Gains, seed: u64) -> Outcome window += 1; } let in_window = (now - (resets - WINDOW_MS)) as f64 / HOUR_MS; - if let Some((from, to, amount)) = scenario.burst { - if in_window >= from && in_window < to { - used += amount * STEP_MS as f64 / HOUR_MS / (to - from); - } + if let Some((from, to, amount)) = scenario.burst + && in_window >= from + && in_window < to + { + used += amount * STEP_MS as f64 / HOUR_MS / (to - from); } let gap = scenario.gap.is_some_and(|(from, to)| in_window >= from && in_window < to); if sensor == Sensor::Poll && !gap && (now - W0) % POLL_MS == 0 { diff --git a/crates/mind-body/tests/public_surface.txt b/crates/mind-body/tests/public_surface.txt index 02f8d4d..26435a4 100644 --- a/crates/mind-body/tests/public_surface.txt +++ b/crates/mind-body/tests/public_surface.txt @@ -263,9 +263,16 @@ mind_body::self_run::inbox: fn render (briefs : & [Brief] , plan : & str) -> Str mind_body::self_run::inbox: fn resolving_sentence (id : & str) -> String mind_body::self_run::inbox: struct Brief # [derive (Clone , Debug , PartialEq , Eq)] pub-fields[id: String, campaign: String, repo: String, item: String, ordinal: u64] mind_body::tempo: const DEFAULT_BEAT_S : u32 +mind_body::tempo: const FALLBACK_MAX_S : u32 +mind_body::tempo: const FALLBACK_MIN_S : u32 +mind_body::tempo: const GAINS : Gains mind_body::tempo: const LOG_BOUND_ORDERS : f64 +mind_body::tempo: fn fallback_beat (state : & mut Fallback , reading : Option < & Reading > , now_ms : i64 , target_permille : u32 , voted : bool ,) -> u32 mind_body::tempo: fn pick (rows : & [Standing] , beat_s : u32) -> Option < usize > mind_body::tempo: fn score (standing : & Standing , beat_s : u32) -> f64 mind_body::tempo: fn tally (votes : & [Option < u32 >]) -> u32 mind_body::tempo: fn urgency_permille (standing : & Standing) -> u16 +mind_body::tempo: struct Fallback # [derive (Clone , Debug , Default , PartialEq)] pub-fields[integral: f64, last_used_permille: u32, last_observed_at_ms: i64, last_now_ms: i64, window_resets_at_ms: i64, rate_per_h: f64] +mind_body::tempo: struct Gains # [derive (Clone , Copy , Debug , PartialEq)] pub-fields[kp: f64, ki: f64, kd: f64] +mind_body::tempo: struct Reading # [derive (Clone , Copy , Debug , PartialEq , Eq)] pub-fields[used_permille: u32, observed_at_ms: i64, resets_at_ms: i64] mind_body::tempo: struct Standing # [derive (Clone , Debug , PartialEq , Eq)] pub-fields[slug: String, eligible: bool, waited_s: Option < u64 >, last_turn_ms: Option < i64 >, self_permille: u16, topic_permille: u16, addressed_by_member: bool]