Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Technology
Department of Mechatronics Engineering
SPEC Laboratory
Lab Manual
Control System Engineering
LAB PREREQUISITES:
None
PREREQUISITE KNOWLEDGE:
Fundamentals of MATLAB programming
OBJECTIVES:
➢ To refresh MATLAB programming
➢ To generate standard test inputs used for analyzing control systems
PRE-LAB EXERCISE
For the following exercises write the MATLAB code below the task specifications.
1. Use MATLAB command to obtain the following
• Extract the fourth row of the matrix generated by magic(6)
• Show the results of ‘x’ multiply by ‘y’ and ‘y’ divides by ‘x’.
Given x = [0:0.1:1.1] and y = [10:21].
• Generate random matrix ‘r’ of size 4 by 5 with number varying between -8 and 9
2. Use MATLAB to generate the first 100 terms in the sequence defined by
a(n+1) = p * a(n) * (1 – a(n))
with p=3 and a(1) = 0.5. After you obtain the sequence, plot the sequence.
READINGS:
For the analysis point of view, the signals, which are most commonly used as reference
inputs, are defined as standard test inputs.The performance of a system can be evaluated with
respect to these test signals.Based on the information obtained, the design of control system is
carried out.
The commonly used test signals are:
• Impulse signal
• Step signal
• Ramp signal
• Parabolic signal
• Exponential signal
• Sine signal
• Cosine signal
Impulse
Step
Ramp
Parabolic
Exponential r (t ) = Aeat t
Sine r (t ) = A sin(2 t ) t
Cosine r (t ) = A cos(2 t ) t
LAB PREREQUISITES:
Exercise 1
PREREQUISITE KNOWLEDGE:
Fundamentals of MATLAB programming
OBJECTIVES:
➢ To introduce SIMULINK platform for modelling.
➢ To introduce transfer function representation in MATLAB and SIMULINK
PRE-LAB:
• Derive the transfer function of the mass-spring-damper system.
The parameter values are M = 750 kg, K= 0 N/m, and B =30 N.s/m.The input force
increases from 0 to 300 N at t = 125 s.
Write the differential equation governing the mechanical translational system. Using
MATLAB solver ode45 solve the Differential Equation Using MATLAB.
• Derive the transfer function (Vout/Iin) of the following circuit with the applied voltage as
input and the voltage across the capacitor as output. Apply the constant parameters in
the transfer function such that the circuit consists of a 1kΩ resistor and a 160uF
capacitor.
READINGS:
Linear Time-Invariant Systems in MATLAB:
Control System Toolbox in MATLAB offers extensive tools to manipulate and analyze linear
time-invariant (LTI) models. It supports both continuous- and discrete-time systems. Systems
can be single-input/single-output (SISO) or multiple-input/multiple-output (MIMO). You can
specify LTI models as:
SIMULINK Exercise
• Represent the differential equation developed for the mass damper system in the pre-lab
exercise, using SIMULINK.
• Represent the transfer function developed for the three systems in the pre-lab exercise,
using SIMULINK.
Series configuration:
If the two blocks are connected as shown below then the blocks are said to be in series. It would
like multiplying two transfer functions. The MATLAB command for such configuration is
“series”.
Example 1: Given the transfer functions of individual blocks, generate the system transfer
function of the block combinations.
Parallel configuration: If the two blocks are connected as shown below then the blocks are
said to be in parallel. It would like adding two transfer functions.
Example 2: For the previous systems defined, modify the MATLAB commands to obtain the
overall transfer function when the two blocks are in parallel.
Feedback configuration: If the blocks are connected as shown below then the blocks are said
to be in feedback. Notice that in the feedback there is no transfer function H(s) defined. When
not specified, H(s) is unity. Such a system is said to be a unity feedback system.
The MATLAB command for implementing a feedback system is “feedback” as shown below:
When H(s) is non-unity or specified, such a system is said to be a non-unity feedback system as
shown below:
Example 4: Given a non-unity feedback system as shown in the figure, obtain the overall
transfer function using MATLAB:
pzmap
Compute pole-zero map of LTI models
pzmap(sys)
pzmap(sys1,sys2,...,sysN)
[p,z] = pzmap(sys)
Description:
pzmap(sys) plots the pole-zero map of the continuous- or discrete-time LTI model sys. For
SISO systems, pzmap plots the transfer function poles and zeros. The poles are plotted as x's
and the zeros are plotted as 0's.
pzmap(sys1,sys2,...,sysN) plots the pole-zero map of several LTI models on a single figure. The
LTI models can have different numbers of inputs and outputs. When invoked with left-hand
arguments,
[p,z] = pzmap(sys) returns the system poles and zeros in the column vectors p and z. No plot is
drawn on the screen. You can use the functions sgrid or zgrid to plot lines of constant damping
ratio and natural frequency in the s- or z- plane.
Example
Plot the poles and zeros of the continuous-time system.
to a square wave with period of four seconds. First generate the square wave with gensig.
Sample every 0.1 second during 10 seconds:
>>[u,t] = gensig(‘square’,4,10,0.1);
Then simulate with lsim.
>> H = tf([2 5 1],[1 2 3])
>>lsim(H,u,t)
We consider here a simple model of the vehicle dynamics, shown in the free-body diagram
(FBD) above. The vehicle, of mass m, is acted on by a control force, u. The force u represents
the force generated at the road/tire interface. For this simplified model we will assume that we
can control this force directly and will neglect the dynamics of the powertrain, tires, etc., that go
into generating the force. The resistive forces, bv, due to rolling resistance and wind drag, are
assumed to vary linearly with the vehicle velocity, v, and act in the direction opposite the
vehicle's motion.With these assumptions we are left with a first-order mass-damper system.
Summing forces in the x-direction and applying Newton's 2nd law, we arrive at the following
system equation:
If the capacitor is initially uncharged at zero voltage when the circuit is switched on, it starts to
charge due to the current ‘i' through the resistor until the voltage across it reaches the supply
voltage. As soon as this happens, the current stops flowing or decays to zero, and the circuit
becomes like an open circuit. However, if the supply voltage is removed, and the circuit is
closed, the capacitor will discharge the energy it stored again through the resistor. The time it
takes the capacitor to charge depends on the time constant of the system, which is defined as the
time taken by the voltage across the capacitor to rise to approximately 63% of the supply
voltage. For a given RC-circuit, this time constant is τ=RC. Hence its magnitude depends on the
values of the circuit components. The RC circuit will always behave in this way, no matter what
the values of the components. That is, the voltage across the capacitor will never increase
indefinitely. In this respect we will say that the system is passive and because of this property it
is stable.
For the RC-circuit as shown in Fig. 1, the equation governing its behavior is given by
where vc (t)is the voltage across the capacitor, R is the resistance and C is the capacitance. The
constant τ=RC is the time constant of the system and is defined as the time required by the
system output i.e. vc (t)to rise to 63% of its final value (which is E). Hence the above equation
can be expressed in terms of the time constant as:
C( s ) n2
=
R( s ) s 2 + 2 n s + n2
The generalized notation for a second order system described above can be written as
n2
C (s) =
s (s 2 + 2 n s + n2 )
for which the transient output, as obtained from the Laplace transform table
where0 < <1. The transient response of the system changes for different values of damping
ratio, . Standard performance measures for a second order feedback system are defined in
terms of step response of a system. Where, the response of the second order system is shown
below.
where MPt is the peak value of the time response, and fv is the final value of the response.
Settling Time: The time required for the system’s output to settle within a certain percentageof
the input amplitude (which is usually taken as 2%). Then, settling time, Ts, is calculated as
Using MATLAB find the step response of the system for values of n = 1 and = 0.1, 0.4,
0.7, 1.0 and 2.0.Plot all the results in the same figure window and fill the following table.
Damping Rise time Peak Time % Overshoot Settling time Steady state
Ratio value
0.1
0.4
0.7
1.0
2.0
Write briefly about the effect of damping ratio on the various specifications of the time
response based on the observations made from the table.
LAB PREREQUISITES:
Exercise 1 to 6
PREREQUISITE KNOWLEDGE:
Fundamentals of MATLAB programming
OBJECTIVES:
• To show how a permanent magnet D.C. motor may be controlled by varying the
magnitude and direction of its armature current and recognize the torque/speed
characteristic of the D.C. Motor
• The objective of this exercise will be to study the effect of feedback on the response of
the system to step input.
READINGS:
3. Find the range of gain, K, for the system shown below that will cause the system to be
stable, unstable and marginally stable. Assume K > 0.
A system is called type 0, type 1, type 2,p , if N=0, N=1, N=2, p , respectively. Note that this
classification is different from that of the order of a system. As the type number is increased,
accuracy is improved; however, increasing the type number aggravates the stability problem. A
compromise between steady-state accuracy and relative stability is always necessary.
The following table summarizes the steady-state errors for type 0, type 1, and type 2 systems
when they are subjected to various inputs. The finite values for steadystate errors appear on the
diagonal line.Above the diagonal, the steady-state errors are infinity; below the diagonal, they
are zero.
Remember that the terms position error, velocity error, and acceleration error mean steady-state
deviations in the output position. A finite velocity error implies that after transients have died
out, the input and output move at the same velocity but have a finite position difference.
The error constants Kp, Kv, and Ka describe the ability of a unity-feedback systemto reduce or
eliminate steady-state error.Therefore, they are indicative of the steady-stateperformance. It is
generally desirable to increase the error constants, while maintainingthe transient response
within an acceptable range. It is noted that to improve the steadystateperformance we can
increase the type of the system by adding an integrator orintegrators to the feedforward path.
This, however, introduces an additional stabilityproblem.The design of a satisfactory system
with more than two integrators in series inthe feedforward path is generally not easy.
Routh’s Stability Condition:
This method yields stability information without the need to solve for the closed-loop system
poles. Using this method, we can tell how many closed-loop system poles are in the left half-
plane, in the right half-plane, and on the jw-axis. (Notice that we say how many, not where.)
The method requires two steps:
• Generate a data table called a Routh table.
• Interpret the Routh table to tell how many closed-loop system poles are in the LHP or
RHP or on the jw-axis.
PREREQUISITE KNOWLEDGE:
Fundamentals of MATLAB programming
Knowledge about root locus plots and types of industrial controllers.
OBJECTIVES:
The objective of this exercise will be:
• To learn root locus using MATLAB
• Study the three term (PID) controller and its effects on the feedback loop
response.
• Investigate the characteristics of the each of proportional (P), the integral (I),
and the derivative (D) controls
• Design P, PD, PI, and PID controllers to meet closed-loop performance
specificationsincluding transient performance and steady-error
READINGS:
Introduction to Root Locus:
Application of the many classical and modern control system design and analysis tools is based
on mathematical model. MATLAB can be used with systems given in the form of transfer
function description. We are interested in how MATLAB can assist us in determining
• the number of branches.
• the starting and ending points of all the branches.
• the intersections of the root loci with the imaginary axis and the corresponding value of
K.
• the system’s oscillating frequency associated with the gain K.
• the breakaway points.
• the value of K at breakaway point.
For any given system G(s) the following figure illustrates a closed loop proportional control.
KP = Proportional gain
KI = Integral gain KD = Derivative gain
First, let's take a look at how the PID controller works in a closed-loop system using the
schematic shown above. The variable (e) represents the tracking error, the difference between
the desired input value (R) and the actual output (C). This error signal (e) will be sent to the
PID controller, and the controller computes both the derivative and the integral of this error
signal. The signal (u) just past the controller is now equal to the proportional gain (KP) times
the magnitude of the error plus the integral gain (KI) times the integral of the error plus the
derivative gain (KD) times the derivative of the error.
This signal (u) will be sent to the plant, and the new output (Y) will be obtained. This new
output (C) will be sent back to the sensor again to find the new error signal (e). The controller
takes this new error signal and computes its derivatives and its internal again. The process goes
on and on.
Example System:
Suppose we have a simple mass, spring, and damper problem.
The transfer function between the displacement X(s) and the input F(s) then becomes
Let
• M = 1kg
• b = 10 N.s/m
• k = 20 N/m
• F(s) = 1N (Unit Step)
Plug these values into the above transfer function
The goal of this problem is to show you how each of KP, KI and KD contributes to obtain
• Fast rise time
• No steady-state error
• Minimum overshoot
Open-loop step response:
Let's first view the open-loop step response
num=1;
den=[1 10 20];
plant=tf(num,den);
step(plant)
The DC gain of the plant transfer function is 1/20, so 0.05 is the final value of the output to a
unit step input. This corresponds to the steady-state error of 0.95, quite large indeed.
Furthermore, the rise time is about one second, and the settling time is about 1.5 seconds. Let's
design a controller that will reduce the rise time, reduce the settling time, and eliminates the
steady-state error.
After several trial and error runs, the gains KP=350, KI=300, and KD=50 provided the desired
response. To confirm, enter the following commands to an m-file and run it in the command
window.
Kp=350;
Ki=300;
Kd=50;
contr=tf([KdKp Ki],[1 0]);
sys_cl=feedback(contr*plant,1);
t=0:0.01:2;
step(sys_cl,t)
Now, we have obtained a closed-loop system with no overshoot, fast rise time, and no steady-
state error.
The characteristics of P, I, and D controllers:
The proportional controller (KP) will have the effect of reducing the rise time and will reduce,
but never eliminate, the steady state error. An integral controller (KI) will have the effect of
eliminating the steady state error, but it may make the transient response worse. A derivative
Note that these corrections may not be accurate, because KP, KI, and KD are dependent of each
other. In fact, changing one of these variables can change the effect of the other two. For this
reason the table should only be used as a reference when you are determining the values for K P,
KI, and KD.
Introduction to MATLAB ‘sisotool’:
A. Getting Started
1. Enter the transfer function for the plant, G(s), in your workspace (i.e., from
theMATLAB command prompt).
2. Type ‘sisotool’ at the command prompt.
3. Click ‘close’ when the help window comes up.
4. Click on View → Design Plots Configuration. In the ‘Plot Type’ column to the farright
of the window that opens, make sure all are set to ‘None’ except the first one,
whichshould be set to ‘Root Locus’ to turn off the bode plot.
B. Loading the Transfer Function
1. Click on File →Import.
2. A window on the left will show you the transfer functions in your workspace, while
thewindow on the right will let you choose the control system configuration.
3. We will usually be assigning G(s) to block ‘G’ (the plant). Double-click the space next
to‘G’ and type your transfer function name and hit Enter. You must hit enter or
nothingwill happen.
4. Once you hit enter, you should be able to click the OK button at the bottom of
thewindow. Then the window will close.
5. After you enter the transfer function, the root locus will be displayed. Double check
tomake sure that the open-loop poles and zeros of your plant are in the correct locations.
C. Generating the Step Response and the Control Effort Plot
1. Click on Analysis → Response to Step Command.
2. You will probably have both curves on one set of axes plot. To fix this click on the
‘Control and Estimation Tools Manager’ window to activate it. Next, click on the
‘Analysis Plots’ tab. Under ‘Plot 2’ select ‘Step’ for the plot type. Now, in the lower
window, check the box next to ‘closed-loop r to u’ under ‘plot 2’ and uncheck the same
box under ‘plot 1’. You should now have the step response in the upper plot of the
figure window and the control effort in the lower plot of the figure window.
3. You can now click on the pink boxes on the root locus (the current closed-loop poles for
the given gain) and move them along the root locus. Essentially, you are exploring
different controller gain values by doing this. Note how the step response changes as
you move the closed-loop pole locations.
4. The values of the closed-loop poles will appear at the bottom of the root locus window
as you click and hold the mouse on the pink boxes representing them. This only gives
PREREQUISITE KNOWLEDGE:
Knowledge on lead and lag introducing and compensating circuits.
OBJECTIVES:
The objective of this exercise will be:
• To learn lag introducing circuits
• Analyse the magnitude and phase response of the lag circuit output.
• Drawing the responses in the semilog graph sheet.
PROCEDURE:
1. Connect the patch cards in the unit as per the connection diagram.
2. Switch ON the power supply of unit.
3. Set sine wave as input and note down the amplitude and frequency of the input signal.
4. View the Lissajous pattern by using CRO, by means of keeping the CRO button in X-Y
mode and estimate the phase shift ( ) of the output signal compared to input due to the
lag process response.
5. Vary the frequency from low to high (below 100Hz) and conduct the experiment and
note down the readings and tabulate it.
6. Plot the gain plot (Gain Vs Frequency) and phase plot(Phase Vs Frequency) in semilog
graph sheet and conclude the behavior of lag process.
7. The phase angle ( ) to be measured from Lissajous pattern as shown in figure.
MODEL GRAPH
RESULT:
PREREQUISITE KNOWLEDGE:
Knowledge on lead and lag introducing and compensating circuits.
OBJECTIVES:
The objective of this exercise will be:
• To learn lead introducing circuits
• Analyse the magnitude and phase response of the lead circuit output.
• Drawing the responses in the semilog graph sheet.
PROCEDURE:
1. Connect the patch cards in the unit as per the connection diagram.
2. Switch ON the power supply of unit.
3. Set sine wave as input and note down the amplitude and frequency of the input signal.
4. View the Lissajous pattern by using CRO, by means of keeping the CRO button in X-
Y mode and estimate the phase shift ( ) of the output signal compared to input due to
the lag process response.
5. Vary the frequency from low to high (above 100Hz)and conduct the experiment and
note down the readings and tabulate it.
6. Plot the gain plot (Gain Vs Frequency) and phase plot(Phase Vs Frequency) in
semilog graph sheet and conclude the behavior of lag process.
7. The phase angle ( ) to be measured from Lissajous pattern as shown in figure.
MODEL GRAPH
RESULT:
PREREQUISITE KNOWLEDGE:
Knowledge on lead and lag introducing and compensating circuits.
OBJECTIVES:
The objective of this exercise will be:
• To learn lead lag introducing circuits
• Analyse the magnitude and phase response of the lead lag circuit output.
• Drawing the responses in the semilog graph sheet.
PROCEDURE
1. Connect the patch cards in the unit as per the connection diagram.
2. Switch ON the power supply of unit.
3. Set sine wave as input and note down the amplitude and frequency of the input
signal.
4. View the Lissajous pattern by using CRO, by means of keeping the CRO button in
X-Y mode and estimate the phase shift ( ) of the output signal compared to input
due to the lag process response.
5. Vary the frequency from low to high and conduct the experiment and note down the
readings and tabulate it.
6. Plot the gain plot (Gain Vs Frequency) and phase plot(Phase Vs Frequency) in
semilog graph sheet and conclude the behavior of lag process.
7. The phase angle ( ) to be measured from Lissajous pattern as shown in figure.
MODEL GRAPH
RESULT:
PREREQUISITES: 11,12
OBJECTIVES:
The objective of this exercise will be:
• To learn lead lag introducing circuits and compensating circuits
• Find theoretical and practical passive elements values for compensating circuits.
PROCEDURE
1. Set sine wave as input and note down the amplitude and frequency of the signal.
2. Now using patch card connect this input to LGin of Lag network as well as CRO(Ch-
1)
5. View the Lissajous pattern by using CRO, by means of keeping the CRO button in X-
Y mode and estimate the phase shift ( ) of the output signal compared to input due to
the lag process response.
6. Note down the frequency, phase and begin to perform calculation to compensate lag
network. (Model calculation given)
7. Find the values of Resistance, Capacitance (R1, R2, C1, C2) and connect suitable
components values on the compensator network.
8. Using patch cards Connect LGout to Cin and connect Cout to Gain amplifier.
10. Conclude the performance of the Lag process compensation using Lead lag network.
To compensate the phase lag angle of - = -33.05°. We have to design the lead compensator of
phase lead angle of (+ = +33.05°)
Frequency (f) = 45 Hz
Phase angle (φ) = 33.05
T2)
= tan-1(28.27) - 33.05°
= 87.97° - 33.05°
= 54.924°
2 π x45xT2 = tan(54.924°)
2 π x45xT2 = 1.424
WKT,
T2 = 1 .424 /(2 π x45) T2 = 5.036ms
So, R2 =50.37KΩ
RESULT: