www.gusucode.com > mpc 案例源码 matlab代码程序 > mpc/ConvertUnconstrainedMPCControllerToStateSpaceModelExample.m

    %% Convert Unconstrained MPC Controller to State-Space Model
% 
%%
% To improve the clarity of the example, suppress messages about working
% with an MPC controller.

% Copyright 2015 The MathWorks, Inc.

old_status = mpcverbosity('off');
%%
% Create the plant model.
G = rss(5,2,3);
G.D = 0;
G = setmpcsignals(G,'mv',1,'md',2,'ud',3,'mo',1,'uo',2);
%%
% Configure the MPC controller with nonzero nominal values, weights, and input targets.
C = mpc(G,0.1);
C.Model.Nominal.U = [0.7 0.8 0];
C.Model.Nominal.Y = [0.5 0.6];
C.Model.Nominal.DX = rand(5,1); 
C.Weights.MV = 2;
C.Weights.OV = [3 4];
C.MV.Target = [0.1 0.2 0.3];
%%
% |C| is an unconstrained MPC controller. Specifying |C.Model.Nominal.DX|
% as nonzero means that the nominal values are not at steady state.
% |C.MV.Target| specifies three preview steps.
%%
% Convert |C| to a state-space model.
sys = ss(C);
%%
% The output, |sys|, is a seventh-order SISO state-space model. The seven
% states include the five plant model states, one state from the default
% input disturbance model, and one state from the previous move, |u(k-1)|.
%%
% Restore |mpcverbosity|.
mpcverbosity(old_status);