Documentation Center |
Modify MPC object's linear state estimator
setestim(MPCobj,M)
setestim(MPCobj,'default')
The setestim function modifies the linear estimator gain of an MPC object. The state estimator is based on the linear model (see State Estimation).
x(k + 1) = Ax(k) + B_{u}u(k) + B_{v}v(k)
y_{m}(k) = C_{m}x(k) + D_{vm}v(k)
where v(k) are the measured disturbances, u(k) are the manipulated plant inputs, y_{m}(k) are the measured plant outputs, and x(k) is the overall state vector collecting states of plant, unmeasured disturbance, and measurement noise models. The order of the states in x is the following: plant states; disturbance models states; noise model states.
setestim(MPCobj,M), where MPCobj is an MPC object, changes the default Kalman estimator gain stored in MPCobj to that specified by matrix M.
setestim(MPCobj,'default') restores the default Kalman gain.
The estimator used in Model Predictive Control Toolbox™ software is described in State Estimation. The estimator's equations are as follows.
By combining these three equations, the overall state observer is
where L = AM.
Note The estimator gain M has the same meaning as the gain L in the kalman function in Control System Toolbox™ software. |
Matrices A, B_{u}, B_{v}, C_{m}, D_{vm} can be retrieved using getestim as follows:
[M,A,Cm,Bu,Bv,Dvm]=getestim(MPCobj)
Design an estimator using pole placement, assuming the linear system AM=L is solvable.
Create a plant model.
G = tf({1,1,1},{[1 .5 1],[1 1],[.7 .5 1]});
To improve the clarity of this example, call mpcverbosity to suppress messages related to working with an MPC controller.
old_status = mpcverbosity('off');
Create a model predictive controller for the plant. Specify the controller sample time as 0.2 seconds.
MPCobj = mpc(G, 0.2);
Obtain the default state estimator gain.
[M,A1,Cm1] = getestim(MPCobj);
Calculate the default observer poles.
e = eig(A1-A1*M*Cm1); abs(e)
ans = 0.9402 0.9402 0.8816 0.8816 0.7430 0.9020
Specify faster observer poles.
new_poles = [.8 .75 .7 .85 .6 .81];
Compute a state-gain matrix that places the observer poles at new_poles.
L = place(A1',Cm1',new_poles)';
place returns the controller-gain matrix, whereas you want to compute the observer-gain matrix. Using the principle of duality, which relates controllability to observability, you specify the transpose of A1 and Cm1 as the inputs to place. This function call yields the observer gain transpose.
Obtain the estimator gain from the state-gain matrix.
M=A1\L;
Specify M as the estimator for MPCobj.
setestim(MPCobj,M);
The pair, ( ), describing the overall state-space realization of the combination of plant and disturbance models must be observable for the state estimation design to succeed. Observability is checked in Model Predictive Control Toolbox software at two levels: (1) observability of the plant model is checked at construction of the MPC object, provided that the model of the plant is given in state-space form; (2) observability of the overall extended model is checked at initialization of the MPC object, after all models have been converted to discrete-time, delay-free, state-space form and combined together.
Restore mpcverbosity.
mpcverbosity(old_status);