diff --git a/src/reactor_sim/dashboard.py b/src/reactor_sim/dashboard.py index ebed992..461f47b 100644 --- a/src/reactor_sim/dashboard.py +++ b/src/reactor_sim/dashboard.py @@ -96,9 +96,9 @@ class ReactorDashboard: elif ch in (ord("t"), ord("T")): self._queue_command(ReactorCommand(turbine_on=not self.reactor.turbine_active)) elif ch in (ord("+"), ord("=")): - self._queue_command(ReactorCommand(rod_step=-0.02)) + self._queue_command(ReactorCommand(rod_position=self._clamped_rod(-0.05))) elif ch == ord("-"): - self._queue_command(ReactorCommand(rod_step=0.02)) + self._queue_command(ReactorCommand(rod_position=self._clamped_rod(0.05))) elif ch == ord("["): demand = self._current_demand() - 50.0 self._queue_command(ReactorCommand(consumer_demand=max(0.0, demand))) @@ -292,3 +292,7 @@ class ReactorDashboard: if self.reactor.consumer: return self.reactor.consumer.demand_mw return 0.0 + + def _clamped_rod(self, delta: float) -> float: + new_fraction = self.reactor.control.rod_fraction + delta + return max(0.0, min(0.95, new_fraction))