Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

## Aircraft with Unstable Predictive Model

This example shows how to control an aircraft with saturating actuators.

Reference:

[1] P. Kapasouris, M. Athans and G. Stein, "Design of feedback control systems for unstable plants with saturating actuators", Proc. IFAC Symp. on Nonlinear Control System Design, Pergamon Press, pp.302--307, 1990

[2] A.�Bemporad, A.�Casavola, and E.�Mosca, "Nonlinear control of constrained linear systems via predictive reference management", IEEE® Trans. Automatic Control, vol. AC-42, no. 3, pp. 340-349, 1997.

MPC Controller Setup

```if ~mpcchecktoolboxinstalled('simulink')
disp('Simulink(R) is required to run this example.')
return
end
```

The linearized open-loop dynamic model for the attack and pitch angles as a function of the elevator and flaperon angles is:

```A=[-0.0151 -60.5651 0 -32.174;
-0.0001 -1.3411 0.9929 0;
0.00018 43.2541 -0.86939 0;
0      0       1      0];
B=[-2.516 -13.136;
-0.1689 -0.2514;
-17.251 -1.5766;
0        0];
C=[0 1 0 0;
0 0 0 1];
D=[0 0;
0 0];
sys=ss(A,B,C,D);
x0=zeros(4,1);
```

The manipulated variables are the elevator and flaperon angles, the attack and pitch angles are measured outputs to be regulated. The open-loop response of the system is unstable.

```pole(sys)
```
```ans =

-7.6636 + 0.0000i
5.4530 + 0.0000i
-0.0075 + 0.0556i
-0.0075 - 0.0556i

```

Both inputs are constrained between +/- 25 deg. The task is to get zero offset for piecewise-constant references, while avoiding instability due to input saturation. We also add constraints on the outputs to limit undershoots.

```MV=struct('Min',{-25,-25},'Max',{25,25});
OV=struct('Min',{-0.5,-100},'Max',{0.5,100});
Weights=struct('Input',[0 0],'InputRate',[0 0],'Output',[10 10]);
```

Construct MPC controller.

```Ts=.05;         %Sampling time
Tstop=40*Ts;    %Simulation time
p=10;           % Prediction horizon
m=3;            % Control horizon
mpcafti=mpc(sys,Ts,p,m);
mpcafti.Weights=Weights;
mpcafti.MV=MV;
mpcafti.OV=OV;
```
```-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
```

```mdl = 'mpc_aircraft';
open_system(mdl)
sim(mdl,Tstop)
```
```-->Converting model to discrete time.
-->Integrated white noise added on measured output channel #1.
-->Integrated white noise added on measured output channel #2.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
```

```bdclose(mdl)
```