"""Named Mock scenarios. SIMULATION ONLY NOT IDENTIFIED FROM REAL HARDWARE NOT A PHYSICAL VALIDATION MODEL """ from __future__ import annotations from dataclasses import dataclass SCENARIO_NAMES = ( "normal", "coupled_4chamber", "sensor_invalid", "sensor_stale", "startup_delay", "disconnect_recover", "safe_mode", "actuator_clamp", "slow_consumer", ) @dataclass(frozen=True) class ScenarioSpec: name: str coupling: float = 0.01 invalid_channels: tuple[int, ...] = () stale: bool = False startup_delay_s: float = 0.0 disconnect_after_s: float = 0.0 recover_after_s: float = 0.0 start_safe: bool = False clamp_heaters: float = 100.0 tick_s: float = 0.05 noise_c: float = 0.0 fresh_horizon_s: float = 3.0 def scenario_spec(name: str) -> ScenarioSpec: key = (name or "normal").strip().lower() if key not in SCENARIO_NAMES: raise ValueError(f"unknown scenario {name!r}; choose one of {SCENARIO_NAMES}") if key == "coupled_4chamber": return ScenarioSpec(name=key, coupling=0.06) if key == "sensor_invalid": return ScenarioSpec(name=key, invalid_channels=(3, 11, 26)) if key == "sensor_stale": return ScenarioSpec(name=key, stale=True, fresh_horizon_s=0.0) if key == "startup_delay": return ScenarioSpec(name=key, startup_delay_s=0.4) if key == "disconnect_recover": return ScenarioSpec(name=key, disconnect_after_s=0.2, recover_after_s=0.5) if key == "safe_mode": return ScenarioSpec(name=key, start_safe=True) if key == "actuator_clamp": return ScenarioSpec(name=key, clamp_heaters=80.0) if key == "slow_consumer": return ScenarioSpec(name=key, tick_s=0.2) return ScenarioSpec(name="normal")