Practical Approach to Tuning MPC Willy Wojsznis, John Gudaz, Ashish Mehta and Terry Blevins Emerson Process Management willy.wojsznis@emersonprocess.com Keywords Model Predictive Control, DMC, MPC Tuning, Reference Trajectory Abstract This paper presents the results of a heuristic approach for developing MPC tuning rules. The tuning has been applied and tested in easy-to-use MPC. Process modeling in this MPC uses normalized input/output range. As a result, there is no need for tuning outputs, a procedure known as adjusting equal concern error. Penalties on moves are set as a function of process deadtime as a primary factor, with some correction from process gain. The default calculation delivers robust control, which tolerates up to triple increase in process static gain. If control is too aggressive, further on-line adjustment can be done by reference trajectory. Test results show that this tuning is robust for process gain change; however, it is much less efficient in compensating process dead time changes. It was found that dead time mismatch is much better compensated with the model correction filter. Combining the three handles, i.e. penalties on moves, reference trajectory and model filter easy and intuitively understandable MPC tuning was achieved. The findings are illustrated by numerous MPC simulated tests. Introduction MPC is a model based control. Therefore, it would seem that after developing process model, controller design is straightforward. However, MPC controller design -or generation, as it is often called- involves many parameters which strongly affect controller performance and robustness. The main issues related to MPC controller generation are the following: Model equalization – traditional MPC models have inputs/outputs in engineering units. Some outputs like temperature may have a range of a thousand degrees, others like composition have a range of a few units. In a multivariable controller, errors from the two outputs should be equalized. Dynamic Matrix Control (DMC) [7], for example, uses a parameter called equal concern of error for that purpose. This parameter is manually adjusted in simulation by trial and error method. An advance in solving this problem is minimizing the condition number of the system matrix and scaling model accordingly [2]. Penalty on moves – another tuning parameter adjusted by trial and error in a traditional MPC/DMC procedure. On-line controller tuning allows further controller performance adjustment by applying range control, model output filtering and reference trajectory. Interesting considerations and proposals for MPC controller tuning are provided in [1] by Lee, J. and Yu, Z. The tuning is based on sensitivity functions in frequency domain. The main tuning parameter is filter gain. Filter calculations are complemented by deliberate selection of penalty on move factors. Another controller design is presented in [2]. It features significant complexity of on-line calculations, which may be more complex than desirable for an MPC embedded in a system controller. A tuning strategy based on required condition number is discussed in [3]. The current paper presents a tuning approach which features simple and intuitively understandable calculations of tuning parameters, delivering a well performing and robust MPC controller. Controller robustness can be easily increased on-line by adjusting reference trajectory time constant. The procedure was developed for small and medium size controllers and includes the following steps: Reviewing the process model Setting the parameters for controller generation Testing the response in simulation Adjusting MPC once control is in service The tuning satisfies the requirements for embedded MPC implementation in a scalable control system. Model Validation Model validation shows exactness of process model and provides a good indication about the required robustness of the controller. If the model demonstrates a significant mismatch with process, the controller should be more robust. There are several validation techniques available; the simplest one is to review the model to ensure that it reflects your knowledge of the process. We present a design which incorporates human inspection. A typical procedure involves the following steps: 1. Inspection of validation errors for all outputs. Simulation software applies real process input data as process model inputs and displays the root mean square error between the calculated output and the actual output for a selected data set that represents normal operation. If the average output error exceeds 1% per scan, associated step responses should be examined in more detail. Figure 1-A shows model validation for incorrect process gain. This figure shows model validation where the model gain is approximately two times smaller than true process gain. Notice that this gain mismatch results in much smaller changes in predicted process output (upper curve). The average squared error is high (2.35 percent per scan). Figure 1. A. Model validation with significant gain mismatch. B. Model validation with correct gain. Figure 1-B shows validation with correct model. This figure shows the same validation plot as the previous figure but with an acceptable error (.32 percent per scan) and a good model – process match (model gain is approximately –3 percent off). 2. Inspection of every step response. Inspection verifies if the gain sign is correct and that the gain value is in the range expected based on the knowledge of the process. It is a significant advantage when identifier has two or more techniques for model identification, for example ARX and FIR1. If the model is accurate, step responses developed by those two techniques should match. Figure 2-A illustrates FIR and ARX step responses for incorrect model. In this figure, FIR and ARX indicate a different gain sign. One reason for such model inaccuracy might be that the dead time used for ARX algorithm was defined poorly. Improving dead time identification, the FIR and ARX matches acceptably (Figure 2-B). A B Figure 2. A. FIR and ARX step responses for incorrect model. B. FIR and ARX responses for correct model. 3. Making minor corrections in process dynamics. Noisy data may introduce error in the process model. Frequently, this is reflected as irregular shape of the step response. In such situations, it would be advantageous to use graphical or numerical step response design tools to smooth out the step response. 1 ARX – AutoRegressive with eXternal inputs, FIR – Finite Impulse Response 4. Correcting step responses that deviate from expected ranges. Noisy data, insufficient excitation, or short test time for data collection, may produce a process model that is not satisfactory for control. However, if plant conditions do not allow for a better test, one should consider correcting the model based on the knowledge of the process, information gathered by observing trends of the measurement, and the obtained process model. MPC application provides numerical entry or graphical design option for step response parameters. 5. Inspecting validation after making model changes. If someone has modified the model it would be a good practice to observe again how well the calculated and actual outputs match in a selected set of data. Model scaling assumes 100% range on the process input and 100% range on the process output, with the same engineering ranges as used for local measurement and control. This simple solution automatically assures outputs equalization and delivers normalized model for controller generation. MPC tuning calculations The MPC controller is generated from the process model and controller design parameters. The MPC controller minimizes the squared error of a controlled variable over the prediction horizon and the squared error of controller output over control horizon: min y[X (k) - R(k)]2 + uU(k)2 (1.1) U(k) where p – prediction horizon m – control horizon X(k) - controlled output p-step ahead prediction vector R(k) - p-step ahead setpoint vector U(k) - m-step ahead incremental controller output moves vector y = diag{y1 ,...,yp} - penalty matrix on the output error u = diag{u1,...,um} - penalty matrix on the control moves The solution is in the form: -1 U(k)= (SuTyTySu + uTu) SuTyTyEp(k) (1.2) where Su - process dynamic matrix built from step responses: p x m for SISO model and p*no x m*ni matrix for MIMO model with ni inputs and no outputs Ep(k) - error vector over prediction horizon The performance of the control algorithm can be modified by the adjustable parameters: p, m, u, and y. From an implementation standpoint, p and m are not convenient to use as tuning parameters. u and y are usually applied as scalars, that is, control error is multiplied by the scalar y over the whole prediction horizon, and any controller moves over control horizon are multiplied by the scalar u. Figure 3. Controller output change in dependence of penalty on moves. Process model is a first order with time constant equal 30 MPC scans, p=120 Let us explore in more detail how controller output depends on tuning parameters for a controller with m=1 for E p (k) =1. After few calculations on (1.2) we have an equation: p u(k)= (S S + ) S uT yT y u uT u -1 uT yT a i y 1 u 1 ai y p 2 (1.3) 2 where ai are the step response coefficients. Figure 3 shows the dependence of controller output u . It is a good practice to assume Penalty on Error (PE= y ) parameter=1, for most cases, y and use Penalty on Moves (PM= u ) for adjusting the controller performance. change on Controller Robustness Sensitivity of control to changes in process dynamics is determined by the controller robustness. The parameter used in controller generation that most impacts robustness is the Penalty on Moves (PM) (Figure 3). PM defines how much the MPC controller is penalized for change in the manipulated output (MV). The Penalty on Moves parameter is defined independently for every MV. High PM value results in a slow controller with a wide stability margin. With such settings, the control is relatively insensitive to change in either the process or the model errors. Low PM values result in a fast controller with a narrow stability margin. When the model used in generating the control accurately reflects the process gain and dynamics, then changing the PM value does not affect the controller performance significantly. However, a difference in the controller performance will occur if the model does not match the real process. Further exploration of controller robustness has been done experimentally. Figures 4 and 5 show gain margin and deadtime margin dependence on process deadtimes for different times to steady state. The obvious conclusion from the plots is, that the gain margin and the deadtime margin is strongly affected by the deadtime. It follows that deadtime should be accounted for as a major factor in calculating PM. Experimental formula (1.4) defines PM which provides stable and responsive MPC operation for model error of up to about 50%. 6 DTi 3Gi DTi PM i 3 1 p p (1.4) DTi is the deadtime in MPC scans for each MVi - CVi relation Gi is gain (no units) for each MVi - CVi relation MV, CV denote Manipulated Variable and Controlled Variable respectively. In a particular MPC implementation, PM is calculated with no user involvement. In most cases, the calculated setting for PM gives good control even if the model error is greater than +/-50%. Figure 4. Deadtime Margin in dependence of process deadtime Figure 5. Gain Margin in dependence of process deadtime A B Figure 6. Setpoint Step Response Using Default Settings with good model and with process gain 2.5 times the model gain. Figure 6 shows an example of a setpoint step response with a good model match and with process gain equal 2.5 times the model gain. PE equals 1, and PM equals 4 (default calculations according 1.4). Effect of penalties on moves on controller performance is shown in Figure 7-A, that shows the same process-model mismatch as in the Figure 6-B except that PM was set to be equal 20 (five times the default setting). Control Sensitivity To meet application requirements, one may consider giving priority to maintaining a specific process output at the setpoint. Penalty on Error (PE) factor indicates importance placed on a specific Controlled Variable (CV). The default value of the PE is 1 for all CVs and this value provides a good control for most applications. Changing the PE from this default value prioritizes control action. Setting the associated PE to a value greater than 1 realizes more sensitive control for the specific CV, while a PE value less than 1 relaxes the control action. The primary criterion for adjusting the PE is acceptable variability on a specific controlled parameter. A B Figure 7. Utilization of PM and Setpoint Filter to compensate for model mismatch. Testing MPC in simulation After controller generation, as a rule MPC is tested in simulation. The simulation environment facilitates the control response for setpoint changes, measured and unmeasured disturbances, constraints handling, and optimization. Controller performance can be tested by adjusting the A B Figure 8. Utilization of model filter to compensate for dead time mismatch. maximum MV move and the setpoint trajectory online. An operator interface used in simulation is shown in Figure 9. Figure 9. MPC simulation interface Tuning MPC in operation Modifying the setpoint reference trajectories is the primary method of on-line MPC tuning. Increasing the setpoint trajectory filter time constant increases overall controller robustness. It is possible to select a specific CV which exhibits an oscillatory response and increases the related setpoint filter. Figure 7-B shows the same process-model mismatch and controller generation settings as in the Figure 6-B. The controller performance is adjusted online by a setpoint filter time constant that equals 120 (same as Prediction Horizon) for the first step response (up) and 240 (two times the prediction horizon) for the second step response (down). The default setpoint filter time constant in Figure 6-B was 0 (zero). Adjusting the SP filter time constant is recommended in increments of one half of the time to steady state up to two times the value of time to steady state. When model mismatch comes from the dead time in a dead time dominant process, SP filter may not be enough to eliminate chattering of the controlled output. Figure 7-A shows application of SP filter =450 sec, with MPC prediction horizon =600 sec. A significant chattering on the process output has been eliminated after application of the model filter with time constant equal to about ten MPC scans. While adjusting MPC controller, user understanding of process behavior, as well as achievable control objectives, is important. Conclusion A simple and transparent procedure of model validation and automatic calculation of tuning parameters for MPC controller delivers robust controller performance. Controller operation can be next adjusted on-line by adjusting reference trajectory time constant and model output filter. References 1. Lee, J.H., Yu, Z. H., “Tuning of Model Predictive Controllers for Robust Performance,” Computers in Chemical Engineering, Vol.18, No 1, pp.15-37, 1994 2. MacArthur, J. Ward, “RMPCT: A New Robust Approach to Multivariable Predictive Control for the Process Industries,” Proceedings of the 1996 Control Systems Conference, Halifax, Canada, 1996. 3. Rahul Shridhar, Douglas J. Cooper, “A novel tuning strategy for multivariable model predictive control,” ISA Transactions, Vol. 36. No. 4, pp. 273-280, 1998. 4. Willy Wojsznis, Terrence Blevins and Mark Nixon, “Easy Robust Optimal Predictive Controller,” Advances in Instrumentation and Control, ISA/2000 Conference, August 2000, New Orleans. 5. “Scalable Control System: easy-to-use MPC implementation platform,” http://easydeltav.com/eventcentral/videos/casestudies/ 6. Qin, S. J. and Badgwell, T. A., “An Overview of Industrial Model Predictive Control Technology,” Fifth International Conference on Chemical Process control, pages 232-256, AIChE and CACHE, 1997. 7. DMCplus - Multivariable Control Software, 1997