diff --git a/.gitignore b/.gitignore index 2ef488f..a2a24a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .venv/ **/__pycache__/ *.egg-info/ +artifacts/ diff --git a/artifacts/last_state.json b/artifacts/last_state.json deleted file mode 100644 index ab97f0b..0000000 --- a/artifacts/last_state.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "control": { - "setpoint_mw": 3000.0, - "rod_fraction": 0.3872181667930225 - }, - "plant": { - "core": { - "fuel_temperature": 633.2342060602825, - "neutron_flux": 31335131.43776027, - "reactivity_margin": 0.006241667151538859, - "power_output_mw": 2976.900110634399, - "burnup": 0.004945521266135161 - }, - "primary_loop": { - "temperature_in": 295.0, - "temperature_out": 338.7522062115579, - "pressure": 14.0, - "mass_flow_rate": 16200.0, - "steam_quality": 0.0 - }, - "secondary_loop": { - "temperature_in": 295.0, - "temperature_out": 360.05377003828596, - "pressure": 6.650537700382859, - "mass_flow_rate": 10880.0, - "steam_quality": 0.6505377003828593 - }, - "turbines": [ - { - "steam_enthalpy": 3090.3226202297155, - "shaft_power_mw": 336.9056685758782, - "electrical_output_mw": 323.4294418328431, - "condenser_temperature": 305.0, - "load_demand_mw": 0.0, - "load_supplied_mw": 0.0 - }, - { - "steam_enthalpy": 3090.3226202297155, - "shaft_power_mw": 336.9056685758782, - "electrical_output_mw": 323.4294418328431, - "condenser_temperature": 305.0, - "load_demand_mw": 0.0, - "load_supplied_mw": 0.0 - }, - { - "steam_enthalpy": 3090.3226202297155, - "shaft_power_mw": 336.9056685758782, - "electrical_output_mw": 323.4294418328431, - "condenser_temperature": 305.0, - "load_demand_mw": 0.0, - "load_supplied_mw": 0.0 - } - ], - "time_elapsed": 600.0 - }, - "metadata": { - "primary_pump_active": true, - "secondary_pump_active": true, - "turbine_active": true, - "turbine_units": [ - true, - true, - true - ], - "shutdown": false, - "consumer": { - "online": false, - "demand_mw": 800.0, - "name": "Grid" - } - }, - "health": { - "core": { - "name": "core", - "integrity": 0.9400000000000066, - "failed": false - }, - "primary_pump": { - "name": "primary_pump", - "integrity": 0.5800000000000063, - "failed": false - }, - "secondary_pump": { - "name": "secondary_pump", - "integrity": 0.1120000000000021, - "failed": false - }, - "turbine_1": { - "name": "turbine_1", - "integrity": 0.610000000000003, - "failed": false - }, - "turbine_2": { - "name": "turbine_2", - "integrity": 0.610000000000003, - "failed": false - }, - "turbine_3": { - "name": "turbine_3", - "integrity": 0.610000000000003, - "failed": false - } - } -} \ No newline at end of file diff --git a/src/reactor_sim/dashboard.py b/src/reactor_sim/dashboard.py index 040a896..4b87e9b 100644 --- a/src/reactor_sim/dashboard.py +++ b/src/reactor_sim/dashboard.py @@ -94,6 +94,9 @@ class ReactorDashboard: self._draw(stdscr, state) self._handle_input(stdscr) if self.quit_requested or self.reset_requested: + # Persist the latest state if we are exiting early. + if self.sim: + self.sim.last_state = state self.sim.stop() break finally: