Dane Sabo a56fcbedc2 julia: nonlinear heatup reach — 10s horizon works, longer fails on stiffness
First working nonlinear reach artifact for the PWR model. TMJets
Taylor-model scheme on the full 10-state closed-loop (unsaturated
ctrl_heatup, ramp reference via augmented time state x[11]).

Status:
  T=10s    : SUCCESS. 10583 reach-sets. T_c envelope [274.45, 295] C,
             n envelope [-5.2e-4, 5.01e-3]. Over-approximation visible
             (n can't be negative physically) but tube is sound and
             bounded.
  T=60s+   : FAILED. Exhausts 50k step budget then hits NaN in
             precursor-decay term.

Root cause: prompt-neutron stiffness. Lambda=1e-4s forces TMJets'
adaptive stepper to ~1ms steps to resolve fast dynamics. 10583 steps
for 10s of sim time means we get ~10s/50000 = 2s horizon max before
step budget exhausts — inadequate for heatup's 5-hour obligation.

Remedy (next session): singular-perturbation reduction of the
neutronics. Treat n as quasi-static algebraic function of (T, C, rho)
rather than a dynamic state. Replaces stiff dn/dt with algebraic
relation, removes fast timescale from reach problem. Standard in
reactor-kinetics reach literature.

What this does prove:
  - Julia/TMJets framework works for this system (previous
    scaling-issue failure is gone with @taylorize'd RHS).
  - Bilinear n*rho term handled correctly by Taylor models.
  - Ramp reference via augmented time state x[11] is a workable
    pattern for time-varying controller references in reach.

What this does NOT prove:
  - Anything about heatup safety — 10s horizon is nowhere near the
    mode's 5-hour obligation.

Includes sim_heatup.jl, a Rodas5 baseline using the same @taylorize-
able RHS form, for cross-validation of the reach tube against a
nominal trajectory once longer horizons are reachable.

WALKTHROUGH.md updated with the finding.

Hacker-Split: got partway up the Julia reach ladder, identified the
physical bottleneck (stiffness), named the fix (reduced-order PKE).

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

Julia port

Parallel implementation of the plant model (../plant-model/) in Julia, intended as an eventual landing spot for reachability if we outgrow the MATLAB / hand-rolled tooling.

Status

  • src/pke_params.jl, src/pke_th_rhs.jl, src/pke_linearize.jl — functional, match MATLAB term-for-term.
  • controllers/controllers.jl — all five modes ported (null, shutdown, heatup, operation, scram). LQR factory included via MatrixEquations.jl.
  • scripts/sim_sanity.jl — closed-loop simulation matches MATLAB to 3 decimals on the 100% → 80% Q_sg step. passing.
  • scripts/reach_operation.jl stub. ReachabilityAnalysis.jl algorithms blow up on this stiff, badly-conditioned system. See the file header for diagnosis and planned fix (state rescaling).

When to prefer Julia over MATLAB

Today: nowhere. The sanity path exists so we don't regret the eventual port.

Once the reach scaling is resolved:

  • Nonlinear reach for the P controller in operation mode (CORA / JuliaReach territory where MATLAB's linearization doesn't suffice).
  • Heatup reach with its time-varying reference.
  • Parametric studies where MATLAB license fees / CI friction matter.

Running

cd julia-port
julia --project=. -e 'using Pkg; Pkg.instantiate()'
julia --project=. scripts/sim_sanity.jl

First run will precompile the dependency stack (OrdinaryDiffEq, ReachabilityAnalysis, LazySets — a few minutes).