Control Lab Manual
Control Lab Manual
Control Lab Manual
لمختبر التحكم
قسم هندسة
الميكاترونكس
1
:اسم الطالب
:الرقم الجامعي
:التخصص
:اليوم
:الساعة
:التوقيع
2
Table of contents
Introduction
3
Experiment No 8 Tuning Rules of PID Controllers
Introduction
Many control dynamic systems, whether they are mechanical, electrical, thermal or hydraulic, may be
described by differential equations. These equations can be obtained d by utilizing physical laws
governing a particular system, for example, Newton’s laws for mechanical systems, and Kirchhoff’s
laws for electrical systems, etc. The setoff differential equations are called a mathematical model. The
response of a dynamic system to an in put signal or to a disturbance signal can be obtained if these
equations are solved using different computer tools.
1 Objectives
At the end of this course, the student should be able to:
-Simulate any control system given by a transfer function.
-Solve linear and nonlinear differential equations
-Investigate the transient response and steady state response of control systems.
-Use feedback in control systems.
-Determine the stability of control systems.
-Determine the effects of different control actions on system performance.
-Investigate the frequency response of control system
Simulink
Simulink is a software package for modeling, simulating, and analyzing dynamic
Systems. It supports linear and nonlinear systems, modeled in continuous time,
4
Sampled time, or a hybrid of the two. Systems can also be multirate, i.e., have
Different parts that is sampled or updated at different rates.
It allows you to represent systems as block diagrams that you build using your
Mouse to connect blocks and your keyboard to edit block parameters. Stateflow is
Part of this environment. The State flow block is a masked Simulink model. State flow
Builds an S-function that corresponds to each State flow machine. This S-function is
The agent Simulink interacts with for simulation and analysis.
The control behavior that State flow models complement the algorithmic behavior
Modeled in Simulink block diagrams. By incorporating State flow diagrams into
Simulink models, you can add event-driven behavior to Simulink simulations. You
Create models that represent both data and control flow by combining State flow
Blocks with the standard Simulink block sets. These combined models are simulated
Using Simulink.
The Using Simulink document describes how to work with Simulink. It explains how
To manipulate Simulink blocks, access block parameters, and connect blocks to
Build models. It also provides reference descriptions of each block in the standard
Simulink libraries.
Experiment No 1
Control Tutorials for Simulink
Simulink is a graphical extension to MATLAB for modeling and simulation of systems. In Simulink,
systems are drawn on screen as block diagrams. Many elements of block diagrams are available, such as
transfer functions, summing junctions, etc., as well as virtual input and output devices such as function
generators and oscilloscopes. Simulink is integrated with MATLAB and data can be easily transfered
between the programs. In these tutorials, we will apply Simulink to the examples from the MATLAB
tutorials to model the systems, build controllers, and simulate the systems. Simulink is supported on
Unix, Macintosh, and Windows environments
The idea behind these tutorials is that you can view them in one window while running
Simulink in another window. System model files can be downloaded from the tutorials and
opened in Simulink. You will modify and extend these system while learning to use
Simulink for system modeling, control, and simulation. Do not confuse the windows, icons,
and menus in the tutorials for your actual Simulink windows. Most images in these tutorials
are not live - they simply display what you should see in your own Simulink windows. All
Simulink operations should be done in your Simulink windows. Starting Simulink
Simulink is started from the MATLAB command prompt by entering the following command: simulink
5
Alternatively, you can hit the New Simulink Model button at the top of the MATLAB command window
as shown below:
When it starts, Simulink brings up two windows. The first is the main Simulink window, which appears
as:
A new model can be created by selecting New from the File menu in any Simulink window
Basic Elements
There are two major classes of items in Simulink: blocks and lines. Blocks are used to generate, modify,
combine, output, and display signals. Lines are used to transfer signals from one block to another.
Blocks
6
Blocks have zero to several input terminals and zero to several output terminals. Unused input terminals
are indicated by a small open triangle. Unused output terminals are indicated by a small triangular point.
The block shown below has an unused input terminal on the left and an unused output terminal on the
right.
Lines
Lines transmit signals in the direction indicated by the arrow. Lines must always transmit signals from
the output terminal of one block to the input terminal of another block. On exception to this is a line can
tap off of another line, splitting the signal to each of two destination blocks, as shown below
Lines can never inject a signal into another line; lines must be combined through the use of a block such
as a summing junction.
A signal can be either a scalar signal or a vector signal. For Single-Input, Single-Output systems, scalar
signals are generally used. For Multi-Input, Multi-Output systems, vector signals are often used,
consisting of two or more scalar signals. The lines used to transmit scalar and vector signals are
identical. The type of signal carried by a line is determined by the blocks on either end of the line.
Simple Example
The simple model consists of three blocks: Step, Transfer Fcn, and Scope. The Step is a source block
from which a step input signal originates. This signal is transfered through the line in the direction
indicated by the arrow to the Transfer Function linear block. The Transfer Function modifies its input
signal and outputs a new signal on a line to the Scope. The Scope is a sink block used to display a signal
much like an oscilloscope.
7
There are many more types of blocks available in Simulink, some of which will be discussed later. Right
now, we will examine just the three we have used in the simple model.
Modifying Blocks
A block can be modified by double-clicking on it. For example, if you double-click on the "Transfer
Fcn" block in the simple model, you will see the following dialog box.
This dialog box contains fields for the numerator and the denominator of the block's transfer function.
By entering a vector containing the coefficients of the desired numerator or denominator polynomial, the
desired transfer function can be entered. For example, to change the denominator to s^2+2s+1, enter the
following into the denominator field:
[1 2 1]
and hit the close button, the model window will change to the following,
8
The "step" block can also be double-clicked, bringing up the following dialog box.
The default parameters in this dialog box generate a step function occurring at time=1 sec, from an
initial level of zero to a level of 1. (in other words, a unit step at t=1). Each of these parameters can be
changed. Close this dialog before continuing.
The most complicated of these three blocks is the "Scope" block. Double clicking on this brings up a
blank oscilloscope screen.
When a simulation is performed, the signal which feeds into the scope will be displayed in this window.
Detailed operation of the scope will not be covered in this tutorial. The only function we will use is the
autoscale button, which appears as a pair of binoculars in the upper portion of the window.
Running Simulations
To run a simulation, we will work with the following model
9
Before running a simulation of this system, first open the scope window by double-clicking on the scope
block. Then, to start the simulation, either select Start from the Simulation menu (as shown below) or
hit Ctrl-T in the model window.
The simulation should run very quickly and the scope window will appear as shown below.
Note that the simulation output (shown in yellow) is at a very low level relative to the axes of the scope.
To fix this, hit the autoscale button (binoculars), which will rescale the axes as shown below.
10
Note that the step response does not begin until t=1. This can be changed by double-clicking on the
"step" block. Now, we will change the parameters of the system and simulate the system again. Double-
click on the "Transfer Fcn" block in the model window and change the denominator to
[1 20 400]
Re-run the simulation (hit Ctrl-T) and you should see what appears as a flat line in the scope window.
Hit the autoscale button, and you should see the following in the scope window.
Notice that the autoscale button only changes the vertical axis. Since the new transfer function has a
very fast response, it it compressed into a very narrow part of the scope window. This is not really a
problem with the scope, but with the simulation itself. Simulink simulated the system for a full ten
seconds even though the system had reached steady state shortly after one second.
To correct this, you need to change the parameters of the simulation itself. In the model window, select
Parameters from the Simulation menu. You will see the following dialog box.
11
There are many simulation parameter options; we will only be concerned with the start and stop times,
which tell Simulink over what time period to perform the simulation. Change Start time from 0.0 to 0.8
(since the step doesn't occur until t=1.0. Change Stop time from 10.0 to 2.0, which should be only
shortly after the system settles. Close the dialog box and rerun the simulation. After hitting the autoscale
button, the scope window should provide a much better display of the step response as shown below.
Building Systems
In this section, you will learn how to build systems in Simulink using the building blocks in Simulink's
Block Libraries. You will build the following system.
12
First you will gather all the necessary blocks from the block libraries. Then you will modify the blocks
so they correspond to the blocks in the desired model. Finally, you will connect the blocks with lines to
form the complete system. After this, you will simulate the complete system to verify that it works.
Gathering Blocks
13
This opens the Sources window which contains the Sources Block Library. Sources are used to
generate signals. libraries.
Drag the Step block from the sources window into the left side of your model window.
Double-click on the Linear icon in the main Simulink window to open the Linear Block Library
window.
Drag the Sum, Gain, and two instances of the Transfer Fcn (drag it two times) into your model
window arranged approximately as shown below. The exact alignment is not important since it
can be changed later. Just try to get the correct relative positions. Notice that the second Transfer
Function block has a 1 after its name. Since no two blocks may have the same name, Simulink
14
automatically appends numbers following the names of blocks to differentiate between them.
Double-click on the Sinks icon in the main Simulink window to open the Sinks window.
Drag the Scope block into the right side of your model window.
Modify Blocks
15
Double-click the rightmost Transfer Function block. Leave the numerator [1], but change the
denominator to [1 2 4]. Close the dialog box. Your model should appear as:
Change the name of the first Transfer Function block by clicking on the words "Transfer Fcn". A
box and an editing cursor will appear on the block's name as shown below. Use the keyboard
(the mouse is also useful) to delete the existing name and type in the new name, "PI Controller".
Click anywhere outside the name box to finish editing.
Similarly, change the name of the second Transfer Function block from "Transfer Fcn1" to
"Plant". Now, all the blocks are entered properly. Your model should appear as:
Now that the blocks are properly laid out, you will now connect them together. Follow these steps.
16
Drag the mouse from the output terminal of the Step block to the upper (positive) input of the
Sum block. Let go of the mouse button only when the mouse is right on the input terminal. Do
not worry about the path you follow while dragging, the line will route itself. You should see the
following.
The resulting
line should have a filled arrowhead. If the arrowhead is open, as shown below, it means it is not
connected to anything.
You can
continue the partial line you just drew by treating the open arrowhead as an output terminal and
drawing just as before. Alternatively, if you want to redraw the line, or if the line connected to
the wrong terminal, you should delete the line and redraw it. To delete a line (or any other
object), simply click on it to select it, and hit the delete key.
Draw a line connecting the Sum block output to the Gain input. Also draw a line from the Gain
to the PI Controller, a line from the PI Controller to the Plant, and a line from the Plant to the
17
Scope. You should now have the following.
The line remaining to be drawn is the feedback signal connecting the output of the Plant to the
negative input of the Sum block. This line is different in two ways. First, since this line loops
around and does not simply follow the shortest (right-angled) route so it needs to be drawn in
several stages. Second, there is no output terminal to start from, so the line has to tap off of an
existing line.
To tap off the output line, hold the Ctrl key while dragging the mouse from the point on the
existing line where you want to tap off. In this case, start just to the right of the Plant. Drag until
you get to the lower left corner of the desired feedback signal line as shown below.
Now, the open arrowhead of this partial line can be treated as an output terminal. Draw a line
from it to the negative terminal of the Sum block in the usual manner.
18
Now, you will align the blocks with each other for a neater appearance. Once connected, the
actual positions of the blocks does not matter, but it is easier to read if they are aligned. To move
each block, drag it with the mouse. The lines will stay connected and re-route themselves. The
middles and corners of lines can also be dragged to different locations. Starting at the left, drag
each block so that the lines connecting them are purely horizontal. Also, adjust the spacing
between blocks to leave room for signal labels. You should have something like:
Finally, you will place labels in your model to identify the signals. To place a label anywhere in
your model, double click at the point you want the label to be. Start by double clicking above the
line leading from the Step block. You will get a blank text box with an editing cursor as shown
below
Type an r in this box, labeling the reference signal and click outside it to end editing.
19
Label the error (e) signal, the control (u) signal, and the output (y) signal in the same manner.
Your final model should appear as:
To save your model, select Save As in the File menu and type in any desired model name. The
completed model can be found here.
Simulation Now that the model is complete, you can simulate the model. Select Start from the
Simulation menu to run the simulation. Double-click on the Scope block to view its output. Hit the
autoscale button (binoculars) and you should see the following.
In some cases, parameters, such as gain, may be calculated in MATLAB to be used in a Simulink model.
If this is the case, it is not necessary to enter the result of the MATLAB calculation directly into Simulink.
For example, suppose we calculated the gain in MATLAB in the variable K. Emulate this by entering the
following command at the MATLAB command prompt.
K=2.5
This variable can now be used in the Simulink Gain block. In your simulink model, double-click on the
Gain block and enter the following in the Gain field.
K
20
Close this dialog box. Notice now that the Gain block in the Simulink model shows the variable K rather
than a number.
Now, you can re-run the simulation and view the output on the Scope. The result should be the same as
before.
Now, if any calculations are done in MATLAB to change any of the variab used in the Simulink model,
the simulation will use the new values the next time it is run. To try this, in MATLAB, change the gain,
K, by entering the following at the command prompt. K=5
21
Example: simulate and solve
1-
A- simulation diagram
B-solution
22
2-
A- simulation diagram
B-solution
23
Experiment N0 2
Solving Differential Equations and Modeling Dynamic Systems
Objectives:
To solve linear differential equations.
To solve a set of differential equations
To represent a dynamic system using transfer functions
To represent a dynamic system using state space
A: Solving linear differential equations
Consider the following linear differential equation
Procedure:
1- Simulate a third order differential equation with coefficients as in table
(2.1)
Simulation diagram
24
2- Plot y (t) and x (t) using an oscilloscope.
3- Record y (t) and x (t) with respect to the time as in table 2.1
Table 2.1 x (t) = constant=2, a= 2, b= 3, c=4
t (sec)
x (t)
Y(t)
4-Plot y(t) on Fig.2.1
Fig.2.1
(2.2)
25
Procedure:
1-Simulate these two equations with coefficients as in table
(2.2)
Simulation diagram
26
Fig.2.2
Where y (t) is the output (the dependent variable), and r(t) is the input (the independent variable ).
Procedure:
1- Simulate the following equation as a transfer function using ‘Transfer function block in Simulink
2-Transfer function
27
3-Apply the coefficients and input as in table 2.3
Table 2.3: a1=2; a2 = 8; a3=4; r (t) =constant=1
Fig.2.3
2.7
2.8
And:
x A B 2.9
y 2.10
Or y =Cx 2.11
Where
29
C= 2.12
7- Procedure:
1-Write a state space equations for a system given by equation 2.13
Input equations in vector form
2-Simulate the state space equation using state space block and the coefficients of Tab.2.4
3-Plot and record y(t)
Table2.4: a1=2; a2=8; a3=4; r (t)=constant=1
30
Fig.2.4
Objectives:
To use fixed feedback.
To use flexible feedback
Introduction:
a) the use of fixed feedback.
The primary purpose of using feedback in control systems is to reduce the sensitivity of the system to
parameter variations and unwanted disturbances. Also the feedback can change the time response of
control system.
1) Consider the system shown in figure 3.1 a. The time constant of the system is T and the gain is K.
The addition of a negative feedback loop around this element reduces the time constant and the gain.
Figure 3.2 b, shows the system with the same feed forward transfer function as that shown in figure 3.2
a, with the exception that a negative feedback loop has been added. The transfer function of this system
is:
3.1
The time constant and the gain of this system have been reduced by (1+a).
If, instead of a negative feedback loop, a positive feedback is added, then the time constant and the gain
can be increased.
A B
Fig.3.1
33
2) Reduction the effect of disturbance:
Figure 3.2 shows a control system subjected to a disturbance when two inputs (the reference input and
disturbance) are present in a linear system, each input can treated independently of the other, and the
output corresponding to each input alone can be added to give the complete output.
For the open-loop control system the effect of the disturbance is equal to:
CN(s) = + G2(s)ּ N(s) Equation 3.3.
And for the closed- loop system the effect of the disturbance is equal to:
Note that the affect of the disturbance in the closed-loop system has been reduced to:
(A)
(B)
Figure 3.2
Procedure:
34
Table 3.1., T=1; K=1; r (t)=unit step
a
0
3
6
Fig.3.3
Comments:
35
Part B: Reduction the time response sensitivity to disturbance:
Fig.3.4
Comments:
36
Part C: Reduction the time response sensitivity to parameter variation:
Fig.3.5
37
Comments:
Procedure:
1- Simulate a closed loop system with: G(s)=1/{s+1}; H(s)= bs ,negative feedback and r(t)=unit
step,as shown :
R(s) C(s)
1
s+1
Step Transfer Fcn Scope
du/dt b
Derivative Gain
2- Plot the output signal on the oscilloscope, and record the results in table 3.4.
Table 3.4
38
b
0
1
2
Fig.3.6
Comments
39
Assignment
bs
40
Experiment No 4
Time Response of First-Order Systems
Objectives:
To study transient response of first-order systems.
To study steady-state response of first-order systems.
Introduction:
The time response of a control system consists of two parts: the transient and the steady-state response.
By transient response, we mean that which goes from the initial state to the final state. By steady-state
response, we mean the manner in which the system output behaves as time approaches infinity.
In analyzing and designing control systems, we must have the basis of comparison of performance of
various control systems. This basis may be set up by specifying particular test input signals and by
comparing the response of various systems to these input values.
The commonly used test input signals are those of step function, ramp function, acceleration function,
impulse function, these functions are called a periodic signals.
The first-order system can be represented by the following transfer function:
G(s) =
Physically, this system may represent an R-C electric circuit, thermal system, liquid-level system, etc. A
block diagram of a first-order system is:
41
1- Construct the circuit shown in figure 4.1. Apply an input signal to the circuit as shown in the
tables.
2- Plot the output signal and the input signal on the oscilloscope.
3- Record c (t) and e(t) with respect to the time as in the following tables
c
e
c
e
4- Plot r(t), c(t) and form tables 4.1,4.2 and 4.3 on Fig.4.2 .a
42
Fig.4.2.a:
Fig.4.2.b:
43
Conclusion:
c
Table 4.5; r (t) =unit step; T=1.
44
Fig.4.3:
Conclusion:
c
e
45
Table 4.8; r (t) = unit ramp ; T=1.
c
e
Fig.4.4:
Conclusion:
46
Steady state response (static response)
1- Construct the circuit shown in figure 4.1.
2-Apply an input signal(constant), to the circuit as shown in the table.
3- After the output reaches it is final value (steady state value), record C with. . . respect to
the input as in the following table
Fig.4.5
Conclusion
47
Assignment
Using inverse Laplace transform, obtain c (t) and e(t) for
1- r(t)=A
2- r(t)=t
48
Experiment No5
Modeling and Control of a DC Servo System
Objectives:
To study transient response
Apply speed feed back
Apply position feed back
Introduction:
Servo drives used in machine-tools and industrial robot manipulators require four-quadrant operation
and also have very demanding requirements for current loop bandwidth, velocity loop bandwidth, torque
smoothness, and high static and dynamic stiffness in a closed position loop.
The primary purpose of using feedback in control systems is to reduce the sensitivity of the system to
parameter variations and unwanted disturbances. Also the feedback can change the time response of
control system.
Dynamic Model of DC Servo System
The position servo system consists of a permanent magnet field armature
controlled DC motor
Interfaced to an output shaft with a gear ratio of N. The schematic diagram of this
system is shown in Fig.1
49
Where:
i a (t) = motor current (A),
Ra = motor armature resistance (),
La motor armature inductance
va(t) = motor armature voltage (V),
e(t) = motor back emf (V),
Te(t) = motor torque (Nm),
Td = load torque (Nm),
J m= net motor-tacho-gears-shafts inertia (Nm/radian/sec/sec),
Bm = net motor-tacho-gears-shafts damping (Nm/radian/sec),
(t) = motor shaft angular speed (radians/sec),
Kt = motor torque constant (Nm/A),
Ke = motor back emf constant (V/radian/sec),
N = gear ratio coupling motor to output shaft (radians/radian),
(t) = angular position of output shaft (radians),
K= position sensor gain (Volts/radian),
K= tacho generator gain (Volts/radian/sec)
Ka= power amplifier gain,
50
A) Transient response of DC motor
1-Simulate the motor as shown in Fig.3
3-Run the simulation and record the output signals:(t), i a (t) in Table 2
Table 2:,vi=UNIT STEP, Td=0
(t
)
ia
(t)
4- Run the simulation record the output signals:(t), i a (t) in Table 3
Table 3: vi=UNIT STEP ,Td=1.147
(t)
51
ia
(t)
4-plot (t) from Table 2 and Table 3 on Fig.4
Fig.4
Fig.5.
52
Comments:
(t
)
ia
(t)
(t)
ia
(t)
Fig.7
Comments:
55
C-Transient response of position closed loop system
1-Simulate the position closed loop system as shown in Fig.9
3-Run the simulation and record the output signals:(t) , i a (t) in Table 6
Table 6:, vi= STEP(FIN.VALUE=10),, Td=0
(t)
ia
(t)
(t)
ia
(t)
56
Fig.10
Fig.11
57
Comments:
58
Experiment N0 6
Time Response of Second Order Systems
Objectives:
To study the transient response of the second order system.
To illustrate the effect of damping ratio variation on the system response.
To determine the transient response specifications.
… 6.1
The dynamic behavior of this system can be described in terms of two parameters ( and
).
Figure 6.1.
Where G(s) =
Procedure:
A) The effect of damping ratio variation on the system response
1. simulate the system in fig.6.1
2. Plot the output & input signals using the oscilloscope.
3. Record the results in Table 6.1.
0.6
59
4. Set the value of damping ratio to zero
5. Plot, measure and record the output signal in Table 6.2.
Fig.6.2
Comments:
60
8-Plot the time response from Table6.2 and 6.3 on the same graph.(Fig.6.3)
Fig.6.3
61
Comments:
9-From the plotted curves obtain the time response specifications and record them into Table 6.4.
(s)
0.6
10- Calculate the roots of the characteristic equation and determine the type of time response as in table
6.5
positive -0.2
Zero 0
8-Plot the time response from Table 6.5 on the same graph.(fig.6.4)
63
Fig.6.4
Comments:
64
Experiment No7
Basic Control Actions (Part One)
Objectives:
To study the proportional control action [P control].
To study the integral control action [I control].
To study the PI control.
Introduction:
Proportional controller: the relationship between the output of the controller and the actuating
error signal e (t) [the input of the controller]:
Proportional control
Where kP is termed to the proportional sensitivity or the gain. Now consider a first-order control system
as shown in figure A.
If there is no control action, i.e. GC(s) = 1, the steady-state error is:
The value of the steady state error becomes smaller as the gain KP becomes larger.
65
Figure A
Integral controller the relationship between the output of the controller and the actuating error
signal e (t) [the input of the controller]:
integral control
66
Proportional plus integral control
Note that the integral control action has converted the order of the control system.
And the steady-state error becomes zero.
Figure B
A) First order system
Procedure:
1- Simulate the system in fig.A. For K=2: T=2
2-Plot the output signal and the error signal.
3-Record and measure the values with respect to kP given in table 7.1.
Table 7.1 r(t)=unit step
Kp t(s)
c
1
e
c
5
e
67
Fig. 7.1
Comments:
68
Table 7.2 r(t)=unit step; simulation stop time 2 seconds
Ki
t(s)
c
10
e
c
20
e
Fig. 7.2.a
69
Fig. 7.2.b
Comments:
Kp t(s)
c
1
e
c
4
e
4-plot the data from table 7.3.a on one figure 7.3.
Fig.7.3.
Comments:
71
5-plot the data from table 7.3.b on one figure7.4
Fig.7.4
Comments:
72
8-Apply a PI controller to system of fig.B
9- Vary the parameters of the controller to have a reasonable response: overshoot ≤20%, zero steady
state error
10-Record the results in table 7.5.a
Table 7.5.a: Kp= :Ti = ; r (t) =constant=5; n (t) =0
11- Using the obtained parameters determine cn(t). Record the results in table 7.5.b
Table 7.5.b: Kp= :Ti= ; r (t) =constant=5; n (t) =constant=1
Fig.7.6
Comments:
73
Conclusion
74
Basic Control Actions (Part Two)
Objectives:
1 To study the PD control action.
2 To study the PID control action.
Introduction:
The control action of a proportional-plus-derivative controller is defined by the following equation:
Kp 20
s2 +3s+20
Step
Plant Scope
Td du/dt
1
Derivative1
n(t)
Proportional-plus-derivative control
Where Kp represents the proportional sensitivity and Td represents the derivative time constant. The
derivative control action, sometimes called rate controller where the magnitude of the controller output
is proportional to rate of change of the actuating error signal and not the actuating error itself. For this
reason this model never used alone, it is always used in combination with proportional or proportional-
plus-integral action. Derivative control does not affect the steady state error directly, it adds damping to
the system and this permits the use of a large value for the gain.
Consider a second order control system with a small damping ratio figure 7.1, the roots of the
characteristic equation are complex-conjugate, and the response to a unit-step input contains to oscillate.
75
The addition of PD controller will reduce the oscillation of the output and reduce the steady state
error .The addition of integral control will eliminate the steady state error
Kp 20
s2 +3s+20
Step
Plant Scope
Td du/dt
1
Derivative1
n(t)
Fig.7.1.a
Procedure:
1. Connect the system shown in figure 7.1.a
2. Plot, measure and record the output signal and the error signal with respect to table 7.1.a
Table 7.1.a ,r(t)=unit step
Td KP t
0 10 C(t)
5 10 C(t)
76
Fig.7.7
Kp 20
s2 +3s+20
Step
Plant Scope
Td du/dt
1
Derivative1
n(t)
1
Ti.s
integrator
PID control
5-Select the time constant of integration so that the max. Overshoot is . Record in table 7.2
77
Table 7.2, ir(t)= unit step
Td KP t 0 .5 1 1.5 2 3 4 5 6 7 8
c
10 5
e
Fig.7.8
Comments
78
Experiment No 8
Tuning Rules of PID Controllers
Objectives:
To study the tuning rules of PID controllers for:
A) S-shaped output of a control system
B) An under damped out put of control system
Introduction:
The process of selecting the controller parameters to meet given performance specifications is known as
controller tuning. Many rules are suggested to do that (meaning to set values K p, Ti and Td) based on
experimental step response or based on the value of Kp.
There are two methods called Ziegler-Nichols tuning rules. In both methods, they aimed at obtaining
25%maximum overshoot (Mp) in step response as shown in figure (8-1).a
figure (8-1).a
79
Figure 8.1
First Method :If the plant involves neither integrator(s) nor dominant complex-conjugate poles, the unit
step response curve may look like an S-shaped curve (figure 8-2)
Figure 8.2
Procedure:
80
Fig.8.3
Type of controller Kp Ti Td
PID 1.2T/L 2L 0.5L
7.Plot the output signal to a unit step input for each case. Ziegler-Nichols Tuning Rule Based on
Step Response of Plant (First Method)
81
Fig.8.4
7. Tune each controller to obtain 25%maximum overshoot (Mp) in step response .Then plot the
output on Fig.8.5
Fig.8.5
82
Second Method:
1) Simulate a plant given by: , with unity feedback and PID controller
Kcr
83
4) Plot the output signal
5) Determine Pcr from the plot
6) Set Kp,Ti and Td as in the following table
7) Plot the output signal for each case (fig.6.6)
Ziegler-Nichols Tuning Rule Based on Critical Gain Kcr and critical Period Pcr (Second Method)
Type of controller Kp Ti Td
PID 0.6Kcr 0.5Pcr 0.125Pcr
Fig.8.6
8.Tune each controller to obtain 25%maximum overshoot (Mp) in step response .Then plot the
output on Fig.8.5
84
Summary:
85
Experiment No9
Frequency-Response Analysis
Objectives:
To study the frequency-response of integral and derivative factors.
To study the frequency-response of first order factor. And second order system
Introduction:
By the term “frequency response” we mean the steady-state response of control system to a sinusoidal
input, where the frequency of the input signal is varied over a certain range the frequency-response
characteristics of a system can be obtained directly from the sinusoidal transfer function, i.e. the transfer
function is which s is replaced by j , where is the angular frequency. If the transfer function of a
control system is G(s), the sinusoidal transfer function becomes:
= -tan-1 ( t),
And Lm = -20 log ( )
86
Procedure:
1. Simulate each element as shown in tables
2. Plot and record the magnitude and the phase
Table 9.1 integrator
Lm [dB]
Lm [dB]
Fig.
Comments:
87
Table 9.3.a first order element: K= 1; T=1
Lm [dB]
Lm [dB]
Lm [dB]
Lm [dB]
88
Fig.
Comments
89
frequency-response of a second order system
Introduction:
Procedure:
1-Simulate a second order system and record as shown in the following tables
Lm [dB]
Lm [dB]
Lm [dB]
90
2- Sketch the magnitude versus frequency and the phase angle versus frequency from table 9.5 on
the same graph
Fig.
Comments:
Which are connected as in fig 1.1, where dotted boxes represent essential additional
items?
A Digital unit the 33-120 is available which allows the Mechanical unit, 33-100, to be
used in conjunction with a computer. Feedback Discovery II Software package 33-911
accompanies the Digital unit.
92
Fig 1.1 - Principal System Interconnections
Descriptions - Mechanical Unit (33-100)
Contains a power amplifier to drive the motor from an analogue or switched input. The
motor drives the output shaft through a 32:1 belt reduction. The motor shaft also carries
a magnetic brake disc and an analogue speed transducer (tachogenerator). A two-
phase pulse train for digital speed and direction sensing is also derived from tracks on
the brake disc.
The output shaft carries analogue (potentiometer) and digital (64 location Gray code)
angle transducers.
The unit contains a simple signal generator to provide low frequency test signals; sine,
square and triangular waves, and requires an external power supply providing:
+5V, 0, at 0.5A
93
Fig 1.9 - The Analogue Unit
With the power supply switched off, connect its outputs to the Mechanical Unit.
94
The motor should remain stationary - there may be a slight movement when the supply
is actually switched.
0.00
Hold the motor check switch to the right and the motor should run clockwise and the
output speed display should indicate 15 to 25 rpm.
Hold the switch left and the motor should run anti-clockwise with approximately the
same speed.
Hold the check switch to one side and gradually lower the brake to maximum. The
motor should slow down.
These tests indicate that Power Supply and Mechanical Unit are operating correctly.
Connect the Analogue Unit to the Mechanical Unit by the 34-way cable.
Rotating the power amplifier zero adjustment should enable the motor to be driven in
both directions up to about the same speed as before.
Either
Or
95
o A facility for X-Y operation with X and Y both able to operate with a d.c input.
Test Waveforms
Connect the oscilloscope to the test signals using either the 4mm sockets in the
Mechanical Unit or the 2mm terminals in the Analogue Unit.
Observe that the frequency may be varied between 0.1 and 1Hz or 1 and 10Hz.
System Waveforms
96
Experiment No 10
Steady state and transient response of DC motor
[ assignment 3]
Objective When you have completed this assignment you will know:
o That the steady speed of the motor is ideally proportional
to the applied voltage, less an amount proportional to load
torque.
o That a d.c tachogenerator provides a signal representing
speed, independent of motor loading.
The motor is a permanent magnet type and can be represented in idealised form as in
fig 3.1(a), where Ra is the armature resistance and T1, T2 are the actual motor terminals.
97
Fig 3.1 - Representation of a Motor in terms of an Ideal Motor.
If the motor is stationary and a voltage Va is applied, a current Ia flows which causes the
motor to rotate. As the motor rotates a back emf Vb is generated. As the motor speeds
up the back emf increases and Ia falls. In an ideal (loss free) motor, the armature
current falls to substantially zero and Vb approximately equals Va. Thus if Va is varied
slowly in either polarity, the motor speed is proportional to Va, and a plot of motor speed
against Va would have the form of fig 3.1(b).
The tachogenerator is a small permanent magnet machine and hence when rotated
produces an emf proportional to speed which can be used as a measure of the rotation
speed.
Brake Characteristics
The magnetic brake consists of a permanent magnet which can be swung over an
aluminium disc. When the disc is rotated eddy currents circulate in the area of the disc
within the magnet gap, and these react with the magnet field to produce a torque which
opposes rotation. This gives an adjustable torque speed relation of the form of fig 3.2,
and provides a very convenient load for the motor.
98
Fig. 3.3
99
The overall characteristics of a motor may be considered from two aspects, both of
which can be related to the idealised representation of fig 3.1(a). These aspects are:
Patching diagram A
Practical 3.1 Steady-State Characteristics
Arrange the system as shown in Fig. 3.3 ,where P3 enables a voltage in the range ±10V
to be applied to the power amplifier.
Use the DVM on the 33-100 for voltage measurements. For each measurement set up
the required steady state then switch between DVM and RPM.
By setting SW1 and varying P3, make a plot of motor speed against amplifier input, in
the range ±10V, scaling the vertical axis in units of 1000 r/min. The plot should have the
general shape of fig 3.4(a).
100
Plot 1:
Note Since the reduction to the output shaft is 32:1, the motor speed is calculated by
multiplying the r/min readng by 32. eg a reading of 31.25 = a motor speed of 1000
r/min.
Initially the motor speed increases substantially linearly with the voltage to the amplifier
because the motor back emf Vb, see fig 3.1(a), approximately equals the amplifier
output, but finally the amplifier limits before the full ±10V input is reached.
Tachogenerator
Plot the tachogenerator characteristics by setting the motor speed to various values by
P3 and measuring the generated voltage.
101
Plot 2:
Determine the tachogenerator factor by measuring the change in generated volts for a
speed change of 1000 r/min.
102
Fig. 3.6
The motor cannot change speed instantly due to the inertia of the armature and any
additional rotating load (the brake disc in the 33-002). This effect has very important
consequences for control system design.
If Va for an ideal motor has a step form as in fig 3.7(a), initially a large current will flow,
limited only by the armature resistance. As the motor rotates and speeds up the back
emf increases and the current is reduced to nearly zero in an ideal motor. This is shown
in the left portion of fig 3.7 (b). If Va is suddenly reduced to zero the back emf still exists,
since the motor continues to rotate, and drives a current in the reverse direction
dissipating energy and slowing the motor. This is illustrated in the right-hand portion of
(b).
103
Fig 3.7 - Transient Characteristics of Motor
The 33-001 motor shows a speed characteristic approximating to fig 3.7(b), but the
power amplifier is arranged to limit the maximum armature current which does not show
the ideal pulse characteristic.
Connect the system as shown in Fig. 3.6, which enables the motor to be driven from the
test square-wave, and allows the speed to be displayed on the Y axis of an
oscilloscope. It is convenient to use an X-Y display.
Set the power amplifier zero adjustment to run the motor at maximum speed in one
direction.
Turn up P3 and the square-wave signal will speed up and slow down the motor.
Adjust P3 until the motor is stationary for one half cycle. This corresponds with Va in fig
3.7(b).
The oscilloscope will now display the speed corresponding with Va in (b).
Plot the speed vs. time for two values of the input signal:
104
Plot 3:
Plot the current vs. time for two values of the input signal:
Plot 4:
Summary:
105
o
Experiment No 11
Introduction
The previous assignments have been concerned with position control, but an important
aspect of closed-loop control is speed control, which has many industrial applications,
varying from heavy industrial, such as paper mills or steel rolling mills, to tape or video
transport mechanisms.
106
Fig 9.1 - Essential features of a Closed Loop Speed Control
Ve = V r - V s
In operation the reference is set to a required value, which drives the motor to generate
Vs, which reduces the error until the system reaches a steady speed.
If the motor is loaded, eg with the magnetic brake on the 33-100, the speed falls; this
tends to increase the error, increasing the motor drive and thus reducing the speed fall
for a given load. Note that this implies negative feedback around the loop.
The speed fall with load, sometimes termed droop is a very important characteristic in
speed control systems.
The rotation direction can be reversed by reversing the reference voltage, though many
industrial speed control systems are required to operate in one direction only.
fig 9.3.
I-a Set P2 (tacho) to zero and set the amplifier feedback resistor to 100K , this gives
G = 1. Set P1 to 100. Set SW1 up to +10 and adjust P3 to run the motor at 1000 r/min
(31.25 r/min at output).
Turn up P2 slightly, if the speed decreases the loop feedback is negative as required. If
the speed increases use the other tachogenerator polarity.
Note that if the system has negative feedback and both the tachogenerator polarity and
the power amplifier input are reversed, the system still has negative feedback, but the
motor runs in the opposite direction.
I-b Set P2 to zero measure and plot the speed response for zero load and full load.
Time[ ]
Speed[no
load]
Speed[Full
load]
108
Plot 1:
2- Set P2 to 100 and readjust P3 to give 1000 r/min with the brake off. Measure and plot
the speed response for zero load and full load.
Time[ ]
Speed[no
load]
Speed[Full
load]
109
Plot 2:
3-Change the feedback resistor to 330K (G = 3.3), adjust P3 to give 1000 r/min with
no load, measure and plot the speed response for zero load and full load.
Time[ ]
Speed[no
load]
Speed[Full
load]
110
Plot 3:
The ripple can be reduced by connecting a capacitor across the error amplifier output resistor,
which introduces a time-constant,
Summary:
111
Experiment No 12
o .
Introduction
Increasing the gain increases the oscillatory tendency in the response, which is
undesirable. There are good practical reasons for using a high gain. An important one is
that, due to the brushes and other factors, all practical motors have a constant friction
(called coulomb friction). Also usually an increased amount of friction force (called
stiction) has to be overcome to start the motor from rest. Therefore a minimum voltage
has to be applied to the motor before rotation starts. This means that there is a
minimum input below which the system will not respond; this is termed dead-band. If the
gain is high the dead-band is reduced, which is advantageous, but the system may
display unwanted oscillation in the response.
112
Fig 6.1a - Velocity Feedback
The form of the system response with high gain can be much improved by applying a
feedback signal to the input proportional to the output shaft position. This arrangement
is termed position feedback, and is illustrated in fig 6.1a and fig6.1b.
113
Fig 6.1b - Velocity Feedback
In the first diagram it is assumed that the input and output signals are available as
voltages and a voltage Vs proportional to output shaft speed is available from a
tachogenerator. A fraction of this voltage KtVs is subtracted from Ve to give Vc, which is
the control voltage applied to the power amplifier giving:
Vc = V e - K t Vs
If a step input is applied to the system the error will initially equal the input step and
decrease as the motor speeds up. As the motor speed increases the velocity signal Vs
increases and subtracts from Ve to give a drive voltage Vc, which is less than the error.
This is illustrated in the second diagram, and the motor drive goes to zero and reverses
before the error goes to zero. This means that the motor begins to slow up before the
initial alignment, greatly reducing or even preventing any overshoot.
114
Measure and plot the position vs. time .
Time[ ]
Position[no
load]
Position[Full
load]
Plot !:
2]Connect P2 to one tachogenerator output and increase its setting; if the overshoot decreases
the velocity feedback polarity is correct. If the overshoot increases connect to the other socket.
When adjusting the tachogenerator feedback a dead beat response will be obtained
when the system aligns in the least possible time, but with no overshoot as in fig 6.3.
Additional velocity feedback will cause an over-damped response, in which the system
slowly moves into alignment.
115
Fig 6.3 - Dead-beat Response
Increase P2 until a deadbeat response is obtained, this occurs when the motor just does
not reverse. Measure and plot the position vs. time for θi -= 45
Time[ ]
Position[no
load]
Position[Full
load]
Plot 2:
116
3]Increase the feedback resistors to 200K, G = 2; and repeat step 2.
Time[ ]
Position[no
load]
Position[Full
load]
Plot 3:
Summary:
Experiment No 13
117
Introduction to 3-Term Control
Objective When you have completed this assignment you will know that:
o A very versatile control signal can be obtained by
combining components depending on the error, the derivative of
the error, and on the integral of the error.
o With capacitor input, an operational amplifier acts as a
differentiator.
o The input must be modified, giving partial differentiation,
for practical reasons.
118
Fig 10.4 - Differentiation by Operational Amplifier
Suppose that a ramp voltage is applied to a capacitor as in fig 10.4(a). Since the voltage
across the capacitor rises steadily a constant current must flow into the capacitor. The
current is proportional to the capacitance C, being given by the relation
i=C
If the capacitor is used as the input element for an operational amplifier as in (b), the
amplifier input will be a virtual earth point (see the Operational Amplifier Characteristics
assignment and fig 2.3) and the amplifier output will be given by
Vo = iRo
and since i = C
finally Vo = -CRo ,
giving the constant output voltage of (b). This indicates the derivative of the input with a
scaling factor -CRo.
Although this circuit in principle measures the derivative, there is a limitation in practical
application. If the input signal contains noise or disturbance components which are
small but rapidly changing, these may cause currents in the capacitor comparable to
those of slower changing signals for which the derivative is required. These unwanted
components in the input are emphasised and may even saturate the amplifier or some
later stage in the amplifying system.
119
The effect of unwanted rapidly changing high frequency components can be limited by a
resistor in series with the capacitor as in fig 10.4(c). If the input is changing slowly the
input current is largely determined by the capacitor, but if the input is changing fast the
current is limited by the resistor giving an overall gain of Ro/R.
In frequency response terms the gain of the ideal differentiator in (c) rises continuously
with increasing frequency, noise corresponding with high frequency components. The
introduction of an input resistor, called a limited derivative, gives a gain initially rising
with frequency, representing correct derivative action, but finally becoming constant
preventing emphasis of high frequency components.
patching diagram a
The upper amplifier in the Controller is intended for use as a differentiator. The two 1µF
capacitors can be used in series to give 0.5µF, singly to give 1µF or in parallel to give
2µF.
120
Arrange the circuit as displayed within the patching diagram a, where the upper
amplifier is connected as a limited differentiator with 1µF capacitor and adjustable input
from the triangle test waveform.
Set the test frequency to about 1Hz, and turn up P4 to 100.Measure and plot the output
of the controller
Time[ ]
Vo{R0=100}
Vo{R0=200}
Plot 1:
v= i dt
This is illustrated in fig 10.6(a). A constant current gives a steady increase of voltage,
the voltage representing the area under the current /time plot.
The illustrated current pulse waveform, comprising a positive pulse, a negative pulse
and then zero current, gives a final voltage value, which is the overall time integral of
the current.
i= .
Vc = V dt
122
giving the amplifier output as
Vo = V dt
If the applied voltage V becomes zero, the current i is also zero and the integrator holds
indefinitely whatever output has been obtained, since the amplifier does not ideally draw
any current at the virtual earth point. If the input is a general waveform the output is
correspondingly scaled integral.
It is often required to set the output of an integrator to zero before the start of
integration, and this can be arranged by a switch, mechanical or electronic, connected
across the capacitor, as shown dotted, which discharges the capacitor. Integration does
not start until the switch is open, irrespective of a possible input signal.
Arrange the integrator amplifier with 2µF as in the patching diagram b. Set SW1 down
to -10 and set P3 to supply about -3V to the controller input. P5 can then be used to
obtain a smaller voltage for the integrator input resistor.
Short circuit the integrator capacitor by the switch and adjust the integrator input voltage
to -1V.
Connect the voltmeter to the amplifier output and open the capacitor switch. The output
should move positively and can be reset to zero by closing the switch.
If the input voltage is 1V and the input resistor is 200k , then the input current i is
= 5µA
If the capacitor is 1µF, 5µA gives 5 volts per second
2µF, 5µA gives 2.5 volts per second
123
hence the output should take about four seconds to move from 0V to +10V.
The +10, 0, -10 switch can be used to make the integrator operate in both directions or
hold with the switch at 0V.
Time[ ]
Vo{C=2µF }
Vo{ C=4µF }
Plot 2:
124
Disconnect the input from P5. Now any current drawn at the virtual earth point will pass
through the capacitor and be integrated.
Discharge the capacitor by the switch and then open the switch and estimate the time
required for the output to reach 10V - it may be some minutes.
0.5 volt/second with 2µF. The value should be much less than 1µA.
patching diagram b
Three-Term Controller Realisation
The operational amplifier circuits providing integration and differentiation have been
investigated and can be combined together with a proportional component to give the 3-
Term Controller of fig 10.8(a).
125
Fig 10.8(a) - Operational Amplifier Realisation of 3-Term Controller
The component values have been chosen so that the circuit can be plugged up on the
controller section of the analogue unit as in the patching diagram. Individual adjustment
of Kd(P4) and Ki(P5) is given by the two potentiometers and a fixed overall gain of K is
obtained in the output summer by Ro/R.
A very important point in the operational amplifier realisation is that both the integrator
and differentiator have a negative sign, hence the proportional component must also
have a negative sign conveniently provided by an inverting unit in the proportional path.
If the individual components are combined in a summer, which introduces an additional
sign reversal, there is then no overall sign reversal.
The input is passed through a +1 buffer unit, which provides a high input resistance so
that the circuit can be operated from another potentiometer to provide an adjustment on
the overall gain K.
126
Fig 10.8(a) - Operational Amplifier Realisation of 3-Term Controller
Connect up the circuit as shown in the patching diagram C with Ro 100K , and
apply a square wave ±5V at about 1Hz. Set P4 and P5 to zero.
The proportional path has an effective gain of +1 and hence should provide a direct
square wave output of ±5V.
Unplug the proportional component from the summer and set P4 to about 20. The output
component will be a pulse as shown in fig 10.9. The ideal derivative of a square wave is
infinite and of zero duration when the wave changes sign and zero when the wave is
constant. A practical differentiator gives a finite pulse as shown.
Set up P4 to zero and P5 to 100. Discharge the capacitor by SW2. When SW2 is opened
the integrator output will be a triangular waveform of about 6V total swing.
Finally combine all components together to give a waveform generally as in fig 10.9.
127
patching diagram C
Summary
128
Experiment no 14
Applications of 3-Term Control
Objective When you have completed this assignment you will know that:
129
o Proportional with Derivative control improves transient
response
o Proportional with Integral control eliminates steady errors
but may give a slow response
130
With the integrator switched Off (SW2 down), P4 set to zero, the 3-term summing
amplifier feedback resistor set to 100K, and P1 to 100, the system has a forward gain G
= 1. Apply a triangular input of about ±5V at 0.1Hz from P3.
Make an X-Y display of the error, which should give a constant steady value.
Set the integrator input P5 to about 40 and open the integrator short circuit switch.
The error should be "integrated out", though the response may be slow.
Experiment with P5 adjustment. Note that increasing P5 eliminates the initial error more
quickly but gives a more oscillatory response.
These tests have shown the general property of integral control. An improved transient
performance can be obtained by introducing derivative control and increasing the
forward path gain.
Change the feedback resistor in the 3-term summing amplifier to 500K, this gives G = 5,
but the direct error is still available at the error operational amplifier output.
With triangle input as before, adjust P4 and P5 by trial and error to a possible 'best'
transient: perhaps just no overshoot. It is useful to increase the input to 0.2Hz.
Display the integrator output to show the output reaching the value required to supply
the motor drive.
The adjustment of integral and derivative controls that gives the 'best' transient for
following does not give the best step response transient, and some acceptable
compromise may be necessary.
Compare the error transients with triangle and step inputs and note that different
adjustments of P4 and P5 give a slightly better response for each input.
131
Fig.11.3b.
Time[ ]
Speed[ ]
Gc(s)=1
Speed[ ]
Gc(s)=5
132
Plot 1:
Time[ ]
Speed[ ]
T =0
l
Speed[ ]
T =max
l
133
Plot 2:
Summary:
134
135