Group dashboard controls and show turbine control mode
This commit is contained in:
@@ -47,30 +47,45 @@ class ReactorDashboard:
|
|||||||
self._log_handler: Optional[logging.Handler] = None
|
self._log_handler: Optional[logging.Handler] = None
|
||||||
self._previous_handlers: list[logging.Handler] = []
|
self._previous_handlers: list[logging.Handler] = []
|
||||||
self._logger = logging.getLogger("reactor_sim")
|
self._logger = logging.getLogger("reactor_sim")
|
||||||
self.keys = [
|
self.help_sections: list[tuple[str, list[DashboardKey]]] = [
|
||||||
|
(
|
||||||
|
"Reactor / Safety",
|
||||||
|
[
|
||||||
DashboardKey("q", "Quit & save"),
|
DashboardKey("q", "Quit & save"),
|
||||||
DashboardKey("space", "SCRAM"),
|
DashboardKey("space", "SCRAM"),
|
||||||
DashboardKey("g", "Toggle primary pump 1"),
|
DashboardKey("r", "Reset & clear state"),
|
||||||
DashboardKey("h", "Toggle primary pump 2"),
|
DashboardKey("a", "Toggle auto rod control"),
|
||||||
DashboardKey("j", "Toggle secondary pump 1"),
|
DashboardKey("+/-", "Withdraw/insert rods"),
|
||||||
DashboardKey("k", "Toggle secondary pump 2"),
|
DashboardKey("[/]", "Adjust consumer demand −/+50 MW"),
|
||||||
DashboardKey("b", "Toggle generator 1"),
|
DashboardKey("s/d", "Setpoint −/+250 MW"),
|
||||||
DashboardKey("v", "Toggle generator 2"),
|
],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Pumps",
|
||||||
|
[
|
||||||
|
DashboardKey("g/h", "Toggle primary pump 1/2"),
|
||||||
|
DashboardKey("j/k", "Toggle secondary pump 1/2"),
|
||||||
|
DashboardKey("m/n", "Maintain primary pumps 1/2"),
|
||||||
|
DashboardKey(",/.", "Maintain secondary pumps 1/2"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Generators",
|
||||||
|
[
|
||||||
|
DashboardKey("b/v", "Toggle generator 1/2"),
|
||||||
DashboardKey("x", "Toggle generator auto"),
|
DashboardKey("x", "Toggle generator auto"),
|
||||||
DashboardKey("t", "Toggle turbine"),
|
DashboardKey("B/V", "Maintain generator 1/2"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Turbines / Grid",
|
||||||
|
[
|
||||||
|
DashboardKey("t", "Toggle turbine bank"),
|
||||||
DashboardKey("1/2/3", "Toggle turbine units 1-3"),
|
DashboardKey("1/2/3", "Toggle turbine units 1-3"),
|
||||||
DashboardKey("y/u/i", "Maintain turbine 1/2/3"),
|
DashboardKey("y/u/i", "Maintain turbine 1/2/3"),
|
||||||
DashboardKey("c", "Toggle consumer"),
|
DashboardKey("c", "Toggle consumer"),
|
||||||
DashboardKey("r", "Reset & clear state"),
|
],
|
||||||
DashboardKey("m/n", "Maintain primary pumps 1/2"),
|
),
|
||||||
DashboardKey(",/.", "Maintain secondary pumps 1/2"),
|
|
||||||
DashboardKey("B/V", "Maintain generator 1/2"),
|
|
||||||
DashboardKey("k", "Maintain core (requires shutdown)"),
|
|
||||||
DashboardKey("+/-", "Withdraw/insert rods"),
|
|
||||||
DashboardKey("[/]", "Adjust consumer demand −/+50 MW"),
|
|
||||||
DashboardKey("s", "Setpoint −250 MW"),
|
|
||||||
DashboardKey("d", "Setpoint +250 MW"),
|
|
||||||
DashboardKey("a", "Toggle auto rod control"),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
@@ -379,6 +394,7 @@ class ReactorDashboard:
|
|||||||
"Turbine / Grid",
|
"Turbine / Grid",
|
||||||
[
|
[
|
||||||
("Turbines", " ".join(self._turbine_status_lines())),
|
("Turbines", " ".join(self._turbine_status_lines())),
|
||||||
|
("Turbine Ctrl", "MANUAL"),
|
||||||
("Unit1 Elec", f"{state.turbines[0].electrical_output_mw:7.1f} MW" if state.turbines else "n/a"),
|
("Unit1 Elec", f"{state.turbines[0].electrical_output_mw:7.1f} MW" if state.turbines else "n/a"),
|
||||||
(
|
(
|
||||||
"Unit2 Elec",
|
"Unit2 Elec",
|
||||||
@@ -403,10 +419,14 @@ class ReactorDashboard:
|
|||||||
win.box()
|
win.box()
|
||||||
win.addstr(0, 2, " Controls ", curses.color_pair(1) | curses.A_BOLD)
|
win.addstr(0, 2, " Controls ", curses.color_pair(1) | curses.A_BOLD)
|
||||||
y = 2
|
y = 2
|
||||||
for entry in self.keys:
|
for title, entries in self.help_sections:
|
||||||
win.addstr(y, 2, f"{entry.key:<8} {entry.description}")
|
win.addstr(y, 2, title, curses.color_pair(1) | curses.A_BOLD)
|
||||||
y += 1
|
y += 1
|
||||||
win.addstr(y + 1, 2, "Tips:", curses.color_pair(2) | curses.A_BOLD)
|
for entry in entries:
|
||||||
|
win.addstr(y, 4, f"{entry.key:<8} {entry.description}")
|
||||||
|
y += 1
|
||||||
|
y += 1
|
||||||
|
win.addstr(y, 2, "Tips:", curses.color_pair(2) | curses.A_BOLD)
|
||||||
tips = [
|
tips = [
|
||||||
"Start pumps before withdrawing rods.",
|
"Start pumps before withdrawing rods.",
|
||||||
"Bring turbine and consumer online after thermal stabilization.",
|
"Bring turbine and consumer online after thermal stabilization.",
|
||||||
|
|||||||
Reference in New Issue
Block a user