dyn_ca_sl

PURPOSE ^

Wrapper used in the dynamic control allocation Simulink block.

SYNOPSIS ^

function u = dyn_ca_sl(arg,B,plim,rlim,T,Wv,W1,W2,S)

DESCRIPTION ^

 Wrapper used in the dynamic control allocation Simulink block.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function u = dyn_ca_sl(arg,B,plim,rlim,T,Wv,W1,W2,S)
0002   
0003 % Wrapper used in the dynamic control allocation Simulink block.
0004   
0005 % Dimensions
0006   [k,m] = size(B);
0007   
0008   % Extract nonconstant input arguments
0009   v = arg(1:k);
0010   uprev = arg(k+1:end);
0011   
0012   % Formulate as a regular QP problem: min ||Wu(u-ud)||
0013   W1sq = W1^2;
0014   W2sq = W2^2;
0015   Wu = sqrtm(W1sq+W2sq);
0016   invWusq = inv(W1sq+W2sq);
0017 
0018   us = S*v;
0019   ud = invWusq*(W1sq*us+W2sq*uprev);
0020   
0021   % Overall position limits
0022   if isempty(rlim)
0023     umin = plim(:,1);
0024     umax = plim(:,2);
0025   else
0026     umin = max(plim(:,1),uprev+rlim(:,1)*T);
0027     umax = min(plim(:,2),uprev+rlim(:,2)*T);
0028   end
0029   
0030   % Use WLS -- fast and robust.
0031   u = wls_alloc(B,v,umin,umax,Wv,Wu,ud);

Generated on Wed 25-Aug-2004 14:38:35 by m2html © 2003