2 MPC Based on Step Response Models Example Load the input and out put data. The input and out put data are generated from the fol lowi ng transfer random zero-mean noi ses tF from i 1 to output 1: g11=5. 72exp(-14s)/ %(60s+1) TF from i nput 2 to output 1: g12=1. 52exp(-15s)/ %(25s+1) Sampl i ng time of 7 mi nutes was used %l oad ml rdat % Determi ne the standard devi ations for input data using [ax, Ix, stdx]=autos(x) Scale the input data by their standard devi ati ons onl y SX=scal(x, nIx, stdx) Put the input and out put data in a form such that they can be used to determi ne the impul se response coeffi ci ents. 35 coeffici ents (n) are used n=35 [xreg, regl=wrtreg(sx, y, n) Determi ne the i mpul se response coefficients By speci fying plotopt=2, two pl ots-pl ot of predi cted out put and actual output, and plot of the out put resi dual (or predi ction error)-are produced nI Theta, yres]=mlr(xreg, yreg, ni nput, pl otopt) 2-8
2 MPC Based on Step Response Models 2-8 Example: % Load the input and output data. The input and output % data are generated from the following transfer % functions and random zero-mean noises. % TF from input 1 to output 1: g11=5.72exp(-14s)/ % (60s+1) % TF from input 2 to output 1: g12=1.52exp(-15s)/ % (25s+1) % Sampling time of 7 minutes was used. % % load mlrdat % % Determine the standard deviations for input data using % autosc. [ax,mx,stdx]=autosc(x); % % Scale the input data by their standard deviations only. mx=0*mx; sx=scal(x,mx,stdx); % % Put the input and output data in a form such that they % can be used to determine the impulse response % coefficients. 35 coefficients (n) are used. n=35; [xreg,yreg]=wrtreg(sx,y,n); % % Determine the impulse response coefficients via mlr. % By specifying plotopt=2, two plots—plot of predicted % output and actual output, and plot of the output % residual (or prediction error)—are produced. ninput=2; plotopt=2; [theta,yres]=mlr(xreg,yreg,ninput,plotopt);
Model ldentification Actual value(o) versus Predicted value(+) 产 tput Residual or Prediction Error Scale theta based on the st andard devi ati ons used in i ng the theta=scal(theta, mx, stdx % Convert the i mpul se model to a step model to be used in MPC desi gn. Sampl ing time of 7 mi nutes was used in determi ni the i mpul se model Number of out puts (1 in this case) must be speci fied nout=l: model =i mp2step(del t, nout, theta) Plot the step response pl otstep(model) 2-9
Model Identification 2-9 % Scale theta based on the standard deviations used in % scaling the input. theta=scal(theta,mx,stdx); % % Convert the impulse model to a step model to be used % in MPC design. % Sampling time of 7 minutes was used in determining % the impulse model. % Number of outputs (1 in this case) must be specified. nout=1; delt=7; model=imp2step(delt,nout,theta); % % Plot the step response. plotstep(model) 0 20 40 60 80 100 120 140 160 180 −6 −4 −2 0 2 4 Actual value (o) versus Predicted Value (+) Sample Number Output 0 20 40 60 80 100 120 140 160 180 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 Output Residual or Prediction Error Sample Number Residual
2 MPC Based on Step Response Models ul step response: y1 E TIME 2-10
2 MPC Based on Step Response Models 2-10 0 50 100 150 200 250 0 1 2 3 4 5 6 u1 step response : y1 TIME 0 50 100 150 200 250 −0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 u2 step response : y1 TIME
Unconstrained Model predictive Control Unconstrained model predictive control The MPC control law can be most easily derived by referring to the following gure future yk+1kx)·· y Manipulated kk+1 k+2 horizon For any assumed set of present and future control moves Au(k), Au(k+ 1), Au(k+m-1)the future behavior of the process outputs k+1A), Mk+p k can be predicted over a horizon p. The m present and future control moves(ms p)are computed to minimize a quadratic objective of the form sP,Tr(Lnk+/k)-rk+DDl +m1|rat△(k+1-1 Here r and r are weighting matrices to penalize particular components of yor u at certain future time intervals. r(k+ n is the (possibly time-varying) vector of future reference values(setpoints). Though m control moves are calculated, only the first one(Au(k) is implemented. At the next sampling interval, new values of the measured output are obtained, the control horizon is shifted forward by one step, and the same computations are repeated. The resulting control law is referred to as"moving horizon"or"receding horizon 2-11
Unconstrained Model Predictive Control 2-11 Unconstrained Model Predictive Control The MPC control law can be most easily derived by referring to the following figure. For any assumed set of present and future control moves ∆u(k), ∆u(k + 1), ..., ∆u(k + m – 1) the future behavior of the process outputs y(k + 1|k), y(k + 2|k), . . . , y(k + p|k) can be predicted over a horizon p. The m present and future control moves (m ≤ p) are computed to minimize a quadratic objective of the form Here and are weighting matrices to penalize particular components of y or u at certain future time intervals. r(k + l) is the (possibly time-varying) vector of future reference values (setpoints). Though m control moves are calculated, only the first one (∆u(k)) is implemented. At the next sampling interval, new values of the measured output are obtained, the control horizon is shifted forward by one step, and the same computations are repeated. The resulting control law is referred to as “moving horizon” or “receding horizon.” past future target u(k) k k+1 k+2 k+p horizon ^ y(k+1|k) y Projected Manipulated Variables Outputs min∆u k( )…∆uk m ( ) + – 1 Γl y ( ) [ ] y k( ) + l|k – r k( ) + l 2 l=1 p + Γl u [ ] ∆u k( ) + l – 1 2 l=1 m Γl y Γl u
2 MPC Based on Step Response Models The predicted process outputs k+1 k),.,k+p k depend on the current measurement jk) and assumptions we make about the unmeasured disturbances and measurement noise affecting the outputs. The MPC Toolbox assumes that the unmeasured disturbances for each output are steps passing through a first order lag with time constant filter(2, ) For rejecting measurement noise, the time constant of an exponential filter filter(l, can be specified by the user. (It can be shown that this procedure is optimal for hite noise disturbances passed through an integrator and a first order lag. and white measurement noise). For conventional Dynamic Matrix Control ( MC) the disturbance time constant is assumed to (filter(2,: )= zeros(1, ny)), i.e., the unmeasured disturbances have the form of steps, and the noise filter time constant is also set to zero (filter(1,: )= zeros(1, ny)),i.e, there is no measurement noise filtering for doing the prediction. Under the stated assumptions, it can be shown that a linear time-invariant feedback control law results △u()= KMPC ED(k+1|k) where Ep(k+1 k) is the vector of predicted future errors over the horizon p which would result if all present and future manipulated variable moves were equal to zero△u(k)=△u(k+1)=.=0. For open-loop stable plants, nominal stability of the closed-loop system depends only on Kmp c which in turn is affected by the horizon p, the number of moves m and the weighting matrices T and r. No precise conditions on m, p, and r exist which guarantee closed-loop stability. In general decreasing m relative to p makes the control action less aggressive and tends to stabilize a system. For p= 1, nominal stability of the closed-loop system is guaranteed for any finite m, and time-invariant input and output weights More commonly, T is used as a tuning parameter. Increasing r always has the effect of making the control action less aggressive The noise filter time constant filter(l:) and the d measured disturbances. They do, however, affect the robustness and the response to unmeasured disturbances 1. See cmpc in the "Reference"section for details on how to specify tfilter
2 MPC Based on Step Response Models 2-12 The predicted process outputs y(k + 1|k), . . . ,y(k + p|k) depend on the current measurement and assumptions we make about the unmeasured disturbances and measurement noise affecting the outputs. The MPC Toolbox assumes that the unmeasured disturbances for each output are steps passing through a first order lag with time constant tfilter(2,:). 1 For rejecting measurement noise, the time constant of an exponential filter tfilter(1,:) can be specified by the user. (It can be shown that this procedure is optimal for white noise disturbances passed through an integrator and a first order lag, and white measurement noise). For conventional Dynamic Matrix Control (DMC) the disturbance time constant is assumed to be zero (tfilter(2,:) = zeros(1,ny)), i.e., the unmeasured disturbances have the form of steps, and the noise filter time constant is also set to zero (tfilter(1,:) = zeros(1,ny)), i.e., there is no measurement noise filtering for doing the prediction. Under the stated assumptions, it can be shown that a linear time-invariant feedback control law results ∆u(k) = KMP C Ep(k + 1|k) where Ep(k + 1|k) is the vector of predicted future errors over the horizon p which would result if all present and future manipulated variable moves were equal to zero ∆u(k) = ∆u(k + 1) = . . . = 0. For open-loop stable plants, nominal stability of the closed-loop system depends only on KMP C which in turn is affected by the horizon p, the number of moves m and the weighting matrices and . No precise conditions on m, p, and exist which guarantee closed-loop stability. In general, decreasing m relative to p makes the control action less aggressive and tends to stabilize a system. For p = 1, nominal stability of the closed-loop system is guaranteed for any finite m, and time-invariant input and output weights. More commonly, is used as a tuning parameter. Increasing always has the effect of making the control action less aggressive. The noise filter time constant tfilter(1,:) and the disturbance time constant tfilter(2,:) do not affect closed-loop stability or the response of the system to setpoint changes or measured disturbances. They do, however, affect the robustness and the response to unmeasured disturbances. 1. See cmpc in the “Reference” section for details on how to specify tfilter. yˆ( ) k Γl y Γl u Γl y Γl u Γl u Γl u