Modelling and Control of Nonlinear Processes Jianying (Meg) Gao and Hector Budman Department of Chemical Engineering University of Waterloo 1 Outline Motivation Modelling •Volterra series •State-affine PI •RS&RP Nonlinear process examples Two major difficulties: modelling and control! Empirical Modelling Control •G-S Motivation Volterra series, state-affine Robust Control Robust Stability (RS) and Robust Performance (RP) Proportional-Integral (PI) control Gain-scheduling PI (G-S PI) Results and Conclusions Continuous stirred tank reactor (CSTR) Future application 2 Nonlinear Process Example 1 Motivation Modelling series •State-affine Fed-batch Bioreactor Mass Balance Linear process: constant dS X D( S i S ) dt YX / S •Volterra Control •G-S PI •RS&RP Substrate Si Nonlinear process: Monod Input ( S ) max , X , S S Ks S Output dS S X D( S i S ) max dt K s S YX / S 3 Nonlinear Process Example 2 Motivation Continuous Stirred Tank Reactor: CSTR Modelling A •Volterra series •State-affine Control •G-S PI •RS&RP A B Heat 1st order Q f , C f ,T f A&B Cooling u Tc Input Mass Balance: Q f , C, T V , ,T Output dC V Q f (C f C ) VkC dt k Linear process: constant Nonlinear process: Arrhenius k (T ) e E RT 4 Nonlinear Control Motivation 1st Difficulty: simple & accurate model Modelling •Volterra series •State-affine Control •G-S PI •RS&RP Accurate: the model gives a good data fit Simple: the model structure is simple to apply for control purpose 2nd Difficulty: model is never perfect! Uncertainty: model/plant mismatch Controllers are desired to be ROBUST to model uncertainty! Robust control: takes into account uncertainty! nonlinear model Linear model uncertainty 5 Empirical Modelling Motivation Type First principles model Empirical model How? Mass, energy balance Input/output data Choose? Difficult, complex Easy Modelling •Volterra series •State-affine Control •G-S PI •RS&RP 1g/l model y set e -y controller u process (inlet concentration) v y measurement 1g/l soft sensor 6 1st Order Volterra Series Motivation Modelling series •State-affine No priori knowledge of the process is required! Black box model between input and output •Volterra Control •G-S PI •RS&RP n y (t ) hi u (t i ) i 1 h1u(t 1) h2 u(t 2) S y(t ) u (t 2) Si u at different time at current time t-2 t-1 t t 7 1st Order Volterra Series Motivation Tc Modelling •Volterra series •State-affine Control Impulse response A Q , C ,T f f Cooling Tc Input 0 1 •G-S PI •RS&RP t f A&B Q f , C, T V , ,T Output C t u [1,0,0,0] 1 n y [0, h1 , h2 ,hn ,0] 1st order Volterra kernels: h1 , h2 , hn 8 1st Order Volterra Series C (1) Tc (1) Motivation Modelling •Volterra series •State-affine = Control •Robust control •Gain-scheduling •PI •MPC + + 1 Tc ( 2) 2 1 C ( 2) 2 1 Tc (1) Tc (2) 2 Cooling Temperature = n y (t ) hi u (t i ) i 1 1 C (1) C (2) 2 Reactor concentration 9 Volterra Series Model Motivation Modelling •Volterra series •State-affine Control •G-S PI •RS&RP No priori knowledge of the process is required! Black box model between input and output More terms, better data fit n n n y (t ) hi u (t i) hij u (t i )u (t j ) i 1 i 1 j 1 h1u(t 1) h2 u(t 2) h11u(t 1)u(t 1) h12u(t 1)u(t 2) 2nd order Volterra kernels: h11 , h12 , hnn 10 Identify Volterra Kernels Motivation Modelling Identification of Volterra kernels u (t i) ui •Volterra series •State-affine y(t ) h1u1 h2 u 2 h11u1u1 h12u1u 2 Control •G-S PI •RS&RP w1 u1 , w2 u 2 , w3 u1u1 , w4 u1u 2 y(t ) h1 w1 h2 w2 h11w3 h12 w4 Linear least squares 11 Volterra Series Model Motivation Advantages Modelling •Volterra series •State-affine Control •G-S PI •RS&RP From input/output data Tc C Straightforward generalization of the linear system description Linear least squares algorithm: hi , hij Disadvantages The output depends on past inputs raised to different powers and in different product combinations, e.g. u(t 1) 2 , u(t 2)u(t 3), u(t 2) 3 Not suitable for robust control approach Linear model uncertainty 12 State-affine Model Motivation Modelling State-affine Model (Sontag, 1978) •Volterra series •State-affine Control •G-S PI •RS&RP I/O Data State-affine system, i.e. systems that are affine in the state variables but are nonlinear with respect to the inputs It can cover a wide range of nonlinear processes Identified from Volterra series model kernels Suitable for robust control Least squares Volterra series model Intermediate step Sontag’s algorithm State-affine model 13 State-affine Model Motivation Model structure x(t 1) F(u )x(t ) G (u )u (t ) Modelling series •State-affine y (t ) h 0 x(t ) •Volterra Where Control F(u ) F0 F1u (t ) F2 u (t ) 2 G (u ) G 1 G 2 u (t ) G 3u (t ) 2 •G-S PI •RS&RP Identification of matrix coefficients Fi , G i , h 0 Iterative matrix manipulation of Volterra kernels Sontag (1978), Budman and Knapp (2000,2001) 14 State-affine Model Motivation x(t 1) (F0 F1u (t )) x(t ) (G 1 G 2 u (t ) 2 )u (t ) Modelling •Volterra series •State-affine Control PI •RS&RP A simple example y(t ) h 0 x(t ) How to treat the nonlinearity as Uncertainty? •G-S Nominal point Nonlinearity x(t 1) F0 x(t ) G 1u (t ) F1u (t )x(t ) G 2 u (t ) 2 u (t ) y(t ) h 0 x(t ) 1,t Linear model uncertainty 2 ,t 15 Nonlinearity Motivation Modelling Uncertainty is function of input: Key advantage! i ,t u(t )i , 1,t u(t ), 2,t u(t ) 2 •Volterra series •State-affine Control Uncertainty Uncertainty bounds Tc 5 50( C ) •G-S PI •RS&RP 0 u(t ) 5 50 1,t 5 50 50 1,t 5 t 16 Results 1 (modelling) Motivation State-affine model True process output Modelling •Volterra series •State-affine 0.3 Control 0.1 •G-S PI •RS&RP 0.2 0 -0.1 -0.2 -0.3 -0.4 -0.5 0 50 100 150 200 250 300 350 400 450 17 Results 1 (modelling) Motivation State-affine model True process output Modelling •Volterra series •State-affine 0.3 Control 0.1 •G-S PI •RS&RP 0.2 0 -0.1 -0.2 -0.3 -0.4 -0.5 0 50 100 150 200 250 300 350 400 450 18 Results 1 (modelling) Motivation Modelling •Volterra series •State-affine Control •G-S PI •RS&RP State-affine model for CSTR x(t 1) (F0 F1u (t )) x(t ) (G 1 G 2 u (t ))u (t ) y (t ) h 0 x(t ) 0.1188 0.0345 F0 2 . 3416 0 . 0937 1 G1 0 0.1076 0 F1 1 . 2289 0 0 G2 1 h 0 0.1755 0.0382 19 Conclusions 1 (modelling) Motivation A general modelling approach is proposed! Modelling •Volterra series •State-affine For a Nonlinear Process: Obtained an empirical model from I/O data! No priori knowledge required! So it can be applied to processes with unknown dynamics! Control •G-S PI •RS&RP Nonlinearity is dealt with as uncertainty! Methods for quantifying the model uncertainty from experimental data are studied. x(t 1) (F0 F1u (t )) x(t ) (G 1 G 2 u (t ))u (t ) y (t ) h 0 x(t ) 1,t 1,t 20 G-S PI Design Motivation PI controller: Modelling •Volterra series •State-affine u (t ) K c [e(t ) Proportional gain: K 2 c Integration time: 4 min I Control e •G-S PI •RS&RP PI 1 0 t 1 I t e(i)] i 1 Slope= u Kc I 2 4 Kc 2 0 t Gain-Scheduling PI controller K c f (Tc ) I g (Tc ) u Si 5 50( 0C ) 21 Traditional Gain-Scheduling A Motivation Modelling •Volterra series •State-affine Control •G-S PI •RS&RP Tc 5 50( C ) 0 5 Q f , C f ,T f A&B Q f , C, T Tc V , ,T 50 5 10 20 25 Linear Model 1 Kc 2 I 4 45 50 Linear Model 2 ? switch Kc 3 I 3 Output Linear Model 3 ? switch Kc 4 I 1.5 22 G-S PI Design Motivation Continuous G-S PI controller: state-space 1 t u (t ) K c (u )[e(t ) e(i)] I (u ) i 1 Modelling •Volterra series •State-affine Math manipulation Control (t 1) (t ) e(t ) •G-S PI •RS&RP u Tc e Cset C u (t ) (C c Wc u (t )) (t ) ( Dc Wd u (t ))e(t ) Cc Kc I , Dc K c Design parameters: Kc I K c , I ,Wc ,Wd 23 Closed-loop System: APS Motivation Modelling η(t 1) A(δ t ) B(δ t ) η(t) e(t) C(δ ) D(δ ) ν(t) t t η(0) η0 •Volterra series •State-affine Control PI •RS&RP Affine Parameter-dependent System: the closed-loop •G-S Assumption1:Affine dependence on the uncertain parameters A(δ t ) A 0 A1δ1,t A 2 δ2,t A n δn,t δ t ( 1 , 2 ,, n ) R n 24 Uncertain Parameter Motivation Modelling Assumption 2: Each uncertain parameter is bounded [ , ] i ,t •Volterra series •State-affine i i 100 Tc 1,t Control •G-S PI •RS&RP 5 1 t Convexity: Parameter vector δ t is valued in a hyper-rectangle called the parameter box 2 W 4 3 W : {(1 , 2 ,, n ) : i { i , i }} 25 Robust Stability Motivation Modelling •Volterra series •State-affine V Lyapunov function 0 V 0 Energy Stable position: zero energy Path: Control •G-S PI •RS&RP V 0 V 0 dV 0 dt V 0 V 0 26 Robust Stability Motivation CSTR: avoid overheating, maintain target Modelling •Volterra series •State-affine Max S Control Min •G-S PI •RS&RP stable 1 W 4 2 3 unstable General RS condition: A( )T PA ( ) P 0, for all W 27 Robust Performance Motivation Modelling •Volterra series •State-affine Disturbance Rejection; performance index Smaller , better performance Larger , worse performance e Control •G-S PI •RS&RP v e L2 1 L2 =Disturbance in A A&B Q f , C, T 1g/l (Cset C ) V , ,T Output 28 Robust Performance Motivation Fed-batch bioreactor: product quality! Modelling •Volterra series •State-affine Control •G-S PI •RS&RP Max S Min Good Bad RP: Solve for and controller parameters A( ) T PA ( ) P A( ) T PB CT T T 2 T B PA ( ) B PB I D 0 for all W C D I 29 Robust Control Design Motivation Modelling •Volterra series •State-affine Control Empirical model of the nonlinear process •G-S PI •RS&RP State-affine model Controller structure K c , I PI: G-S PI: K c , I ,Wc ,Wd Closed-loop system RS and RP conditions are checked linear model uncertainty controller closed-loop RS ? RP ? 30 Results 2 (Linear PI) Motivation Linear PI: RS and RP regions Modelling 20 •Volterra 18 series •State-affine Control •G-S PI •RS&RP 16 I Wc Wd 0 RS region Good 14 12 RP region 10 8 6 4 2 0.5 1 1.5 2 2.5 3 3.5 Kc 31 Results 2 (G-S PI RS) Motivation Improve over linear PI Kc=2.42,taui=1.1545 Modelling 0.5 •Volterra series •State-affine Good Control PI •RS&RP 0 •G-S Wc -0.5 -1 -1 -0.5 0 Wd 0.5 1 1.5 32 Results 2 (G-S PI RP) Motivation Improve over linear PI Kc=2,taui=1.1545 Modelling 0.5 •Volterra series •State-affine Good Control PI •RS&RP 0 •G-S Wc -0.5 -1 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 Wd 33 Results 2 (PI) Motivation Simulation: G-S PI is much BETTER! Modelling •Volterra series •State-affine Control •G-S PI •RS&RP 1 Disturbance 0.5 0 -0.5 -1 0 2 4 6 8 10 12 14 16 18 20 1 Linear PI 0.5 0 G-S PI:better -0.5 -1 2 4 6 8 10 12 14 16 18 20 34 Conclusions 2 (Control) Motivation Design and simulation results Modelling PI •Volterra series •State-affine Linear Control •G-S PI •RS&RP G-S I Wc Wd 2 1.15 0 0 0.96 0.38 1.37 2.95 -0.004 0.001 0.39 0.22 optimal simulation is a good performance index Kc Consistence between analysis and simulation A general robust design approach is proposed! Based on empirical model from I/O data! G-S PI! Much better performance for wide operation range! 35 Conclusions Motivation Two difficulties are solved efficiently! Modelling •Volterra series •State-affine Modelling: state-affine Control: robust control Control •G-S PI •RS&RP Our contributions! Quantify uncertainty from I/O data! Develop global RP conditions! Propose Continuous G-S PI structure! 36 Application Motivation Modelling Empirical Modelling •Volterra series •State-affine Control •G-S PI •RS&RP Models: nonlinear biochemical processes chemical and Robust Control Design Nonlinear processes when nonlinearity is treated as uncertainty! Uncertain processes with real and timevarying uncertainty! 37 Motivation Modelling •Volterra series •State-affine Control •G-S PI •RS&RP 38 Unconstrained MPC K+m p: prediction horizon;m: control horizon k: sampling point, same as t Unconstrained MPC Quadratic Design Objective 2 1 2 ˆ min { Γ[Y(k 1 / k ) R (k 1)] ΛU } [1] u ( k ) 2 ˆ (k 1 / k ) M Y ˆ (k ) W(k 1 / k ) S u U(k ) s.t. Y p p Solution 0 0 Γε ( k 1 / k ) ΓS u [2] U(k ) 0 Λ ε(t 1 / k ) R(k 1 / k ) M p Y(k ) W(k 1 / k ) Unconstrained MPC Least Squares Solution x (A T A) 1 A Tb Ax b MPC Solution: Best Sequence of m Control Moves uT p 1 uT p U(k ) (S Γ ΓS Λ Λ) S Γ Γε(k 1 / k ) T u p T T Present Control Move is Implemented u (k ) K MPCε(k 1 / k ) K MPC 1 0 01m (S Γ ΓS Λ Λ) S ΓT Γ uT p T u p T 1 uT p MPC Design Parameters No general guide on design parameters! Control horizon: m Small: a robust controller that is relatively insensitive to model errors Large: computational effort increases; excessive control action Prediction horizon: p Large: more conservative control action which has a stabilizing effect but also increase the computational effort weighting matrix for outputs : Usually set Γ const Γ State-space MPC Weighting matrix for inputs: Λ I More important than other parameters Small Large Λ Λ more aggressive control, less stable less aggressive control, more stable State-space MPC (Zanovello and Budman,1999) U(k ) E2 T1K mpcN 2 U(k 1) u(k ) C K N y ( k ) mpc 2 u1 Closed-loop System: APS Robust G-S MPC Operation Range Step 1 1(u=-1) Step 2 1 1 0 Step 3 1 {1,0} Step 4 2(u=0) 1 u [1,1] 2 State Affine 1&2 State Affine 2&3 MPC 1-2 MPC 2-3 Switching 3(u=1) 1 0 1 1 {0,1} RS & RP Outline Traditional G-S Design Design procedure and disadvantages Robust G-S Design Affine parameter-dependent systems (APS) RS and its LMI formulation RP and its LMI formulation Robust G-S MPC design State-affine model and uncertainty quantification State-space formulation of MPC Results and Conclusions Case study: nonlinear CSTR Nonlinear CSTR Pure A Q f , C f ,T f Mix of A and B V , ,T u(t)=Tc 1st –order exothermal reaction Q f , C ,T Results (1) Optimization Design Results: Table 1 # of ranges u [1,1] k 5 k4 k 3 k2 k 1 [0.2033,0.7817,0.9618,1.4984,1.0681] [0.1909,0.7518,1.0746,1.6372] 0.5044 0.4440 [0.3521,0.2013,1.2408] 0.4729 [0.1121,1.7121] 0.4210 [1.1650] 0.4461 Evenly Separated Ranges Conclusions (1) Efficient Robust G-S MPC Design Simulation test with disturbances, e.g. IMA, and etc. Global G-S MPC designed with guaranteed RS and RP Analysis is the worst case which covers all the simulations Observations of the Robust G-S MPC Design Performance index close to each other Even separations may not capture the process nonlinearity Conservatism of the design Robust G-S MPC Performance depends on # of separations Separation point locations: evenly or not Nonlinear dynamics Results (2) Comparison of two controllers: Analysis & Simulation G-S MPC 5-1: G-S MPC 5-2: Λ Λ designed based on optimization chosen randomly Table 2 optmization Yes No ( k 5 , u [1,1] ) [0.2033,0.7817,0.9618,1.4984,1.0681] [10,10,10,10,10] simulation 0.5044 0.7230 0.2115 0.3144 Results (2) CSTR Simulation: Figure 1 G-S MPC output and disturbance 1 0.8 Disturbance 0.6 0.4 No optimization 0.2 0 -0.2 Optmization -0.4 -0.6 -0.8 -1 0 5 10 15 20 25 30 35 40 45 50 Conclusions (2) is a Good performance index Consistence between analysis and simulation (Table 2) Robust G-S MPC Design Global G-S MPC designed with guaranteed RS and RP Analysis is the worst case Future Directions Separation of operation range, # of separations Reducing conservatism of the design Process with more nonlinearity Traditional G-S Design A typical G-S design procedure for nonlinear plants Step1: select n operating points which cover the range of the plant’s dynamics Step 2: Linearize a first principle model or identify linear models around each operating point Step 3: Design local linear controller for each local linear model Step 4: In between operating points, the gains of the local controllers are interpolated, or scheduled, resulting in a global controller.