Dane Sabo d2997c2861 plant-model: add shutdown/heatup/scram controllers and LQR, linearize
Fill out the DRC mode set with ctrl_shutdown (u = -5*beta), ctrl_scram
(u = -8*beta), and ctrl_heatup (feedback-linearizing P on ramped T_avg
reference, saturated u, no integrator). Add ctrl_operation_lqr as a
full-state-feedback counterpart to ctrl_operation — K cached, closed-loop
essentially perfect under the 100%->80% Q_sg step where plain P has ~5F
overshoot.

Add pke_linearize for numerical (A, B, B_w) Jacobians at any operating
point; test_linearize confirms ~4e-4 rel err vs nonlinear sim for a
5% Q_sg step. Extend pke_solver with an optional x0 argument so each
mode can start from a plausible IC.

main_mode_sweep.m exercises all five modes back-to-back and saves the
4-panel plots. CLAUDE.md updated with model-validity-range note (trust
region is ~+/-50C around operating point; true cold shutdown is out of
scope for the linear feedback coefficients).

Hacker-Split: build out control layer end-to-end for reachability.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 12:52:03 -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.