Port pke_params, pke_th_rhs, pke_linearize, and all five controllers to Julia. sim_sanity.jl reproduces the MATLAB main.m operation-mode scenario (100%->80% Q_sg step) and matches final state to 3 decimals across n, T_f, T_avg, T_cold, u. reach_operation.jl is a stub: ReachabilityAnalysis.jl (LGG09, GLGM06, BFFPSV18) numerically explodes on the raw stiff system — envelopes of 1e14 K to 1e37 K instead of the known-tight 0.03 K. Almost certainly a state-scaling issue: precursors C_i ~ 1e5, temperatures ~ 300, eigvals span 5000x. Diagonal scaling + retry is planned; left for the next pass since the hand-rolled MATLAB reach already discharges the operation-mode obligation. Project.toml pins OrdinaryDiffEq >= 6.111 (the one that precompiled cleanly on first instantiate). Manifest gitignored. Hacker-Split: Julia path open, reach side needs a scaling pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
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).
|