Open access peer-reviewed chapter

# Efficient Nonlinear Model Predictive Control for Affine System

By Tao Zheng and Wei Chen

Submitted: November 23rd 2010Reviewed: January 25th 2011Published: July 5th 2011

DOI: 10.5772/22952

## 1. Introduction

Model predictive control (MPC) refers to the class of computer control algorithms in which a dynamic process model is used to predict and optimize process performance. Since its lower request of modeling accuracy and robustness to complicated process plants, MPC for linear systems has been widely accepted in the process industry and many other fields. But for highly nonlinear processes, or for some moderately nonlinear processes with large operating regions, linear MPC is often inefficient. To solve these difficulties, nonlinear model predictive control (NMPC) attracted increasing attention over the past decade (Qin et al., 2003, Cannon, 2004). Nowadays, the research on NMPC mainly focuses on its theoretical characters, such as stability, robustness and so on, while the computational method of NMPC is ignored in some extent. The fact mentioned above is one of the most serious reasons that obstruct the practical implementations of NMPC.

Analyzing the computational problem of NMPC, the direct incorporation of a nonlinear process into the linear MPC formulation structure may result in a non-convex nonlinear programming problem, which needs to be solved under strict sampling time constraints and has been proved as an NP-hard problem (Zheng, 1997). In general, since there is no accurate analytical solution to most kinds of nonlinear programming problem, we usually have to use numerical methods such as Sequential Quadric Programming (SQP) (Ferreau et al., 2006) or Genetic Algorithm (GA) (Yuzgec et al., 2006). Moreover, the computational load of NMPC using numerical methods is also much heavier than that of linear MPC, and it would even increase exponentially when the predictive horizon length increases. All of these facts lead us to develop a novel NMPC with analytical solution and little computational load in this chapter.

Since affine nonlinear system can represents a lot of practical plants in industry control, including the water-tank system that we used to carry out the simulations and experiments, it has been chosen for propose our novel NMPC algorithm. Follow the steps of research work, the chapter is arranged as follows:

In Section 2, analytical one-step NMPC for affine nonlinear system will be introduced at first, then, after description of the control problem of a water-tank system, simulations will be carried out to verify the result of theoretical research. Error analysis and feedback compensation will be discussed with theoretical analysis, simulations and experiment at last.

Then, in Section 3, by substituting reference trajectory for predicted state with stair-like control strategy, and using sequential one-step predictions instead of the multi-step prediction, the analytical multi-step NMPC for affine nonlinear system will be proposed. Simulative and experimental control results will also indicate the efficiency of it. The feedback compensation mentioned in Section 2 is also used to guarantee the robustness to model mismatch.

Conclusion and further research direction will be given at last in Section 4.

## 2. One-step NMPC for affine system

### 2.1. Description of NMPC for affine system

Consider a time-invariant, discrete, affine nonlinear system with integer k representing the current discrete time event:

xk+1=f(xk)+g(xk)×ukkE1
xkXRnE2
ukURmE3
ξkRnE4

In the above, uk,xkkare input, state and disturbance of the system respectively, f:RnRn, g:RnRn×mare corresponding nonlinear mapping functions with proper dimension.

Assume x^k+j|kare predictive values of xk+jat time k, Δuk=uk-uk-1and Δu^k+j|kare the solutions of future increment of uk+jat time k, then the objective function Jkcan be written as follow:

Jk=F(x^k+p|k)+j=0p-1G(x^k+j|k,Δuk+j|k)E5

The function F (.) and G (.,.) represent the terminal state penalty and the stage cost respectively, where p is the predictive horizon.

In general, Jkusually has a quadratic form. Assume wk+j|kis the reference value of xk+jat time k which is called reference trajectory (the form of wk+j|kwill be introduced with detail in Section 2.2 and 3.1 for one-step NMPC and multi-step NMPC respectively), semi-positive definite matrix Q and positive definite matrix R are weighting matrices, (2) now can be written as :

Jk=j=1px^k+j|kwk+j|kQ2+j=0p1Δuk+j|kR2E6

Corresponding to (1) and (3), the NMPC for affine system at each sampling time now is formulated as the minimization ofJk, by choosing the increments sequence of future control input[Δuk|kΔuk+1|kΔuk+p1|k], under constraints (1b) and (1c).

By the way, for simplicity, In (3), part of Jkis about the system statexk, if the output of the systemyk=Cxk, which is a linear combination of the state (C is a linear matrix), we can rewrite (3) as follow to make an objective function Jkabout system output:

Jk=j=1pCx^k+j|kwk+j|kQ2+j=0p1Δuk+j|kR2=j=1py^k+j|kwk+j|kQ2+j=0p1Δuk+j|kR2E7

And sometimes, Δuk+j|kin Jkcould also be changed as uk+j|kto meet the need of practical control problems.

### 2.2. One-step NMPC for affine system

Except for some special model, such as Hammerstein model, analytic solution of multi-step NMPC could not be obtained for most nonlinear systems, including the NMPC for affine system mentioned above in Section 2.1. But if the analytic inverse of system function exists (could be either state-space model or input-state model), the one-step NMPC always has the analytic solution. So all the research in this chapter is not only suitable for affine nonlinear system, but also suitable for other nonlinear systems, that have analytic inverse system function.

Consider system described by (1a-1d) again, the one-step prediction can be deduced directly as follow with only one unknown data Δuk|k=uk|kuk1at time k:

x^k+1|k=f(xk)+g(xk)uk|k=f(xk)+g(xk)uk1+g(xk)Δuk|k=x^k+1|k1+g(xk)Δuk|kE8

In (5), x^k+1|k1means the part which contains only known data (xkanduk-1) at time k, and g(xk)Δuk|kis the unknown part of predictive statex^k+1|k.

If there is no model mismatch, the predictive error of (5) will bex˜k+1|k=xk+1x^k+1|k=ξk+1. Especially, if ξkis a stationary stochastic noise with zero mean and varianceE[ξk]=δ2, it is easy known thatE[x˜k+1|k]=0, andE[(x˜k+1|kE[x˜k+1|k])T(x˜k+1|kE[x˜k+1|k])]=nδ2, in another word, both the mean and the variance of the predictive error have a minimum value, so the prediction is an optimal prediction here in (5).

Then if the setpoint isxsp, and to soften the future state curve, the expected state value at time k+1 is chosen aswk+1|k=αxk+(1α)xsp, where α[0,1)is called soften factor, thus the objective function of one-step NMPC can be written as follow:

Jk=x^k+1|kwk+1|kQ2+Δuk|kR2E9

To minimize Jkwithout constraints (1b) and (1c), we just need to have JkΔuk|k=0and2JkΔuk|k20, then:

Δuk|k=(g(xk)TQg(xk)+R)1(g(xk)Q(x^k+1|k1wk+1|k))E10

Mark H=g(xk)TQg(xk)+RandF=g(xk)Q(wk+1|kx^k+1|k1), so the increment of instant future input is:

Δuk|k=H1FE11

But in practical control problem, limitations on input and output always exist, so the result of (8) is usually not efficient. To satisfy the constraints, we can just put logical limitation on amplitudes of ukandxk, or some classical methods such as Lagrange method could be used. For simplicity, we only discuss about the Lagrange method here in this chapter.

First, suppose every constraint in (1b) and (1c) could be rewritten in the form asaiTΔuk|kbi, i=1,2,q, then the matrix form of all constraints is:

AΔuk|kBE12

In which, A=[a1Ta2T...aqT]TB=[b1b2...bq]T.

Choose Lagrange function asLk(λi)=Jk+λiT(aiTΔuk|kbi),i=1,2,q, let LΔuk|k=HΔuk|k+F+aiλi=0andLλi=aiTΔuk|kbi=0, then:

Δuk|k=H1(F+aiλi)E13
λi=aiTH1F+biaiTH1aiE14
If λi0in (10b), means that the corresponding constraint has no effect onΔuk|k, we can chooseλ¯i=0, but if λi0in (10b), the corresponding constraint has effect on Δukindeed, so we must chooseλ¯i=λi, finally, the solution of one-step NMPC with constraints could be:
Δuk|k=H1(F+ATΛ¯)E15

In which, Λ¯=[λ¯1λ¯2λ¯q]T

### 2.3. Control problem of the water-tank system

Our plant of simulations and experiments in this chapter is a water-tank control system as that in Fig. 1. and Fig. 2. (We just used one water-tank of this three-tank system). Its affine nonlinear model is achieved by mechanism modeling (Chen et al., 2006), in which the variables are normalized, and the sample time is 1 second here:

xk+1=xk0.2021xk+0.01923ukE16

s. t.

xk[0%,100%]E17

uk[0%,100%]E18

In (12), xkis the height of water in the tank, and ukis the velocity of water flow into the tank, from pump P1 and valve V1, while valve V2 is always open. In the control problem of the water-tank, for convenience, we choose the system state as the output, that meansyk=xk, and the system functions are f(xk)=xk0.2021xkandg(xk)=0.01923.

To change the height of the water level, we can change the velocity of input flow, by adjusting control current of valve V1, and the normalized relation between the control current and the velocity ukis shown in Fig. 3.

## 2.4 One-step NMPC of the water-tank system and its feedback compensation

Choose objective functionJk=(x^k+1|kwk+1|k)2+0.001Δuk|k2, xsp=30%and soften factorα=0.95, to carry out all the simulations and the experiment in this section. (except for part of Table 1., where we chooseα=0.975)

Suppose there is no model mismatch, the simulative control result of one-step NMPC for water-tank system is obtained as Fig. 4. and it is surely meet the control objective. Figure 4.Simulation of one-step NMPC without model mismatch and feedback compensation

To imitate the model mismatch, we change the simulative model of the plant from xk+1=xk0.2021xk+0.01923uktoxk+1=xk110%×0.2021xk+90%×0.01923uk, but still use xk+1=xk0.2021xk+0.01923ukto be the predictive model in one-step NMPC, the result in Fig. 5. now indicates that there is obvious steady-state error. Figure 5.Simulation of one-step NMPC with model mismatch but without feedback compensationProposition 1: For affine nonlinear systemxk+1=f(xk)+g(xk)uk, if the setpoint isxsp, steady-state is usandxs, and the predictive model isxk+1=f(xk)+g(xk)uk, without consideration of constraints, the steady-state error of one-step NMPC ise=xsxsp=(f(xs)f(xs))+(g(xs)g(xs))us1α, in which αis the soften factor.Proof: If the system is at the steady-state, then we have xk1=xk=xsanduk1=uk=us.

Sinceuk1=uk=us, soΔuk=0, from (8), we know matrix F=0, or equally(wk+1|kx^k+1|k1)=0.

Update the process of one-step NMPC at time k, we have:

wk+1|k=αxk+(1α)xsp=αxs+(1α)xspE19
x^k+1|k1=f(xk)+g(xk)uk1=f(xs)+g(xs)usE20

(13)-(14), and notice that xs=f(xs)+g(xs)usfor steady-state, we get:

0
=αxs+(1α)xspf(xs)g(xs)us=xsf(xs)g(xs)us+(1α)xsp(1α)xsE21
=(f(xs)f(xs))+(g(xs)g(xs))us+(1α)(xspxs)E22
So:
e=xsxsp=(f(xs)f(xs))+(g(xs)g(xs))us1αE23

Proof end.

Because the soften factorα[0,1), thus 1α0always holds, the necessary condition for e=0is(f(xs)f(xs))+(g(xs)g(xs))us=0. When there is model mismatch, there will be steady-state error, while this error is independent of weight matrix Q and dependent of the soften factorα. For corresponding discussion on steady-state error of one-step NMPC with constraints, the only difference is (11) will take the place of (8) in the proof.

Table 1. is the comparison on e=xsxspbetween simulation and theoretical analysis, and they have the same result. (simulative modelxk+1=xk110%×0.2021xk+90%×0.01923uk, predictive modelxk+1=xk0.2021xk+0.01923uk)

  Q e=xs-xspSimulation(%) e=xs-xspValue of (15)(%) 0.975 0 -8.3489 -8.3489 0.001 -8.3489 -8.3489 0.01 -8.3489 -8.3489 0.95 0 -4.5279 -4.5279 0.001 -4.5279 -4.5279 0.01 -4.5279 -4.5279

### Table 1.

Comparison on e=xsxspbetween simulation and theoretical analysis

From (15) we know, we cannot eliminate this steady-state error by adjustingα, so feedback compensation could be used here, mark the predictive error ekat time k as follow:

ek=xkx^k|k1=xk(x^k|k11+g(xk1)Δuk1)E24

In which, xkis obtained by system feedback at time k, and x^k|k1is the predictive value of xkat time k-1.

Then add ekto the predictive value of xk+1at time k directly, so (5) is rewritten as follow:

x^k+1|k=f(xk)+g(xk)uk1+g(xk)Δuk|k+ek=x^k+1|k1+g(xk)Δuk|k+ekE25

Use this new predictive value to carry out one-step NMPC, the simulation result in Fig. 6. verify its robustness under model mismatch, since there is no steady-state error with this feedback compensation method.

The direct feedback compensation method above is easy to understand and carry out, but it is very sensitive to noise. Fig. 7. is the simulative result of it when there is noise add to the system state, we can see that the input vibrates so violently, that is not only harmful to the actuator in practical control system, but also harmful to system performance, because the actuator usually cannot always follow the input signal of this kind.

To develop the character of feedback compensation, simply, we can use the weighted average error e¯kinstead of single ekin (17):

x^k+1|k=x^k+1|k1+g(xk)Δuk|k+i=1shiek+1i=x^k+1|k1+g(xk)Δuk|k+e¯k,i=1shi=1E26

Choosei=20, hi=0.05, the simulative result is shown in Fig. 8. Compared with Fig. 7. it has almost the same control performance, but the input is much more smooth now. Using the same method and parameters, experiment has been done on the water-tank system, the result in Fig. 9. also verifies the efficiency of the proposed one-step NMPC for affine systems with feedback compensation. Figure 6.Simulation of one-step NMPC with model mismatch and direct feedback compensation Figure 7.Simulation of one-step NMPC with model mismatch, noise and direct feedback compensation Figure 8.Simulation of one-step NMPC with model mismatch, noise and smoothed feedback compensation

## 3. Efficient multi-step NMPC for affine system

Since reference trajectory and stair-like control strategy will be used to establish efficient multi-step NMPC for affine system in this chapter, we will introduce them in Section 3.1 and 3.2 at first, and then, the multi-step NMPC algorithm will be discussed with theoretical research, simulations and experiments.

### 3.1. Reference trajectory for future state

In process control, the state usually meets the objective in the form of setpoint along a softer trajectory, rather than reach the setpoint immediately in only one sample time. This may because of the limit on control input, but a softer change of state is often more beneficial to actuators, even the whole process in practice. This trajectory, usually called reference trajectory, often can be defined as a first order exponential curve:

wk+j|k=αwk+j1|k+(1α)xsp,j=1,2,,p1E27

In which, xspstill denotes the setpoint, α[0,1)is the soften factor, and the initial value of the trajectory iswk|k=xk.The value of αdetermines the speed of dynamic response and the curvature of the trajectory, the larger it is, the softer the curve is. Fig. 10. shows different trajectory with differentα. Generally speaking, suitable αcould be chosen based on the expected setting time in different practical cases.

### 3.2. Stair-like control strategy

To lighten the computational load of nonlinear optimization, which is one of the biggest obstacles in NMPC’s application, stair-like control strategy is introduced here. Suppose the first unknown control input’s incrementΔuk=ukuk1=Δ, and the stair coefficient βis a positive real number, then the future control input’s increment can be decided by the following expression:

Δuk+j=βΔu=k+j1βjΔuk=βjΔ,j=1,2,,p1E28

Instead of the full future sequence of control input’s increment:[ΔukΔuk+1Δuk+p1], which has p independent variables. Using this strategy, in multi-step NMPC, it now need only computeΔuk. The computational load now is independent of the length of predictive horizon, which is very convenient for us to choose long predictive horizon in NMPC to obtain a better control performance (Zheng et al., 2007).

Since the dynamic optimization process will be repeated at every sample time, and only instant input uk=uk-1+Δukwill be carried out actually in NMPC, this strategy is efficient here. In the strategy, it supposes the future increase of control input will be in a same direction, which is the same as the experience in control practice of the human beings, and prevents the frequent oscillation of the input, which is very harmful to the actuators in real control plants. Fig. 11. shows the input sequences with differentβ.

### 3.3. Multi-step NMPC for affine system

The one-step NMPC in Section 2 is simple and fast, but it also has one fatal disadvantage. Its predictive horizon is only one step, while long predictive horizon is usually needed for better performance in MPC algorithms. One-step prediction may lead overshooting or other bad influence on system’s behaviour. So we will try to establish a novel efficient multi-step NMPC based on proposed one-step NMPC in this section.

In this multi-step NMPC algorithm, the first step prediction is the same as (5), then follows the prediction of x^k+1|kin (5), the one-step prediction of x^k+j|k,j=2,3,,pcould be obtained directly:

x^k+j|k=f(x^k+j1|k)+g(x^k+j1|k)uk+j1|kE29

Since x^k+j1|kalready contains nonlinear function of former data, one may not obtain the analytic solution of (21) for prediction more than one step. Take the situation of j=2 for example:

x^k+2|k=f(x^k+1|k)+g(x^k+1|k)uk+1|k=f(f(xk)+g(xk)uk|k)+g(f(xk)+g(xk)uk|k)uk+1|kE30

For most nonlinear f(.) and g(.), the embedding form above makes it impossible to get an analytic solution of uk+1and further future input. So, using reference trajectory, we modified the one-step predictions when j2as follow:

x^k+j|k=f(wk+j1|k)+g(wk+j1|k)uk+j1=f(wk+j1|k)+g(wk+j1|k)(uk1+i=0j1Δuk+i|k)E31

Using the stair-like control strategy, markΔuk|k=Δ, (23) can be transformed as:

x^k+j|k=f(wk+j1|k)+g(wk+j1|k)(uk1+i=0j1βiΔ)=f(wk+j1|k)+g(wk+j1|k)uk1+g(wk+j1|k)i=0j1βiΔ=x^k+j|k1+g(wk+j1|k)i=0j1βiΔE32

Here, x^k+j|k1contains only the known data at time k, while the other part is made up by the increment of future input, thus the unknown data are separated linearly by (24), so the analytic solution of Δcan be achieved.

Forj=1,2,,p, write the predictions in the form of matrix:
X^k=[x^k+1|kx^k+2|kx^k+p|k]Xk1=[x^k+1|k1x^k+2|k1x^k+p|k1]Wk=[wk+1|kwk+2|kwk+p|k]ΔUk=[Δuk|kΔuk+1|kΔuk+p1|k]=[ΔβΔβp1Δ]Sk=[g(wk|k)=g(xk)00g(wk+1|k)g(wk+1|k)0g(wk+p1|k)g(wk+p1|k)g(wk+p1|k)]=[s100s2s20spspsp]SkΔUk=[s1s2(1+β)sp(1+β++βp1)]Δ=S¯kΔE33
ThusX^k=Xk1+SkΔUk=Xk1+S¯kΔ, for minimization of traditional quadric objective functionminΔJk=minΔ[(X^kWk)TQ(X^kWk)+ΔUkTRΔUk], where semi-positive definite matrix Q and positive definite matrix R are weighting matrices, by JkΔ=0and2JkΔ20, the control solution of multi-step prediction is then obtained. Especially for single input problem, with objective functionminΔJk=minΔ[(X^kWk)T(X^kWk)+rΔUkTΔUk], it is easily denoted as follow:
Δ=S¯kT(WkXk1)S¯kTS¯k+r(1+β2++β2(p1))E34

At last, the instant input uk|k=uk1+Δcan be carried out actually. As mentioned in Section 2, and if the model mismatch can be seen as time-invariant in p sample time (usually satisfied in the case of steady state in practice), to maintain the robustness, ekor e¯kcan be also added to every prediction as mentioned in (17) and (18):

x^k+1|k=f(xk)+g(xk)uk|k+e¯kx^k+j|k=f(wk+j1|k)+g(wk+j1|k)uk+j1|k+e¯k,j=2,3,,pE35

Though there are approximate predictions in the novel NMPC which may take in some inaccuracy, the feedback compensation mentioned above and the new optimization process at every sample time will eliminate the error before its accumulation, to keep the efficiency of the algorithm. The constraints also could be handled by methods mentioned Section 2 or by other numerical optimizing algorithm, thus we would not discuss about it here again.

### 3.4. Multi-step NMPC of the water-tank system

Chooseα=0.975, β=0.5, r=0.005, xsp=60%or30%and predictive horizon p=10to carry out simulations. Still use the different plant model and predictive model as that of Fig. 5. and Fig. 6. to imitate the model mismatch, the result in Fig. 12. and Fig. 13. shows the efficiency and robustness of this efficient multi-objective NMPC.

Chooseα=0.975, β=0.5, r=0.005, xsp=60%to carry out experiments. Comparing control result between one-step NMPC and multi-step NMPC in Fig. 14. and Fig. 15., we can see the obvious developments on both input and output of the water-tank system when longer predictive horizon is used. It also verifies the efficiency of proposed novel multi-step NMPC algorithm. At last, Fig. 16. is the satisfactory performance of the efficient multi-step NMPC under disturbance (we open an additional outlet valve of the tank for 20 seconds). Figure 12.Simulation of multi-step NMPC with model mismatch but without feedback compensation Figure 13.Simulation of multi-step NMPC with model mismatch and feedback compensation Figure 14.Experiment of one-step NMPC with setpointxsp=60%(Overshooting exists when setpoint is higher thanFig. 9.) Figure 15.Experiment of one-step NMPC with setpointxsp=60%(p=10 and and No overshooting)

## 4. Conclusion

Using a series of approximate one-step predictions instead of the traditional multi-step prediction, the proposed multi-step NMPC leaded to an analytic result for nonlinear control of affine system. The use of stair-like control strategy caused a very little computational load and the feedback compensation brought robustness of model mismatch to it.

The simulations and experiments verify the practicability and efficiency of this multi-step NMPC for affine system, while the theoretical stability and other analysis will be the future work with considerable value.

## Acknowledgments

This work is supported by National Natural Science Foundation of China (Youth Foundation, No. 61004082) and Special Foundation for Ph. D. of Hefei University of Technology (No. 2010HGBZ0616, from the Fundamental Research Funds for the Central Universities).

chapter PDF
Citations in RIS format
Citations in bibtex format

## How to cite and reference

### Cite this chapter Copy to clipboard

Tao Zheng and Wei Chen (July 5th 2011). Efficient Nonlinear Model Predictive Control for Affine System, Advanced Model Predictive Control, Tao Zheng, IntechOpen, DOI: 10.5772/22952. Available from:

### Related Content

#### This Book

Edited by Tao Zheng

Next chapter

#### Implementation of Multi-dimensional Model Predictive Control for Critical Process with Stochastic Behavior

By Jozef Hrbcek and Vojtech Simak

#### Frontiers of Model Predictive Control

Edited by Tao Zheng

First chapter

#### A Real-Time Gradient Method for Nonlinear Model Predictive Control

By Knut Graichen and Bartosz Käpernick

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.