Tutorials
Tutorials
PROBLEM DEFINITION
ANIMATION
SOLUTION
>%Steady-State Error Ex1 >%The problem definition used in this example is adopted and modified from: Dorf, Richard C. & Robert H. Bishop (1998): "Modern Control Systems" . eighth edition. page 283, >%Addison Wesley >%Solution by Xin Yang, Pitt Oppermann and Belinda Schwerin, ICSL (Griffith University)
Part 1)
The step responses for K1 and K2 values ranging from 1 to 5 are plotted. From these, the characteristics can be viewed to find those which yield the best rise time with overshoot less than 5%. Since it is also required that the rise time be reasonable, the fastest system may not be the most suitable.
K1=[1:1:5]; num=[tau1 1]; dent1=[tau2 1]; dent2=[1 0 0]; for n2=1:length(K2) num1=K2(n2)*num; T1=tf(num1, dent1); for n1=n2:length(K1) num2=K1(n1); T2=tf(num2, dent2); G=T1*T2; T=feedback(G,1); figure step(T) % graphical representation of step response % define tau of numerator of Controller % define denominator of Controller % define denominator of G1(s) % iterate through each value of K2 % define numerator of Controller % create transfer function of Controller % iterate through each value of K1 % define numerator of G1 (s) % create transfer function of G1 (s) % create open-loop transfer function % create closed-loop transfer function
title(['Step Response with K1= ' num2str(K1(n1)) ' and K2= ' , num2str(K2(n2))]) end end
Part_1) RESULTS
Below is an extract of the results generated by the MATLAB program. We can see the first graph, with K1=5 and K2=2 has an overshoot more than 5% which doesn't meet the specifications for the question. The value of gain K=K1 K2=10 and the transfer function is equal to: Transfer function: 10 s + 10 --------------s^2 + 10 s + 10
The function considered to best meet all requirements for the problem, has K1=4 and K2=4. Here the percentage overshoot is 4.78%, which is less than the 5% required, and the rise time is only 0.118 seconds. The value of gain K=K1 K2=16 and the transfer function is equal to: Transfer function: 16 s + 16 -----------------------s^2 + 16 s + 16 Below is the corresponding graph:
The third graph included here is an example of results where the overshoot and fast rise time requirements are met, however the rise time is likely to be too fast for the telescope. The value of corresponding gain K=K1 K2=20 and the transfer function is equal to: Transfer function: 20 s + 20 --------------s^2 + 20 s + 20
Part 2)
%Determine steady-state error of the system for a step and a ramp input clc; close all; clear all; tau1=1; tau2=0; %---------------------------------------------------------------% Controller, G1(s) and Graphical Output %---------------------------------------------------------------K2=4; num=[tau1 1]; K1=4; % define tau of numerator of Controller
num1=K2*num; dent1=[tau2 1]; T1=tf(num1, dent1); num2=K1; dent2=[1 0 0]; T2=tf(num2, dent2); G=T1*T2; T=feedback(G,1); figure [y1, t1] = step(T); step(T); figure plot(t1, 1-y1); error for a step input
% define numerator of Controller % define denominator of Controller % create transfer function of Controller % define numerator of G1(s) % define denominator of G1 (s) % create transfer function of G1(s)
title('Steady-State Error of the System for a Step Input'); xlabel('Time (sec)'); ylabel('Error'); num3=1; dent3=[1 0]; T3=tf(num3, dent3); figure [y2, t2] = step(T*T3); step(T*T3); response title('Ramp Response'); figure % graphical representation of ramp % define numerator of input signal % define denominator of input signal % create transfer function of input signal
title('Steady-State Error of the System for a Ramp Input'); xlabel('Time (sec)'); ylabel('Error');
Part_2) RESULTS
Part_3)
The transfer function of this system is given by :
= 1 and
= 0,
the coefficients which minimize the ITAE performance criterion for step input are given in Table 5.6 (p259) of Modern Control Systems [Dorf, Richard C. & Bishop, Robert H., 1998, 8th ed., Addison Wesley]. For a second order equation, these are given as : s2 + 1.4 wns + wn2 .
Equating the coefficients of this expression to that of the denominator of T1(s) : K = 1.4 wn and K = wn2 wn = 1.4 and K = 1.96. Therefore K=K1.K2 = 1.96 is the gain required for an ITAE optimal system with step input. Applying this value to the expression for T(s) yields :
Since it is desirable to have T2(s) in the form of the general closed-loop transfer function, we can then add a pre-filter P(s) such that P(s)*T2(s) matches the general transfer function above. Therefore, the pre-filter and closed-loop transfer function is :
Similarly, the gain K can be found for an ITAE optimal system with ramp input. Here, Table 5.7 [Dorf & Bishop, p263] provides the standard second order equation as : s2 + 3.2 wns + wn2 and the general closed-loop transfer function is of the form :
Equating the denominators of this and T1(s) : K = 3.2 wn and K = wn2 wn = 3.2 and K = 10.24 . Therefore, for a ramp input and ITAE optimal system, a gain of K=K1.K2=10.24 is required, resulting in the transfer function :
Matlab Code
%Determine the value of K1K2 for an ITAE optimal system for (1) a step input and (2) a ramp input clc; close all; clear all; K1=1; K2=1; % set initial gains K1 & K2 to 1
% define numerator of G(s) % define denominator of G(s) % create transfer function of G(s)
G=tf(Gnum,Gden)
%---------------------------------------% ORIGINAL CONTROLLER %---------------------------------------Cnum=K2*([tau1 1]); Cden=[tau2 1]; C=tf(Cnum,Cden); % define numerator of controller % define denominator of controller % create transfer function of controller
%------------------------------------------------------------------------------% STEP RESPONSE : Find T(s) and plot step response before tuning %------------------------------------------------------------------------------T=feedback(C*G,1) step(T) hold on %----------------------------------------------------------------------------% STEP RESPONSE : ITAE OPTIMAL SYSTEM, with K1*K2=1.96 %----------------------------------------------------------------------------T2num=1.96*([1 1]); T2den=[1 1.96 1.96]; % define numerator of optimal system % define denominator of optimal system % system transfer function % plot step response (K1*K2=1)
T2=tf(T2num,T2den) step(T2)
%--------------------------------------------------------------------------------------% STEP RESPONSE : ITAE OPTIMAL SYSTEM, with P(s) pre-filter %--------------------------------------------------------------------------------------Pnum=1; Pden=[1 1]; P=tf(Pnum,Pden); PGCL=T2*P step(PGCL) % define numerator of P % define denominator of P % create transfer function of P % system transfer function = T2*P % plot step response
%------------------------------------------------------------------------------% RAMP RESPONSE : Create input function and find ramp response %------------------------------------------------------------------------------figure Rnum=1; Rden=[1 0]; RampIn=tf(Rnum,Rden); step(RampIn*T) hold on %-----------------------------------------------------------------------------------------% RAMP RESPONSE : ITAE OPTIMAL SYSTEM, with K1*K2=10.24 %-----------------------------------------------------------------------------------------T3num=10.24*([1 1]); T3den=[1 10.24 10.24]; T3=tf(T3num,T3den); % define numerator of optimal system % define denominator of optimal system % create transfer function for optimal system % define numerator of ramp input function % define denominator of ramp input function % create ramp input transfer function % plot response for ramp input
step(RampIn*T3)
Part_3) RESULTS
Step responses of original and ITAE optimal system :
Step response of original system (blue), ITAE optimal system (green), and ITAE optimal system with pre-filter (red). The characteristics shown on the response plots indicate that the percent overshoot, rise time and settling time were all improved in the ITAE optimal system (green). While the overshoot
resulting is still quite large (21%), adding the pre-filter produced a response with overshoot reduced down to 4.6%. Adding this filter did, however, result in a settling time which is slightly longer than that observed without the filter (yet still a significant improvement on that of the original system response). The rise time also showed an increase to 1.52 seconds, which is greater than either of the other two responses. For the ramp response, ITAE optimization also resulted in an improved result, particularly in the first few seconds, as shown by the plot below.
Ramp response of original system (blue) and for ITAE optimal system (green). TUTORIALS PROBLEM DEFINITION ANIMATION