Nghiên cứu điều khiển thích nghi cho robot lặn tự hành - 18


in horizontal plan,” International Journal of Control, vol. 87, no. 5, pp. 1076–1093, 2014.

[122] C. Shen, B. Buckham, and Y. Shi, “Modified C/GMRES Algorithm for Fast Nonlinear Model Predictive Tracking Control of AUVs,” IEEE Transactions on Control Systems Technology, vol. 25, no. 5, pp. 1896– 1904, 2017.

[123] J. Gao, A. A. Proctor, Y. Shi, and C. Bradley, “Hierarchical Model Predictive Image-Based Visual Servoing of Underwater Vehicles with Adaptive Neural Network Dynamic Control,” IEEE Transactions on Cybernetics, vol. 46, no. 10, pp. 2323–2334, 2016.

[124] J. Sun and J. Chen, “Networked predictive control for systems with unknown or partially known delay,” IET Control Theory & Applications, vol. 8, no. 18, pp. 2282–2288, 2014.

[125] S. Li and G.P. Liu, “Networked predictive control for nonlinear systems with stochastic disturbances in the presence of data losses,” Neurocomputing, vol. 194, pp. 56–64, 2016.

[126] Y. Sheng, Y. Shen, and M. Zhu, “Delay-dependent global exponential stability for delayed recurrent neural networks,” IEEE Transactions on Neural Networks and Learning Systems, 2016.

[127] C. F. Caruntu and C. Lazar, “Network delay predictive compensation based on time-delay modelling as disturbance,” International Journal of Control, vol. 87, no. 10, pp. 2012–2026, 2014.

[128] Y. Ding, Z. Xu, J. Zhao, K. Wang, and Z. Shao, “Embedded MPC controller based on interior-point method with convergence depth control,” Asian Journal of Control, vol. 18, no. 6, pp. 2064–2077, 2016.

[129] J.Q. Huang and F. L. Lewis, “Neural-network predictive control for nonlinear dynamic systems with time-delay,” IEEE Transactions on Neural Networks and Learning Systems, vol. 14, no. 2, pp. 377–389, 2003.

Có thể bạn quan tâm!

Xem toàn bộ 169 trang tài liệu này.


PHỤ LỤC

Nghiên cứu điều khiển thích nghi cho robot lặn tự hành - 18

CÁC FILE MATLAB ĐỂ THỰC HIỆN MÔ PHỎNG ĐIỀU KHIỂN AUV‌


PL1. File mô phỏng điều khiển hướng và độ sâu AUV


% Submarine control test

% Date: 2019/Apr/14th

% ANNAI control of heading and depth

% Author: PHAM VIET ANH – HCM Unv. Of Transport

%======================================================================

clear; % clear all variables


NN = 6000; % number of sample

h = 0.1; % sample time (sec) i = 0;

% -------------------------------------- z = 0;

delta = 0;

delta_s = 0;

max_delta = 20*(pi/180); max_delta_s = 20*(pi/180);


% Controller's parameters of the rudder

% rho = 1; lambda = 0.2; sigma1 = 0.2; sigma2 = 0.05;

rho = 0.5; lambda = 0.1; sigma1 = 0.2; sigma2 = 0;


% Controller's parameters of the P&S stern planes

rho_s = 0.2; lambda_s = 0.1; sigma1_s = 0.2; sigma2_s = 0;


% ui = [ delta_r delta_s delta_b delta_bp delta_bs n ]'


% initial states: x = [ u v w p q r x y z phi theta psi ]' x = [0.3 0 0 0 0 0 0 0 -10 0 0 0*pi/180]';

U = 0.3;


%*************** START SIMULATION ******************* disp('Running...')


% We start executing the controller with ralative small weights: W21 = rand(6,4)*0.0001; % Set random hidden layer weights

W32 = rand(1,6)*0.0001; % Set random output layer weights W21_s = rand(6,4)*0.0001; % Set random hidden layer weights W32_s = rand(1,6)*0.0001; % Set random output layer weights


% lr_rate(3) = 0.01; % Initial learning rate

% N(3) = 5; % Initial number of iterations

net_in = zeros(4,1); % Set initial inputs of neural network net_in_s = zeros(4,1);


while i < NN, i=i+1;

time = (i-1)*h; % simulation time in seconds clc;


fprintf('Running...n*Counter = %d (%d)n',round(i/10),round((NN- i)/10));


r = x(6);

w = x(3);


% Sensor noise for the heading sensor with a uniform distribution on

% [-0.1,+0.1] deg.

% s = 0.1*(pi/180)*(2*rand - 1);

s = 0; % This allow us to remove the noise psi = x(12) + s; % Heading of the ship with sensor noise Z = x(9);


% psi = x(6);


% control system

% Phuong an 1:

if i<2000, psi_ref(i) = 10*(pi/180); end if i>=2000, psi_ref(i) = 0*(pi/180); end if i>=4000, psi_ref(i) = 10*(pi/180); end

% Phuong an 2

% psi_ref(i) = 10*(pi/180); Z_ref(i) = -4;


err = psi-psi_ref(i); % Do lech huong di so voi huong dat net_in(1) = err;


err_s = Z-Z_ref(i); net_in_s(1) = err_s;


ii=round(i/10);

if round(i/10)==0,ii=2,end


% store data for presentation xout(i,:) = [time,x',U,delta,delta_s]; e_out(ii,:) = [err; err_s];

%----------------------------------------------------------------------

----

% Dau ra cua BDK duoc tinh toan 1 giay 1 lan (theo bien "ii") if ii>3

% Calculate rudder command:

delta = mlnnc(1,6,4,net_in,W21,W32); delta_s = mlnnc(1,6,4,net_in_s,W21_s,W32_s);

if abs(delta)>max_delta,delta=sign(delta)*max_delta;end if

abs(delta_s)>max_delta_s,delta_s=sign(delta_s)*max_delta_s;end


ui = [delta

delta_s 0

0

0

300 ];


[xdot,U] = npsauv(x,ui);

% numerical integration

x = euler2(xdot,x,h); % Euler integration

% z = z + h*err;

% z = z + h*err_s;


% Now update the weights of NN using adaptive interaction algorithm


% (intensive training):

[W21,W32] = annaiTrainIte(h,0.5,50,1,6,4,net_in,... err,delta,r,z,rho,lambda,sigma1,sigma2); % Add

integration action

[W21_s,W32_s] = annaiTrainIte(h,0.5,50,1,6,4,net_in_s,...


err_s,delta_s,w,z,rho_s,lambda_s,sigma1_s,sigma2_s); % Add integration action


net_in(2) = e_out(ii-1,1); net_in(3) = e_out(ii-2,1); net_in(4) = e_out(ii-3,1);


net_in_s(2) = e_out(ii-1,2); net_in_s(3) = e_out(ii-2,2); net_in_s(4) = e_out(ii-3,2);

end % end of "if ii>3"

%----------------------------------------------------------------------


end


% time-series

t = xout(:,1);

u = xout(:,2);

v = xout(:,3);

w = xout(:,4);

p = xout(:,5);

q = xout(:,6);

r = xout(:,7)*180/pi;

X = xout(:,8);

Y = xout(:,9);

Z = xout(:,10);

phi = xout(:,11); theta = xout(:,12);

psi = xout(:,13)*180/pi; U = xout(:,14);

delta = -xout(:,15)*180/pi; delta_s = xout(:,16)*180/pi; psi_ref = psi_ref*180/pi;


% PLOT THE RESULTS

figure(1) clf subplot(211)

plot(t,psi_ref,'LineWidth',2,'Color','r','LineStyle','--') hold on

plot(t,psi,'LineWidth',2,'Color','b','LineStyle','-')

title('NNC control - Yaw angle psi (deg)'),ylabel('[Deg]'),grid on legend('Set course','Heading','Location','Best')

subplot(212) hold on

plot(t,delta,'LineWidth',2,'Color','b','LineStyle','-') title('Rudder angle delta (deg)')

xlabel('Time (s)'),ylabel('[Deg]'),grid on

% legend('PID','NNC')


figure(2) clf

hold on subplot(211)

plot(t,Z_ref,'LineWidth',2,'Color','r','LineStyle','--') hold on


plot(t,Z,'LineWidth',2,'Color','b','LineStyle','-')

title('NNC control - Actual depth Z (m)'),ylabel('[m]'),grid on legend('Desired depth','Actual depth','Location','Best') subplot(212) plot(t,delta_s,'LineWidth',2,'Color','b','LineStyle','-') title('Plane angle delta_s (deg)')

xlabel('Time (s)'),ylabel('[Deg]'),grid on


figure(3) clf

plot3(X,Y,Z,'LineWidth',2,'Color','b','LineStyle','-') grid on

title('Simulation of the AUV track by NNC') xlabel('X(m)'),ylabel('Y(m)'),zlabel('Z(m)')

% >>>>>>END<<<<<<<<


PL2. File mô phỏng điều khiển hướng, độ sâu và tốc độ AUV


% Submarine control test

% Decoupled control of speed, depth and course

% Date: 2009/May/01st

% Author: PHAM VIET ANH – HCM Unv. Of Transport

%======================================================================

clear; % clear all variables


NN = 6000; % number of sample

h = 0.1; % sample time (sec) i = 0;

% -------------------------------------- z = 0;

z_s = 0;

z_n = 0;

delta = 0;

delta_s = 0;

n = 150;

u = 0.3;

max_delta = 20*(pi/180); max_delta_s = 20*(pi/180); max_n = 1500;

%----------------------------------------------------------------------

% Controller's parameters of the rudder

rho = 0.5; lambda = 0.1; sigma1 = 0.2; sigma2 = 0;

%----------------------------------------------------------------------

% Controller's parameters of the P&S stern planes

rho_s = 0.2; lambda_s = 0.1; sigma1_s = 0.2; sigma2_s = 0.01;

%----------------------------------------------------------------------

% Controller's parameters of the propeller

rho_n = 1.5; lambda_n = 0.1; sigma1_n = 0.2; sigma2_n = 0.05;

%----------------------------------------------------------------------

% ui = [ delta_r delta_s delta_b delta_bp delta_bs n ]'


% initial states: x = [ u v w p q r x y z phi theta psi ]' x = [0.3 0 0 0 0 0 0 0 -10 0 0 0*pi/180]';

U = 0.3;


%*************** START SIMULATION ******************* disp('Running...')


% We start executing the controller with ralative small weights: W21 = rand(6,4)*0.0001; % Set random hidden layer weights

W32 = rand(1,6)*0.0001; % Set random output layer weights W21_s = rand(6,4)*0.0001; % Set random hidden layer weights W32_s = rand(1,6)*0.0001; % Set random output layer weights W21_n = rand(6,4)*0.0001; % Set random hidden layer weights W32_n = rand(1,6)*0.0001; % Set random output layer weights


net_in = zeros(4,1); % Set initial inputs of neural network net_in_s = zeros(4,1);

net_in_n = zeros(4,1);


while i < NN, i=i+1;

time = (i-1)*h; % simulation time in seconds clc;

fprintf('Running...n*Counter = %d (%d)n',round(i/10),round((NN- i)/10));


r = x(6);

w = x(3);

udot = u-x(1);

u = x(1);

q = x(5);

theta= x(11);


% Sensor noise for the heading sensor with a uniform distribution on

% [-0.1,+0.1] deg.

% s = 0.1*(pi/180)*(2*rand - 1);

s = 0; % This allow us to remove the noise psi = x(12) + s; % Heading of the ship with sensor noise Z = x(9);


% psi = x(6);


% control system

% Phuong an 1:

if i<2000, psi_ref(i) = 10*(pi/180); end if i>=2000, psi_ref(i) = 0*(pi/180); end if i>=4000, psi_ref(i) = 15*(pi/180); end

% Phuong an 2

% psi_ref(i) = 10*(pi/180); Z_ref(i) = -2;

% if i<3000, ud(i) = 0.4; end

% if i>=3000, ud(i) = 0.5; end ud(i) = 0.4;


err = psi-psi_ref(i); % Do lech huong di so voi huong dat net_in(1) = err;


err_s = Z-Z_ref(i); net_in_s(1) = err_s;


err_n = -u+ud(i); net_in_n(1) = err_n;


ii=round(i/10);

if round(i/10)==0,ii=2,end


% store data for presentation

xout(i,:) = [time,x',U,delta,delta_s,n]; e_out(ii,:) = [err; err_s;err_n];

%---------------------------------------------------------------------

% Dau ra cua BDK duoc tinh toan 1 giay 1 lan (theo bien "ii") if ii>3

% Calculate rudder command:


delta = mlnnc(1,6,4,net_in,W21,W32); delta_s = mlnnc(1,6,4,net_in_s,W21_s,W32_s);

n = mlnnc(1,6,4,net_in_n,W21_n,W32_n)*1500;

if abs(delta)>max_delta,delta=sign(delta)*max_delta;end if

abs(delta_s)>max_delta_s,delta_s=sign(delta_s)*max_delta_s;end if abs(n)>max_n,n=sign(n)*max_n;end


ui = [delta

delta_s 0

0


0

n ];


[xdot,U] = npsauv(x,ui);

% numerical integration

x = euler2(xdot,x,h); % Euler integration z = z + h*err;

z_s = z_s + h*err_s; z_n = z_n + h*err_n;


% Now update the weights of NN using adaptive interaction algorithm

% (intensive training):

[W21,W32] = annaiTrainIte(h,0.5,50,1,6,4,net_in,... err,delta,r,z,rho,lambda,sigma1,sigma2);

% Add integration action

[W21_s,W32_s] = annaiTrainIte(h,0.5,50,1,6,4,net_in_s,...


err_s,delta_s,w,theta,rho_s,lambda_s,sigma1_s,sigma2_s); % Add integration action

[W21_n,W32_n] = annaiTrainIte(h,0.5,50,1,6,4,net_in_n,...


err_n,n/1500,udot,z_n,rho_n,lambda_n,sigma1_n,sigma2_n);% Add integration action


net_in(2) = e_out(ii-1,1); net_in(3) = e_out(ii-2,1); net_in(4) = e_out(ii-3,1);


net_in_s(2) = e_out(ii-1,2); net_in_s(3) = e_out(ii-2,2); net_in_s(4) = e_out(ii-3,2);


net_in_n(2) = e_out(ii-1,3); net_in_n(3) = e_out(ii-2,3); net_in_n(4) = e_out(ii-3,3);

end % end of "if ii>3"

%----------------------------------------------------------------------

----


end


% time-series

t = xout(:,1);

u = xout(:,2);

v = xout(:,3);

w = xout(:,4);

p = xout(:,5);

q = xout(:,6);

r = xout(:,7)*180/pi;

X = xout(:,8);

Y = xout(:,9);

Z = xout(:,10);

phi = xout(:,11);

theta = xout(:,12)*180/pi; psi = xout(:,13)*180/pi; U = xout(:,14);

delta = -xout(:,15)*180/pi; delta_s = xout(:,16)*180/pi; n = xout(:,17);

psi_ref = psi_ref*180/pi;

Xem tất cả 169 trang.

Ngày đăng: 21/02/2023
Trang chủ Tài liệu miễn phí