[mpsol,diag,aux,Valuefunction,Optimizer] = solvemp(F,obj,[],x{1},u{1})
ctrlYalmip = EMPCController(mpt_mpsol2pu(mpsol));
The structure ctrlYalmip will be filled in incomplete. For example
ctrlYalmip.N = N;
ctrlYalmip.nu = nu;
are missing also. But this is not such a big problem because I can fill in them manually later on although not nice.
The problem/bug comes here (MPT):
[uYalmip,feasibleYalmip,openloopYalmip] = ctrlYalmip.evaluate(x0);
function [u, feasible, openloop] = evaluate(obj, xinit, varargin)
...
[U, feasible, idx, J] = obj.optimizer.feval(xinit, ...
'primal', 'tiebreak', 'obj');
...
will return only with one element in U despite of the fact that for example N = 3
(The open-loop u{1}, u{2}, u{3} is required to get working EMPCController evaluate(x0))
therefore this error will come:
Error using EMPCController/evaluate (line 216)
Number of optimizers is inconsistent with "N" and/or "nu".
- How could I reach with solvemp to get a correct form in mpsol which is good for MPT and to get a MPT consistent ctrl object?
- How can I get the open loop solution from solvemp in YALMIP at all?
- Does it exist in YALMIP similar method to this: [uYalmip,feasibleYalmip,openloopYalmip] = ctrlYalmip.evaluate(x0);?
2.) If I use a different, second method which is written in the MPT User guide:
ctrlMptYal = MPCController(sys,N);
Y = ctrlMptYal.toYALMIP();
...
Y.constraints = F; % F in YALMIP formulation
Y.objective = obj; % obj in YALMIP formulation
ctrlMptYal.fromYALMIP(Y);
ctrlMptYalExplct = EMPCController(ctrlMptYal);
figure;
subplot(2,1,1);
ctrlMptYalExplct.partition.plot();
title('MPT\_YALMIP mix');
subplot(2,1,2);
ctrlMptYalExplct.feedback.fplot();
[uMptYal,feasibleMptYal,openloopMptYal] = ctrlMptYalExplct.evaluate(x0)
then MPT ignores the complete YALMIP constraints completely.
- Why?
--------------------------------------------------------------------------------------------------------------------------
- So I can not realize the original, with the older MPT worked communication between the MPT and the YALMIP.
- How could I resolve this issue?
And a last, little general question:
-Can
explicit MPC polihedron/polytope slices plot in YALMIP also (for example
in case of 4 state variables) or only with MPT toolbox with
slice12 = ctrl.partition.slice([1,2],[0,0]);
figure;
slice12.plot()
xlabel('x_3'); ylabel('x_4');