I am using integral action even when the error is zero from 8 to 9 seconds, the controller output stays above 0. As the disturbance is a step input, once the controller “forget” the disturbance, the error will start again, as shown from 10 seconds onwards.
The phase margin is very small. This means the system is marginally stable and that instability can be caused by a very small amount of delay.
We can increase the phase margin through a phase compensator so that a small delay will not introduce in huge instabilities.
Manual control is unable to reduce the error.
When the number of unstable poles is equal to the number of encirclement of the critical point (-1/K, 0). When K is greater than 0.5, -1/K will be less than -2, which allows the encirclement of pole at -2.
At the origin, there will be a spiral similar to the first Nyquist plot in the report (Section 2). Assuming the delay is small, parts of the plot other than the original will stay the same.
gain: 17.4199829 time period = 1.771`
%
% Command file flysim.m for 3F1 Flight Control Experiment.
% Copyright: Cambridge University Engineering Department, October 1994.
% Author: M.C. Smith.
%
% T=0.4;
num=[6.3, 4.3, 0.28];den=[1, 11.2, 19.6, 16.2, 0.91, 0.27]; % Numerator and denominator of plant
% Laplace transfer function
runtime=15; % target simulation interval in seconds
wght=[0,2,0,0]; % entries are: impulse, step and sinusoid disturbance
% weightings and sinusoidal frequency (Hz). Impulse and step
% occur randomly between 0.2 and 0.6 secs. Sinusoid
% begins at t=0.
samper=30; % target sampling period in milliseconds
srate=(samper+1.3)/1000; % anticipated average sampling period in secs
% was samper+0.6
grphc1
integ=0;
deriv=0;
yprev=0;
Kp=10.44;
Ti=0.9;
Td=0.225*1.4;
% Td=0.225;
for i=1:count
set(hh,'Xdata',hx,'Ydata',hy+y*hz);
% pp=p(1,2);
integ=integ + y * srate;
integ=sign(integ)*min(abs(integ),0.169);
deriv=(y-yprev)/srate;
pp=-Kp*(y+integ/Ti+deriv*Td);
yprev=y;
pp=sign(pp)*min(max(0,abs(pp)-0),10);
set(jh,'Xdata',jx,'Ydata',jy+pp*jz);
drawnow;
ylist(i)=y;
ulist(i)=pp;
x=adis*x + bdis*(pp+disturb(i));
y=cdis*x + ddis*(pp+disturb(i));
while (time2-time1<samper)
time2=clock;time2=1000*(60*time2(5)+time2(6));
end
thetimes(i)=time2;
time1=time2;
if (y<-10 | y>10 )
flg=1;crashind=i+1;
thetimes(i+1)=thetimes(i)+samper;
ylist(i+1)=y;
ulist(i+1)=sign(p(1,2))*min(abs(p(1,2)),10);
break;
end
end
grphc2