Dane Sabo 1eab154847 SOS + polytopic barrier exploration — first degree-4 barrier found
Polytopic (Nagumo face-by-face LP check) and SOS polynomial
(Prajna-Jadbabaie w/ CSDP) barrier attempts on operation mode.

**Polytopic (barrier_polytopic.jl):** the naive check on
inv2_holds ∩ precursor_tube_bounds fails — 16 of 18 faces can be
crossed under A_cl. This is EXPECTED: safety halfspaces alone form
a set too big for LQR to contract from everywhere.  The correct
approach is Blanchini's pre-image iteration (max robustly controllable
invariant set). Sketched in the script; 2-3 days to implement properly.

**SOS (barrier_sos_2d.jl):** a working proof of concept.

CSDP returns OPTIMAL on a 2-state projection of the operation mode
(dn, dT_c) with:
  X_entry  = |dn| ≤ 0.01, |dT_c| ≤ 0.1
  X_unsafe = dn ≥ 0.15 (high-flux-trip direction)
  Dynamics = reduced 2×2 A_cl after LQR.
  No disturbance (B_w projects to 0 in this subset).
  Global decrease condition (-(∇B·f) SOS) instead of Putinar ∂{B=0}.

Result: a degree-4 polynomial B(x) satisfying all three barrier
conditions.  Coefficients printed.  First non-quadratic barrier
artifact for this plant.

Caveats:
  - 2D projection loses precursor coupling.
  - Disturbance ignored in this projection.
  - Global-decrease is stronger than the Putinar ∂{B=0} condition;
    the latter requires bilinear σ_b·B formulation (BMI) and
    iterative solvers. Deferred.
  - Scaling to 10-state degree-4 gives SDP ~ 1000×1000; CSDP may
    choke. Mosek or MOSEK-free SDP (SCS) might handle.

JuMP, HiGHS, SumOfSquares, DynamicPolynomials, CSDP all added to
Project.toml.

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