📄 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 Austinclear all;clf;global Ksi;echo on%%%%%%%%%%%%%%%%%%%%%% Controller structurem=2; %Length of the observation sequenced=1; %Perturbation propagation delay. Bridgesim.m has the same parameter.n=2; %Length of the controlling sequenceneighbors=40; %Number of nearest neighbors for local plane approximationniter=200; %Total number of points for surface reconstructionecho off%%%%%%%%%%%%%%%%%%%%%goaly=Inf; %Steady state stabilizationgoalu=[0; 0];%goalu=Inf; %Objective output%goaly=[0.278; 0.6165]; u=[0; 0]; %Initial perturbationfor 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'endif (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); endif(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); endif(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); endif(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'; drawnowend 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';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -