0% found this document useful (0 votes)
96 views73 pages

Ee3512 - Control and Instrumentation Laboratory Manual

The document is a lab manual for the EE3512 Control and Instrumentation Laboratory at Agni College of Technology, detailing safety rules, guidelines for laboratory notebooks, and a list of experiments. It outlines course objectives, expected outcomes, and specific experiments related to control systems, including simulations and system identification. Additionally, it emphasizes the importance of safety and proper documentation in laboratory work.

Uploaded by

joeljacob0104
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views73 pages

Ee3512 - Control and Instrumentation Laboratory Manual

The document is a lab manual for the EE3512 Control and Instrumentation Laboratory at Agni College of Technology, detailing safety rules, guidelines for laboratory notebooks, and a list of experiments. It outlines course objectives, expected outcomes, and specific experiments related to control systems, including simulations and system identification. Additionally, it emphasizes the importance of safety and proper documentation in laboratory work.

Uploaded by

joeljacob0104
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

EE3512 - CONTROL AND INSTRUMENTATION


LABORATORY
(R-2021)
Record cum Lab manual
AGNI COLLEGE OF TECHNOLOGY
(Approved by AICTE/UGC, Accredited by NBA, New Delhi, Affiliated to Anna university, ISO 9001:2008 Certified Institution),
Thalambur, Chennai-600130.

BONAFIDE CERTIFICATE
Reg. No.

RECORD NOTE BOOK


20 - 20

Name of the Lab :……………………………………………………………………………………………………….

Department :………………………………………………………………………………………………………..

Certified that this is a Bonafide Record of Practical Work done by


Mr. / Ms. …………………………………………………………………………………………

of………………………………………………………Department……… …………..Semester
………………………………………………………………….. Laboratory during the year
20 - 20 .

Signature of Lab-in-Charge. Signature of the Head of Dept.

Submitted for Practical Examination held on ………………….......

INTERNAL EXAMINER EXTERNAL EXAMINER


LABORATORY PRACTICE
SAFETY RULES

1. SAFETY is of paramount importance in the Electrical Engineering Laboratories.


2. Electricity NEVER EXECUSES careless persons. So, exercise enough care and attention
in handling electrical equipment and follow safety practices in the laboratory.
(Electricity is a good servant but a bad master).
3. Avoid direct contact with any voltage source and power line voltages. (Otherwise, any
such contact may subject you to electrical shock)
4. Wear rubber-soled shoes. (To insulate you from earth so that even if you accidentally
contact a live point, current will not flow through your body to earth and hence you
will be protected from electrical shock)
5. Wear laboratory-coat and avoid loose clothing. (Loose clothing may get caught on an
equipment/instrument and this may lead to an accident particularly if the equipment
happens to be a rotating machine)
6. Girl students should have their hair tucked under their coat or have it in a knot.
7. Do not wear any metallic rings, bangles, bracelets, wristwatches and neck chains.
(When you move your hand/body, such conducting items may create a short circuit or
may touch a live point and thereby subject you to Electrical shock)
8. Be certain that your hands are dry and that you are not standing on wet floor. (Wet
parts of the body reduce the contact resistance thereby increasing the severity of the
shock)
9. Ensure that the power is OFF before you start connecting up the circuit. (Otherwise
you will be touching the live parts in the circuit).
10. Get your circuit diagram approved by the staff member and connect up the circuit
strictly as per the approved circuit diagram.
11. Check power chords for any sign of damage and be certain that the chords use safety
plugs and do not defeat the safety feature of these plugs by using ungrounded plugs.
12. When using connection leads, check for any insulation damage in the leads and avoid
such defective leads.
13. Do not defeat any safety devices such as fuse or circuit breaker by shorting across it.
Safety devices protect YOU and your equipment.
14. Switch on the power to your circuit and equipment only after getting them checked up
and approved by the staff member.
15. Take the measurement with one hand in your pocket. (To avoid shock in case you
accidentally touch two points at different potentials with your two hands)
16. Do not make any change in the connection without the approval of the staff member.
17. In case you notice any abnormal condition in your circuit (like insulation heating up,
resistor heating up etc), switch off the power to your circuit immediately and inform
the staff member.
18. Keep hot soldering iron in the holder when not in use.
19. After completing the experiment show your readings to the staff member and switch
off the power to your circuit after getting approval from the staff member.
20. Determine the correct rating of the fuse/s to be connected in the circuit after
understanding correctly the type of the experiment to be performed: no-load test or
full-load test, the maximum current expected in the circuit and accordingly use that
fuse-rating.(While an over-rated fuse will damage the equipment and other
instruments like ammeters and watt-meters in case of over load, an under-rated fuse
may not allow one even to start the experiment)
21. Moving iron ammeters and current coils of wattmeter’s are not so delicate and hence
these can stand short time overload due to high starting current. Moving iron meters
are cheaper and more rugged compared to moving coil meters. Moving iron meters
can be used for both a.c. and d.c. measurement. Moving coil instruments are however
more sensitive and more accurate as compared to their moving iron counterparts and
these can be used for d.c. measurements only. Good features of moving coil
instruments are not of much consequence for you as other sources of errors in the
experiments are many times more than those caused by these meters.
22. Some students have been found to damage meters by mishandling in the following
ways:
i. Keeping unnecessary material like books, lab records, unused meters etc. causing
meters to fall down the table.
ii. Putting pressure on the meter (especially glass) while making connections or
while talking or listening somebody.
GUIDELINES FOR LABORATORY NOTEBOOK
The laboratory notebook is a record of all work pertaining to the experiment. This record
should be sufficiently complete so that you or anyone else of similar technical background
can duplicate the experiment and data by simply following your laboratory notebook.
Record everything directly into the notebook during the experiment. Do not use scratch
paper for recording data. Do not trust your memory to fill in the details at a later time.
Organization in your notebook is important. Descriptive headings should be used to
separate and identify the various parts of the experiment. Record data in chronological
order. A neat, organized and complete record of an experiment is just as important as the
experimental work.
1. Heading:
The experiment identification (number) should be at the top of each page.Your name and
date should be at the top of the first page of each day's experimental work.
2. Object:
A brief but complete statement of what you intend to find out or verify in the experiment
should be at the beginning of each experiment
3. Diagram:
A circuit diagram should be drawn and labeled so that the actual experiment circuitry could
be easily duplicated at any time in the future. Be especially careful to record all circuit
changes made during the experiment.
4. Equipment List:
List those items of equipment which have a direct effect on the accuracy of the data. It may
be necessary later to locate specific items of equipment for rechecks if discrepancies develop
in the results.
5. Procedure:
In general, lengthy explanations of procedures are unnecessary. Be brief. Short
commentaries alongside the corresponding data may be used. Keep in mind the fact that the
experiment must be reproducible from the information given in your notebook.
6. Data:
Think carefully about what data is required and prepare suitable data tables. Record
instrument readings directly. Do not use calculated results in place of direct data; however,
calculated results may be recorded in the same table with the direct data. Data tables should
be clearly identified and each data column labeled and headed by the proper units of
measure.
7. Calculations:
Not always necessary but equations and sample calculations are often given to illustrate the
treatment of the experimental data in obtaining the results.
8. Graphs:
Graphs are used to present large amounts of data in a concise visual form. Data to be
presented in graphical form should be plotted in the laboratory so that any questionable
data points can be checked while the experiment is still set up. The grid lines in the
notebook can be used for most graphs. If special graph paper is required, affix the graph
permanently into the notebook. Give all graphs a short descriptive title. Label and scale the
axes. Use units of measure. Label each curve if more than one on a graph.
9. Results:
The results should be presented in a form which makes the interpretation easy. Large
amounts of numerical results are generally presented in graphical form. Tables are
generally used for small amounts of results. Theoretical and experimental results should be
on the same graph or arrange in the same table in a way for easy correlation of these results.
10. Conclusion:
This is your interpretation of the results of the experiment as an engineer. Be brief and
specific. Give reasons for important discrepancies.

TROUBLE SHOOTING HINTS

1. Be Sure that the power is turned ON


2. Be sure the ground connections are common
3. Be sure the circuit you build is identical to your circuit diagram (Do a node by node
check)
4. Be sure that the supply voltages are correct
5. Be sure that the equipment is set up correctly and you are measuring the correct
parameters
6. If steps 1 through 5 are correct then you probably have used a component with the wrong
value or one that doesn’t work. It is also possible that the equipment does not work
(although this is not probable) or the protoboard you are using may have some unwanted
paths between nodes. To find your problem you must trace through the voltages in your
circuit node by node and compare the signal you expect to have. Then if they are different
use your engineering judgment to decide what is causing the different or ask your lab
assistant.
EE3512 CONTROL AND INSTRUMENTATION LABORATORY LT P C
0042
COURSE OBJECTIVES:
 To make the students familiarize with various representations of systems.
 To make the students analyze the stability of linear systems in the time domain and
frequency domain.
 To make the students design compensator based on the time and frequency domain
Specifications.
 To develop linear models mainly state variable model and transfer function model
 To make the students to design a complete closed loop control system for the physical
systems.

LIST OF EXPERIMENTS:
1. Analog (op amp based) simulation of linear differential equations.
2. Numerical Simulation of given nonlinear differential equations.
3. Real time simulation of differential equations.
4. Mathematical modeling and simulation of physical systems in at least two fields.
 Mechanical
 Electrical
 Chemical process
5. System Identification through process reaction curve.
6. Stability analysis using Pole zero maps and Routh Hurwitz Criterion in simulation
platform.
7. Root Locus based analysis in simulation platform.
8. Determination of transfer function of a physical system using frequency response and
Bode’s asymptotes.
9. Design of Lag, lead compensators and evaluation of closed loop performance.
10. Design of PID controllers and evaluation of closed loop performance.
11. Discretization of continuous system and effect of sampling.
12. Test of controllability and observability in continuous and discrete domain in simulation
platform.
13. State feedback and state observer design and evaluation of closed loop performance.
14. Mini Project 1: Simulation of complete closed loop control systems including sensor and
actuator dynamics.
15. Mini Project 2: Demonstration of a closed loop system in hardware.
TOTAL: 60 PERIODS
COURSE OUTCOMES:
At the end of this course, the students will demonstrate the ability
CO1: To model and analyze simple physical systems and simulate the performance in
analog and digital platform.
CO2: To design and implement simple controllers in standard forms.
CO3: To design compensators based on time and frequency domain specifications.
CO4: To design a complete closed control loop and evaluate its performance for simple
physical systems.
CO5: To analyze the stability of a physical system in both continuous and discrete domains.
LIST OF EXPERIMENTS

PAGE DATE OF MARK


S. No. DATE NAME OF THEEXPERIMENT SIGN
NO SUBMISSION (10)
LIST OF EXPERIMENTS

PAGE DATE OF MARK


S. No. DATE NAME OF THEEXPERIMENT SIGN
NO SUBMISSION (10)
SIMULINK BLOCKS

OUTPUT WAVE FORMS

2
Ex. No. 1 Date

ANALOG (OP AMP BASED) SIMULATION OF LINEAR DIFFERENTIAL

EQUATIONS
AIM

To Study the analog (op amp based) simulation of linear differential equations using
Mat lab-Simulink.
APPARATUS REQUIRED

A PC with MATLAB package

PROCEDURE

1. To build a SIMULINK model to obtain response of a amplifier, the following procedure


is followed:

2. In MATLAB software open a new model in SIMULINK library browser.

3. From the continuous block in the library drag the transfer function block.

4. From the source block in the library drag the step input.

5. From the sink block in the library drag the scope.

6. From the math operations block in the library drag the summing point.

7. From the discrete block in the library drag the amplifier.

8. Connect all to form a system and give unity feedback to the system.

9. For changing the parameters of the blocks connected double click the respective block.

10. Start simulation and observe the results in scope.

11. Compare the simulated and theoretical results.

3
PROGRAMME
A.OPEN LOOP RESPONSE (FIRST ORDER SYSTEM)
T.F=4/(s+2)
1. Response of system to Step input
n=[4];
d=[1 2];
sys=tf(n,d);
step(sys)
2. Response of system to Impulse input
n=[4];
d=[1 2];
sys=tf(n,d);
step(sys)
impulse(sys)

RESULT:
Thus experiment on ANALOG (OP AMP BASED) circuit was performed
successfully to view real time simulation of Linear differential equations and
verified the same using MATLAB/Simulink Toolbox: Control System Toolbox.

4
Ex. No. 2 Date

NUMERICAL SIMULATION OF GIVEN NONLINEAR DIFFERENTIAL

EQUATIONS.
AIM
To digitally simulate the characteristics of Linear SISO systems using Numerical Simulation
of given nonlinear differential equations.

APPARATU REQUIRED
1. A PC with MATLAB package.

THEORY
State Variable approach is a more general mathematical representation of a system, which,
along with the output, yields information about the state of the system variables at some
predetermined points along the flow of signals. It is a direct time-domain approach, which
provides a basis for modern control theory and system optimization. SISO (single input single
output) linear systems can be easily defined with transfer function analysis. The transfer
function approach can be linked easily with the state variable approach.

The state model of a linear-time invariant system is given by the following equations:

Y(t) = C X(t) + D U(t) Output equation


Where A = n x n system matrix, B = n x m input matrix,
C= p x n output matrix and
D = p x m transmission matrix,

5
PROGRAM:
B. Close Loop Response
1. Response of Step input
n=[4];
d=[1 2];
sys=tf(n,d);
sys=feedback(sys,1,-1)
step(sys)
2. Response of Impulse input
n=[4];
d=[1 2];
sys=tf(n,d);
sys=feedback(sys,1,-1)
impulse(sys)

Second Order System


TF= 4/s2+6s+16
1. Open Loop Response of Step Input
n=[4];
d=[1 6 16];
sys=tf(n,d);
step(sys)

6
2. pen Loop Response of impulse Input
n=[4];
d=[1 6 16];
sys=tf(n,d);
impulse(sys)

Close Loop Response


1. Step Input
n=[4];
d=[1 6 16];
sys=tf(n,d);
sys=feedback(sys,1,-1) ;
step(sys)

7
2. Impulse Input

n=[4];
d=[1 6 16];
sys=tf(n,d);
sys=feedback(sys,1,-1) ;
impulse(sys)

8
PROGRAM
% Simulation of discrete model
clear,
clc
% Model Parameters
a=0.25;b=2;
% Simulation Parameters
Ts=0.1; %s
Tstop=30; %s
uk=1; % Step Response
x(1)=0;
% Simulation
for k=1:(Tstop/Ts)
x(k+1)=(1-a*Ts).*x(k) + Ts*b*uk;
end
% Plot the Simulation Results
k=0:Ts:Tstop;
plot(k,x)
grid on

OUTPUT:

RESULT:
Thus experiment on Numerical circuit was performed successfully to
view real time simulation of given Non Linear differential equations and verified the
same using MATLAB/Simulink Toolbox: Control System Toolbox .

9
Ex. No. 3 Date

Real time simulation of differential equations

AIM
By a suitable experiment perform a real time simulation of differential equations and
verify the same by MATLAB/Simulink Toolbox: Control System Toolbox.

Software Requirement:
1. Computer system with MATLAB
2. MATLAB/Simulink Toolbox: Control System Toolbox

Differential equation
In mathematics, a differential equation is an equation that relates one or more
unknown functions and their derivatives. In applications, the functions generally
represent physical quantities, the derivatives represent their rates of change, and the
differential equation defines a relationship between the two. Such relations are common;
therefore, differential equations play a prominent role in many disciplines
including engineering, physics, economics, and biology.

The study of differential equations consists mainly of the study of their solutions (the set
of functions that satisfy each equation), and of the properties of their solutions. Only the
simplest differential equations are soluble by explicit formulas; however, many
properties of solutions of a given differential equation may be determined without
computing them exactly.

Often when a closed-form expression for the solutions is not available, solutions may be
approximated numerically using computers. The theory of dynamical systems puts
emphasis on qualitative analysis of systems described by differential equations, while
many numerical methods have been developed to determine solutions with a given
degree of accuracy.

Types

Differential equations can be divided into several types. Apart from describing the
properties of the equation itself, these classes of differential equations can help inform the
choice of approach to a solution. Commonly used distinctions include whether the
equation is ordinary or partial, linear or non-linear, and homogeneous or heterogeneous.
This list is far from exhaustive; there are many other properties and subclasses of
differential equations which can be very useful in specific contexts.

Ordinary differential equations[edit]


Main articles: Ordinary differential equation and Linear differential equation
An ordinary differential equation (ODE) is an equation containing an unknown function
of one real or complex variable x, its derivatives, and some given functions of x. The
unknown function is generally represented by a variable (often denoted y), which,
therefore, depends on x. Thus x is often called the independent variable of the equation.
The term "ordinary" is used in contrast with the term partial differential equation, which
may be with respect to more than one independent variable.
Linear differential equations are the differential equations that are linear in the unknown
function and its derivatives. Their theory is well developed, and in many cases one may
express their solutions in terms of integrals.
Most ODEs that are encountered in physics are linear. Therefore, most special
functions may be defined as solutions of linear differential equations (see Holonomic
function).
As, in general, the solutions of a differential equation cannot be expressed by a closed-
form expression, numerical methods are commonly used for solving differential
equations on a computer.

Partial differential equations

A partial differential equation (PDE) is a differential equation that contains


unknown multivariable functions and their partial derivatives. (This is in contrast
to ordinary differential equations, which deal with functions of a single variable and their
derivatives.) PDEs are used to formulate problems involving functions of several
variables, and are either solved in closed form, or used to create a relevant computer
model.
PDEs can be used to describe a wide variety of phenomena in nature such
as sound, heat, electrostatics, electrodynamics, fluid flow, elasticity, or quantum
mechanics. These seemingly distinct physical phenomena can be formalized similarly in
terms of PDEs. Just as ordinary differential equations often model one-
dimensional dynamical systems, partial differential equations often
model multidimensional systems. Stochastic partial differential equations generalize
partial differential equations for modeling randomness.

Non-linear differential equations


A non-linear differential equation is a differential equation that is not a linear
equation in the unknown function and its derivatives (the linearity or non-linearity in the
arguments of the function are not considered here). There are very few methods of
solving nonlinear differential equations exactly; those that are known typically depend
on the equation having particular symmetries. Nonlinear differential equations can
exhibit very complicated behaviour over extended time intervals, characteristic of chaos.
Even the fundamental questions of existence, uniqueness, and extendability of solutions
for nonlinear differential equations, and well-posedness of initial and boundary value
problems for nonlinear PDEs are hard problems and their resolution in special cases is
considered to be a significant advance in the mathematical theory (cf. Navier–Stokes
existence and smoothness). However, if the differential equation is a correctly formulated
representation of a meaningful physical process, then one expects it to have a solution.
Linear differential equations frequently appear as approximations to nonlinear
equations. These approximations are only valid under restricted conditions. For example,
the harmonic oscillator equation is an approximation to the nonlinear pendulum
equation that is valid for small amplitude oscillations.

Problem

The first order ordinary differential equation that describes a simple series electrical
circuit witha resistor, inductor, and sinusoidal voltage source is as follows:

Procedure
1. Connections are made as per the circuit diagram.
2. Connect the function generator and CRO
3. Tabulate the reading and draw the graph.
Time Current

di
L  10  sin( 150  t )  i  R
dt
For this example, the inductance (L) is 1 henry and the resistance (R) is 10 Ω. The voltage
source is sinusoidal with a peak voltage equal to 10 volts and an angular velocity of 150
radians/second. The MATLAB statement written to solve the above ODE is as follows:

solution_1 = dsolve(‘DI=10*sin(150*t)–10*I’,’I(0)=0’,’t’);

The dsolve function symbolically solves the ordinary differential equation specified above.
The first argument is the actual ODE to be solved. D denotes differentiation with respect to
the independent variable which in this case is time or t. A repeated differentiation process
would be required if a digit other than 1 were to follow D. The character following the D (I
in this case, which is the circuit current), is the dependent variable. The remaining terms of
the equation are coded as usual. The second argument is used to specify the initial
conditions of the circuit. The initial current in this circuit at t = 0 is 0. The final argument is
used to specify the independent variable. Note that all arguments must be contained within
single quotation marks as shown.

The output from the dsolve function is the symbolic solution to the differential equation.
To get a quick visual understanding of the solution, the student should use the MATLAB
ezplot function in conjunction with the xlabel, ylabel, and grid commands. The result is a
simple graph which displays the numerical solution to the differential equation, the
symbolic solution to the differential equation, and appropriate units for the x and y axes.
The MATLAB statements written to provide the output to the graphical environment are
as follows:

ezplot(solution_1,[0 0.5]),… xlabel(‘Time,Seconds’),ylabel(‘Current,Amperes’),…

grid

The electrical circuit defined above may be solved quickly using the symbolic solving
capabilities of MATLAB. Only 1 statement was needed to define the engineering
application. For plotting purposes and proper documentation of the solution, 3 more
statements are required. This short program was run on the Student Version of the
MATLAB software distributed to the class. The results of the program are presented in
Figure 1.

Program
clc
clear all
close all
solution_1 = dsolve(‘DI=10*sin(150*t)–10*I’,’I(0)=0’,’t’);
ezplot(solution_1,[0 0.5]),… xlabel(‘Time,Seconds’),ylabel(‘Current,Amperes’),…
grid

FIGURE 1 Solution to ODE describing an RL Electrical Circuit

Next, the differential equation describing the RL electrical circuit is modeled using
Simulink. Simulink is a block diagram programming language that is packaged with the
Student Version of MATLAB. With Simulink, the differential equation is described using
blocks from the Simulink library. The blocks include an integrator, gain, summer, sine
wave source, and scope. The blocks are then “wired” together to generate the differential
equation. The complete Simulink model for the electrical circuit is depicted in Figure 2

FIGURE 2 Simulink model for an RL Electrical Circuit

The scope block in Simulink allows the student to generate a quick “picture” of the
current flowing in the electrical circuit. For this example, the x and y axes were scaled to
resemble the MATLAB graph produced for Figure 1. The results of the solution to the
equation using Simulink are shown in Figure 3.

FIGURE 3 Simulink Results for an RL Electrical Circuit

Next, the Simulink model is modified to provide simulation data (time, current) to the
MATLAB workspace using the To Workspace block. All Simulink variables are now
defined in the MATLAB script file and the Simulink model remains unedited. The script
file calls the Simulink model and the resulting simulation data is presented using the
MATLAB plot command. The script file allows the student to quickly change the
parameters of the model to simulate multiple cases. The modified Simulink model is
shown in Figure 4.

FIGURE 4 Simulink model to send results to MATLAB Workspace

The actual MATLAB m file used for this example is shown in Figure 5 and the results of the
simulation are shown in Figure 6.

FIGURE 5 MATLAB script file used to call Simulink model and plot results
FIGURE 6 Results from MATLAB script file

Result
Thus experiment on RL circuit was performed successfully to view real time
simulation of differential equations and verified the same using MATLAB/Simulink
Toolbox: Control System Toolbox.
Ex. No. 4 Date

Mathematical modeling and simulation of physical systems


Electromechanical system
TRANSFER FUNCTION OF ARMATURE CONTROLLED DC MOTOR

AIM:
To derive the mathematical model (transfer function) of the given DC motor by
experimentally and determine its transfer function parameters then perform the MATLAB
simulation to analyse time and frequency response.

COMPONENTS REQUIRED:
S. Name of the No of
Range Type
No Components Quantity
1 DC motor with loading arrangement DC 1
2 Ammeter (0-2A) MC 1
3 Ammeter (0-10A) MC 1
4 Voltmeter (0-300V) MC 1
5 Rheostat 270Ω, 1.2A 1

Fuse calculation:
125 % of full load current

Assumptions:
 The field current is constant.
 The flux which is proportional to the field current is also constant.
 The torque generated is proportional to the product of flux and the armature current
Tm  I a

T  I a Tm  K t I a

Where Kt is the motor torque constant


 Back EMF of the motor is proportional to the speed and the flux E b α Φ.
Precautions:
 At the time of starting the motor should be at no load condition.
 Armature rheostat must be kept at maximum resistance position.
 Field rheostat must be kept at minimum resistance position.
PROCEDURE: To Find Torque Constant [KT]
1. Connections are given as per the circuit diagram.
2. The DPST is switched on and set the rated field current by adjusting the field
rheostat.
3. Adjust the armature rheostat and apply the rated voltage to the armature voltage and
motor is made to run at rated speed.
4. Now load the motor with loading arrangement until the rated current is reached.
5. Note down the If, Va, Ia and spring balance reading in table.
6. Graph is drawn between the torque and field current from the graph KT = ∆T/∆If.
Circuit diagram (To Find Torque Constant [K T], to fined Back EMF constant [Kb] and
Rotational losses)

Tabulation
Armature Armature Field Spring Balance Torque
Voltage Current Current  t
T  9.81  ( S1 ~ S 2 ) r  
Va (V) Ia (A) If (A) S1 S2 S1 ~ S2  2

PROCEDURE: To fined Back EMF constant [Kb] and Rotational losses


1. The connections are given as per the circuit diagram. (Do not load the motor)
2. The D.C supply is given by closing the DPST switch.
3. Run the motor at its rated speed by adjusting field rheostat.
4. Noted down the readings of applied voltage and armature current and speed by
varying the armature rheostat.
5. Determine the Back EMF, armature input power & Back EMF constant using
60
K b  Eb
formula. 2N
6. Rotational losses can be determined from the graph.
Tabulation to find Back EMF constant [Kb]
No load
Armature Armature Copper Constant
Speed Speed Input Back
Voltage Current Loss Losses =
N (rpm) N (rps) Power emf
Va(V) Ia(A) Pc  I a2 Ra Pi - Pc
Pi  I a Ra

PROCEDURE: Determination of dN/dt


1. Connections are made as per the circuit diagram.
2. Switch on the supply. Before it chuck the precaution.
3. By varying the field and armature rheostat, the motor is made to run at rated speed.
4. Now disconnect the supply by opening the DPST switch and note down the time
taken by the motor to come at rest.
5. Draw the graph between time and speed. Determine dN/dt by taking slope of the
curve.
Speed (rpm) Time (sec)

CIRCUIT DIAGRAM: (To Find Ra)


PROCEDURE: (To Find Ra)
1. The circuit connections are made as per the circuit diagram.
2. Keeping autotransformer in minimum position, Main is switched ON.
3. Slowly adjust the variac and apply a small voltage (say 20V) to the armature
winding.
4. Note down voltmeter, ammeter and wattmeter readings.
5. Bring the variac to minimum position and switch OFF the main supply.

Armature Armature Wattmeter Armature


Voltage Current Reading Resistance
Va (V) Ia (A) P (W) Ra (Ω)

Average

CIRCUIT DIAGRAM: (To Find La)

PROCEDURE: (To Find La)


1. The circuit connections are made as per the circuit diagram.
2. Keeping autotransformer in minimum position, Main is switched ON.
3. Slowly adjust the variac and apply a small voltage (say 20V) to the armature
winding.
4. Note down voltmeter, ammeter and wattmeter readings.
5. Bring the variac to minimum position and switch OFF the main supply.
Armature Armature Wattmeter Armature Armature Armature
Voltage Current Reading Resistance Impedance Reactance
Va (V) Ia (A) P (W) Ra (Ω) Za (Ω) Xa (Ω)

Average

Formula used:
1) Inertia constant: J
J
Pr
 
Kg  m 2
 4 2
dN 
N   
 3600 dt 
2) Frictional Coefficient: f
Pr  N .m  rad 
f  2  
 2N   s 
 
 60 
Pr – Rotational Losses from the graph
3) Back EMF constant K b
E b  V  I a Ra
60
K b  Eb
2N
Where:
V- Applied voltage in V, Ia – Armature current in A.
Ra – Armature Resistance in Ω.
N – Rated speed in RPM
4) Transfer function
 ( s) Kt
G( s)  
Eb (s) sRa  sLa  f  sJ   K t K b 
Where:
KT – Torque constant calculated from graph (T Vs Ia)
Ra – Armature Resistance in Ω
La – Inductance of Armature in H
fo – Viscous friction coefficient In N-M / rad /sec
J – Equivalent moment of inertia of motor and load referred to motor shaft (K g -m2)
Kb – Is the back EMF constant.
Model graph

Eb T
Kb  Kt 
I a
Back EMF (V)

N

Torque (T)
∆Eb ∆T

∆N ∆Ia

Speed (rps) Armature Current (A)

Constant Losses (W)


N
t
Speed (N)

∆N

∆t Pr

Time(s) Armature Voltage (V)

Programme

clc
clear all
close all
num = [0 0 0 Kt]
den = [La*J (La*f + J*Ra) (Ra*f + Kt*Kb) Kt]
sys = tf(num,den)
step(sys)
bode(sys)

Result:
Thus the mathematical model (transfer function) of the given DC motor was
successfully and its transfer function parameters were calculated also MATLAB simulation
of its time and frequency response was done successfully.
Ex. No. 5 Date

SYSTEM IDENTIFICATION THROUGH PROCESS REACTION CURVE

AIM

To design the system identification through the process reaction curve by using MATLAB
Software.

APPARATUS REQUIRED

A PC with MATLAB package

PROCEDURE

Open the MATLAB software using a MATLAB icon Open a blank M- File or
Simulink file (File, New, M file)Type the given program in M file
Run the program using debug option or using F5 key
Find the stability of the system in the output graph and compare it with
theoretical value

PROGRAM
s = tf('s');
G = (2*s+1)/(s^2+3*s+2);
k = 0.7;
T = feedback(G*k,1);
pzmap(T)
grid, axis([-2 0 -1 1])
%------Applying Adaptive LMS algorithm --------%
for i=3:1:N

%Outputs
Plant_Output(i)=Input_Plant(i)*Weights_Plant(1)+Input_Plant(i-
1)*Weights_Plant(2)+Input_Plant(i-2)*Weights_Plant(3);
Model_Output(i)=Input_Model(i)*Weights_Model(1)+Input_Model(i-

%White gaussian noise signal added to the output of the plant.


Plant_Output(i)=Plant_Output(i)+Noise(i);
error(i)=Plant_Output(i)-Model_Output(i);

2)*error(i));
end
%Plots of error square and log of normalized error square

t=1:1:N;
error_square=power(error,2);
Max_error_square=max(error_square);

Normalized_error_Square=error_square./Max_error_square;

plot(t,error_square);
legend('error square');
title('Plot of error square Vs no of iterations');
xlabel('iterations');
ylabel('error square')

figure,
plot(t,log(Normalized_error_Square));
legend('Normalized error square log');
title('Plot of Normalized error square log Vs no of iterations');
xlabel('iterations');
ylabel('Normalized error square log')

% Testing mode %

s=30;
Input_test=rand(1,s);

for j= 3:1:s

Plant_Out_test(1)=Input_test(1)*Weights_Plant(1);

Plant_Out_test(2)=Input_test(2)*Weights_Plant(1)+Input_test(1)*Weights_Plan
t(2);
Plant_Out_test(j)=Input_test(j)*Weights_Plant(1)+Input_test(j-
1)*Weights_Plant(2)+Input_test(j-2)*Weights_Plant(3);

Out_Model_test(1)=Input_test(1)*Weights_Model(1);

Out_Model_test(2)=Input_test(2)*Weights_Model(1)+Input_test(1)*Weights_Mode
l(2);
Out_Model_test(j)= Input_test(j)*Weights_Model(1)+Input_test(j-
1)*Weights_Model(2)+Input_test(j-2)*Weights_Model(3);

error_test(1)= Plant_Out_test(1)-Out_Model_test(1);
error_test(2)= Plant_Out_test(2)-Out_Model_test(2);
error_test(j)= Plant_Out_test(j)-Out_Model_test(j);

end
p=1:1:s;
figure,
plot(p,Plant_Out_test,'-ro',p,Out_Model_test,'-.b');
legend('Plant Out test','Out Model test');
title('Comparision of outputs of Plant and Model during testing');
xlabel('iterations');
ylabel('Output')

square_error= error_test.^2;
SSE=sum(square_error);

end

RESULT:
Thus the analysis of the system identification through process reaction curve
stability MATLAB simulation platform were done successfully.
Ex. No. 6 Date

Stability analysis using Pole zero maps and Routh Hurwitz


Criterion in simulation platform
Aim
To analysis the stability of given transfer function using Pole zero maps and Routh
Hurwitz Criterion in MATLAB simulation platform.

Software Requirement:
1. Computer system with MATLAB
2. MATLAB/Simulink Toolbox: Control System Toolbox

Before discussing the Pole zero maps and Routh-Hurwitz Criterion, firstly we will study the
stable, unstable and marginally stable system.
1. Stable System: If all the roots of the characteristic equation lie on the left half of the
'S' plane then the system is said to be a stable system.
2. Marginally Stable System: If all the roots of the system lie on the imaginary axis of
the 'S' plane then the system is said to be marginally stable.
3. Unstable System: If all the roots of the system lie on the right half of the 'S' plane
then the system is said to be an unstable system.

Stability analysis using Pole zero maps in simulation platform


An open-loop linear time-invariant system is stable if:
 In continuous-time, all the poles on the complex s-plane must be in the left-half plane
(blue region) to ensure stability. The system is marginally stable if distinct poles lie
on the imaginary axis, that is, the real parts of the poles are zero.
 In discrete-time, all the poles in the complex z-plane must lie inside the unit circle
(blue region). The system is marginally stable if it has one or more poles lying on the
unit circle.
example
pzmap(sys1,sys2,...,sysN) creates the pole-zero plot of multiple models on a single figure.
The models can have different numbers of inputs and outputs and can be a mix of
continuous and discrete systems. For SISO systems, pzmap plots the system poles and
zeros. For MIMO systems, pzmap plots the system poles and transmission zeros.
example
[p,z] = pzmap(sys) returns the system poles and transmission zeros as column
vectors p and z. The pole-zero plot is not displayed on the screen.
Pole-Zero Plot of Dynamic System
Plot the poles and zeros of the continuous-time system represented by the following
2 s 2  5s  1
transfer function: H ( s)  2
s  3s  5
Program
clc
clear all
close all
H = tf([2 5 1],[1 3 5]);
pzmap(H)
grid on
Pole-Zero Plot of Identified System
Plot the pole-zero map of a discrete time identified state-space (idss) model. In
practice you can obtain an idss model by estimation based on input-output measurements
of a system. For this example, create one from state-space data.

Program

A = [0.1 0; 0.2 -0.9];


B = [.1 ; 0.1];
C = [10 5];
D = [0];
sys = idss(A,B,C,D,'Ts',0.1); %%Examine the pole-zero map.
pzmap(sys)

Stability analysis using Routh Hurwitz Criterion in simulation platform

Statement of Routh-Hurwitz Criterion


Routh Hurwitz criterion states that any system can be stable if and only if all the roots of the
first column have the same sign and if it does not has the same sign or there is a sign change
then the number of sign changes in the first column is equal to the number of roots of the
characteristic equation in the right half of the s-plane i.e. equals to the number of roots with
positive real parts.
Necessary but not sufficient conditions for Stability
We have to follow some conditions to make any system stable, or we can say that there are
some necessary conditions to make the system stable.
Consider a system with characteristic equation:
All the coefficients of the equation should have the same sign.
1. There should be no missing term.
If all the coefficients have the same sign and there are no missing terms, we have no
guarantee that the system will be stable. For this, we use Routh Hurwitz Criterion to check
the stability of the system. If the above-given conditions are not satisfied, then the system is
said to be unstable. This criterion is given by A. Hurwitz and E.J. Routh.

Advantages of Routh- Hurwitz Criterion


1. We can find the stability of the system without solving the equation.
2. We can easily determine the relative stability of the system.
3. By this method, we can determine the range of K for stability.
4. By this method, we can also determine the point of intersection for root locus with an
imaginary axis.
Limitations of Routh- Hurwitz Criterion
1. This criterion is applicable only for a linear system.
2. It does not provide the exact location of poles on the right and left half of the S plane.
3. In case of the characteristic equation, it is valid only for real coefficients.

For the following transfer function apply Routh- Hurwitz Criterion


a) s4 + 2s3 + 6s2 + 4s + 1 = 0
b) s4 + 3s3 + 3s2 + 2s + 1=0
1
c) G ( s )  5
s  7s + 6s + 42s 2 + 8s + 56
4 3

%% Routh-Hurwitz stability criterion


%
% The Routh-Hurwitz stability criterion is a necessary (and frequently
% sufficient) method to establish the stability of a single-input,
% single-output(SISO), linear time invariant (LTI) control system.
% More generally, given a polynomial, some calculations using only the
% coefficients of that polynomial can lead us to the conclusion that it
% is not stable.
% Instructions
% ------------
%
% in this program you must give your system coefficients and the
% Routh-Hurwitz table would be shown
%
% Farzad Sagharchi,Iran
% 2007/11/12
%% Initialization
clear ; close all; clc
% Taking coefficients vector and organizing the first two rows
coeffVector = input('input vector of your system coefficients: \n i.e. [an an-1 an-2
... a0] = ');
ceoffLength = length(coeffVector);
rhTableColumn = round(ceoffLength/2);
% Initialize Routh-Hurwitz table with empty zero array
rhTable = zeros(ceoffLength,rhTableColumn);
% Compute first row of the table
rhTable(1,:) = coeffVector(1,1:2:ceoffLength);
% Check if length of coefficients vector is even or odd
if (rem(ceoffLength,2) ~= 0)
% if odd, second row of table will be
rhTable(2,1:rhTableColumn - 1) = coeffVector(1,2:2:ceoffLength);
else
% if even, second row of table will be
rhTable(2,:) = coeffVector(1,2:2:ceoffLength);
end
%% Calculate Routh-Hurwitz table's rows
% Set epss as a small value
epss = 0.01;
% Calculate other elements of the table
for i = 3:ceoffLength

% special case: row of all zeros


if rhTable(i-1,:) == 0
order = (ceoffLength - i);
cnt1 = 0;
cnt2 = 1;
for j = 1:rhTableColumn - 1
rhTable(i-1,j) = (order - cnt1) * rhTable(i-2,cnt2);
cnt2 = cnt2 + 1;
cnt1 = cnt1 + 2;
end
end

for j = 1:rhTableColumn - 1
% first element of upper row
firstElemUpperRow = rhTable(i-1,1);

% compute each element of the table


rhTable(i,j) = ((rhTable(i-1,1) * rhTable(i-2,j+1)) - ....
(rhTable(i-2,1) * rhTable(i-1,j+1))) / firstElemUpperRow;
end

% special case: zero in the first column


if rhTable(i,1) == 0
rhTable(i,1) = epss;
end
end
%% Compute number of right hand side poles(unstable poles)
% Initialize unstable poles with zero
unstablePoles = 0;
% Check change in signs
for i = 1:ceoffLength - 1
if sign(rhTable(i,1)) * sign(rhTable(i+1,1)) == -1
unstablePoles = unstablePoles + 1;
end
end
% Print calculated data on screen
fprintf('\n Routh-Hurwitz Table:\n')
rhTable
% Print the stability result on screen
if unstablePoles == 0
fprintf('~~~~~> it is a stable system! <~~~~~\n')
else
fprintf('~~~~~> it is an unstable system! <~~~~~\n')
end
fprintf('\n Number of right hand side poles =%2.0f\n',unstablePoles)
reply = input('Do you want roots of system be shown? Y/N ', 's');
if reply == 'y' || reply == 'Y'
sysRoots = roots(coeffVector);
fprintf('\n Given polynomial coefficients roots :\n')
sysRoots
end

Result
Thus the analysis of the stability of given transfer function using Pole zero maps and
Routh Hurwitz Criterion in MATLAB simulation platform were done successfully.
Ex. No. 7 Date

Root Locus based analysis in simulation platform


Aim
To perform Root Locus based analysis in simulation platform for the given transfer function
and comment on stability of the system.
Software Requirement:
3. Computer system with MATLAB
4. MATLAB/Simulink Toolbox: Control System Toolbox

Closed-Loop Poles
The root locus of an (open-loop) transfer function is a plot of the locations (locus) of all
possible closed-loop poles with some parameter, often a proportional gain , varied
between 0 and . The figure below shows a unity-feedback architecture, but the procedure
is identical for any open-loop transfer function , even if some elements of the open-loop
transfer function are in the feedback path.

The closed-loop transfer function in this case is:

(1)
and thus the poles of the closed-loop system are values of such that .
If we write , then this equation can be rewritten as:
(2)

(3)
Let be the order of and be the order of (the order of the polynomial
corresponds to the highest power of ).
We will consider all positive values of . In the limit as , the poles of the closed-loop
system are solutions of (poles of ). In the limit as , the poles of the
closed-loop system are solutions of (zeros of ).
No matter our choice of , the closed-loop system has poles, where is the number of
poles of the open-loop transfer function . The root locus then has branches, each
branch starts at a pole of and approaches a zero of . If has more poles than
zeros (as is often the case), and we say that has zeros at infinity. In this case, the
limit of as is zero. The number of zeros at infinity is , the number of open-
loop poles minus the number of open-loop zeros, and is the number of branches of the root
locus that go to "infinity" (asymptotes).
Since the root locus consists of the locations of all possible closed-loop poles, the root locus
helps us choose the value of the gain to achieve the type of performance we desire. If any
of the selected poles are on the right-half complex plane, the closed-loop system will be
unstable. The poles that are closest to the imaginary axis have the greatest influence on the
closed-loop response, so even if a system has three or four poles, it may still behave similar
to a second- or a first-order system, depending on the location(s) of the dominant pole(s).

Plotting the Root Locus of a Transfer Function


Consider an open-loop system which has a transfer function of

(4)
How do we design a feedback controller for the system using the root-locus method? Let's
assume our design criteria are 5% overshoot and 1 second rise time.

Choosing a Value of K from the Root Locus


The plot above shows all possible closed-loop pole locations for a pure proportional
controller. In this case, not all of these closed-loop pole locations indicate satisfaction of our
design criteria. To determine what part of the locus is acceptable, we can use the
command sgrid(zeta,wn) to plot lines of constant damping ratio and natural frequency. Its
two arguments are the damping ratio ( ) and natural frequency ( ) [these may be vectors
if you want to look at a range of acceptable values]. In our problem, we need an overshoot
less than 5% (which means a damping ratio of greater than 0.7) and a rise time of 1 second
(which means a natural frequency greater than 1.8).
On the plot above, the two dotted lines at about a 45-degree angle indicate pole locations
with = 0.7; in between these lines, the poles will have > 0.7 and outside of these lines <
0.7. The semicircle indicates pole locations with a natural frequency = 1.8; inside of the
circle, < 1.8 and outside of the circle > 1.8.
Going back to our problem, to make the overshoot less than 5%, the poles have to be in
between the two angled dotted lines, and to make the rise time shorter than 1 second, the
poles have to be outside of the dotted semicircle. So now we know what part of the root
locus, which possible closed-loop pole locations, satify the given requirements. All the poles
in this location are in the left-half plane, so the closed-loop system will be stable.
From the plot above we see that there is part of the root locus inside the desired region.
Therefore, in this case, we need only a proportional controller to move the poles to the
desired region. You can use the rlocfind command in MATLAB to choose the desired poles
on the locus:
[k,poles] = rlocfind(sys)
Click on the plot the point where you want the closed-loop pole to be. You may want to
select the points indicated in the plot below to satisfy the design criteria.

Note that since the root locus may have more than one branch, when you select a pole, you
also identify where other closed-loop poles are too, all for the same corresponding value
of . Remember that these poles will affect the response too. From the plot above, we see
that of the four poles selected (indicated by "+" signs), the two closest to the imaginary axis
are in our desired region. Since these poles tend to dominate the response, we have some
confidence that are desired requirements will be met for a proportional controller with this
value of .
Closed-Loop Response
In order to verify the step response, you need to know the closed-loop transfer function.
You could compute this using the rules of block diagram reduction, or let MATLAB do it
for you (there is no need to enter a value for K if the rlocfind command was used):
The two arguments to the function feedback are the transfer function in the forward path
and the transfer function in the feedback path of the open-loop system. In this case, our
system is unity feedback.
If you have a non-unity feedback situation, look at the help file for the MATLAB
function feedback, which demonstrates how to find the closed-loop transfer function with a
gain in the feedback path.
Checking the step response of the closed-loop system with the chosen value of .
As we expected, this response has an overshoot less than 5% and a rise time less than 1
second.

Program

clear
close all
clc
s = tf('s');
sys = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));
rlocus(sys) %%Plotting the Root Locus of a Transfer Function
axis([-22 3 -15 15])
zeta = 0.7; %%Choosing a Value of K from the Root Locus
wn = 1.8;
sgrid(zeta,wn)
K = 350;
sys_cl = feedback(K*sys,1) %%Closed Loop Response of the given system

[z,p,k] = tf2zp(sys_cl) %%Checking the stability of the system


if real(p)<=0
disp('System is STABLE')
else
disp('System is UNSTABLE')
end

Result
Thus the simulation of Root Locus based for the given transfer function was done
successfully and stability of the system has been found.
Ex. No. 8 Date

DETERMINATION OF TRANSFER FUNCTION OF A PHYSICAL SYSTEM USING


FREQUENCY RESPONSE AND BODE S ASYMPTOTES.
AIM

To Design the bode plot for the given system and also determine the gain and phase margin
using MATLAB Software.

APPARATUS REQUIRED

A PC with MATLAB package

PROCEDURE

Open the MATLAB software using a MATLAB icon Open a blank M- File or
Simulink file (File, New, M file)Type the given program in M file
Run the program using debug option or using F5 key
Find the stability of the system in the output graph and compare it with
theoretical value

PROGRAM
1. Lag Compensator
K=9600
d1=conv([1 4 0],[1 80]) % used to formulate the polynomial
G=tf(K,d1) % generate the transfer function.
margin(G)
pmreq=input('Enter Required Phase Margin') % enter 33 as given in question
pmreq=pmreq+5
phgcm=pmreq-180
wgcm=input('Enter new gain cross over frequency') % from the first bode
plot use the mouse pointer and locate wgcm corresponding to phgcm.
[Beta,p]=bode(G,wgcm)
T=10/wgcm
Zc=1/T
Pc=1/(Beta*T)
Gc=tf([1 Zc],[1 Pc])
sys=Gc*G/Beta
margin(sys)
2..LEAD COMPENSATOR
clear variables;
% plant G parameters
s = tf('s');
a = 2.5; b = 27;
%% a) Gain K for PO=10
PO = 10; % percentage overshoot
zeta = log(100/PO)/sqrt(pi^2+ (log(100/PO))^2 ); % damping ratio
PM_d = round(100*zeta)+1; % PM desired at the nearest round value
h = tand(180-90-PM_d);
omega_c = roots([1 (a+b)/h -a*b]); % new omega_c
K = omega_c(2)*sqrt(omega_c(2)^2+a^2)*sqrt(omega_c(2)^2+b^2); % new gain K
G = K/( s*(s+a)*(s+b) ); % Plant G
figure;
margin(G);

RESULT:
Thus the mathematical model (transfer function) of the given Physical system
successfully and its transfer function parameters were calculated also MATLAB simulation
of its time and frequency response and Bodes asymptotes was done successfully.
Ex. No. 9 Date

Design of Lag, lead compensators and evaluation of closed


loop performance
AIM
To design the Lag Lead Compensator and evaluation of closed loop performance of given
simple system.

Software Requirement:
1. Computer system with MATLAB
2. MATLAB/Simulink Toolbox: Control System Toolbox

Problem

The plant to be controlled is described by the transfer function


280( s  0.5)
G p ( s) 
s( s  0.2)( s  5)( s  70)
This is a Type 1 system, so the closed-loop system will have zero steady-state error for a
step input, and a non-zero, finite steady-state error for a ramp input (assuming that the
closed-loop system is stable). As shown in the next section, the error constant for a ramp
input is Kx−plant = 2. At low frequencies, the plant has a magnitude slope of −20
db/decade, and at
high frequencies the slope is −60 db/decade. The phase curve starts at −90◦ and ends at
−270◦.

The specifications that must be satisfied by the closed-loop system are:


• steady-state error for a ramp input ess_specified ≤ 0.02;
• phase margin P Mspecified ≥ 55◦;
• gain crossover frequency ωx_specified = 5 r/s.

Our ability to graphically make the various measurements needed during the design
obviously depends on the accuracy and resolution of the Bode plots of |KcGp (jω)|. High
resolution plots like those obtained from MATLAB allow us to obtain reasonably accurate
measurements. Rough, hand-drawn sketches would yield much less accurate results and
might be used only for first approximations to the design. Being able to access the actual
numerical data allows for even more accurate results than the MATLAB-generated plots.
The procedure that I use when working in MATLAB generates the data arrays for
frequency, magnitude, and phase from instructions such as the following:

Program
Uncompensated system
%% where N1= log10 (ωmin), N2 = log10 (ωmax), and num, den are the numerator and
denominator polynomials, respectively, of KcGp (s). For this example, N1 = −3; N2 = 4;
clc
clear all
close all
N1 = −3;
N2 = 4;
num = 25 ∗ 280 ∗[1 0.5];
den = conv([1 0.2 0], conv([1 5],[1 70]));
w = logspace(N1,N2,1+100*(N2-N1));
[mag,ph] = bode(num,den,w);
semilogx(w,20*log10(mag),w,ph),grid

The data arrays mag, ph, and w can be searched to obtain the various values needed during
the design of the compensator.

Compensator transfer function is


25( s 3.03  1)( s 0.5  1) 25(0.33s  1)( 2s  1)
Gc _ lag _ lead ( s )  
( s 8.24  1) ( s 0.107  1) (0.121s  1)(9.34s  1)
14.5( s  3.03)( s  0.5)
Gc _ lag _ lead ( s) 
( s  8.24)( s  0.107)
The closed-loop system consisting of this compensator in series with Gp(s) in (20) in a unity-
feedback configuration will satisfy all of the specifications. The Bode plots for the final
compensated system are shown in Fig. 7, and the closed-loop step responses for the various
systems are shown in Fig. 8. The Bode plots clearly show that the gain crossover frequency
and phase margin specifications have been satisfied. The step response for the lead-
compensated system is the curve with peak overshoot nearly as large as the response from
KcGp(s). The step response of the lag-lead-compensated system has much smaller
overshoot than KcGp(s), but a slightly longer settling time. Compared with Gp(s), the final
compensated system has a shorter settling time, slightly less overshoot, approximately the
same phase margin, and much smaller steady-state error.

Compensated system

clc
clear all
close all
N1 = −3;
N2 = 4;
w = logspace(N1,N2,1+100*(N2-N1));

num_uncom = 25 ∗ 280 ∗[1 0.5];


den_uncom = conv([1 0.2 0], conv([1 5],[1 70]));
sys_uncom = tf(num_uncom,den_uncom)
[mag_un,ph_un] = bode(sys_uncom,w);

num_com = 14.5 ∗ conv([1 3.03],[1 0.5]);


den_com = conv([1 8.24],[1 0.107]);
sys_com = tf(num_com,den_com)

sys = series(sys_uncom, sys_com)


[mag,ph] = bode(sys,w);
semilogx(w,20*log10(mag),w,ph, w,20*log10(mag_un),w,ph_un);
grid

The data arrays mag, ph, and w can be searched to obtain the various values needed during
the design of the compensator.

Result
Thus the design of the Lag Lead Compensator were done successfully and evaluation of
closed loop performance of given simple system had been done.
Ex. No. 10 Date

Design of PID controllers and evaluation of closed loop


performance
Aim
To design the PID controllers and evaluation of closed loop performance of simple system

Software Requirement:
3. Computer system with MATLAB
4. MATLAB/Simulink Toolbox: Control System Toolbox

Theory
The PID controller is widely employed because it is very understandable and because it is
quite effective. One attraction of the PID controller is that all engineers understand
conceptually differentiation and integration, so they can implement the control system even
without a deep understanding of control theory. Further, even though the compensator is
simple, it is quite sophisticated in that it captures the history of the system (through
integration) and anticipates the future behavior of the system (through differentiation). We
will discuss the effect of each of the PID parameters on the dynamics of a closed-loop
system and will demonstrate how to use a PID controller to improve a system's
performance.

PID Overview
In this tutorial, we will consider the following unity-feedback system:

The output of a PID controller, which is equal to the control input to the plant, is calculated
in the time domain from the feedback error as follows:

(1)
First, let's take a look at how the PID controller works in a closed-loop system using the
schematic shown above. The variable ( ) represents the tracking error, the difference
between the desired output ( ) and the actual output ( ). This error signal ( ) is fed to the
PID controller, and the controller computes both the derivative and the integral of this error
signal with respect to time. The control signal ( ) to the plant is equal to the proportional
gain ( ) times the magnitude of the error plus the integral gain ( ) times the integral of
the error plus the derivative gain ( ) times the derivative of the error.
This control signal ( ) is fed to the plant and the new output ( ) is obtained. The new
output ( ) is then fed back and compared to the reference to find the new error signal ( ).
The controller takes this new error signal and computes an update of the control input. This
process continues while the controller is in effect.
The transfer function of a PID controller is found by taking the Laplace transform of
Equation (1).

(2)
where = proportional gain, = integral gain, and = derivative gain.

The Characteristics of the P, I, and D Terms


Increasing the proportional gain ( ) has the effect of proportionally increasing the control
signal for the same level of error. The fact that the controller will "push" harder for a given
level of error tends to cause the closed-loop system to react more quickly, but also to
overshoot more. Another effect of increasing is that it tends to reduce, but not eliminate,
the steady-state error.
The addition of a derivative term to the controller ( ) adds the ability of the controller to
"anticipate" error. With simple proportional control, if is fixed, the only way that the
control will increase is if the error increases. With derivative control, the control signal can
become large if the error begins sloping upward, even while the magnitude of the error is
still relatively small. This anticipation tends to add damping to the system, thereby
decreasing overshoot. The addition of a derivative term, however, has no effect on the
steady-state error.
The addition of an integral term to the controller ( ) tends to help reduce steady-state
error. If there is a persistent, steady error, the integrator builds and builds, thereby
increasing the control signal and driving the error down. A drawback of the integral term,
however, is that it can make the system more sluggish (and oscillatory) since when the error
signal changes sign, it may take a while for the integrator to "unwind."
The general effects of each controller parameter ( , , ) on a closed-loop system are
summarized in the table below. Note, these guidelines hold in many cases, but not all. If
you truly want to know the effect of tuning the individual gains, you will have to do more
analysis, or will have to perform testing on the actual system.
CL RESPONSE RISE TIME OVERSHOOT SETTLING TIME S-S ERROR
Kp Decrease Increase Small Change Decrease
Ki Decrease Increase Increase Decrease
Kd Small Change Decrease Decrease No Change
Problem
Suppose we have a simple mass-spring-damper system.
The governing equation of this system is
(3)
Taking the Laplace transform of the governing equation, we get
(4)
The transfer function between the input force and the output displacement then
becomes

(5)
Let
m = 1 kg
b = 10 N s/m
k = 20 N/m
F=1N
Substituting these values into the above transfer function

(6)
The goal of this problem is to show how each of the terms, , , and , contributes to
obtaining the common goals of:
 Fast rise time
 Minimal overshoot
 Zero steady-state error

Open-Loop Step Response


Let's first view the open-loop step response
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 a steady-state error of 0.95, which is quite large.
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
eliminate the steady-state error.

Proportional Control
From the table shown above, we see that the proportional controller ( ) reduces the rise
time, increases the overshoot, and reduces the steady-state error. The closed-loop transfer
function of our unity-feedback system with a proportional controller is the following,
where is our output (equals ) and our reference is the input:

(7)

Let the proportional gain ( ) equal 300


The above plot shows that the proportional controller reduced both the rise time and the
steady-state error, increased the overshoot, and decreased the settling time by a small
amount.
Proportional-Derivative Control
Now, let's take a look at PD control. From the table shown above, we see that the addition
of derivative control ( ) tends to reduce both the overshoot and the settling time. The
closed-loop transfer function of the given system with a PD controller is:

(8)
Let equal 300 as before and let equal 10.

This plot shows that the addition of the derivative term reduced both the overshoot and the
settling time, and had a negligible effect on the rise time and the steady-state error.

Proportional-Integral Control
Before proceeding to PID control, let's investigate PI control. From the table, we see that the
addition of integral control ( ) tends to decrease the rise time, increase both the overshoot
and the settling time, and reduces the steady-state error. For the given system, the closed-
loop transfer function with a PI controller is:
(9)
Let's reduce to 30, and let equal 70.
We have reduced the proportional gain ( ) because the integral controller also reduces the
rise time and increases the overshoot as the proportional controller does (double effect). The
above response shows that the integral controller eliminated the steady-state error in this
case.
Proportional-Integral-Derivative Control
Now, let's examine PID control. The closed-loop transfer function of the given system with
a PID controller is:

(10)
After several iterations of tuning, the gains = 350, = 300, and = 50 provided the
desired response.

Now, we have designed a closed-loop system with no overshoot, fast rise time, and no
steady-state error.

Program

clear
close all
clc

%% Initial values
Kp = 1;
Ki = 1;
Kd = 1;

s = tf('s');
C = Kp + Ki/s + Kd*s %% PID Controller Transfer Function

C = pid(Kp,Ki,Kd) %% Alternative way of PID Controller Transfer Function

tf(C)
s = tf('s');
P = 1/(s^2 + 10*s + 20); %% given simple mass-spring-damper system TF
step(P) %% Open-Loop Step Response

Kp = 300; %% Design of Proportional Controller & Step Response


C = pid(Kp)
T = feedback(C*P,1)
t = 0:0.01:2;
step(T,t)

Kp = 300; %% Design of Proportional-Derivative Controller & Step Response


Kd = 10;
C = pid(Kp,0,Kd)
T = feedback(C*P,1)
t = 0:0.01:2;
step(T,t)

Kp = 30; %% Design of Proportional-Integral Controller & Step Response


Ki = 70;
C = pid(Kp,Ki)
T = feedback(C*P,1)
t = 0:0.01:2;
step(T,t)

Kp = 350; %% Design of Proportional-Integral-Derivative Controller & Step Response


Ki = 300;
Kd = 50;
C = pid(Kp,Ki,Kd)
T = feedback(C*P,1);
t = 0:0.01:2;
step(T,t)

Result

Thus the design of PID controllers was done successfully and evaluation of closed loop
performance of simple system was done.
Ex. No. 11 Date

Discretization of continuous system and effect of sampling


Aim
To discretize the given continuous system and analysis the effect of sampling for
various sampling time
Software Requirement:
1. Computer system with MATLAB
2. MATLAB/Simulink Toolbox: Control System Toolbox

DISCRETIZATION OF CONTINUOUS SYSTEMS


In this experiment we shall discuss converting a continuous-time system into a discrete-
time system. We shall explicitly include the ZOH required to convert the discrete control
samples uk into the plant control input u(t).

Sampling the Plant


In this subsection we shall show how to convert a continuous- time state-variable
description of a plant into a discrete-time state-variable description.
Suppose a continuous time-invariant plant is given by

x= Ax + Bu
y= Cx + Du

with x(t) Є Rn, measured output y(t) Є Rp, and control input u(t) Є Rm. For digital control
purposes it is desired to define a discrete time index k such that

t = Kt

with T the sampling period. Then, the discrete control input uk is to be switched at times
kT, k= 0,1,...,N-1 by the microprocessor.
The usual procedure for controlling the plant is to hold the control input u(t) constant
between control switching. This may be achieved by adding a ZOH before the plant.
Then, the continuous plant input u(t) is given in terms of the discrete control uk by

u(t)= uk , kT ≤ t< (k+1)T

Note that u(t) is switched at the times kT so that it is continuous from the right.
T
uk u(t) x(t) y(t) yk
ZOH x  Ax  Bu C

hold sample
Sampling a continuous-time system
Also shown in the figure is a sampler with period T added to the output channel of the
plant. This A/D device generates the samples
Yk = Y(kT)
of the output. Let us also define the samples
Xk = X(kT)
of the state vector.
It is now required to determine a dynamical relation betweenuk and xk such that
Xk+1 = As Xk + Bs Uk.
That is, we need to determine the sampled equivalents As, Bs of Aand B.
To achieve this, first write the solution of state space equations, which is
t
x(t )  e A ( t t 0 )
x(t 0 )   e A(t  ) Bu ( )d
t0

Setting t0 = kT and t = (k+1)T yields


(k+1)T
( k 1)T
A[(k 1)T  ]
x(( k  1)T )  e x(kT )  e Bu ( )d
AT

kT
Since u(t) has the constant value of uk over the sample period due to the ZOH, we may
extract it from the integrand. Then, changingvariables to λ= τ-kT yields
T
x k 1  e AT
x k   e A[T  ] Bd .u k
0
Changing variables again to τ= T-λ yields finally
T
x k 1  e AT x k   e A Bd  .u k
0
By comparison with (0 we may now identify the discretized plant matrices as
As= eAT
T
B   e A Bd 
s

It is important to notice that the discretized plant matrix As isalways nonsingular.


Since the output equation is a nondynamical relation, we maysimply write

yk= Cxk + Duk.

That is, the C and D matrices are unchanged on discretization.


The design of digital controls proceeds as follows. First, a continuous-time state-variable
model of the plant is derived. Then, As and Bs are determined using the above equations.
Finally, the techniques to be presented are used to design a discrete control sequence uk.
During the implementation phase when the control is actually applied to the plant, u(t) is
manufactured by passing uk through a ZOH. Commercial digital signal processors (DSPs)
will usually have a ZOH built in.
It is important to clearly realize that this approach to digital controls design explicitly
includes the effects of the ZOH, since u(t) was assumed constant over the sample period in
deriving Bs. Thus, the resulting controller takes into account the properties of the hold and
sampling processes, guaranteeing exact behavior at the sample instants.
In order to evaluate As, Bs we may use
1 1
A s  e AT  I  AT  A 2T 2  A3T 3  
2! 3!
and, by integrating this term-by-term and multiplying by B,
1 1
B s  BT  ABT 2  A 2 BT 3  
2! 3!
Based on these equations, it is easy to write a computer program to discretize a
continuous plant (A, B). The series may be terminated when the terms become
smaller than some desired threshold. For large n, this technique could suffer numerical
problems due to the raising of matrix A to large powers.

Sampling the Transfer Function


It is a straightforward matter to determine the relation between the transfer functions of the
plant and its discretized version including the ZOH. If there is an output
Y = Cx
then, by sampling both sides we obtain yk= Cxk.

The continuous and discretized transfer functions are defined respectively by

H(s) = C (sI-A)-1 B
Hs(z) = C (zI-As)-1 Bs,

where argument s is the Laplace variable and z the Z-transform variable.


The impulse response of the ZOH is
(1  e  sT )
L( ZOH )  with L(.) the Laplace transform. Recall that the delay e-sT is represented
s
in terms of Z-transforms as z-1. Therefore, with some abuse in notation we can say

(1  e  sT ) (1  z 1 )
L( ZOH ) 

s s
Let us consider Fig. Error! Reference source not found.. The transfer function from uk to yk
including the ZOH is given by

 H (s) 
H s ( z )  (1  z 1 ) Z  With Z (.) the Z-transform.
 s 
This equation says that Hs(z)/(1-z-1)= Z(H(s)/s). Since the Z-transform of the discrete unit
step is 1/(1-z-1), this means that the discrete step response should equal the samples of the
continuous step response. Thus, ZOH sampling is also called discretization by step
invariance.
The key to finding the discretized transfer function Hs(z) is determining the Z-transform of
H(s)/s. This may be achieved using the partial fraction expansion. If the n+1 poles of H(s)/s
are distinct, then its PFE is
H ( s) n1 K i

s i 1 s  si
with Ki the residue of the pole at s= si. A term-by-term Z- transform of this is easy to
perform, for recall that each term has an inverse Laplace transform of Kiesit. However, this
is equal to Ki(esiT)k= Kizik, which has a Z-transform of Ki/(1-ziz-1).
Therefore, the sampled transfer function is given by

n 1 n 1
Ki Ki
H s ( z )  (1  z 1 )  (1  z 1 ) where
i 1 1  e i 1 1 
siT
z 1 z i z 1
zi  e siT
Evaluation of Hs(z) by using this formula, or by discretization of (A,B) and then application
of (0, will yield the same result.

If H(s)/s has repeated poles the partial-fraction expansion will contain terms like K/(s-si)j.
If some of the poles of H(s)/s are complex, then the associated residues Ki in (0 will be
complex. In this case it is better to keep the complex pole pair in a single term. In either case
we should refer to Table 7.1-1 to obtain the Z-transforms of the terms in the partial-fraction
expansion of H(s)/s.
The relative degree of a scalar transfer function is the degree of the denominator minus the
degree of the numerator. It is equivalent to the number of zeros at infinity. It is an
interesting fact that, no matter what the relative degree of the continuous-time transfer
function, the relative degree of the discretized equivalent Hs(z) is always equal to one,
except at some isolated values of the sampling period T. This may be seen by examining (0,
for on combining the sum over a common denominator, the constant term in the numerator
vanishes because H(s)/s has relative degree of two. The numerator term in z-1 is the
highest-order term, and its coefficient is a transcendental equation in T. That is, it vanishes
only for isolated values of T.
Discretize the following continuous-time transfer function:
s 1
H (s)  e 0.3s
s  4s  5
2

This system has an input delay of 0.3 s. Discretize the system using the triangle (first-order-
hold) approximation with sample time Ts = 0.1 s.
Program
clc
clear all
close all
H = tf([1 -1],[1 4 5],'InputDelay', 0.3);
Hd = c2d(H,0.1,'foh');
%%Compare the step responses of the continuous-time and discretized systems.
step (H,'-',Hd,'- -')

Discretize Model with Fractional Delay Absorbed into Coefficients


Discretize the following delayed transfer function using zero-order hold on the input,
and a 10-Hz sampling rate.
10
H (s)  e 0.25s
s 2  3s  10
Program
clc
clear all
close all
h = tf(10,[1 3 10],'IODelay',0.25);
hd = c2d(h,0.1)
%%Compare the step responses of the continuous-time and discretized models.
step(h,'--',hd,'-')

Sample time: 0.1 seconds


Discrete-time transfer function.
In this example, the discretized model hd has a delay of three sampling periods. The
discretization algorithm absorbs the residual half-period delay into the coefficients of hd.

Result
Thus discretization the given continuous system were done successfully and the effect of
sampling for various sampling time also be done.
Ex. No. 12 Date

Test of controllability and observability in continuous and


discrete domain in simulation platform

Aim: Aims of the experiment are


1. To test controllability and observability properties of the system by both Kalman’s
Testand Gilbert’s Test mathematically.
2. To verify answers by the software programming.

Software Requirement:
3. Computer system with MATLAB
4. MATLAB/Simulink Toolbox: Control System Toolbox

Problem:
Consider the state model given below.
𝑥̇ = 𝐴𝑥̇ + 𝐵𝑢
𝑦 = 𝐶𝑥̇

 0 1 0  0

Where A  0 0 
1 , B  0, C  1 0 0 in which

 A31  A32  A33  1
𝐴31 = 𝑑𝑚𝑟, 𝐴33 = (𝑑 + 𝑚 + 𝑟), 𝐴32 = 𝑑𝑚 + (𝑑 + 𝑚) 𝑟,
With 𝑟 = number at the unit place in roll number,
𝑑 = number at the tenth place in date of birth,
𝑚 = number at the unit place in the month of birth.

Check controllability and observability of the above system by both Kalman’s Test and
Gilbert’s Test.

Programe :
%% Check for observability and controllability
% Name of student: Roll No. 33
% Date of birth: 17 Month of birth: 11

clear
close all
clc
%% Initial values
r = 3; % number at the unit place in roll number
d = 1; % number at tenth place in date of birth
m = 1; % number at unit place in month of birth
A31 = d*m*r; A32 = d*m+(d+m)*r; A33 = d+m+r;
%% Problem: Consider the system representation
A = [0 1 0;0 0 1;-A31 -A32 -A33];
B = [0; 0; 1];
C = [1 0 0];
% eigenvaues (just for checking stability)
E = eig(A);
%% Controllability Test
% Kalman's Test: Method 1 (by calculation)
Qc1 = [B A*B A^2*B];
R1 = rank(Qc1);
% Kalman's Test: Method 2 (using inbuilt command)
Qc2 = ctrb(A,B);
R2 = rank(Qc2);
% Gilbert's Test
[M,D] = eig(A); % To get modal and diagonal matrices
Lambda = inv(M)*A*M;
B_tilde = inv(M)*B;
%% Observability Test
% Kalman's Test: Method 1 (by calculation)
Qo1 = [C; C*A; C*A^2];
R3 = rank(Qo1);
% Kalman's Test: Method 2 (using inbuilt command)
Qo2 = obsv(A,C);
R4 = rank(Qo2);
% Gilbert's Test
C_tilde = C*M;

Result
Thus the controllability and observability in continuous and discrete domain in simulation
platform (MATLAB) was done successfully.
Ex. No. 13 Date

State feedback and state observer design and evaluation of


closed loop performance.
Aim
To design State feedback controller and state observer controller and evaluation of closed
loop performance. Verify the same using simulation platform.

Software Requirement:
1. Computer system with MATLAB
2. MATLAB/Simulink Toolbox: Control System Toolbox

Problem
The magnetically suspended ball
There are several different ways to describe a system of linear differential equations.
The state-space representation is one of the way. For a single-input, single-output (SISO)
LTI system, the state-space form is given below:

where is an n by 1 vector representing the system's state variables, is a scalar


representing the input, and is a scalar representing the output. The matrices (n by
n), (n by 1), and (1 by n) determine the relationships between the state variables and
the input and output.
To introduce the state-space control design method, we use the magnetically suspended ball
as an example. The current through the coils induces a magnetic force which can balance
the force of gravity and cause the ball (which is made of a magnetic material) to be
suspended in mid-air. The modeling of this system has been established in many control
text books (including Automatic Control Systems by B. C. Kuo, the seventh edition).

The equations for the system are given by:


where is the vertical position of the ball, is the current through the electromagnet, is
the applied voltage, is the mass of the ball, is the acceleration due to gravity, is the
inductance, is the resistance, and is a coefficient that determines the magnetic force
exerted on the ball. For simplicity, we will choose values = 0.05 kg, = 0.0001, = 0.01
H, = 1 Ohm, = 9.81 m/s^2. The system is at equilibrium (the ball is suspended in mid-
air) whenever = (at which point = 0). We linearize the equations about the
point = 0.01 m (where the nominal current is about 7 Amps) and obtain the linear state-
space equations:

where:

is the set of state variables for the system (a 3x1 vector), is the deviation of the input
voltage from its equilibrium value ( ), and (the output) is the deviation of the height of
the ball from its equilibrium position ( ).

Controllability and Observability


A system is controllable if there always exists a control input, , that transfers any state
of the system to any other state in finite time. It can be shown that an LTI system is
controllable if and only if its controllabilty matrix, , has full rank (i.e. if rank( ) = n where
n is the number of states variables). The rank of the controllability matrix of an LTI model
can be determined in MATLAB using the commands rank(ctrb(A,B)) or rank(ctrb(sys)).

All of the state variables of a system may not be directly measurable, for instance, if the
component is in an inaccessible location. In these cases it is necessary to estimate the values
of the unknown internal state variables using only the available system outputs. A system
is observable if the initial state, , can be determined based on knowledge of the system
input, , and the system output, , over some finite time interval . For LTI
systems, the system is observable if and only if the observability matrix, , has full rank (i.e.
if rank( ) = n where n is the number of state variables). The observability of an LTI model
can be determined in MATLAB using the command rank(obsv(A,C)) or rank(obsv(sys)).

Controllability and observability are dual concepts. A system ( , ) is controllable if and


only if a system ( , ) is observable. This fact will be useful when designing an observer,
as we shall see below.
Control Design Using Pole Placement
Let's build a controller for this system using a pole placement approach. The schematic of a
full-state feedback system is shown below. By full-state, we mean that all state variables are
known to the controller at all times. For this system, we would need a sensor measuring the
ball's position, another measuring the ball's velocity, and a third measuring the current in
the electromagnet.

For simplicity, let's assume the reference is zero, = 0. The input is then

The state-space equations for the closed-loop feedback system are, therefore,

The stability and time-domain performance of the closed-loop feedback system are
determined primarily by the location of the eigenvalues of the matrix ( ), which are
equal to the closed-loop poles. Since the matrices and are both 3x3, there will be 3
poles for the system. By choosing an appropriate state-feedback gain matrix , we can
place these closed-loop poles anywhere we'd like (because the system is controllable). We
can use the MATLAB function place to find the state-feedback gain, , which will provide
the desired closed-loop poles.
Before attempting this method, we have to decide where we want to place the closed-loop
poles. Suppose the criteria for the controller were settling time < 0.5 sec and overshoot < 5%,
then we might try to place the two dominant poles at -10 +/- 10i (at = 0.7 or 45 degrees
with = 10 > 4.6*2). The third pole we might place at -50 to start (so that it is sufficiently
fast that it won't have much effect on the response), and we can change it later depending
on what closed-loop behavior results. Remove the lsim command from your m-file and
everything after it, then add the following lines to your m-file:

From inspection, we can see the overshoot is too large (there are also zeros in the transfer
function which can increase the overshoot; you do not explicitly see the zeros in the state-
space formulation). Try placing the poles further to the left to see if the transient response
improves (this should also make the response faster).

This time the overshoot is smaller. Consult your textbook for further suggestions on
choosing the desired closed-loop poles.
Compare the control effort required ( ) in both cases. In general, the farther you move the
poles to the left, the more control effort is required.
Note: If you want to place two or more poles at the same position, place will not work. You
can use a function called acker which achieves the same goal (but can be less numerically
well-conditioned):
K = acker(A,B,[p1 p2 p3])
Introducing the Reference Input
Now, we will take the control system as defined above and apply a step input (we choose a
small value for the step, so we remain in the region where our linearization is valid).
Replace t, u , and lsim in your m-file with the following:

The system does not track the step well at all; not only is the magnitude not one, but it is
negative instead of positive!
Recall the schematic above, we don't compare the output to the reference; instead we
measure all the states, multiply by the gain vector , and then subtract this result from the
reference. There is no reason to expect that will be equal to the desired output. To
eliminate this problem, we can scale the reference input to make it equal to in steady-
state. The scale factor, , is shown in the following schematic:

We can calcuate within MATLAB employing the function rscale (place the following line
of code after K = ...).

Note that this function is not standard in MATLAB. You will need to download it
here, rscale.m, and save it to your current workspace. Now, if we want to find the response
of the system under state feedback with this scaling of the reference, we simply note the fact
that the input is multiplied by this new factor, : and now a step can be tracked reasonably
well. Note, our calculation of the scaling factor requires good knowledge of the system. If
our model is in error, then we will scale the input an incorrect amount. An alternative,
similar to what was introduced with PID control, is to add a state variable for the integral of
the output error. This has the effect of adding an integral term to our controller which is
known to reduce steady-state error.
Observer Design
When we can't measure all state variables (often the case in practice), we can build
an observer to estimate them, while measuring only the output . For the magnetic
ball example, we will add three new, estimated state variables ( ) to the system. The
schematic is as follows:

The observer is basically a copy of the plant; it has the same input and almost the same
differential equation. An extra term compares the actual measured output to the
estimated output ; this will help to correct the estimated state and cause it to
approach the values of the actual state (if the measurement has minimal error).

The error dynamics of the observer are given by the poles of .


First, we need to choose the observer gain . Since we want the dynamics of the observer to
be much faster than the system itself, we need to place the poles at least five times farther to
the left than the dominant poles of the system. If we want to use place, we need to put the
three observer poles at different locations.

The equations in the block diagram above are given for the estimate . It is conventional to
write the combined equations for the system plus observer using the original state
equations plus the estimation error: . We use the estimated state for
feedback, , since not all state variables are necessarily measured. After a little bit of
algebra (consult your textbook for more details), we arrive at the combined state and error
equations for full-state feedback with an observer.
To see how the response to a non-zero initial condition with no reference input appears, add
the following lines into your m-file. Here we will assume that the observer begins with an
initial estimate equal to zero, such that the initial estimation error is equal to the initial state
vector, .

Responses of all the state variables are plotted below. Recall that lsim gives us and ; to
get , we need to compute .

From the above, we can see that the observer estimates converge to the actual state variables
quickly and track the state variables well in steady-state.
Programe :
%% State feedback and state observer
clear
close all
clc
A=[0 1 0; 980 0 -2.8 ; 0 0 -100 ];
B=[0; 0; 100 ];
C = [ 1 0 0 ];
% eigenvaues (just for checking stability)
poles = eig(A)
% Draw the Open-Loop Response to Non-Zero Initial Condition
t = 0:0.01:2;
t = 0:0.01:2;
u = zeros(size(t));
x0 = [0.01 0 0];

sys = ss(A,B,C,0);

[y,t,x] = lsim(sys,u,t,x0);
plot(t,y)
title('Open-Loop Response to Non-Zero Initial Condition')
xlabel('Time (sec)')
ylabel('Ball Position (m)')

% Design a state feedback controller


p1 = -10 + 10i;
p2 = -10 - 10i;
p3 = -50;

K = place(A,B,[p1 p2 p3]);
sys_cl = ss(A-B*K,B,C,0);

lsim(sys_cl,u,t,x0);
xlabel('Time (sec)')
ylabel('Ball Position (m)')

% Design a state feedback controller


p1 = -20 + 20i;
p2 = -20 - 20i;
p3 = -100;

K = place(A,B,[p1 p2 p3]);
sys_cl = ss(A-B*K,B,C,0);
lsim(sys_cl,u,t,x0);
xlabel('Time (sec)')
ylabel('Ball Position (m)')

% Introducing the Reference Input


t = 0:0.01:2;
u = 0.001*ones(size(t));
sys_cl = ss(A-B*K,B,C,0);
lsim(sys_cl,u,t);
xlabel('Time (sec)')
ylabel('Ball Position (m)')
axis([0 2 -4E-6 0])

Nbar = rscale(sys,K) % Calculate scalar vector.

lsim(sys_cl,Nbar*u,t)
title('Linear Simulation Results (with Nbar)')
xlabel('Time (sec)')
ylabel('Ball Position (m)')
axis([0 2 0 1.2*10^-3])

% Design a state observer controller


op1 = -100;
op2 = -101;
op3 = -102;
L = place(A',C',[op1 op2 op3])';
At = [ A-B*K B*K
zeros(size(A)) A-L*C ];

Bt = [ B*Nbar
zeros(size(B)) ];

Ct = [ C zeros(size(C)) ];
sys = ss(At,Bt,Ct,0);
lsim(sys,zeros(size(t)),t,[x0 x0]);
title('Linear Simulation Results (with observer)')
xlabel('Time (sec)')
ylabel('Ball Position (m)')

t = 0:1E-6:0.1;
x0 = [0.01 0.5 -5];
[y,t,x] = lsim(sys,zeros(size(t)),t,[x0 x0]);

n = 3;
e = x(:,n+1:end);
x = x(:,1:n);
x_est = x - e;

% Save state variables explicitly to aid in plotting


h = x(:,1); h_dot = x(:,2); i = x(:,3);
h_est = x_est(:,1); h_dot_est = x_est(:,2); i_est = x_est(:,3);

plot(t,h,'-r',t,h_est,':r',t,h_dot,'-b',t,h_dot_est,':b',t,i,'-g',t,i_est,':g')
legend('h','h_{est}','hdot','hdot_{est}','i','i_{est}')
xlabel('Time (sec)')

Result
Thus the design of State feedback and state observer and evaluation of closed loop
performance was done successfully.
References:
Experiments
These lab Manual experiments are taken from the following References
No.
https://en.wikipedia.org/wiki/Differential_equation
Solving Differential Equations Using MATLAB/Simulink
Frank W. Pietryga, P.E. University of Pittsburgh at Johnstown.
3
Proceedings of the 2005 American Society for Engineering Education
Annual Conference & Exposition Copyright © 2005, American Society for
Engineering Education
6 Routh- Hurwitz Criterion
https://www.javatpoint.com/control-system-routh-hurwitz-stability-
criterion
Program - Farzad Sagharchi
https://in.mathworks.com/matlabcentral/fileexchange/17483-routh-hurwitz-
stability-criterion
Pole Zero map - https://in.mathworks.com/help/ident/ref/lti.pzmap.html
7 Introduction: Root Locus Controller Design
https://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&sec
tion=ControlRootLocus
9 Lag-Lead Compensator Design Using Bode Plots - Prof. Guy Beale
Electrical and Computer Engineering Department, George Mason
University, Fairfax, Virginia
10 Introduction: PID Controller Design
https://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&s
ection=ControlPID
11 These notes are taken from F.L. Lewis, Applied Optimal Control and
Estimation: Digital Design and Implementation, Prentice-Hall, New
Jersey, TI Series, Feb. 1992.

Program - Continuous-Discrete Conversion Methods


https://in.mathworks.com/help/control/ug/continuous-discrete-conversion-
methods.html
12 Department of Electrical Engineering - K.K. Wagh Institute of
Engineering Education and Research, Hirabai Haridas Vidyanagari,
AmrutDham, Panchavati, Nashik-422003
13 Introduction: State-Space Methods for Controller Design
https://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&s
ection=ControlStateSpace

You might also like