No BSD License  

Highlights from
nlcontrol

nlcontrol

by

 

Nonlinear algorithm for controlling dynamical systems, particularly where linear methods fail.

brdemo.m
% Simulation of data acqusition and control of the liquid bridge.
% The liquid bridge is modeled as a 4-dimensional nonlinear system with 4
% rotational degrees of freedom. The system is double degenerate and
% therefore requires a two-input-two-ouput controller. 
% Nonlinearities are present in the state transition matrix as saturating x^3
% terms, cross-coupling x1*x2 terms and as the term corresponding to the
% crossmixing of the inputs (u1*u2) 
% 
% Control is implemented using a multidimensional nonlinear hypersurface
% algorithm with m = 2 (length of time-delayed sequence), 
% n = 2 (length of the control sequence), 
% d = 1 (delay time before control perturbations reach system output).
% neighbors = 40 number of nearest neighbors used for surface
%    approximation. It has to be larger then the dimension
%    of the extended space (~4*system_dimension). I use at 
%    least a factor of two of that number, i.e neighbors ~10*dimension
% niter=200 Number of points to keep for global approximation.
%    For this example the system is only weakly nonlinear
%    (i.e. the transition matrix is a monotonic function)
%    niter/neighbor = 5 is sufficient for satisfactory results.
%    If the system is highly nonlinear, niter/neighbor ~ (10)^(4*dimension)
%    
% The system is simulated by the routine bursim.m which takes the
% control input vector (u) as its argument and returns the system response.
% This demo requires the folowing subroutines:
%           contr.m - nonlinear controller
%           idseq.m - identification sequence builder
%           ctrseq.m - control sequence builder
%	    bridgesim.m - to simulate the liquid bridge
%	    linint.m - nearest neighbor tangential plane approximation
%	    delaysig2.m - an extended version of delaysig.m
%
% Written by V. Petrov, CNLD 9-11-97
% e-mail: Val.Petrov@chaos.ph.utexas.edu
% 
% Copyright (c) 1997, 1998 The University of Texas at Austin

clear all;
clf;
global Ksi;

echo on
%%%%%%%%%%%%%%%%%%%%%
% Controller structure
m=2; %Length of the observation sequence
d=1; %Perturbation propagation delay. Bridgesim.m has the same parameter.
n=2; %Length of the controlling sequence
neighbors=40; %Number of nearest neighbors for local plane  approximation
niter=200;    %Total number of points for surface reconstruction
echo off
%%%%%%%%%%%%%%%%%%%%%
goaly=Inf;  %Steady state stabilization
goalu=[0; 0];
%goalu=Inf;  %Objective output
%goaly=[0.278; 0.6165];  

u=[0; 0];  %Initial perturbation

for i=1:300

% !!!!!!! This is the only place the system simulator is called !!!!!!!!! 
 y=bridsim(u);

if (i==1)
disp '**********************************************************************'
disp '1. Autonomous dynamics, no perturbations applied.'
disp ' Only two counter-propagating waves of the liquid bridge are modelled'
disp ' in this example'
end
if (i==30)
disp '**********************************************************************'
disp '2. Now we apply random perturbation to two inputs and collect the'
disp '   responces from two outputs (mode=0)'
end

 if(i < 101 & i > 30)
   u=contr(y, goaly, goalu, 0,[1; 1], niter, m, n, d, neighbors); 
 end

if(i==101)
disp '**********************************************************************'
disp '3. In the next 50 steps we try to stabilize the system'
disp '   using linear controller (niter~neighbors)'
end
 if(i > 100 & i < 151)
   u=contr(y, goaly, goalu, 1, [1; 1], 61, m, n, d, 60); 
 end

if(i==151)
disp '**********************************************************************'
disp '4. Adaptive approach to the steady state interogates the control'
disp '   surface by adding small random perturbations to the control'
disp '   perturbations (mode=2) and improves convergence'
end

 if(i > 150 & i < 231)
  u=contr(y, goaly, goalu, 2,[0.1; 0.1], niter, m, n, d, neighbors); 
 end

if(i==231)
disp '**********************************************************************'
disp '5. Control is fully activated to reach the goal unstable state' 
disp '   in minimum number of steps (mode=1)'
disp '**********************************************************************'
end
 if(i > 230)
   u=contr(y, goaly, goalu, 1, [1; 1], niter, m, n, d, neighbors); 
 end
     
 xs(:,i)=y;
 us(:,i)=u;
 Ksis(:,i)=Ksi;
 ind=(max(1,i-29):i);
 figure(1)
  plot(real(Ksis(1,ind)),imag(Ksis(1,ind)),'r-',real(Ksis(3,ind)),imag(Ksis(3,ind)),'g-'), title 'Phase space'

 figure(2)
 subplot(2,1,1), plot(ind,xs(1,ind),'y-',ind,xs(2,ind),'b-'), title 'y';
 subplot(2,1,2), plot(ind,us(1,ind),'ro',ind,us(2,ind),'go'), title 'u';
 drawnow

end

 figure(1)
  plot(real(Ksis(1,:)),imag(Ksis(1,:)),'r.',real(Ksis(3,:)),imag(Ksis(3,:)),'g.'), title 'Phase space'
 figure(2)
 subplot(2,1,1), plot(1:i,xs(1,:),'y-',1:i,xs(2,:),'b-'),title 'y';
 subplot(2,1,2), plot(1:i,us(1,:),'r-',1:i,us(2,:),'g-'),title 'u';







































































Contact us