Convert unconstrained MPC controller to state-space linear system
sys = ss(MPCobj)
sys = ss(MPCobj,signals)
sys = ss(MPCobj,signals,ref_preview,md_preview)
[sys,ut] = ss(MPCobj)
ss command returns a linear controller
in the state-space form. The controller is equivalent to the traditional
(implicit) MPC controller
MPCobj when no constraints
are active. You can then use Control System
Toolbox™ software for
sensitivity analysis and other diagnostic calculations.
linear discrete-time dynamic controller
sys = ss(
x(k + 1) = Ax(k) + Bym(k)
u(k) = Cx(k) + Dym(k)
where ym is the vector
of measured outputs of the plant, and u is the
vector of manipulated variables. The sampling time of controller
Vector x includes the states of the observer (plant + disturbance + noise model states) and the previous manipulated variable u(k-1).
returns the linearized MPC controller in its full form and allows you to specify the signals that
you want to include as inputs for
sys = ss(
The full form of the MPC controller has the following structure:
x(k + 1) = Ax(k) + Bym(k) + Brr(k) + Bvv(k) + Bututarget(k) + Boff
u(k) = Cx(k) + Dym(k) + Drr(k) + Dvv(k) + Dututarget(k) + Doff
r is the vector of setpoints for both measured and unmeasured plant outputs
v is the vector of measured disturbances.
utarget is the vector of preferred values for manipulated variables.
signals as a character vector or string with any combination that
contains one or more of the following characters:
'r' — Output references
'v' — Measured disturbances
'o' — Offset terms
't' — Input targets
For example, to obtain a controller that maps [ym; r; v] to u, use:
sys = ss(MPCobj,'rv');
In the general case of nonzero offsets, ym,
r, v, and
utarget must be interpreted as the difference between
the vector and the corresponding offset. Offsets can be nonzero is
Vectors Boff and
Doff are constant terms. They are nonzero if and only
MPCobj.Model.Nominal.DX is nonzero (continuous-time prediction models), or
MPCobj.Model.Nominal.X is nonzero
(discrete-time prediction models). In other words, when
an equilibrium state, Boff,
Doff are zero.
Only the following fields of
MPCobj are used
when computing the state-space model:
specifies if the MPC controller has preview actions on the reference and measured disturbance
signals. If the flag
sys = ss(
ref_preview = 'on', then matrices
Br and Dr
multiply the whole reference sequence:
x(k + 1) = Ax(k) + Bym(k) + Br[r(k);r(k + 1);...;r(k + p – 1)] +...
u(k) = Cx(k) + Dym(k) + Dr[r(k);r(k + 1);...;r(k + p– 1)] +...
Similarly if the flag
matrices Bv and Dv multiply
the whole measured disturbance sequence:
x(k + 1) = Ax(k) +...+ Bv[v(k);v(k + 1);...;v(k + p)] +...
u(k) = Cx(k) +...+ Dv[v(k);v(k + 1);...;v(k + p)] +...
also returns the input target values for the full form of the controller.
ut is returned as a vector of doubles,
utarget(k+1); ... utarget(k+h)].
h — Maximum length of previewed inputs; that is,
utarget — Difference between the input target and corresponding input
offsets; that is,
To improve the clarity of the example, suppress messages about working with an MPC controller.
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.
C to a state-space model.
sys = ss(C);
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,