Index: mttroot/mtt/lib/control/PPP/ppp_qp.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_qp.m +++ mttroot/mtt/lib/control/PPP/ppp_qp.m @@ -1,6 +1,6 @@ -function [u,U,iterations] = ppp_qp (x,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu) +function [u,U,iterations] = ppp_qp (x,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu,test) ## usage: [u,U] = ppp_qp (x,W,J_uu,J_ux,J_uw,Gamma,gamma) ## INPUTS: ## x: system state ## W: Setpoint vector @@ -22,10 +22,14 @@ if nargin<9 mu = 0 endif + if nargin<10 + test=0; + endif + ## Check the sizes n_x = length(x); [n_U,m_U] = size(J_uu); @@ -39,11 +43,11 @@ endif if length(gamma)>0 # Constraints exist: do the QP algorithm ## QP solution for weights U - [U,iterations] = qp_mu(J_uu,(J_ux*x - J_uw*W),Gamma,gamma,mu); + [U,iterations] = qp_mu(J_uu,(J_ux*x - J_uw*W),Gamma,gamma,mu,[],[],0,test); ##U = qp(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # QP solution for weights U ##U = pd_lcp04(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # QP solution for weights U u = Us0*U; # Control signal else # Do the unconstrained solution Index: mttroot/mtt/lib/control/PPP/ppp_qp_sim.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_qp_sim.m +++ mttroot/mtt/lib/control/PPP/ppp_qp_sim.m @@ -1,9 +1,9 @@ function [T,y,u,X,Iterations] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q,\ Tau_u,Min_u,Max_u,Order_u, \ Tau_y,Min_y,Max_y,Order_y, \ - W,x_0,Delta_ol,mu,movie) + W,x_0,Delta_ol,mu,test,movie) ## usage: [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, Tau_u,Min_u,Max_u,Order_u, Tau_y,Min_y,Max_y,Order_y, W,x_0,movie) ## Needs documentation - see ppp_ex11 for example of use. ## OUTPUTS ## T: Time vector @@ -14,19 +14,23 @@ if nargin<19 # No intermittent control Delta_ol = 0; endif - if nargin<20 # No movie + if nargin<20 # Mu mu = 0; endif - if nargin<21 # No movie + if nargin<21 + test=0 + endif + + if nargin<22 # No movie movie = 0; endif - +test = test ## Check some sizes [n_x,n_u,n_y] = abcddim(A,B,C,D); [n_x0,m_x0] = size(x_0); if (n_x0 != n_x)||(m_x0 != 1) @@ -111,11 +115,11 @@ ## Current Setpoint value w = W(:,floor(t/dt)+1); ## Compute U(t) via QP optimisation - [uu, U, iterations] = ppp_qp (x,w,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu); # Compute U + [uu, U, iterations] = ppp_qp (x,w,J_uu,J_ux,J_uw,Us0,Gamma,gamma,mu,test); # Compute U ## Compute the cost (not necessary but maybe interesting) # [J_t] = ppp_cost (U,x,W,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww); # cost # J = [J J_t];