Hide minor edits - Show changes to markup
% create a closed-loop system loop = ClosedLoop(empc, anothermodel);
autpwa = loop.toSystem();
autpwa = ClosedLoop(empc, anothermodel).toSystem();
@]
@]
@]
@]
It is also possible to verify whether a given explicit MPC controller provides closed-loop stability when coupled with a different system:
(:source lang=MATLAB :)% a different model will be used for the verification anothermodel = LTISystem('A', [1 1; 0 0.9], 'B', [1; 0.5]); % create a closed-loop system loop = ClosedLoop(empc, anothermodel); % convert the closed-loop system into an autonomous PWA system autpwa = loop.toSystem(); % construct the PWQ Lyapunov function L = autpwa.lyapunov('pwq'); % plot the PWQ Lyapunov function L.fplot('lyapunov');
This feature is currently only available in development releases of MPT3. To install the latest development version, run the following:
(:source lang=MATLAB :)tbxmanager source add http://www.tbxmanager.com/package/unstable.xml/mpt tbxmanager update
MPT3 allows to construct piecewise quadratic (PWQ) Lyapunov functions for autonomous PWA systems via the PWASystem/lyapunov()
method.
Example which verifies closed-loop stability of an explicit MPC controller:
(:source lang=MATLAB :)model = LTISystem('A', [1 1; 0 1], 'B', [1; 0.5]); model.x.min = [-5; -5]; model.x.max = [5; 5]; model.u.min = -1; model.u.max = 1; model.x.penalty = QuadFunction(eye(2)); model.u.penalty = QuadFunction(1); % add LQR terminal set and terminal penalty model.x.with('terminalSet'); model.x.terminalSet = model.LQRSet(); model.x.with('terminalPenalty'); model.x.terminalPenalty = model.LQRPenalty(); N = 5; % prediction horizon empc = MPCController(model, N).toExplicit(); % create a closed-loop system loop = ClosedLoop(empc, model); % convert the closed-loop system into an autonomous PWA system autpwa = loop.toSystem(); % construct the PWQ Lyapunov function L = autpwa.lyapunov('pwq'); % plot the PWQ Lyapunov function L.fplot('lyapunov');