MaximaLabsOpen app

Real-Time Optimization (RTO)

The steady-state economic layer above the per-tick QP: a linear program (SciPy/HiGHS) over the identified gain matrix picks the MV targets maximizing value minus cost at the plant's active constraint set — the textbook LP-on-top-of-MPC hierarchy, not a GPU/NLP solve.

apcrtooptimization
Concept

The steady-state economic layer sits above DMC's per-tick QP, run far slower. Given the identified steady-state gain matrix, MV/CV bounds, and a linear cost/value vector, it picks the MV move targets that push the plant to its most valuable active constraint set — the textbook LP-on-top-of-MPC hierarchy real DMC3-class controllers use.

The math
Show the governing equations
maxΔumv(cvvaluecvgaincv,mvcostmv)Δumv\max_{\Delta u} \sum_{mv} \Big(\sum_{cv} \text{value}_{cv}\cdot\text{gain}_{cv,mv} - \text{cost}_{mv}\Big)\Delta u_{mv}
s.t.  uloΔuuhi,yloy0+GΔuyhi\text{s.t.}\ \ u_{lo} \le \Delta u \le u_{hi}, \quad y_{lo} \le y_0 + G\Delta u \le y_{hi}
Solved as a linear program via SciPy/HiGHS — deliberately not an NLP or a GPU solve. The identified gain matrix is linear, so an LP is the exact right tool, not an approximation.
Execution

Reuses flowsim.analysis.planning.solve_plan directly rather than a bespoke solver — the same LP machinery a refinery's production-planning module would use.