% Demostration program to simulate the boundary control of beam equation
% with time delays using Smith predictor and its variants
% It takes about half an hour to finish all demos on PIII 1G, 256M
% Copyright: Jinsong Liang and YangQuan Chen
% Last modified: 02/16/2003
clear all
close all
syms x
% initialization
m = 0; % tip mass, only zero has been tested for Smith predictor control
alfa = 0.1; % static controller gain
theta_real = 0.05; % real delay
theta_guess = 0.05; % guessed delay
u_0 = x^3 - 3*x^2; % initial displacement condition
v_0 = 0; % initial velocity condition, only zero has been tested
t_sim = 25; % simulation time
steps_x = 20; % number of points in x direction for simulation
% end of initialization
disp('Demostration of boundary control of beam equation with time delays using modified Smith predictor')
disp('WARNING: it takes about half an hour to finish all demos on PIII 1G, 256M memory.')
disp(' So the recommended hardware configuration is: PIV 4G, 1G memory ;)')
disp('Case 1: Boundary control of beam equation with time delays using static controller only.');
input('Press any key to continue.\n');
ctrl_type = 0;
beam_smith(m, theta_real, theta_guess, ctrl_type, [alfa], u_0, v_0);
clear x % syms x is not needed any more
global x; % global parameters needed in funciton F_lap.m,
% generated in beam_smith.m
x = 1;
[v_tip_t, t_v] = nilt('F_lap_v', t_sim);
v_tip_t = real(v_tip_t);
figure
subplot(2,1,1)
plot(t_v, v_tip_t)
xlabel('\itt')
ylabel('\itv', 'rotation', 0)
title('tip velocity using static controller only')
[u_tip_t, t] = nilt('F_lap', t_sim);
u_tip_t = real(u_tip_t);
subplot(2,1,2)
plot(t, u_tip_t)
xlabel('\itt')
ylabel('\itu', 'rotation', 0)
title('tip displacement using static controller only')
%keyboard
u_xt = [];
for x = 0:1/steps_x:1,
[u_xt_new, t] = nilt('F_lap', t_sim);
u_xt_new = real(u_xt_new);
u_xt = [u_xt, u_xt_new'];
end
x = 0:1/steps_x:1;
figure
[X, T] = meshgrid(x, t);
% There is distortion in u(x,0), due to unknown reasons possibly in nilt.m
% So u(x,0) is discarded in the plot of displacement of whole beam
surf(X(2:end,:), T(2:end, :), u_xt(2:end, :), 'FaceColor','interp', ...
'EdgeColor','none', 'FaceLighting','phong')
%daspect([5 5 1])
%axis tight
view(-50,30)
camlight left
xlabel('\itx');
ylabel('\itt')
zlabel('\itu(x,t)')
title('Displacement of whole beam using static controlle only');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear x;
syms x
u_0 = x^3 - 3*x^2; % initial displacement condition
v_0 = 0; % initial velocity condition, only zero has been tested
disp('Case 2: Boundary control of beam equation with time delays using plain Smith predictor.');
input('Press any key to continue.\n');
ctrl_type = 1;
beam_smith(m, theta_real, theta_guess, ctrl_type, [alfa], u_0, v_0);
clear x % syms x is not needed any more
global x; % global parameters needed in funciton F_lap.m,
% generated in beam_smith.m
x = 1;
[v_tip_t, t_v] = nilt('F_lap_v', t_sim);
v_tip_t = real(v_tip_t);
figure
subplot(2,1,1)
plot(t_v, v_tip_t)
xlabel('\itt')
ylabel('\itv', 'rotation', 0)
title('tip velocity using plain Smith predictor')
[u_tip_t, t] = nilt('F_lap', t_sim);
u_tip_t = real(u_tip_t);
subplot(2,1,2)
plot(t, u_tip_t)
xlabel('\itt')
ylabel('\itu', 'rotation', 0)
title('tip displacement using plain Smith predictor')
%keyboard
u_xt = [];
for x = 0:1/steps_x:1,
[u_xt_new, t] = nilt('F_lap', t_sim);
u_xt_new = real(u_xt_new);
u_xt = [u_xt, u_xt_new'];
end
x = 0:1/steps_x:1;
figure
[X, T] = meshgrid(x, t);
% There is distortion in u(x,0), due to unknown reasons possibly in nilt.m
% So u(x,0) is discarded in the plot of displacement of whole beam
surf(X(2:end,:), T(2:end, :), u_xt(2:end, :), 'FaceColor','interp', ...
'EdgeColor','none', 'FaceLighting','phong')
%daspect([5 5 1])
%axis tight
view(-50,30)
camlight left
xlabel('\itx');
ylabel('\itt')
zlabel('\itu(x,t)')
title('Displacement of whle beam using plain Smith predoctor');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear x;
syms x % now we need x to be a sym rather than a double
u_0 = x^3 - 3*x^2; % initial displacement condition
v_0 = 0; % initial velocity condition, only zero has been tested
disp('Case 3: Boundary control of beam equation with time delays using Smith predictor with lead-lag filter.');
input('Press any key to continue.\n');
ctrl_type = 2;
k_flt = 1.0681;
z_flt = 0.6283;
p_flt = 1.2681;
beam_smith(m, theta_real, theta_guess, ctrl_type, [alfa, k_flt, z_flt, p_flt], u_0, v_0);
clear x % now we need x to be a double rath than a sym
global x; % global parameters needed in funciton F_lap.m,
% generated in beam_smith.m
x = 1;
[v_tip_t, t_v] = nilt('F_lap_v', t_sim);
v_tip_t = real(v_tip_t);
figure
subplot(2,1,1)
plot(t_v, v_tip_t)
xlabel('\itt')
ylabel('\itv', 'rotation', 0)
title('tip velocity using Smith predictor with lead-lag filter')
[u_tip_t, t] = nilt('F_lap', t_sim);
u_tip_t = real(u_tip_t);
subplot(2,1,2)
plot(t, u_tip_t)
xlabel('\itt')
ylabel('\itu', 'rotation', 0)
title('tip displacement using Smith predictor with lead-lag filter')
%keyboard
u_xt = [];
for x = 0:1/steps_x:1,
[u_xt_new, t] = nilt('F_lap', t_sim);
u_xt_new = real(u_xt_new);
u_xt = [u_xt, u_xt_new'];
end
x = 0:1/steps_x:1;
figure
[X, T] = meshgrid(x, t);
% There is distortion in u(x,0), due to unknown reasons possibly in nilt.m
% So u(x,0) is discarded in the plot of displacement of whole beam
surf(X(2:end,:), T(2:end, :), u_xt(2:end, :), 'FaceColor','interp', ...
'EdgeColor','none', 'FaceLighting','phong')
%daspect([5 5 1])
%axis tight
view(-50,30)
camlight left
xlabel('\itx');
ylabel('\itt')
zlabel('\itu(x,t)')
title('Displacement of whole beam using Smith predictor with lead-lag filter')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear x;
syms x % now we need x to be a sym rather than a double
u_0 = x^3 - 3*x^2; % initial displacement condition
v_0 = 0; % initial velocity condition, only zero has been tested
disp('Case 4: Boundary control of beam equation with time delays using Smith predictor with time advance approximator');
input('Press any key to continue.\n');
ctrl_type = 3;
k_flt = 1.0364e4;
tao_flt = 7.27099;
beam_smith(m, theta_real, theta_guess, ctrl_type, [alfa, k_flt, tao_flt], u_0, v_0);
clear x % now we need x to be a double rath than a sym
global x; % global parameters needed in funciton F_lap.m,
% generated in beam_smith.m
x = 1;
[v_tip_t, t_v] = nilt('F_lap_v', t_sim);
v_tip_t = real(v_tip_t);
figure
subplot(2,1,1)
plot(t_v, v_tip_t)
xlabel('\itt')
ylabel('\itv', 'rotation', 0)
title('tip velocity using Smith predictor with time advance approximator')
[u_tip_t, t] = nilt('F_lap', t_sim);
u_tip_t = real(u_tip_t);
subplot(2,1,2)
plot(t, u_tip_t)
xlabel('\itt')
ylabel('\itu', 'rotation', 0)
title('tip displacement using predictor with time advance approximator')
%keyboard
u_xt = [];
for x = 0:1/steps_x:1,
[u_xt_new, t] = nilt('F_lap', t_sim);
u_xt_new = real(u_xt_new);
u_xt = [u_xt, u_xt_new'];
end
x = 0:1/steps_x:1;
figure
[X, T] = meshgrid(x, t);
% There is distortion in u(x,0), due to unknown reasons possibly in nilt.m
% So u(x,0) is discarded in the plot of displacement of whole beam
surf(X(2:end,:), T(2:end, :), u_xt(2:end, :), 'FaceColor','interp', ...
'EdgeColor','none', 'FaceLighting','phong')
%daspect([5 5 1])
%axis tight
view(-50,30)
camlight left
xlabel('\itx');
ylabel('\itt')
zlabel('\itu(x,t)')
title('Displacement of whole beam using Smith predictor with time advance approximator');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%