Add enthalpy tracking and dashboard metrics
This commit is contained in:
@@ -91,7 +91,7 @@ class ReactorDashboard:
|
||||
DashboardKey("r", "Reset & clear state"),
|
||||
DashboardKey("a", "Toggle auto rod control"),
|
||||
DashboardKey("+/-", "Withdraw/insert rods"),
|
||||
DashboardKey("Numpad 1-9", "Set rods to 0.1 … 0.9 (manual)"),
|
||||
DashboardKey("1-9 / Numpad", "Set rods to 0.1 … 0.9 (manual)"),
|
||||
DashboardKey("[/]", "Adjust consumer demand −/+50 MW"),
|
||||
DashboardKey("s/d", "Setpoint −/+250 MW"),
|
||||
DashboardKey("p", "Maintain core (shutdown required)"),
|
||||
@@ -213,12 +213,19 @@ class ReactorDashboard:
|
||||
self._queue_command(ReactorCommand(generator_auto=not self.reactor.generator_auto))
|
||||
elif ch in (ord("t"), ord("T")):
|
||||
self._queue_command(ReactorCommand(turbine_on=not self.reactor.turbine_active))
|
||||
elif keyname and keyname.decode(errors="ignore") in ("!", "@", "#", '"'):
|
||||
name = keyname.decode(errors="ignore")
|
||||
turbine_hotkeys = {"!": 0, "@": 1, "#": 2, '"': 1}
|
||||
self._toggle_turbine_unit(turbine_hotkeys[name])
|
||||
elif ch in (ord("!"), ord("@"), ord("#"), ord('"')):
|
||||
turbine_hotkeys = {ord("!"): 0, ord("@"): 1, ord("#"): 2, ord('"'): 1}
|
||||
self._toggle_turbine_unit(turbine_hotkeys[ch])
|
||||
elif keyname and keyname.startswith(b"KP_") and keyname[-1:] in b"123456789":
|
||||
target = (keyname[-1] - ord("0")) / 10.0 # type: ignore[arg-type]
|
||||
self._queue_command(ReactorCommand(rod_position=target, rod_manual=True))
|
||||
elif ch in (ord("!"), ord("@"), ord("#")):
|
||||
idx = ch - ord("!")
|
||||
self._toggle_turbine_unit(idx)
|
||||
elif ord("1") <= ch <= ord("9"):
|
||||
target = (ch - ord("0")) / 10.0
|
||||
self._queue_command(ReactorCommand(rod_position=target, rod_manual=True))
|
||||
elif ch in _NUMPAD_ROD_KEYS:
|
||||
self._queue_command(ReactorCommand(rod_position=_NUMPAD_ROD_KEYS[ch], rod_manual=True))
|
||||
elif curses.KEY_F1 <= ch <= curses.KEY_F9:
|
||||
@@ -441,6 +448,7 @@ class ReactorDashboard:
|
||||
("Outlet Temp", f"{state.primary_loop.temperature_out:7.1f} K (Target {constants.PRIMARY_OUTLET_TARGET_K:4.0f})"),
|
||||
("Pressure", f"{state.primary_loop.pressure:5.2f}/{constants.MAX_PRESSURE:4.1f} MPa"),
|
||||
("Pressurizer", f"{self.reactor.pressurizer_level*100:6.1f}% @ {constants.PRIMARY_PRESSURIZER_SETPOINT_MPA:4.1f} MPa"),
|
||||
("Loop Energy", f"{state.primary_loop.energy_j/1e6:7.0f} MJ"),
|
||||
("Relief", "OPEN" if self.reactor.primary_relief_open else "CLOSED"),
|
||||
],
|
||||
)
|
||||
@@ -460,6 +468,11 @@ class ReactorDashboard:
|
||||
("Outlet Temp", f"{state.secondary_loop.temperature_out:7.1f} K (Target {constants.SECONDARY_OUTLET_TARGET_K:4.0f})"),
|
||||
("Pressure", f"{state.secondary_loop.pressure:5.2f}/{constants.MAX_PRESSURE:4.1f} MPa"),
|
||||
("Steam Quality", f"{state.secondary_loop.steam_quality:5.2f}/1.00"),
|
||||
("Drum Energy", f"{state.secondary_loop.energy_j/1e6:7.0f} MJ"),
|
||||
(
|
||||
"Spec Enthalpy",
|
||||
f"{(state.secondary_loop.energy_j / max(1e-6, state.secondary_loop.inventory_kg))/1e3:7.0f} kJ/kg",
|
||||
),
|
||||
("Relief", "OPEN" if self.reactor.secondary_relief_open else "CLOSED"),
|
||||
],
|
||||
)
|
||||
@@ -492,10 +505,8 @@ class ReactorDashboard:
|
||||
("Load", f"{self._total_load_supplied(state):7.1f}/{self._total_load_demand(state):7.1f} MW"),
|
||||
("Consumer", f"{consumer_status}"),
|
||||
("Demand", f"{consumer_demand:7.1f} MW"),
|
||||
(
|
||||
"Steam",
|
||||
f"P={state.secondary_loop.pressure:4.2f} MPa q={state.secondary_loop.steam_quality:4.2f} mdot={state.secondary_loop.mass_flow_rate:6.0f} kg/s",
|
||||
),
|
||||
("Steam Enthalpy", f"{state.turbines[0].steam_enthalpy:7.0f} kJ/kg" if state.turbines else "n/a"),
|
||||
("Steam Flow", f"{state.secondary_loop.mass_flow_rate * max(0.0, state.secondary_loop.steam_quality):7.0f} kg/s"),
|
||||
],
|
||||
)
|
||||
right_y = self._draw_section(right_win, right_y, "Generators", self._generator_lines(state))
|
||||
|
||||
Reference in New Issue
Block a user