Dane Sabo e69fd0a6f4 reachability: pin FRET predicates as numerical halfspaces
predicates.json is the single source of truth for concretizing the
FRET-spec predicates (t_avg_above_min, t_avg_in_range, p_above_crit,
inv1_holds, inv2_holds) as polytopes {x : A x <= b}. Until now these
were abstract booleans in the synthesis spec; reach analysis
re-invented ad-hoc thresholds that weren't tied to the spec. Closes
the Thrust-1-meets-Thrust-3 seam.

T_standby now defined as T_c0 - 60 F = 275 C (from user review).
Replaces the earlier simplification where shutdown IC held all temps
at T_cold0. 275 C is inside the model's +/-50 C trust region around
operating point and above coolant saturation at reduced pressure.

load_predicates.m in MATLAB reads the JSON and resolves rhs_expr
strings (which reference plant-derived constants like T_c0, T_cold0,
T_standby) into numeric bounds. Returns per-predicate (A_poly, b_poly)
plus a constants struct.

main_mode_sweep.m now pulls T_standby from predicates and uses it
for shutdown + heatup ICs. Heatup horizon extended to 90 min to
cover the wider 60 F -> operating range at 28 C/hr tech-spec limit.

reach_operation.m reads delta_safe_Tc from the t_avg_in_range
halfspace instead of hardcoding +/-5 K. Current concretization is
+/-2.78 C (~5 F); LQR reach still shows 28x margin.

inv1_holds and inv2_holds are marked PLACEHOLDER in the JSON —
engineering best guesses, not derived from a specific plant's tech
specs or a DNBR correlation. Revisit before thesis defense.

Hacker-Split: single-source concretization for FRET predicates,
end seam with reach.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 15:09:37 -04:00
..

plant-model

PWR plant model (point kinetics + lumped thermal-hydraulics) and mode-specific continuous controllers for the HAHACS preliminary example.

Overview

A 10-state coupled neutronics + thermal-hydraulics model in MATLAB:

  • 6 delayed neutron precursor groups (U-235 thermal fission, Keepin)
  • Lumped fuel, core coolant, and SG/cold-leg thermal nodes
  • Steam generator heat removal Q_sg(t) as the bounded disturbance input
  • Doppler and moderator temperature reactivity feedback
  • External rod reactivity u as the controllable input

State vector: x = [n; C1..C6; T_f; T_c; T_cold] (10 states). See CLAUDE.md for the naming convention.

Quick Start

Open MATLAB in this directory and run:

main

The default scenario runs two simulations of a 100% → 80% SG demand step: once with ctrl_null (plant feedback only) and once with ctrl_operation (proportional rod reactivity on T_avg error), and plots the comparison.

Files

File Role
main.m Entry point — scenario config and run
pke_params.m Plant parameters and steady-state derivation
pke_th_rhs.m Dynamics ẋ = f(t, x, plant, Q_sg, u)
pke_initial_conditions.m Analytic steady-state x0
pke_solver.m Closed-loop driver — takes a controller function handle
plot_pke_results.m 4-panel results plot
load_profile.m SG heat demand shapes
controllers/ctrl_null.m u = 0 baseline
controllers/ctrl_operation.m Stabilizing mode: P on T_avg

Controllers

Controllers share a single signature:

u = ctrl_<mode>(t, x, plant, ref)

Returns scalar u (external rod reactivity in dk/k). The solver swaps controllers via function handle:

[t, X, U] = pke_solver(plant, Q_sg, @ctrl_operation, ref, tspan);

Additional modes (ctrl_heatup, ctrl_scram, ctrl_shutdown) will land in controllers/ following the same signature.

Running Different Scenarios

Swap Q_sg in main.m:

% Step down to 90% at t = 10s
Q_sg = @(t) plant.P0 * (1.0 - 0.1 * (t >= 10));

% Interpolated time series
t_data = [0, 100, 200, 300];
q_data = [1.0, 0.85, 0.9, 1.0] * plant.P0;
Q_sg = @(t) interp1(t_data, q_data, t, 'linear', 'extrap');

Swap the controller:

[t, X, U] = pke_solver(plant, Q_sg, @ctrl_null, [], tspan);

Change the reference (for modes that use one):

ref.T_avg = plant.T_c0 + 5;   % track 5 C above nominal

Requirements

MATLAB (R2020b or newer, tested on R2025b). Uses ode15s from base MATLAB — no toolboxes required.