Dane Sabo fbbaebff9f julia migration: port MATLAB to Julia, delete MATLAB, rename julia-port -> code
Full toolchain port. Numerical equivalence verified against MATLAB:
- main_mode_sweep.jl: every mode's final state matches MATLAB to 3-4 dp
- reach_operation.jl: per-halfspace margins match MATLAB exactly
- barrier_lyapunov.jl: per-halfspace bounds match (best Qbar from sweep
  yields max|dT_c| = 33.228 K either side)
- barrier_compare_OL_CL.jl: OL gamma 1.038e13, CL gamma 1.848e4
  matching the MATLAB result; LQR helps by ~20,000x on every halfspace.

Phase summary:
  Phase 1: pke_solver.jl, plot_pke_results.jl (Plots.jl), main_mode_sweep.jl
  Phase 2: reach_linear.jl, reach_operation.jl, barrier_lyapunov.jl,
           barrier_compare_OL_CL.jl, load_predicates.jl
  Phase 3 (this commit): delete plant-model/ entirely, delete reach
           code from reachability/ keeping predicates.json + docs,
           git mv julia-port/ -> code/, update root README + CLAUDE,
           write code/CLAUDE.md and code/README.md, update reach
           README + WALKTHROUGH file paths, journal preamble note
           that pre-port entries reference MATLAB paths.

Why now: prompt-neutron stiffness in nonlinear reach made it clear we
need TMJets, which is Julia. Already had the Julia plant model
working and matching MATLAB. Two languages = two sources of truth =
two places to drift. One language, one truth.

Manifest.toml gitignored. .mat results gitignored.

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

code

Plant model, controllers, and reach-analysis toolchain for the HAHACS preliminary example. All Julia.

What this is

A 10-state coupled neutronics + thermal-hydraulics model (point kinetic equations + lumped thermal loop) with continuous-mode controllers for each of the DRC modes (shutdown, heatup, operation, scram), plus a hand-rolled linear reach-tube propagator, a Lyapunov-ellipsoid barrier attempt, and scaffolding for TMJets-based nonlinear reach.

Ported from MATLAB on 2026-04-20 once the reach experiments made it clear that Julia's stack (OrdinaryDiffEq, MatrixEquations, ReachabilityAnalysis, LazySets, @taylorize) was the right tool for everything we need going forward. The MATLAB originals are in the git history.

Running

First time:

cd code
julia --project=. -e 'using Pkg; Pkg.instantiate()'

Subsequent:

julia --project=. scripts/main_mode_sweep.jl          # all 5 DRC modes, figures
julia --project=. scripts/reach_operation.jl          # operation-mode linear reach
julia --project=. scripts/barrier_lyapunov.jl         # Lyapunov barrier attempt
julia --project=. scripts/barrier_compare_OL_CL.jl    # OL vs CL barrier
julia --project=. scripts/reach_heatup_nonlinear.jl   # nonlinear heatup (10s cap)

Figures save to ../docs/figures/. Reach results save to ../reachability/*.mat (gitignored).

Structure

See CLAUDE.md for the architectural overview and ../journal/ for the invention-log-style narrative of how this code got written.

Dependencies

From Project.toml:

  • OrdinaryDiffEq — ODE solver, Rodas5 for stiff systems.
  • MatrixEquationsarec for LQR Riccati, lyapc for Lyapunov.
  • ReachabilityAnalysis + LazySets — reach sets and set operations.
  • Plots — figures (GR backend by default).
  • JSON — read ../reachability/predicates.json.
  • MAT — save results.

Manifest.toml is gitignored; regenerate locally on first Pkg.instantiate().