Folds three previously-separate pieces into one preliminary-example repo for the HAHACS thesis: - thesis/ (submodule) → gitea Thesis.git — the PhD proposal - fret-pipeline/ — FRET requirements to AIGER controller (was ~/Documents/fret_processing/; prior single-commit history abandoned per user decision) - plant-model/ — 10-state PKE + lumped T/H PWR model (was ~/Documents/PKE_Playground/; never version-controlled before) - presentations/2026DICE/ (submodule) → gitea 2026DICE.git - reachability/, hardware/ — empty placeholders for Thrust 3 and HIL - docs/architecture.md — how the discrete and continuous layers compose - claude_memory/ — session notes and scratch knowledge pattern Plant model refactored to thesis naming (x, plant, u, ref); pke_th_rhs now takes u as an explicit arg instead of reading rho_ext from the params struct. First two controllers built to the contract u = ctrl_<mode>(t, x, plant, ref): ctrl_null (baseline) and ctrl_operation (stabilizing, proportional on T_avg). Validated under a 100% -> 80% Q_sg step: ctrl_operation reduces steady-state T_avg drift ~47% vs. the unforced plant. Root CLAUDE.md emphasizes that CLAUDE.md files are living documents and that any knowledge not captured before a session ends is lost forever; claude_memory/ holds the session-level notes that haven't stabilized enough to graduate into a CLAUDE.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
Matlab
50 lines
1.7 KiB
Matlab
function dxdt = pke_th_rhs(t, x, plant, Q_sg, u)
|
|
% PKE_TH_RHS ODE right-hand side for coupled PKE + thermal-hydraulics.
|
|
%
|
|
% State x = [n; C1..C6; T_f; T_c; T_cold] (10 x 1)
|
|
%
|
|
% Inputs:
|
|
% t - time [s]
|
|
% x - continuous state vector (10 x 1)
|
|
% plant - parameter struct from pke_params()
|
|
% Q_sg - function handle Q_sg(t) returning SG heat removal [W]
|
|
% u - external reactivity (rod worth) [dk/k], scalar
|
|
%
|
|
% The controller is responsible for computing u; this function treats u
|
|
% as a given input. Q_sg is the bounded disturbance.
|
|
|
|
n = x(1);
|
|
C = x(2:7);
|
|
T_f = x(8);
|
|
T_c = x(9);
|
|
T_cold = x(10);
|
|
T_hot = 2 * T_c - T_cold;
|
|
|
|
Q_sg_val = Q_sg(t);
|
|
|
|
% --- Reactivity with feedback ---
|
|
% rho = u + alpha_f*(T_f - T_f0) + alpha_c*(T_c - T_c0)
|
|
rho = u ...
|
|
+ plant.alpha_f * (T_f - plant.T_f0) ...
|
|
+ plant.alpha_c * (T_c - plant.T_c0);
|
|
|
|
% --- Neutronics ---
|
|
dndt = (rho - plant.beta) / plant.Lambda * n + plant.lambda_i' * C;
|
|
dCdt = (plant.beta_i / plant.Lambda) * n - plant.lambda_i .* C;
|
|
|
|
% --- Thermal-hydraulics ---
|
|
% Fuel node: fission power in, heat transfer to coolant out
|
|
dTf_dt = (plant.P0 * n - plant.hA * (T_f - T_c)) / (plant.M_f * plant.c_f);
|
|
|
|
% Core coolant: heat from fuel in, bulk enthalpy flow out
|
|
dTc_dt = (plant.hA * (T_f - T_c) - 2*plant.W*plant.c_c*(T_c - T_cold)) ...
|
|
/ (plant.M_c * plant.c_c);
|
|
|
|
% SG/loop node: hot leg enthalpy in, SG heat removal out
|
|
dTcold_dt = (plant.W * plant.c_c * (T_hot - T_cold) - Q_sg_val) ...
|
|
/ (plant.M_sg * plant.c_c);
|
|
|
|
dxdt = [dndt; dCdt; dTf_dt; dTc_dt; dTcold_dt];
|
|
|
|
end
|