PWR-HYBRID-3/julia-port/controllers/ctrl_heatup_unsat.jl
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

21 lines
730 B
Julia

"""
ctrl_heatup_unsat(t, x, plant, ref)
Heatup controller WITHOUT saturation. Identical to `ctrl_heatup` but the
`clamp()` is removed — u can be anything the feedback-linearization +
ramped-reference P wants.
Used as the starting point for nonlinear reach analysis. The full
`ctrl_heatup` adds saturation on top of this, which turns the controller
into a 3-mode piecewise-affine system and is hybrid-reach territory.
"""
function ctrl_heatup_unsat(t, x, plant, ref)
Kp = 1e-4
T_f = x[8]
T_avg = x[9]
u_ff = -plant.alpha_f * (T_f - plant.T_f0) -
plant.alpha_c * (T_avg - plant.T_c0)
T_ref = min(ref.T_start + ref.ramp_rate * t, ref.T_target)
return u_ff + Kp * (T_ref - T_avg)
end