LQ and Model Predictive Control (MPC) of a tank process

Similar documents
LQ Control of a Two Wheeled Inverted Pendulum Process

Automatic Control II Computer exercise 3. LQG Design

Multivariable Control Laboratory experiment 2 The Quadruple Tank 1

16.30 Estimation and Control of Aerospace Systems

Rural/Urban Migration: The Dynamics of Eigenvectors

Chapter 7 Interconnected Systems and Feedback: Well-Posedness, Stability, and Performance 7. Introduction Feedback control is a powerful approach to o

YTÜ Mechanical Engineering Department

4F3 - Predictive Control

1. Type your solutions. This homework is mainly a programming assignment.

Optimal control and estimation

CHAPTER 2 MODELING OF THREE-TANK SYSTEM

sc Control Systems Design Q.1, Sem.1, Ac. Yr. 2010/11

State Feedback MAE 433 Spring 2012 Lab 7

Lec 6: State Feedback, Controllability, Integral Action

Computer Aided Control Design

CDS Final Exam

Infinite Horizon LQ. Given continuous-time state equation. Find the control function u(t) to minimize

Module 03 Linear Systems Theory: Necessary Background

YTÜ Mechanical Engineering Department

Module 9: State Feedback Control Design Lecture Note 1

Linear Parameter Varying and Time-Varying Model Predictive Control

4F3 - Predictive Control

Robust Model Predictive Control for Autonomous Vehicle/Self-Driving Cars

Laboratory 11 Control Systems Laboratory ECE3557. State Feedback Controller for Position Control of a Flexible Joint

Linear System Theory. Wonhee Kim Lecture 1. March 7, 2018

EL2450: Hybrid and Embedded Control Systems: Homework 1

Modeling and Model Predictive Control of Nonlinear Hydraulic System

Process Control Exercise 2

Input-output data sets for development and benchmarking in nonlinear identification

CALIFORNIA INSTITUTE OF TECHNOLOGY Control and Dynamical Systems

Automatic Control 2. Model reduction. Prof. Alberto Bemporad. University of Trento. Academic year

State Feedback Controller for Position Control of a Flexible Link

Control Design. Lecture 9: State Feedback and Observers. Two Classes of Control Problems. State Feedback: Problem Formulation

Lecture 9 Nonlinear Control Design

FEEDBACK CONTROL SYSTEMS

Overview of Models for Automated Process Control

MATH4406 (Control Theory) Unit 6: The Linear Quadratic Regulator (LQR) and Model Predictive Control (MPC) Prepared by Yoni Nazarathy, Artem

Problem Set 3: Solution Due on Mon. 7 th Oct. in class. Fall 2013

Lecture 4 and 5 Controllability and Observability: Kalman decompositions

ECE504: Lecture 8. D. Richard Brown III. Worcester Polytechnic Institute. 28-Oct-2008

Intermediate Process Control CHE576 Lecture Notes # 2

Outline. 1 Linear Quadratic Problem. 2 Constraints. 3 Dynamic Programming Solution. 4 The Infinite Horizon LQ Problem.

Schiestel s Derivation of the Epsilon Equation and Two Equation Modeling of Rotating Turbulence

Online Model Predictive Torque Control for Permanent Magnet Synchronous Motors

Model Predictive Control

Chapter 3 Least Squares Solution of y = A x 3.1 Introduction We turn to a problem that is dual to the overconstrained estimation problems considered s

SAMPLE SOLUTION TO EXAM in MAS501 Control Systems 2 Autumn 2015

Lecture 9 Nonlinear Control Design. Course Outline. Exact linearization: example [one-link robot] Exact Feedback Linearization

Optimizing Control of Hot Blast Stoves in Staggered Parallel Operation

Improved Predictions from Measured Disturbances in Linear Model Predictive Control

EEE582 Homework Problems

Linearization problem. The simplest example

Variable-gain output feedback control

Lecture 2: Discrete-time Linear Quadratic Optimal Control

1 Continuous-time Systems

Model predictive control of industrial processes. Vitali Vansovitš

Linear System Theory

AUTOMATIC CONTROL. Andrea M. Zanchettin, PhD Spring Semester, Introduction to Automatic Control & Linear systems (time domain)

Subject: Optimal Control Assignment-1 (Related to Lecture notes 1-10)

MS-E2133 Systems Analysis Laboratory II Assignment 2 Control of thermal power plant

Control Systems Lab - SC4070 Control techniques

Contents lecture 6 2(17) Automatic Control III. Summary of lecture 5 (I/III) 3(17) Summary of lecture 5 (II/III) 4(17) H 2, H synthesis pros and cons:

7.1 Linear Systems Stability Consider the Continuous-Time (CT) Linear Time-Invariant (LTI) system

Advanced Process Control Tutorial Problem Set 2 Development of Control Relevant Models through System Identification

Math Camp Notes: Everything Else

Department of Mechanical Engineering ME 96. Free and Forced Convection Experiment. Revised: 25 April Introduction

State Regulator. Advanced Control. design of controllers using pole placement and LQ design rules

1. Linearity of a Function A function f(x) is defined linear if. f(αx 1 + βx 2 ) = αf(x 1 ) + βf(x 2 )

New Lyapunov Krasovskii functionals for stability of linear retarded and neutral type systems

Appendix A Solving Linear Matrix Inequality (LMI) Problems

(Refer Slide Time: 00:01:30 min)

Perspective. ECE 3640 Lecture 11 State-Space Analysis. To learn about state-space analysis for continuous and discrete-time. Objective: systems

Chapter 9 Observers, Model-based Controllers 9. Introduction In here we deal with the general case where only a subset of the states, or linear combin

Linear Quadratic Zero-Sum Two-Person Differential Games Pierre Bernhard June 15, 2013

Iterative Controller Tuning Using Bode s Integrals

Comparing Methods for System Identification on the Quadruple Tank Process

On-off Control: Audio Applications

PREDICTIVE CONTROL OF NONLINEAR SYSTEMS. Received February 2008; accepted May 2008

Modeling and Analysis of Dynamic Systems

Properties of Open-Loop Controllers

Module 07 Controllability and Controller Design of Dynamical LTI Systems

6.241 Dynamic Systems and Control

Discrete Time Systems:

Time-Invariant Linear Quadratic Regulators!

OPTIMAL CONTROL WITH DISTURBANCE ESTIMATION

Real-Time Voltage Stability Monitoring using PMUs

CHAPTER 1 Basic Concepts of Control System. CHAPTER 6 Hydraulic Control System

10/8/2015. Control Design. Pole-placement by state-space methods. Process to be controlled. State controller

NONLINEAR PREDICTIVE CONTROLLER: INFLUENCE OF ITERATIONS NUMBER ON REGULATION QUALITY

Robotics. Control Theory. Marc Toussaint U Stuttgart

Principles of Optimal Control Spring 2008

Feedback Control of Turbulent Wall Flows

9. Introduction and Chapter Objectives

Introduction to Controls

Merging Optimization and Control

CHAPTER 2 CONTINUOUS STIRRED TANK REACTOR PROCESS DESCRIPTION

MULTIVARIABLE PROPORTIONAL-INTEGRAL-PLUS (PIP) CONTROL OF THE ALSTOM NONLINEAR GASIFIER MODEL

Übersetzungshilfe / Translation aid (English) To be returned at the end of the exam!

Lecture 9: Discrete-Time Linear Quadratic Regulator Finite-Horizon Case

ECEN 420 LINEAR CONTROL SYSTEMS. Lecture 6 Mathematical Representation of Physical Systems II 1/67

Transcription:

Uppsala University Information Technology Systems and Control Susanne Svedberg 2000 Rev. 2009 by BPGH, 2010 by TS, 2011 by HN Last rev. September 22, 2014 by RC Automatic control II Computer Exercise 4 LQ and Model Predictive Control (MPC) of a tank process Preparation exercises: Preparation exercises 1 and 2. Reading instructions: Chapter 5, 9 and 16 in GladLjung Name Assistant's comments Program Year of reg. Date Passed prep. ex. Passed comp. ex. Sign Sign

Contents 1 Introduction 1 1.1 Survey................................. 1 2 Modeling of the process 3 2.1 Physical modeling.......................... 3 3 LQ control of the tank process 6 3.1 Theory................................. 6 3.2 Controller design........................... 7 4 Model Predictive Control of the tank process 9 4.1 Theory................................. 9 4.2 Controller design........................... 11 i

1 Introduction This laboratory work is partially based on Computer Exercise 3. Therefore it is advisable to have Computer Exercise 3 fresh in mind before starting this laboratory work. The goal of this laboratory work is to illustrate how physical modeling can be used to form a mathematical model of a real process and how this model can be used for controller design. Two dierent control methods, LQ control and MPC, will be compared. Both methods use state-space models in the controller design. 1.1 Survey In this laboratory work a tank process is modeled using physical modeling. The resulting non linear model is linearized around a stationary operating point and the model is used in the design of the controllers. The water level in the lower tank is controlled using these controllers. The laboratory work consists of the following steps: Modeling using physical relations from uid mechanics and experimental estimation of the parameters in the model. The model is described in state-space form. LQ control of the process. Knowing the model of the system and using the experience about LQ from Computer Exercise 3, an LQ controller is designed. The water level in the lower tank is then controlled. Model Predictive Control of the process. With the knowledge of the system in forms of model and physical limitations an MP C is designed. Comparisons are then made between the LQ controller and the MPC. The tank system consists of two identical water tanks placed on top of each other. Each tank has a small hole in the bottom so that the water can ow from the upper tank to the lower and from the lower tank to a container below the system. The holes are approximately equally large in both tanks. An electrical pump moves the water from the container to the upper tank. Each tank is equipped with a sensor that delivers a voltage that is approximately proportional to the water level in the tank. The process is depicted schematically in Figure 1. 1

q 1in h 1 y 1 q 1out = q 2in u PUMP h 2 y 2 q 2out Water Figure 1: The tank process The input signal to the process is the voltage u (volts) to the electrical pump. The ow of water through the pump is approximately proportional to the voltage u: q pump = K p u (1) The output signals from the process are the voltages y 1 and y 2 (volts) from the water level sensors in the upper and lower tank respectively. Since the sensors are nearly linear the following relations between the output signals and the water levels h 1 and h 2 in the both tanks are obtained: y 1 = K 1 h 1 (2) y 2 = K 2 h 2 (3) where K 1 and K 2 are the proportionality constants of the water level sensors. 2

2 Modeling of the process 2.1 Physical modeling In this section a non linear model of the tank system is derived. The model is then linearized around a stationary operating point. The tank process can be described by the two coupled dierential equations and A 1 dh 1 dt = q 1in q 1out (4) A 2 dh 2 dt = q 2in q 2out (5) where A is the area of the cross sections of the tanks. The Equations (4) and (5) simply state that the net change of volume in a tank is equal to the dierence between the volume entering the tank and the volume leaving it. The ow into the upper tank, q 1in, is equal to the ow out of the electrical pump, q pump = K p u, which gives q 1in = K p u. (6) Furthermore, the ow into the lower tank is equal to the ow out of the upper tank, so q 2in = q 1out. (7) The ows out from the two tanks, q 1out and q 2out are given by Torricelli's principle: and q 1out = a 1 2gh1 (8) q 2out = a 2 2gh2. (9) where a is the area of the holes. By putting all this together the following non linear model for the system is obtained: A 1 dh 1 a 1 dt A 2 dh 2 a 2 dt = 2gh 1 + K p a 1 u (10) = 2gh 1 2gh 2 (11) Now introduce the stationary working point u = u 0 h 1 = h 01 h 2 = h 02 3

where the last two sets of equalities should ideally be approximately the same following the fact that the areas of the holes in the two tanks are equal. Note that a stationary working point is dened by the water levels being constant so that dh 1 /dt = dh 2 /dt = dh 0i /dt = 0, and from Equation (10) we obtain 0 = dh 0 1 dt = 2gh 01 + K p a 1 u 0. (12) The non linear model (10)(11) is now linearized. This is done by a Taylor series expansion around the working point. From (10) A 1 dh 1 = g 2gh 01 (h 1 h 01 ) + K p u 0 + K p (u u 0 ) a 1 dt 2h 01 a 1 a 1 +Higher order terms (13) g = (h 1 h 01 ) + K p (u u 0 ) 2h 01 a 1 +Higher order terms (14) where, in the last equality, Equation (12) has been used. From (11) A 2 dh 2 = g 2gh 01 + (h 1 h 01 ) g 2gh 02 (h 2 h 02 ) a 2 dt 2h 01 2h 02 +Higher order terms (15) g g = (h 1 h 01 ) (h 2 h 02 ) 2h 01 2h 02 +Higher order terms (16) Introducing the notations for the deviations from the operating point h 1 = h 1 h 01 h 2 = h 2 h 02 u = u u 0 the linearized model (neglecting terms of second order or higher) d h 1 dt d h 2 dt is obtained, where T i = A i a i = 1 T 1 h 1 + K p A 1 u (17) = 1 T 1 h 1 1 T 2 h 2 (18) 2h 0i g (19) Using Equation (10) with u equal to zero, or Equation (11) with h 1 equal to zero, gives dh i hi = a i A i 2gdt (20) 4

Integrating the left hand side from the height h 1i to the height h 2i and the right hand side from time t 1 to t 2 gives an expresion for a i A i as a i = 2( h1i h 2i ) (21) A i 2g ti Hence T i = t i h0i h1i (22) h 2i The Equations (2) and (3) now give the nal model: d y 1 dt d y 2 dt = 1 T 1 y 1 + K pk 1 A 1 u (23) = 1 T 1 K 2 K 1 y 1 1 T 2 y 2 (24) Note that the model is linearized around a certain working point (h 0i, u 0 ). The linearized system will thus not behave exactly as the original system, but the approximation is reasonable for small deviations from the working point. Preparation exercise 1: Give a model of the system in state-space form. Let the states be the (voltage) deviation of the water levels from the working point and let the output be the level (voltage) deviation in the lower tank. Execute the script tankparameters.m to obtain the parameters for the model. Exercise: Give the state space model for the system with the numerical values for the parameters. 5

Controller Tank System r(k) u(k) x(k) y(k) m ẋ = Ax + Bu C L Figure 2: Block diagram of the LQ controller and the tank system Exercise: Are there any physical limitations on the system? If yes, what are they? We now have the continuous-time model of the process. In Matlab linear systems can be represented as LTI objects (LTI is an abbreviation for Linear Time Invariant). Thus, a linear system may be treated as a single object rather than being described by the system matrices. In order for your model to be used for control design, it is necessary to convert the model into this form. The controllers will then convert the model into discrete time using the sampling time chosen by you. Form the LTI object contsys using the ss command. Note that it is possible to get help in Matlab for the dierent functions by typing help fname. 3 LQ control of the tank process 3.1 Theory An LQ controller as described in Computer Exercise 3 and in Glad-Ljung Chapter 9 will be used. We will use the LQ controller to nd a suitable desired closed-loop system. The system is described in the form of a block diagram 6

in Figure 2. The main idea for the LQ controller is to minimize a quadratic criterion. Consider a system in state space form x(k + 1) = Ax(k) + Bu(k) (25) y(k) = Cx(k) where all the states are measured. The system can be controlled with a statefeedback: u(k) = Lx(k) + mr(k) (26) where m is chosen so that the closed loop system has unit static gain. In the LQ design, the gain matrix, L, is determined so that the following cost function is minimized: V = [r(k) y(k)] 2 Q 1 + [u(k)] 2 Q 2 (27) k=1 where y and u are scalars. Eq (27) can be compared with eq (9.35) in Glad Ljung. The closed loop system in state space form is then x(k + 1) = (A BL)x(k) + Bmr(k) (28) y(k) = Cx(k) The gain matrix, L, hence depends on the weights Q 1 and Q 2 in eq. (27). Preparation exercise 2: Consider the criterion in eq. (27). Explain how Q 1 and Q 2 aect the closed loop system. How can Q 1 and Q 2 aect the fastness of the closed loop system and why? 3.2 Controller design The controller is designed in the same way as the LQ controller in Computer Exercise 3. The Matlab function lq_sim load your continuous-time state space model of the system, contsys and the parameters K1, K2, u0, h0 in tankparameters.m. convert the model into discrete time using a sampling interval tsamp. 7

calculates L from the LQ criteria. calculates m so that the static gain (r y = x 2 ) equals 1. control the tank system given an external reference signal, r(t). The LQ control of the tank process is activated with the function: where lq_sim( Q 1, Q 2, r, Tscale, tsamp) Q 1 is the weight on the output signal and must be given. Note that only the ratio Q 1 /Q 2 determines the characteristics of the controller. Q 2 is the weight on the manipulated signal and must be given. r is the reference signal to be specied to the system. Keep in mind that it is given as a deviation with respect to the working point. Tscale is the time scale for the plot. Default value is [360] seconds. tsamp is the sampling time. Default is [1] second. Alternatively, one can simulate how the system responds when the input has a maximum and/or minimum value, which is quite common in real systems. In this case, the pump can take values between 0 and 9V. The LQ control with bounded inputs is activated with the function: lq_sim_cap( Q 1, Q 2, r, Tscale, tsamp) whose arguments work in the same way as in the unbounded version. Exercise How does bounding the input aect the response of the system? 8

Exercise How does the ratio Q 1 /Q 2 (for example 1, 100 and the result you had in Computer Exercise 3) aect the response of the system? Are there any benets or drawbacks with big values of Q 1 /Q 2? Exercise How can overow be prevented? 4 Model Predictive Control of the tank process As seen in the LQ control of the process the tanks can easily overow which in a real situation might be very expensive and/or dangerous and not at all optimal. The most desirable feature in MPC is the way it allows and implements constraints into the control design. Here you will try some dierent MPC design strategies. 4.1 Theory Theory was presented during the lectures and will therefore only be mentioned briey. The tank system is given in state space form: x(k + 1) = Ax(k) + Bu(k) (29) y(k) = Cx(k) 9

where both the states x 1 and x 2 are assumed measurable. The basic criterion to be minimized, with respect to the input signal, is given by: V (k) = P M Q 1 (r(k + j) ŷ(k + j)) 2 + Q 2 ( û(k + j)) 2 j=1 where Q 1 = the weight on the output error. Q 2 = the weight on the increment of the input signal, u. r = the reference signal (target). ŷ = the predicted output, see example 16.1 in GladLjung. û = the increment of the input (u(k) = u(k 1) + û(k), and û(k + j) = û(k + j 1) + û(k + j) for j = 1,..., M) j=1 For a schematic view of the prediction horizon (P) and the control horizon (M), see Figure 3. As in the LQ controller the ratio of the weights Q 1 /Q 2 is of importance for the minimization. When the constraints are added to the controller the minimization problem becomes nonlinear and numerical methods are needed to solve the minimization problem. past future reference ŷ(k + j) y Control signal u(k) k k+1 k+2 k+m k+p control horizon prediction horizon Figure 3: A schematic view of the horizons of Model Predictive Control. 10

4.2 Controller design The design will use the Matlab function mpc_sim, which: loads your continuous-time state space model of the system, contsys in tankparameters.m. converts the model into discrete time using a sampling interval tsamp. designs the controller according to the parameters you choose. controls the tank system given an external reference signal, r(t). The Model Predictive Controller of the tank process is activated with the Matlab function: where mpc_sim(q 1, Q 2, r, M, P, ylim, ulim, Tscale, tsamp) Q 1 is the weight on the output signal, the water level in the lower tank. It must be given. Q 2 is the weight on the manipulated signal. It must be given. ylim are the constraints on the two output signals, the tank levels: [C y1 min C y2 min C y1 max C y2 max]. The default values are [-inf -inf inf inf], i.e. no constraints. ulim are the constraints on the manipulated signal, the pump voltage: [C umin C umax ]. The default values are [-inf inf], i.e. no constraints. M is the control horizon (called N in GladLjung). It is usually much smaller than P. Can be from 1 up to P. The size of the optimization problem is determined by the size of M. Default value is [3]. P is the prediction horizon (called M in Glad-Ljung) and should cover the rise time of the system. Default value is [30]. Tscale is the duration of the simulation. Default value is [360] seconds. tsamp is the sampling time. Default is [1] second. 11

Exercise How do the constraints aect the control of the system? Are there any major dierences between this control and the LQ control (consider approximate rise times, sensitivity for measurement noise and risk of overow)? Try dierent horizons and sampling time. For example try some of the following combinations: M = 3 P = 30 tsamp = 2 (default) M = 3 P = 10 tsamp = 2 M = 3 P = 10 tsamp = 0.5 M = 3 P = 15 tsamp = 5 Of course you can try other values instead/as well. Try dierent values for all the parameters. Make some step changes and evaluate the results! Exercise How do the dierent tuning parameters aect the controller and thereby the closed loop system? a, The eect of dierent control horizons, M? b, The eect of dierent prediction horizons, P? a, The eect of dierent sampling times, tsamp? 12