Control Systems Lab Report
Lab #2: Steady-State Error
Name
Student No
Time Slot
Signature
1:
Monday
Tuesday
Wednesday
Thursday
13:00
Friday
2:
We, by signing this page, declare that the work presented in this report is all work done by us, unless appropriate reference has been made to the work of others. We acknowledge that should this not be the case the report will receive zero marks and due action may be taken.
Lab Number: 2
Demonstrator
Submitted on
Mark Received
Aim
One of the objectives of most control systems is that the system output response follows a specific reference signal accurately in the steady state. The difference between the output and the reference in the steady state is defined as the steady-state error. In the real world, because of friction and other imperfections and the natural composition of the system, the steady state of the output response seldom agrees exactly with the reference. Therefore, steady-state errors in control systems are almost unavoidable. In a design problem, one of the objectives is to keep the steady-state error to a minimum, or below a certain tolerable value, and at the same time the transient response must satisfy a certain set of specifications, such as those discussed in laboratory 1. The accuracy requirement for individual control systems depends to a great extent on the control system objectives of the particular system. For instance, the final position accuracy of an elevator would be far less stringent than the pointing accuracy for the control of a Large Space Telescope whose accuracy of position control is often measured in micro radians.
Experiment 1
1.1. Requirements
In Experiment 1, Matlab was used to find different characteristics of the systems shown below in figure1.1.1 and figure1.1.2.
( Figure1. 1. 2 ) ( Figure1.1 .1 )
For these systems the system type, Kpos, Kv and Ks was calculated using MATLAB and the results were discussed. The steady state error for inputs of 30u(t), 30tu(t) and 30t^2u(t) were also calculated and discussed.
1.2. Introduction
Before analyzing the steady state error of a system, system error needs to be explained. The ideal system would display the least amount of error that quickly reduces to zero. Using Figure1.2.1 below this can be clarified.
Figure1.2.1 : Closed loop System
Using the Figure 1.2.1 where the reference signal, r(t), is the signal that the output c(t) has to track. For a system with unity feedback, H(s) = 1, the input it a reference signal and therefore the error is simply e(t) = r(t) – c(t).
http://controls.ame.nd.edu/ame301/hw7/specifications.jpg
Figure1.2.2 : step response plot example with steady state error.
In the Figure above the steady state error of the system can easily be seen. If the system were to be ideal the error would be zero and the settling time would be as close to zero as possible. The steady state error can be defined as:
When H(s) is not unity, the actuating signal may or may not be the error, depending on the form of e(t) = reference signal – c(t) and the purpose of H(s).
Clearly, depends on the characteristics of G(s) or more specifically on the number of poles that G(s) has at s=0. This number is known as the type of the control system, or simply the system type. Now let us investigate the effects of the types of inputs on the steady-state error. We will consider only the Step, Ramp and Parabolic inputs.
Steady-State Error of a System with a Step Input is when the input, r(t) to the control system is a step function with a magnitude R, R(s) = R/s, the steady state error of a system can be calculated using the following formula.
Kpos = lims->0 G(s)
estep() =
Steady-State Error of a System with a Step Input is when the input, r(t) to the control system is a step function with a magnitude R, R(s) =, the steady state error of a system can be calculated using the following formula.
Kv = lims->0 sG(s)
eramp() =
Steady-State Error of a System with a Step Input is when the input, r(t) to the control system is a step function with a magnitude R, R(s) = , the steady state error of a system can be calculated using the following formula.
Ka= lims->0 s2G(s)
eparabola() =
A system’s behaviour steady state error for all three of the standard input’s applied will place it into a system type. This system type can be used when applying the system to a specific application. A type 0 system will only be able to handle a step input as it has a constant error in this situation. For a ramp and parabolic input the steady state error is infinite. A type 1 system has zero error for a step input and a constant error for ramp input. A parabolic input will result in an infinite steady state error. Type 3 systems maintain zero error for step and ramp inputs and a constant error for parabolic inputs.
The figure1.2.3 below shows how different systems are classed into their respective system type given different system characteristics.
Figure1.2.3
The construction of control systems for individual applications is a very important aspect in today’s society. The accuracy of such systems is also very important. As such understanding steady state error and knowing how to apply systems and the inputs that could be encountered is important.
1.3. Solution Description
For Experiment (1), the two systems given in the lab manual, which are shown below, were input into a Matlab script using the ‘tf’ inbuilt transfer function.
Where the System Functions were calculated to be able to be put into the MATLAB code function ‘tf’ is shown below.
The Transfer functions T(s) were then calculated using MATLAB and the simplified System transfer Functions are shown below in Figure 1.3.1
Figure1.3.1
1.4. Test Results
Table 1 : Table of results for experiment 1.
1.5. Discussion& Conclusions
Q1 : Given the values of Kpos , Kv , or Ka, what do you know about each system?
As seen from Table1, the two systems analysed in the experiment were both system type 0.
This was determined because both systems displayed a real value as an error for a step input and an infinite value error for a ramp and parabolic input. The way system types are determined was shown in Figure1.1.3.
Q2 : What does the sign (positive / negative) of the steady-state error tell you ?
From the results it is possible to see that system (a) had a significantly larger absolute steady state error value than that of system (b).System (b) showed much greater accuracy with less absolute steady state error than that of system (a). This showing that the positive error value of system (b) created a more stable output of the system.
Before the error formulas are introduced and calculated, it is possible to judge the performance of a system by its constant (K) values. For a perfect system with no steady state error, ideally, Kp would equal zero, Kv one, and Ka one.
However this sort of system is very hard to achieve. If Kv or Ka are equal to zero then the steady state error is infinite as seen in the results table. If Kposequalled to negative one, the steady state error would become infinity. As seen in the results table the Kposis very close to negative one therefore that is the reason that the steady state error is of such a large value.
The sign of the steady state error indicates whether the output is greater than the input or whether the input is greater than the output. As seen in the results table, system (a) displays a negative error value, therefore it is shown that the output of the system is greater than the input, indicating an amplification of some degree. A positive error shown in system (b) indicates a smaller output, compared to the input.
1.6. References
· Figure1.2.2: http://fea.kpi.ua/books/catalog/catalog1/0002/APPNO005.HTM
· Laboratory manual No.1 – System response in time domain Designed in line with textbook by N. Nise: Control systems Engineering, prescribed for the course
· Norman S.Nise – Control Systems Engineering (sixth edition)
1.7. Appendix:
% Lab 2 Grant Gatland and Wayne Els
%% Experiment 1 a
clear all;
clc;
close all;
numg = 10*poly([-7]); % setting the numerator of G(s)
deng = poly([0 -4 -8 -12]); % Setting the denominator of G(s)
G = tf(numg,deng); % Generating the transfer function of G(s)
numh = poly([-10]); % setting the numerator of H(s)
denh = poly([-5 -15 -20]); % setting the numerator of H(s)
H = tf(numh,denh); % setting the numerator of H(s)
Ge = feedback(G,(H-1)); %Checking Stability
disp('Checking Stability:')
Ge = tf(Ge) % creating transfer function Ge
T = feedback(Ge,1); %Finding the feedback
disp('Step Input of 30u(t)')
Kp = dcgain(Ge) % Calculating Kp with Step Input of 30u(t)
ess = 30/(1+Kp); % steady state error with Step Input of 30u(t)
Zeros = zero(Ge); % finding the roots of the numerator
Poles = pole(Ge); % finding the roots of the denominator
disp('Ramp Input of 30tu(t)') % display Ramp Input of 30tu(t)
numsGe = 10*poly([Zeros]); % Numerator of Ge
numsGe = conv([1 0],numsGe);
densGe = poly([Poles]); % Denominator
sG = tf(numsGe,densGe); % Creating the transfer function
sG = minreal(sG); % pole cancelation of the poles outside the range
Kv = dcgain(sG) % Dc gain of sG
ess = 30/Kv % steady state error calculation with 30t(u(t)) input
disp('Parabolic Input of 30t^2(t)')
nums2Ge = 10*poly([Zeros]); % Numerator of Ge
nums2Ge = conv([1 0 0],numsGe);
dens2Ge = poly([Poles]); % Denominator
s2G = tf(nums2Ge,dens2Ge); % Creating the transfer function
s2G = minreal(s2G); % pole cancelation of the poles outside the range
Ka = dcgain(s2G) % Dc gain of sG
ess = 30/Ka % steady state error calculation with 30t(u(t)) input
%% Experiment 1b
clear all;
clc;
close all;
numG1 = poly([-7]); % Numerator of Ge
denG1 = poly([0 -4 -8 -12]); % Denominator of Ge
G1 = tf(numG1,denG1); % Creating the transfer function G1
numG2 = 5*poly([-9 -13]); % Numerator of Ge
denG2 = poly([-10 -32 -64]); % Denominator of Ge
G2 = tf(numG2,denG2); % Creating the transfer function
G2 = feedback(G2,10); %Checking Stability
Ge1 = G1*G2 %Multiplying the transfer function by the feedback
numH = 1; % Numerator of h
denH = poly([-3]); % Denominator of h
H = tf(numH,denH); % Creating the transfer function H
Ge = feedback(Ge1,H) %Checking Stability
Zeros = zero(Ge) % finding the roots of the numerator
Poles = pole(Ge) % finding the roots of the denominator
disp('Step input of 30u(t)'); %display step Input of 30tu(t)
Kp = dcgain(Ge) %Dc gain of function Ge
ess = 30/(1+Kp) %Steady state error formula
disp('Ramp input of 30tu(t)'); %display ramp input 30tu(t)
numsGe = 5*poly([Zeros]); %Numerator of Ge
numsGe = conv([1 0],numsGe); %New Numerator of Ge
densGe = poly([Poles]); %Denominator of Ge
sG = tf(numsGe,densGe); %Transfer function of numerator and denominator Ge
sG = minreal(sG); % pole cancelation of the poles outside the range
Kv = dcgain(sG) %Dc gain of function Ge
ess = 30/Kv %Steady state error formula for Kv
disp('Parabolic Input of 30t^2(t)') %Displays Parabolic input of 30t^2(t)
nums2Ge = 5*poly([Zeros]); %Numerator of Ge2
nums2Ge = conv([1 0 0],numsGe); %New Numerator of Ge2
dens2Ge = poly([Poles]); %Denominator of Ge2
s2G = tf(nums2Ge,dens2Ge); %Transfer function of numerator and denominator Ge
s2G = minreal(s2G); % pole cancelation of the poles outside the range
Ka = dcgain(s2G) %Dc gain of function Ge
ess = 30/Ka %Steady state error formula for Ka
Experiment 2
2.1. Requirements of Experiment 2
Experiment 2A was put forward with a representation of a closed-loop system of the dc motor servomechanism with a given Gt value (0) and the PID controller (shown in figure 2.4) to be in proportion only.
For part a) Kp and Gt values were given and Matlab was required to find the equivalent forward transfer functions of a unity feedback system, aswell as the system type, the Kpos, kv, ka values and the steady state error for the inputs u(t), tu(t) and t2u(t),
Part b) required the implementation of the ESVL program to give an indication of the effect of non-ideal system behavior and steady state error. For the given program to run, some parameters were given. Kp=2, Ki=0, Kd=0, Gt=0, Gp=2 and a 1V constant input signal.
Part c) required the input signal to be bumped up to 2V and the effect of the steady state error must be observed.
Part c) required the input signal to be returned to 1V and the Kp to be increased, and the effect on the steady state error must again be observed.
Experiment 2B was followed the same method as 2A, however the Gp value was changed to 1. The process from 2A must be repeated and the results must be recorded.
2.2. Introduction (Background)
Block diagram: When doing anything with programing, a very easy method of understanding what you are doing is to draw block diagrams. They are just a simple way of writing step by step the process needed to get a desired output. A perfect example of a simple block diagram is shown below in figure 2.1. It shows that there is an input given into a system then it is processed and as a result an output is given.
Figure 2.1: Basic Block Diagram
ESVL: The abbreviation ESVL has been used in this report. ESVL stands for ELECTROMECHANICAL SERVOMECHANISM VIRTUAL LABORATORY and is a program that is used on a computer to simulate the operation of a DC motor servomechanism within a feedback control system. An image of what the ESVL represents is shown below in figure 2.2; which is the physical servomechanism. A Block diagram is also given (Figure 2.3) to show the internal programing of the system.
Figure 2.2: Servomechanism Figure 2.3: Block diagram of open loopservomechanism
As seen in figure 2.3 the power amp, motor and gearbox are represented by a first order system. Km is the gain of the motor which includes the gain from the amplifier and the gearbox. Here Km and τ are 19.513 and 0.1 respectively. kωand kθ are 0.23 and 0.796 respectively.
The servomechanism described above is incorporated in a feedback control system which lets the system control the motor shaft angle. Figure 2.4 below shows the ESVL program display. The block labelled PID is the control controller.
Figure 2.4: ESVL Display
The term feedback control system mentioned above means that the output value is controlled by feeding back the controlled value and using it to alter or manipulate the input value so that the output value is the same or very similar to the desired output.
2.3. Solution Description
Simplifying the given box diagram below of a closed loop system with proportion control and the given values: Km= 19.513
Kθ=0.796
τ=0.1
As it is seen above, this is the method used to simplify the servo mechanism initial response. Just by following some simply mathematics, the equation looks much simpler and easier to understand for people who do not know how to use block diagrams.
Pulled from the appendix:
“Kp=2; -Setting variable Kp to 2
Km=19.513; -Setting variable Km to 19.513
Ko=0.796; -Setting variable Kp to 0.796
t=0.1; -Setting variable Kp to 0.1
var = 10*Kp*Km*Ko; -Setting variable var to multiply 10*Kp*Km*Ko
num = var; -Setting variable num to var
den = [1,10,var]; -Setting variable Kp to 1 10 and variable var
G = tf(num,den) -Transfer function num divided by den “
Some important steps in proceeding with task 2 were to firstly set the values needed in the formula to a variable. This would make it much easier to make a final formula or else the final equation would be very long which makes it more prone to mistakes.
Also some variables were set in place of the full formula; again to avoid mistakes in the code. It is seen that there are variables for num and den, which are short for numerator and denominator.
Also in the last line of code shown above are the letters tf followed by some brackets. This creates a transfer function model of whatever values are placed in the brackets directly after.
2.4. Test Results
Servomechanism with Gp = 2
Servomechanism with Gp=1
Results where Kp=2, and an input of 1V applied :
Transfer function Geq(s)
System type
0
1
Kpos
1
Inf
Kv
0
31.0647
Ka
0
0
ess (r = u(t))
0.5V
0
ess (r = tu(t))
Inf
0.0322V
ess (r = ½ t2u(t))
Inf
Inf
Results where Kp = 2, and input increased to 2V :
ess (r = u(t))
1V
0.5V – No change
Results where an input of 1V applied , and Kp is increased to _____V :
ess (r = Ku(t))
0.5V – No change
0V – No change
Table 2 : Table of results for experiment 2.
The table above shows all the values that were given from Matlab and the ESVL system.
C:\Users\Wayne\Documents\University\3304ENG-Control Systems\Lab2\Pics\1V.jpg
Figure 2.5: ESVL at 1V input
As seen in the above image, the bottom right corner shows the voltages from each voltage reader from the virtual mechanism shown above and labelled on the diagram. Number [5] shows the input voltage which sits around 1.014V which is just above the input value of 1,and number [4] shows the steady state error which is sitting at 0.485V which is consistent with the Matlab result at 0.5V. Therefore these values agree with the results in table 2 above.
C:\Users\Wayne\Documents\University\3304ENG-Control Systems\Lab2\Pics\2V.jpg
Figure 2.6: ESVL at 2V input
This is the same format as the image above, the bottom right corner shows the voltages from each voltage reader from the virtual mechanism shown above and labelled on the diagram. Number [5] shows the input voltage which sits at 2.017V which is close to the input value of 2V, and number [4] shows the steady state error which is sitting at 1.019V which is again consistent with the Matlab result of 1V.
2.5. Discussion& Conclusions
Experiment 2A
Q1 : Given the values of Kpos , Kv , or Ka, what do you know about the system?
If the Kpos, Kv or Ka values were given we would know the system type, for example if the Kpos result was a constant value and not zero, then the system type would be 0. If the Kpos value was infinite and the Kv value was a constant then this would be a type 1 system. If none of the criteria above were correct; the system would be a type 2. This is clearly shown in the table below.
Figure 7: Table showing relationships between input as well as errors Table extracted from Control systems engineering textbook online.
Also if the Kpos, Kv or Ka values were given we would have an idea of the input signal shape, whether it would be a step function, ramp function or a parabolic function.
Q2 : What differences were observed between the Matlab and ESVL simulated results? Explain any differences.
The main differences that were noticed between Matlab and the ESVL program was that the results presented from Matlab seemed to be rounded off or slightly less accurate.
For example the steady state error for ramp function with Gp=2 and input voltage of 1V, the value Matlab presented was 0.5V. For the same experiment through ESVL the steady state error for ramp function with Gp=2 was 0.485V. This is shown in figure 2,5 above.
Q3 : Comment on the effect of increasing the input signal magnitude on the steady-state error.
As seen in the images shown above in figure 2.6, increasing the input voltage to 2V and keeping the pre-set value for Gp being 2. It is clear that there is no chance in steady state error. The Error is half that of the input which is 1V. This is the same for the previous voltage of 1V and the steady state error being half that of 0.5V.
Q4 : Comment on the effect of increasing gain Kp on the output signal.
Three tests were done, firstly kp being 2, then kpbeing 4 and finally kp being 10. To make sure there were no other variances, the voltage was set back and remained at 1V,. After these tests it was clear from the ESVL program that no change was occurring with the output response.
Experiment 2B
Q5 : Given the values of Kpos , Kv , or Ka, what do you know about the system?
As mentioned above, if the Kpos, Kv or Ka values we would know the system type, for example if the Kpos result was a constant value and not zero, then the system type would be 0. If the Kpos value was infinite and the Kv value was a constant then this would be a type 1 system. If none of the criteria above were correct; the system would be a type 2. This is clearly shown in the table below.
Also if the Kpos, Kv or Ka values were given we would have an idea of the input signal shape, whether it would be a step function, ramp function or a parabolic function.
This is made clear when looking at the figure 2.7 above.
Q6 : Comment on the effect of increasing the input signal magnitude on the steady-state error.
As mentioned above, as seen in the images shown above in figure 2.6, increasing the input voltage to 2V and keeping the pre-set value for Gp being 2. It is clear that there is no chance in steady state error. The Error is half that of the input which is 1V. This is the same for the previous voltage of 1V and the steady state error being half that of 0.5V.
Q7 : What is the effect of increasing gain Kp on the output signal?
As mentioned above, there is no effect on increasing the Kp value.
Q8 : Summarize the effect of reducing the feedback path gain GP to 1 on the transfer function, system type and steady state error.
Reducing the feedback path gain Gp from 2 to1 plays a major role in results. Changing the feedback can change the whole system. Looking at table 2 it is clear exactly what affects have taken place. Firstly the transfer function changes, the constant value in function Gp=1 falls off then the poles automatically change.
It is seen that the Kpos, Kv and the Ka values are all altered. Therefore the system type will no doubt be changed with it. For the servomechanism with Gp=2, the Kpos is 1, the Kv is 0 and the Ka is 0. Therefore looking at the table shown in figure 2.7 it is known to be a type 0.
For the servomechanism with Gp=1, the Kpos is infinite, the Kv is 31.07 and the Ka is 0. Therefore looking at the table shown in figure 2.7 it is known to be a type 1.
To re-iterate if the Kpos, Kv or Ka values were given we would know the system type, which includes type 0, type 1 or type 2. Also if the Kpos, Kv or Ka values were given we would have an idea of the input signal shape, whether it would be a step function, ramp function or a parabolic function.
The main differences that were noticed between Matlab and the ESVL program was that the results presented from Matlab are less accurate than ESVL. For example the steady state error for ramp function with Gp=2 and input voltage of 1V, the value Matlab presented was 0.5V. For the same experiment through ESVL the steady state error for ramp function with Gp=2 was 0.485V. This is shown in figure 2.5 above.
As seen in the images shown above in figure 2.6, increasing the input voltage to 2V and keeping the other values exactly the same, it becomes clear that there is no chance in steady state error. To see whether or not kp plays a major role in the results, a simple test was constructed which involved changing the kp to three different values and viewing the results for any discrepancies.
Altering the feedback gain Gp can change the whole system. As described above, looking at table 2 it is clear exactly what affects have taken place. Basically all the values are different as a result of changing the feedback gain. All K values with the exception of Ka were altered. Therefore the system type will change as well. When the gain is 1, the Kpos value is a constant but with the gain being 2, the Kv value is a constant. Therefore straight away we can see the system type will be different.
In conclusion it was learnt that the Kpos value does not play such an important role for the steady state error in the way that increasing it will not change the entire system. This was discussed and tested and as a result it was proved that varying the Kpos from 2 to 10 does not change the error.
It was seen that changing the feedback gain Gp can alter the whole system in the way that will which change the Kpos , Kv and the Ka values which means it will then change the system type.
Also we can see that Matlab gives us correct results. They are seen to be less accurate than ESVL, but with possible altering of the code the Matlab could be made to show more accuracy.
2.6. References
· Laboratory manual No.1 – System response in time domain Designed in line with textbook by N. Nise: Control systems Engineering, prescribed for the course
· Norman S.Nise – Control Systems Engineering (sixth edition)
2.7. Appendix
%% Experiment 2A)a
clc; %Clear Screen
closeall; %Close all the opened programs within matlab
clearall; %Clears all values
Kp=2; %Setting variable Kp to 2
Km=19.513; %Setting variable Km to 19.513
Ko=0.796; %Setting variable Kp to 0.796
t=0.1; %Setting variable Kp to 0.1
var = 10*Kp*Km*Ko; %Setting variable var to multiply 10*Kp*Km*Ko
num = var; %Setting variable num to var
den = [1,10,var]; %Setting variable Kp to 1 10 and variable var
G = tf(num,den) %Transfer function num divided by den
s = tf([1 0],1); %Transfer function of values shown
'Step' %For step function
Kp = dcgain(G) %Setting variable Kp to the gain G (feedback)
estep = 1/(1+Kp) %Applying the step function formula for error
'Ramp' %For step function
Kv = dcgain(s*G) %Setting variable Kv to the gain G times s
eramp = 1/Kv %Applying the ramp function formula for error
'Parabolic' %For step function
Ka = dcgain((s^2)*G) %Setting variable Ka to the gain G times s^2
epara = 1/Ka %Applying the parabolic function formula for error
if ((Kp~=0) && (Kp~=inf)) %If Kp does not=0, and kp is not infinite
fprintf('System type 0 \n'); %Displays “system type 0”
elseif ((Kv~=0) && (Kv~=inf)) %If Kv does not=0, and kv is not infinite
fprintf('system type 1 \n'); %Displays “system type 1”
else %Or else move to next line
fprintf('System type 2 \n'); %Displays “system type 2”
end
%% Experiment 2B
clc; %Clear Screen
closeall; %Close all the opened programs within matlab
clearall; %Clears all values
Kp=2; %Setting variable Kp to 2
Km=19.513; %Setting variable Km to 19.513
Ko=0.796; %Setting variable Kp to 0.796
t=0.1; %Setting variable Kp to 0.1
var = 10*Kp*Km*Ko; %Setting variable var to multiply 10*Kp*Km*Ko
num = var; %Setting variable num to var
den = [1,10,0]; %Setting variable Kp to 1 10 0
G = tf(num,den) %Transfer function num divided by den
s = tf([1 0],1); %Transfer function of values shown
'Step' %For step function
Kp = dcgain(G) %Setting variable Kp to the gain G (feedback)
estep = 1/(1+Kp) %Applying the step function formula for error
'Ramp' %For step function
Kv = dcgain(s*G) %Setting variable Kv to the gain G times s
eramp = 1/Kv %Applying the ramp function formula for error
'Parabolic' %For step function
Ka = dcgain((s^2)*G) %Setting variable Ka to the gain G times s^2
epara = 1/Ka %Applying the parabolic function formula for error
if ((Kp~=0) && (Kp~=inf)) %If Kp does not=0, and kp is not infinite
fprintf('System type 0 \n'); %Displays “system type 0”
elseif ((Kv~=0) && (Kv~=inf)) %If Kv does not=0, and kv is not infinite
fprintf('system type 1 \n'); %Displays “system type 1”
else %Or else move to next line
fprintf('System type 2 \n'); %Displays “system type 2”