Optimizing Economic Performance using Model Predictive Control James B. Rawlings Department of Chemical and Biological Engineering Second Workshop on Computational Issues in Nonlinear Control Monterey, California November 7-8, 2011 Rawlings Optimizing Economic Performance 1 / 35
Outline 1 Motivation 2 Solving the optimal control problem 3 Closed-loop properties 4 Conclusions and Future Outlook Rawlings Optimizing Economic Performance 2 / 35
Optimizing economics: Current industrial practice Planning and Scheduling Steady State Optimization Validation Model Update Reconciliation Two layer structure Drawbacks Controller Plant Rawlings Optimizing Economic Performance 3 / 35
Optimizing economics: Current industrial practice Planning and Scheduling Steady State Optimization Validation Controller Plant Model Update Reconciliation Two layer structure Drawbacks Inconsistent models Re-identify linear model as setpoint changes Time scale separation may not hold Economics unavailable in dynamic layer Rawlings Optimizing Economic Performance 3 / 35
Optimizing economics: what s desirable? Profit -4-2 0 Input (u) 2 4-4 -2 0 2 4 State (x) Rawlings Optimizing Economic Performance 4 / 35
Optimizing economics: what s desirable? Profit -4-2 0 Input (u) 2 4-4 -2 0 2 4 State (x) Rawlings Optimizing Economic Performance 4 / 35
Steady-state problem definition Stage cost: l(x, u) = plant profit function Rawlings Optimizing Economic Performance 5 / 35
Steady-state problem definition Stage cost: l(x, u) = plant profit function Optimization: min l(x, u) x,u subject to: x = f (x, u) x X u U Rawlings Optimizing Economic Performance 5 / 35
Steady-state problem definition Stage cost: l(x, u) = plant profit function Optimization: min l(x, u) x,u subject to: x = f (x, u) x X u U Solution: (x s, u s ) Rawlings Optimizing Economic Performance 5 / 35
MPC problem definition dynamic case Cost function: V = N 1 j=0 l(x(j), u(j)) Rawlings Optimizing Economic Performance 6 / 35
MPC problem definition dynamic case Cost function: V = Optimization: subject to: N 1 j=0 min V (u, x(0)) u l(x(j), u(j)) u = {u(0), u(1),... u(n 1)} x + = f (x, u) x X N u U N Rawlings Optimizing Economic Performance 6 / 35
MPC problem definition dynamic case Cost function: V = Optimization: subject to: Stage cost: N 1 j=0 min V (u, x(0)) u l(x(j), u(j)) u = {u(0), u(1),... u(n 1)} x + = f (x, u) x X N u U N std MPC: l(x, u) = x x s 2 Q + u u s 2 R or eco MPC: l(x, u) = l(x, u) Rawlings Optimizing Economic Performance 6 / 35
MPC problem definition dynamic case Cost function: V = Optimization: subject to: Stage cost: N 1 j=0 min V (u, x(0)) u l(x(j), u(j)) u = {u(0), u(1),... u(n 1)} x + = f (x, u) x X N u U N std MPC: l(x, u) = x x s 2 Q + u u s 2 R or eco MPC: l(x, u) = l(x, u) Control law: u 0 (x) = u 0 (0; x) Rawlings Optimizing Economic Performance 6 / 35
What closed-loop behavior is desirable? Fast tracking x(0) Q R (fast tracking) x sp x x s x(0) k Rawlings Optimizing Economic Performance 7 / 35
What closed-loop behavior is desirable? Slow tracking x(0) Q R (slow tracking) x sp x x s x(0) k Rawlings Optimizing Economic Performance 8 / 35
What closed-loop behavior is desirable? Asymmetric tracking x(0) Q R (fast tracking) x sp x x s x(0) k Rawlings Optimizing Economic Performance 9 / 35
Computation: Problem statement For an economic MPC regulation problem, the following are available The economic profit P(x, u) = l(x, u) The nonlinear first principles model ẋ = f (x, u) The state and input constraints g(x, u) 0, u u u Rawlings Optimizing Economic Performance 10 / 35
Computation: Problem statement For an economic MPC regulation problem, the following are available The economic profit P(x, u) = l(x, u) The nonlinear first principles model ẋ = f (x, u) The state and input constraints g(x, u) 0, u u u The dynamic optimization problem is V N (x, u) = N 1 k=0 ẋ = f (x, u) l(x(k), u(k)) + V f (x(n)) x(0) = x g(x(k), u(k)) 0, u u(k) u, k I 0:N 1 Rawlings Optimizing Economic Performance 10 / 35
Sequential and Simultaneous approach Sequential approach ODE integration and sensitivity computation inside the optimization loop: Slow Derivative computation using sensitivities Simultaneous approach Discretization of both state and control profiles DAE / ODE converted into NLP Leads to large-scale NLPs Rawlings Optimizing Economic Performance 11 / 35
Strategy (Biegler, 2007) Rawlings Optimizing Economic Performance 12 / 35
Strategy h i Finite element, i Element boundary (Biegler, 2007) Rawlings Optimizing Economic Performance 12 / 35
Strategy h i Finite element, i Collocation points Element boundary (Biegler, 2007) Rawlings Optimizing Economic Performance 12 / 35
Strategy h i Finite element, i Collocation points Element boundary (Biegler, 2007) Rawlings Optimizing Economic Performance 12 / 35
Strategy h i Finite element, i Collocation points Element boundary (Biegler, 2007) Rawlings Optimizing Economic Performance 12 / 35
Simultaneous approach: Formulation (Biegler, 2007) Divide the control horizon into finite elements. Rawlings Optimizing Economic Performance 13 / 35
Simultaneous approach: Formulation (Biegler, 2007) Divide the control horizon into finite elements. Approximate state and control profiles by a family of polynomials x(t) = x(k 1) + h k u(t) = K i=1 K i=1 Ψ i ( t tk 1 h k ( ) t tk 1 dx Ω i h k dt k,i ) u k,i Rawlings Optimizing Economic Performance 13 / 35
Simultaneous approach: Formulation (Biegler, 2007) Divide the control horizon into finite elements. Approximate state and control profiles by a family of polynomials x(t) = x(k 1) + h k u(t) = K i=1 K i=1 Ψ i ( t tk 1 h k ( ) t tk 1 dx Ω i h k dt k,i ) u k,i x k 1 : State at the beginning of element k h k : Length of the element k u k,i : Control variable in element k at the collocation point i dx/dt k,i : First derivative in element k at the collocation point i Ω i : Polynomial of order K satisfying Ω i (0) = 0 Ω i (ρ r ) = δ i,r for i = 1,, K for i, r = 1,, K Ψ i : Lagrange polynomial of degree K satisfying Ψ i (ρ r ) = δ i,r for i, r = 1,, K Rawlings Optimizing Economic Performance 13 / 35
Simultaneous approach: Properties Orthogonal Collocation: Properties Control variables are discretized at the same level as the state variables Can deal with instabilities Allow direct enforcement of state and control variable constraints, at the same level of discretization as the state variables Rawlings Optimizing Economic Performance 14 / 35
Simultaneous approach: Properties Orthogonal Collocation: Properties Control variables are discretized at the same level as the state variables Can deal with instabilities Allow direct enforcement of state and control variable constraints, at the same level of discretization as the state variables Analysis of the Optimality Conditions An equivalence has been established between the KKT conditions of NLP and the variational necessary conditions Rates of convergence established Rawlings Optimizing Economic Performance 14 / 35
Simultaneous approach: Properties Orthogonal Collocation: Properties Control variables are discretized at the same level as the state variables Can deal with instabilities Allow direct enforcement of state and control variable constraints, at the same level of discretization as the state variables Analysis of the Optimality Conditions An equivalence has been established between the KKT conditions of NLP and the variational necessary conditions Rates of convergence established Simultaneous strategy requires solution of large NLPs Rawlings Optimizing Economic Performance 14 / 35
Software tools Computational Infrastructure for Operations Research (COIN-OR) Object Oriented Code for large scale nonlinear optimization, tailored to structure, sparse linear algebra and computer architecture : IPOPT-3.x Object Oriented Code for for the automatic differentiation of C and C++ programs: ADOL-C High-level interpreted language, for simulations: Octave (www.octave.org) User Interpreted Problem parameters Results GNU Octave Problem definition: DAE s, Objective, Constraints NLMPC tool Compiled IPOPT First and second order derivatives ADOL-C Rawlings Optimizing Economic Performance 15 / 35
Case studies Two examples demonstrating performance benefit of economic MPC Different disturbance scenarios Economics optimizing MPC compared with tracking MPC Performance improvement measure G = P T,eco P T,track TP s Rawlings Optimizing Economic Performance 16 / 35
Example: Evaporation process Steam F100 P100 T100 Separator L2 F4, T3 T201 LT F200 Condenser Condensate F5 Cooling water T200 Differential equations: M dx2 dt C dp2 dt = F 1X 1 F 2X 2 = F 4 F 5 Energy balances Level controller Condensate Evaporator LC Operating cost: Cost of electricity, steam and cooling water Feed F1, X1, T1 F3 F2 Product X2, T2 Economic objective: Minimize operating cost Rawlings Optimizing Economic Performance 17 / 35
d P 100 (kpa) 250 0-1 -2-3 -4-5 -6-7 -8 0 20 40 60 time (min) 80 100 70 60 50 X 2(%) 40 30 400 350 300 200 150 100 0 20 40 60 80 100 time (min) 20 0 20 40 60 80 100 time (min) 16000 12000 cost ($/h) 8000 4000 F 200 (kg/min) 160 50 45 P 2 (kpa) 40 35 0 0 20 40 60 80 100 time (min) 220 200 180 140 120 100 0 20 40 60 80 100 time (min) eco-mpc track-mpc 30 0 20 40 60 80 100 time (min) Rawlings Optimizing Economic Performance 18 / 35
d P 100 (kpa) 250 50 12000 45 40 10000 35 30 cost ($/h) 8000 25 20 F 1 6000 15 T 1 T 10 100 4000 0 10 20 30 40 50 60 70 80 90 0 10 20 30 40 50 60 70 80 90 time (min) time (min) 40 36 32 X 2(%) 28 24 400 350 300 200 150 100 0 10 20 30 40 50 60 70 80 90 time (min) 20 0 10 20 30 40 50 60 70 80 90 time (min) 400 360 320 F 200 (kg/min) 280 240 P 2 (kpa) 52 200 0 10 20 30 40 50 60 70 80 90 time (min) 56 54 50 eco-mpc track-mpc 48 0 10 20 30 40 50 60 70 80 90 time (min) Rawlings Optimizing Economic Performance 19 / 35
Performance Avg. operating cost ( 10 3 $ / hr) Disturbance eco-mpc track-mpc G Measured 5894.3 5965.5 2.2 % Unmeasured 5804.1 6154.8 6.15 % Table: Performance comparison of the evaporator process under economic and tracking MPC Rawlings Optimizing Economic Performance 20 / 35
Challenges for analyzing closed-loop behavior Sequence of optimal costs is not monotone decreasing Rawlings Optimizing Economic Performance 21 / 35
Challenges for analyzing closed-loop behavior Sequence of optimal costs is not monotone decreasing Infinite horizon cost is unbounded for all input sequences Rawlings Optimizing Economic Performance 21 / 35
Challenges for analyzing closed-loop behavior Sequence of optimal costs is not monotone decreasing Infinite horizon cost is unbounded for all input sequences Optimal cost is not a Lyapunov function for the closed-loop system Rawlings Optimizing Economic Performance 21 / 35
Challenges for analyzing closed-loop behavior Sequence of optimal costs is not monotone decreasing Infinite horizon cost is unbounded for all input sequences Optimal cost is not a Lyapunov function for the closed-loop system Standard nominal MPC stability arguments do not apply Rawlings Optimizing Economic Performance 21 / 35
Challenges for analyzing closed-loop behavior Sequence of optimal costs is not monotone decreasing Infinite horizon cost is unbounded for all input sequences Optimal cost is not a Lyapunov function for the closed-loop system Standard nominal MPC stability arguments do not apply Simulations indicate the closed loop is stable Rawlings Optimizing Economic Performance 21 / 35
Challenges for analyzing closed-loop behavior Sequence of optimal costs is not monotone decreasing Infinite horizon cost is unbounded for all input sequences Optimal cost is not a Lyapunov function for the closed-loop system Standard nominal MPC stability arguments do not apply Simulations indicate the closed loop is stable How can we be sure? Rawlings Optimizing Economic Performance 21 / 35
Recent results for economic MPC The economic MPC for linear dynamics, f (x, u) = Ax + Bu, and convex cost is asymptotically stabilizing (Rawlings, Bonné, Jørgensen, Venkat, and Jørgensen, 2008) Rawlings Optimizing Economic Performance 22 / 35
Recent results for economic MPC The economic MPC for linear dynamics, f (x, u) = Ax + Bu, and convex cost is asymptotically stabilizing (Rawlings, Bonné, Jørgensen, Venkat, and Jørgensen, 2008) Proof based on convexity of stage cost Rawlings Optimizing Economic Performance 22 / 35
Recent results for economic MPC The economic MPC for linear dynamics, f (x, u) = Ax + Bu, and convex cost is asymptotically stabilizing (Rawlings, Bonné, Jørgensen, Venkat, and Jørgensen, 2008) Proof based on convexity of stage cost No Lyapunov function was found Rawlings Optimizing Economic Performance 22 / 35
Rotated cost and Lyapunov function Stability results extended to nonlinear systems satisfying strong duality. There exists constant λ R n such that min l(x, u) + (x,u) Z λ (x f (x, u)) l(x s, u s ) Rawlings Optimizing Economic Performance 23 / 35
Rotated cost and Lyapunov function Stability results extended to nonlinear systems satisfying strong duality. There exists constant λ R n such that min l(x, u) + (x,u) Z λ (x f (x, u)) l(x s, u s ) The Lyapunov function is based on rotated stage cost L(x, u) = l(x, u) l(x s, u s ) + λ (x f (x, u)) Diehl, Amrit, and Rawlings (2011) Rawlings Optimizing Economic Performance 23 / 35
Generalization to dissipative systems Stability results generalized to dissipative systems. There exists function λ : X R and supply rate s : X U R such that λ(f (x, u)) λ(x) s(x, u) (x, u) Z Rawlings Optimizing Economic Performance 24 / 35
Generalization to dissipative systems Stability results generalized to dissipative systems. There exists function λ : X R and supply rate s : X U R such that λ(f (x, u)) λ(x) s(x, u) (x, u) Z Rotated stage cost min l(x, u) + λ(x) λ(f (x, u)) l(x s, u s ) (x,u) Z L(x, u) = l(x, u) l(x s, u s ) + λ(x) λ(f (x, u)) MPC also shown to outperform optimal steady performance Angeli, Amrit, and Rawlings (2011) Rawlings Optimizing Economic Performance 24 / 35
Chemical reactor example: Unstable system CSTR with parallel reactions R P 1 R P 2 Economic objective: Maximize P 1 (x 2) ẋ 1 = 1 10 4 x 2 1 e 1/x 3 400x 1e 0.55/x 3 x 1 ẋ 2 = 10 4 x 2 1 e 1/x 3 x 2 ẋ 3 = u x 3 x 1, x 2: Concentrations of R, P 1 x 3: Temperature in the reactor. u: Heat flux through the reactor wall Rawlings Optimizing Economic Performance 25 / 35
Chemical reactor example: Unstable system CSTR with parallel reactions R P 1 R P 2 Economic objective: Maximize P 1 (x 2) ẋ 1 = 1 10 4 x 2 1 e 1/x 3 400x 1e 0.55/x 3 x 1 ẋ 2 = 10 4 x 2 1 e 1/x 3 x 2 ẋ 3 = u x 3 x 1, x 2: Concentrations of R, P 1 x 3: Temperature in the reactor. u: Heat flux through the reactor wall 0.4 0.3 u 0.2 0.1 0 1 2 3 4 5 6 7 8 9 0.16 0.12 x 2 0.08 0.04 0.4 x 1 0.2 0 1 2 3 4 5 6 7 8 9 0.2 0.15 x 3 0.1 0 0 1 2 3 4 5 6 7 8 9 0.05 0 1 2 3 4 5 6 7 8 9 Rawlings Optimizing Economic Performance 25 / 35
Average performance Asymptotic average of any function of states and inputs (y = h(x, u)): Av[y] := lim T T h(x(k), u(k)) k=0 T + 1 Asymptotic average closed-loop performance T k=0 l(x(k), u(k)) Av [l(x, u)] := lim, x + = f (x, κ N (x)) T T + 1 Rawlings Optimizing Economic Performance 26 / 35
Nonsteady operation: Average constraints Auxiliary output variable y = h(x, u) Closed and convex set Y, such that h(x s, u s ) Y Receding horizon control strategy such that (x(k), u(k)) Z Av[y] Y k I 0 Rawlings Optimizing Economic Performance 27 / 35
Enforcing convergence Optimizing economic performance may not give stability Tradeoff between stability and performance Convergence may be enforced by modifying the dynamic problem Convex regularization terms in the objective l(x, u) = l(x, u) + u 2 S + x x s 2 Q + u u s 2 R Zero variance constraint Av[ x x s 2 ] {0} Rawlings Optimizing Economic Performance 28 / 35
Convex terms in objective l(x, u) = l(x, u) + u 2 S + u u s 2 R u 0.4 0.3 0.2 0.1 0 2 4 6 8 10 0.2 x 1 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0.2 R = 0.15 S = 0.17 0 2 4 6 8 10 0.15 x 2 x 3 0.1 0 0 2 4 6 8 10 0.05 0 2 4 6 8 10 Rawlings Optimizing Economic Performance 29 / 35
Zero variance constraint Av[ x x s 2 ] {0} 0.4 0.3 u 0.2 0.1 0 5 10 15 20 25 30 35 40 0.15 0.1 x 2 0.05 0 0 5 10 15 20 25 30 35 40 0.4 0.35 0.3 0.25 x 1 0.2 0.15 0.1 0.05 0 5 10 15 20 25 30 35 40 x 3 0.2 0.15 0.1 0.05 0 5 10 15 20 25 30 35 40 Rawlings Optimizing Economic Performance 30 / 35
MPC Research Monograph Published in 2009 Rawlings Optimizing Economic Performance 31 / 35
MPC Research Monograph Published in 2009 576 page text Rawlings Optimizing Economic Performance 31 / 35
MPC Research Monograph Published in 2009 576 page text 3 appendices on web (133 pages) Rawlings Optimizing Economic Performance 31 / 35
MPC Research Monograph Published in 2009 576 page text 3 appendices on web (133 pages) 214 exercises Rawlings Optimizing Economic Performance 31 / 35
MPC Research Monograph Published in 2009 576 page text 3 appendices on web (133 pages) 214 exercises 335 page solution manual Rawlings Optimizing Economic Performance 31 / 35
MPC Research Monograph Published in 2009 576 page text 3 appendices on web (133 pages) 214 exercises 335 page solution manual total: 1044 pages Rawlings Optimizing Economic Performance 31 / 35
MPC Research Monograph Published in 2009 576 page text 3 appendices on web (133 pages) 214 exercises 335 page solution manual total: 1044 pages www.nobhillpublishing.com Rawlings Optimizing Economic Performance 31 / 35
Status of Economic MPC Opportunities Performance advantage Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Opportunities Performance advantage Consistent model for optimizing performance Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Opportunities Performance advantage Consistent model for optimizing performance Consistent statement of process objectives Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Opportunities Performance advantage Consistent model for optimizing performance Consistent statement of process objectives Optimization software well developed Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Opportunities Performance advantage Consistent model for optimizing performance Consistent statement of process objectives Optimization software well developed Linear dynamics and convex objectives well supported Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Opportunities Performance advantage Consistent model for optimizing performance Consistent statement of process objectives Optimization software well developed Linear dynamics and convex objectives well supported Leverage from industrial implementation of linear MPC Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Opportunities Performance advantage Consistent model for optimizing performance Consistent statement of process objectives Optimization software well developed Linear dynamics and convex objectives well supported Leverage from industrial implementation of linear MPC This is a big opportunity! Rawlings Optimizing Economic Performance 32 / 35
Status of Economic MPC Challenges Understanding the interplay between nonlinearity of model and convexity of objective Rawlings Optimizing Economic Performance 33 / 35
Status of Economic MPC Challenges Understanding the interplay between nonlinearity of model and convexity of objective Managing the complexity of an optimal economic solution Rawlings Optimizing Economic Performance 33 / 35
Status of Economic MPC Challenges Understanding the interplay between nonlinearity of model and convexity of objective Managing the complexity of an optimal economic solution Developing theory, algorithms, tuning procedures, and realistic case studies that support industrial implementation Rawlings Optimizing Economic Performance 33 / 35
Status of Economic MPC Challenges Understanding the interplay between nonlinearity of model and convexity of objective Managing the complexity of an optimal economic solution Developing theory, algorithms, tuning procedures, and realistic case studies that support industrial implementation This is a big challenge! Rawlings Optimizing Economic Performance 33 / 35
Acknowledgments Rishi Amrit, UW Madison Shell Larry Biegler, CMU Financial support from NSF #CTS-0825306, 0931835 and Texas Wisconsin California Control Consortium (TWCCC) members Rawlings Optimizing Economic Performance 34 / 35
Further reading I D. Angeli, R. Amrit, and J. B. Rawlings. On average performance and stability of economic model predictive control. IEEE Trans. Auto. Cont., 2011. Accepted for publication. L. Biegler. An overview of simultaneous strategies for dynamic optimization. Chem. Engg. Proc. PI, 46(11):1043 1053, 2007. ISSN 0255-2701. M. Diehl, R. Amrit, and J. B. Rawlings. A Lyapunov function for economic optimizing model predictive control. IEEE Trans. Auto. Cont., 56(3):703 707, 2011. J. B. Rawlings, D. Bonné, J. B. Jørgensen, A. N. Venkat, and S. B. Jørgensen. Unreachable setpoints in model predictive control. IEEE Trans. Auto. Cont., 53 (9):2209 2215, October 2008. Rawlings Optimizing Economic Performance 35 / 35