0% found this document useful (0 votes)
142 views132 pages

Control Systems Lab Manual - With Challenging Experiments

This document provides information about a control systems laboratory manual, including details about the course, objectives, outcomes, and contents. The key points are: 1. The manual is for a 4 credit control systems lab course taken in the 4th semester of an electronics and communication engineering program. 2. The course objectives are to provide understanding of system modeling, response with and without feedback, time and frequency domain behavior, stability analysis, and state variable approach. 3. The contents include 10 experiments covering topics like time response analysis, stability analysis, root locus, Nyquist plot, PID control, and state space methods using MATLAB and LabVIEW. 4. An introduction section defines concepts like transfer functions, block
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)
142 views132 pages

Control Systems Lab Manual - With Challenging Experiments

This document provides information about a control systems laboratory manual, including details about the course, objectives, outcomes, and contents. The key points are: 1. The manual is for a 4 credit control systems lab course taken in the 4th semester of an electronics and communication engineering program. 2. The course objectives are to provide understanding of system modeling, response with and without feedback, time and frequency domain behavior, stability analysis, and state variable approach. 3. The contents include 10 experiments covering topics like time response analysis, stability analysis, root locus, Nyquist plot, PID control, and state space methods using MATLAB and LabVIEW. 4. An introduction section defines concepts like transfer functions, block
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/ 132

Control Systems

Laboratory
Manual
B18EC4050
IV Semester

School of Electronics and


Communication Engineering
REVA University School of ECE

B18EC4050 L T P C
Control Systems Lab
Duration :14 Wks 2 1 1 4

Prerequisites:

Knowledge of Network analysis, Integration and differentiation, Matrix equations, Laplace


Transform.
Course Objectives:
The objectives of this course are:
1. To provide an understanding of system modeling.
2. To provide and understanding on the system response with and without feedback.
3. To provide a detailed understanding of time domain and frequency domain behavior of a
system
4. To have an understanding of stability analysis of the system and its significance
5. To introduce the state variable approach for linear invariant system in both continuous time
and discrete time for the analysis and design of system.

Course Outcomes:
After completion of the course a student will be able to:
1. Apply the concept of modeling of systems for simple mechanical and electrical system. (a, b,
d, j)
2. Able to write the Transfer function using various techniques like using differential equations,
Block diagrams, signal flow graphs.(a, b, c, d,j)
3. Able to apply time domain and frequency domain analyses technique to determine stability of
system. (a, b, d, j)
4. Able to design the stable system. (a, b, c,d, j)
5. Able to model a system in state space and solve state space equation.(a, b, d, j).

Control Systems Lab – B18EC4050


REVA University School of ECE

CONTENTS

PART – A

SL.No. List of Experiments PAGE No.


Introduction to Control Systems. 1

1 Time Response of First order using labVIEW. 6

2 Time response of Second order system using labVIEW. 11

3 Stability Analysis Based on Pole Position 18

4 Stability Analysis of system using Bode Plot using labVIEW. 26

PART – B

SL.No. List of Experiments PAGE No.


5 To reduce steady state error of a system using MATLAB. 31

6 Create root locus for a given transfer function using MATLAB. 41

7 To obtain Nyquist Plot for a given transfer function of the system 48


using MATLAB and comment on the stability.

8 To observe effect of each of the PID parameters on the closed- 53


loop dynamics using MATLAB.

9 State-Space Methods for Controller Design using MATLAB. 58


10 List of challenging experiments level-1 and Level-2 72

Control Systems Lab – B18EC4050


REVA University School of ECE

Introduction

In studying control system the reader must be able to model dynamic system and analyze dynamic
characteristics. A mathematical model of dynamic system is defined as set of equations that represents
the dynamics of the system accurately or fairly well. Mathematical model is not unique to a given
system. A system may be represented in many different ways and therefore may have many
mathematical models, depending on once prospective.
The dynamics of many systems whether they are mechanical, electrical, thermal economic, biological
and so on may be described in terms of differential equations. Such differential equations are obtained
by using physical laws governing a particular system. For example Newton’s law for mechanical
system and Kirchhoff’s law for electrical system.

Transfer Function
The transfer function Of a linear time invariant differential equation is defined as the ratio of the
Laplace transform of the output (response function) to the Laplace transform of the input (driving
function) under the assumption that all initial conditions are zero.
Question: Why Time domain equations (differentiation equations) are transformed to ‘S’ domain?

Block Diagram
A functional block or simply the block is a symbol for mathematical operation on input signal to the
block that produces output.

Transfer Function.
R(s) C(s)
G(s)

The transfer function of the components are usually entered in the corresponding block which are
connected by arrows to indicate direction of flow of signals .The signal can pass only in the direction
of the arrows.

Question: What are the advantages of writing the block diagram of system?

General format of transfer function:

𝒄(𝒔) 𝒔𝒎 + 𝒃𝟏 𝒔𝒎−𝟏 +𝒃𝟐 𝒔𝒎−𝟐 + 𝒃𝟑𝒔𝒎−𝟑−−−−−−𝒃𝒏−𝟏𝒔𝟏 +𝒃𝒏


= :m<n
𝑹(𝒔) 𝒂𝟎 𝒔𝒏 + 𝒂𝟏𝒔𝒏−𝟏+𝒂𝟐 𝒔𝒏−𝟐+ 𝒂𝟑𝒔𝒏−𝟑 −−−−−−𝒂𝒏−𝟏 𝒔𝟏 +𝒂𝒏

C(s) = Output of system


R(s)-=Input of system

Control Systems Lab- B18EC4050 Page | 1


REVA University School of ECE

Question: what is characteristic equation?

The same transfer function can be written in factorized form.

𝒄(𝒔) 𝒌(𝒔+𝒛𝟏 )(𝒔+𝒛𝟐 )(𝒔+𝒛𝟑 )−−−−−(𝒔+𝒛𝒎−𝟏)(𝒔+𝒛𝒎 )


=
𝒓(𝒔) 𝒔𝒏 (𝒔+𝒑𝟏)(𝒔+𝒑𝟐)(𝒔+𝒑𝟑 )−−−−−(𝒔+𝒑𝒏−𝟏 )(𝒔+𝒑𝒏)

The numerator roots 𝑧1 , 𝑧2, 𝑧3 − − − −𝑧𝑚−1, 𝑧𝑚 are called zeros.


K= Gain
The denominator roots 𝑝1 , 𝑝2, 𝑝3 − − − −𝑝𝑛−1, 𝑝𝑛 are called poles.
Poles and zeros can be real or complex.

Question: Why the name poles and zeros!!

Introduction to second order system:

Control systems are generally called upon to perform both under transient (dynamic) and steady state
conditions. In order to analyze the transient and steady state behaviour(these together referred as of
the system time response) of control systems, the first step is to obtain mathematical model. For any
specific input signal complete time response can be obtained through Laplace transform inversion (or
through convolution integral in case the input is such that we cannot obtain its Laplace transform).
Usually the control signal to control system are not known fully ahead of time. In most cases the
signals may be random in nature, e.g, in radar tracking system, the position and speed of target to be
tracked may vary in random fashion. It is thus difficult to express the actual input signals
mathematically by simple equations. The characteristics of actual signals which severely strain a
control system are sudden shock, a sudden change, a constant velocity and a constant acceleration.
System dynamic behaviour for analysis and design is therefore judged and compared under
application of standard test signals-an impulse, a step, a constant velocity(a ramp input) and constant
acceleration(a parabolic input).
The nature of transient response is revelled by any one of these test signals as this nature dependent
upon system poles and not upon type of input signal.
It is therefore sufficient to analyze transient response to any one of the test signals-a step is generally
used for this purpose as this signal can be easily generated. Steady state response is then examined to
step as well as other test signals; the ramp and parabolic signal.
The time response performance of control system is measured by computing several response
performance indices as well as steady state accuracy for the standard input signals. These indices give
a quantitative method to compare the performance of alternative system configurations or to adjust
the parameter of a given system. As a given parameter is varied, various performance indices may
change in conflicting manner .The best parameter choice would thus be the best compromising
solution. Certain of the parameter indices may be specified as a upper and lower bounds in a design.

(Ref: Control Systems Engineering by I.J Nagarath M Gopal 5th edition: page 194 ,195,196,197)

Control Systems Lab- B18EC4050 Page | 2


REVA University School of ECE

Table 1 Standard Test Signals and their Laplace Transform

Standard test signal r(t) Mathematical expression in time domain Laplace Transform
Step input r(t)=Au(t) 𝐴
u(t)=1;t>0 𝑅 (𝑆 ) =
𝑆
u(t)=0;t<0
Ramp Input R(t)=At;t>0 𝐴
=0;t<0 𝑅 (𝑆 ) =
𝑆2

Parabolic input 𝐴𝑡 2 𝐴
𝑅(𝑡) = 2 ;t>0 𝑅 (𝑆 ) =
𝑆3
=0 ; t<0
Impulse input δ(t) = 0; t≠0 𝑅 (𝑆 ) = 1

∫ δ(t)dt = 1
−ℇ

Transfer function of second order system:

𝐶(𝑠) 𝑝(𝑠) 𝜔𝑛 2
= =
𝑅(𝑠) 𝑞(𝑠) 𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛 2

Where 𝜁 = 𝐷𝑎𝑚𝑝𝑖𝑛𝑔 𝑟𝑎𝑡𝑖𝑜 and is dimensionless. 𝜔𝑛 = 𝑈𝑛𝑑𝑎𝑚𝑝𝑒𝑑 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦

Note: The time response of any system is characterized by roots of denominator polynomial q(s),
which in fact poles of transfer function. The denominator polynomial is therefore called
characteristic equation.

The characteristic equation of second order system is


𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛 2 = 0
The roots of this characteristic equation is given by

𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛 2 = (𝑠 − 𝑠1)(𝑠 − 𝑠2)

Control Systems Lab- B18EC4050 Page | 3


REVA University School of ECE

Table 2 Relation between Damping ratio value and Roots of characteristic


equation

ζ Roots Damping
values
ζ<1 −𝜁𝜔𝑛 ± 𝑗 𝜔𝑛 √(1 − 𝜁 2 Under damped 𝜔𝑑 = 𝜔𝑛 √(1 − 𝜁 2
=−𝜁𝜔𝑛 ± 𝑗𝜔𝑑 Is called damped natural
Roots are complex and frequency.Transient response
conjugate exhibits an oscillation which
amplitude decreases with time.
ζ>1 The roots are real Over damped Transient response exhibits no
oscillation when amplitude
decreases with time.
ζ=1 The roots are real and equal Critically damped Highest possible speed of
response and yet non
oscillatory.
(Robotic control system shall
be designed to have damping
factor of ζ=1(or close to it but
less than unity)

Transient response specifications of second order system: (For step input)

The step response of second order system is characterized by following performance indices.
(i) How fast the system moves to follow the input?
(ii) How oscillatory it is(indicative of damping)
(iii) How long does it take to practically reach the final value.

1. Delay time 𝑡𝑑 : It is the time required for the response to reach 50% of final value in first attempt.

2. Rise time𝑡𝑟 : It is the time required for the response to rise from 10% to 90% of the final value
for over damped system and 0 to 100% of final value for under damped systems.

3. Peak value 𝑡𝑝 : It is the time required for the response to reach the peak of time response or peak
overshoot.

4. Peak overshoot 𝑀𝑝 :It indicates the normalized difference between the time response peak and
it is defined as

𝐶(𝑡𝑝 )−𝐶(∞)
Peak percent overshoot= x100%
𝐶(∞)

In most control system (except type-0) the steady output for step input is same as input.For
example ,for second order system 𝐶 (∞) = 𝐶𝑠𝑠 = 1 i.e is same as input.

Control Systems Lab- B18EC4050 Page | 4


REVA University School of ECE

5. Settling time 𝑡𝑠 : It is the time required for the response to reach and stay within a specified
tolerance band(usually 2% or 5% of final value).

Table 3 Transient response performance index of second order system:


Specification Formula
Rise time √(𝟏 − 𝜻𝟐
𝝅 − 𝒕𝒂𝒏−𝟏 𝛇
𝒕𝒓 =
𝝎𝒏 √(𝟏 − 𝜻𝟐
Peak time 𝝅
𝒕𝒑 =
𝝎𝒏 √(𝟏 − 𝜻𝟐
Peak overshoot −𝜻𝝅
𝑴𝒑 = 𝒆 √(𝟏−𝜻𝟐

Settling time 𝟒
𝒕𝒔 =𝜻𝝎
𝒏
Steady state error 𝟐𝜻
𝒆𝒔𝒔 =𝝎
𝒏

Introduction about labVIEW 2019

 LabVIEW is an application development environment for visual programming.

 The LabVIEW environment is used for creating, debugging and managing


applications written in 'G', a graphical programming language.

 Applications developed in LabVIEW are called VI's (VI stands for Virtual
Instrument )

Control Systems Lab- B18EC4050 Page | 5


REVA University School of ECE

Experiment-1
Time Response of First order

Introduction:
The dynamics of many systems of interest to engineers may be represented by a simple model
containing one independent energy storage element.

Exercise: To build mathematical modeling of Electrical system and to obtain time response.

Aim:

(i) To develop transfer function of first order system


(ii) To plot unit Step response of RL series circuit when output is taken across resistor
R and output is taken across inductor L.
(iii) To find time constant of the system.

(i) Writing the Transfer function of first order Electrical System:

Step 1: Apply KVL

𝑑𝑖
𝑢(𝑡) = 𝐿 + 𝑅 𝑖 : u(t)=Unit step input
𝑑𝑡

Take Laplace transform:


1
= 𝐿𝑠 𝐼 (𝑠) + 𝑅 𝐼(𝑠)
𝑠
1
𝐼 (𝑠) =
𝑠(𝐿𝑠 + 𝑅)

Control Systems Lab- B18EC4050 Page | 6


REVA University School of ECE

If out is taken across resistor:


1
𝑉 𝑜 (𝑠) = 𝑅 𝐼(𝑠) = 𝑅
𝑠(𝐿𝑠 + 𝑅)
1
𝑉𝑜(𝑠) 𝑅 1 1/𝑅𝐿
𝑠(𝐿𝑠+𝑅)
Transfer function = = = 𝑅
𝑉𝑖 (𝑠) 1/𝑠 𝑅(𝐿𝑠+𝑅) (𝑠+ )
𝐿

Problem statement: Simulate unit step response of series RL circuit when output is taken across
Resistor using LabVIEW.

Procedure to construct a block diagram using labVIEW :


R=1, L=1
Construct transfer function with given values.
 Open LabVIEW
 File> New VI
 Right click on Block diagram window control and simulations control design model
construction CD construct transfer function model.VI place the block on the BD.
 Wire the terminals

o
 Right click at input terminal of CD construct transfer function model.VI Create Control
 Create control for both numerator and denominator.

 Right click on Block diagram window  control and simulations control design model
construction CD draw transfer function model.VI connect with CD construct transfer function
model.VI
 Right click on the equation terminal of the CD draw transfer function model.VI create  Indicator
(rename label)
 Right click on Block diagram window  control and simulations control design Time
response CD step response.VI place the block on Block diagram window.

Control Systems Lab- B18EC4050 Page | 7


REVA University School of ECE

 Wire from the CD construct transfer function model.VI to input terminal of CD step
response.VIChoose polymorphic instance to be automatic.
 Right click on output terminal of CD step response.VI Create Indicator.
 Right click on Block Diagram control and simulations control design Time response
 CD parametric time response.VIPlace it on the Block Diagram window.
 Wire the output data from CD construct transfer function.VI to  CD parametric time response.VI
 Right click on second output terminal of CD parametric time response.VI create Indicator.
 Assign values for numerator and denominator as per the TF model.

Figure1: Block Diagram Panel Display of First Order System Time Response:
Where R=1 Ohm and L=1 Henry

Control Systems Lab- B18EC4050 Page | 8


REVA University School of ECE

Figure2: Front Panel Display of First Order System Time Response: Where R=1 Ohm and
L=1 Henry
Tabular Column:
Output is taken across Resistor (R)

R in L in Transfer function Rise Time Settling Time Response Remarks


ohms henry O/P across R (0-90% of Time Constant (Draw the
𝑹⁄𝑳 final value) ( 2% of (0-63.33% Graph)
𝑻𝑭 =
𝑹 final of final
(𝒔 + )
𝑳 value) value)

Control Systems Lab- B18EC4050 Page | 9


REVA University School of ECE

Result:

i. The transfer function of given RL circuit is:


ii. The time constant of the circuit is:

Challenge level 1:
1. Plot unit step response of RL circuit if output is taken across inductor
(i) R=2 ohm, L= 1 henry
(ii) R=2 ohm, L= 2 henry
(i) R=1 ohm, L= 2 henry
2. Why decaying curve?
1. Comment on time constant and gain of RL series circuit.
2. Consider series RC circuit and plot step resp

Exercise Question:
Order of system
Identify poles, zeros and gain of RL circuit.
What is the relation between order of equation and number of roots of equation?

Control Systems Lab- B18EC4050 Page | 10


REVA University School of ECE

EXPERIMENT-2
Time response of Second order system

Aim:

(i) To develop transfer function of second order system


(ii) To plot unit Step response of RLC series circuit when output is taken across
capacitor ‘C’, Resistor ‘R’ and inductor ‘L’.

Theory:

Transfer function of second order system:


(i) Writing the Transfer function of second order Mechanical System:

The fundamental law governing mechanical system is newtons second law.


(i) Mass spring Dashpot system :

Step1: Apply Newtons law


𝑑 2𝑥 𝑑 𝑥
F=𝑀 2 + 𝑓 + 𝑘𝑥
𝑑𝑡 𝑑𝑡
Where,
M=Mass of system.
f= Frictional co-efficient.
K=Spring constant

Control Systems Lab- B18EC4050 Page | 11


REVA University School of ECE

Step2: Apply Laplace transform

F(s) = 𝑀𝑠 2 𝑋 (𝑠) + 𝑓𝑠 𝑋(𝑠) + 𝑘𝑋(𝑠)


X(s)= Displacement
F(s) =Force is Input

Then transfer function of above mechanical system is:

𝑋(𝑠) 1
= 2
𝐹(𝑠) 𝑠 + 𝑠 + 1

(ii) Writing the Transfer function of second order Electrical System:

Consider RLC series circuit:

Step1: Apply Kirchhoff’s voltage law:

𝑑𝑖 1
𝑢 (𝑡 ) = 𝐿 + 𝑅𝑖+ ∫ 𝑖 𝑑𝑡.
𝑑𝑡 𝐶
u(t) = Unit step input

Step2: Apply Laplace Transform

1 1
= 𝐿𝑠 𝐼 (𝑠) + 𝑅 𝐼(𝑠) + 𝐼 (𝑠)
𝑠 𝐶𝑠

1 𝐶 1/𝐿
𝐼 (𝑠) = = =
1 𝐿𝐶𝑠 2 + 𝑅𝐶𝑠 + 1 𝑠 2 + 𝑅 𝑠 + 1
𝐿𝑠 2 + 𝑅𝑠 +
𝐶 𝐿 𝐿𝐶

Control Systems Lab- B18EC4050 Page | 12


REVA University School of ECE

If out is taken across capacitor:

1 1 1/𝐿 1/𝐿𝐶𝑠
𝑉 𝑜 (𝑠) = 𝐼 (𝑠) = =
𝐶𝑠 (𝐶𝑠) 𝑠 2 + 𝑅 𝑠 + 1 𝑅
𝑠2 + 𝑠 +
1
𝐿 𝐿𝐶 𝐿 𝐿𝐶
Therefore Transfer function is:
𝟏/𝑳𝑪𝒔
𝟏 𝑹 𝟏
𝑽𝒐(𝒔) 𝑰(𝒔) 𝒔𝟐 + 𝑳 𝒔 + 𝑳𝑪 𝟏/𝑳𝑪
= 𝑪𝒔 = =
𝑽𝒊 (𝒔) 𝐔(𝐬) 𝟏 𝑹 𝟏
𝒔𝟐 + 𝒔 +
𝒔 𝑳 𝑳𝑪

Problem statement:
Simulate unit step response of series RLC circuit when output is taken across Capacitor
using LabVIEW for the following Parameter Values.

Procedure to construct a block diagram using labVIEW :


R=1Ω, L=1H and C=1F
Construct transfer function with given values.
 Open LabVIEW
 File> New VI
 Right click on Block diagram window control and simulations control design model
construction CD construct transfer function model.VI place the block on the Block
diagram window
 Wire the terminals

o
 Right click at input terminal of CD construct transfer function model.VI Create Control
 Create control for both numerator and denominator.

Control Systems Lab- B18EC4050 Page | 13


REVA University School of ECE

 Right click on BD control and simulations control design model construction CD draw
transfer function model.VI connect with CD construct transfer function model.VI

 Right click on the equation terminal of the CD draw transfer function model.VI create  Indicator
(rename label)

 Right click on BD control and simulations control design Time response CD step
response.VI place the block on BD.

 Wire from the CD construct transfer function model.VI to input terminal of CD step
response.VIChoose polymorphic instance to be automatic.

 Right click on output terminal of CD step response.VI Create Indicator.

 Right click on Block Diagram control and simulations control design Time response
 CD parametric time response.VIPlace it on the Block Diagram window.

 Wire the output data from CD construct transfer function.VI to  CD parametric time response.VI
 Right click on second output terminal of CD parametric time response.VI create Indicator.

 Assign values for numerator and denominator as per the TF model.

Control Systems Lab- B18EC4050 Page | 14


REVA University School of ECE

Figure1: Block Diagram Panel Display of Second Order System Time Response: Where R=1
Ohm, L=1 Henry and C=1Farad

Control Systems Lab- B18EC4050 Page | 15


REVA University School of ECE

Figure2: Front Panel Display of Second Order System Time Response: Where R=1 Ohm,
L=1 Henry and C=1 Farad.

Control Systems Lab- B18EC4050 Page | 16


REVA University School of ECE

Tabular Column:

Transfer function
R in L in C in O/P across R Rise Settling Response
ohms Henry Farad 𝑻𝑭 Time % Time (Draw Remarks
𝟏 (0-90% Overshoot ( 2% of the
𝑳𝑪 tp in
= of final Graph)
𝑹 𝟏 Sec
(𝒔𝟐 + 𝒔 + ) final value)
𝑳 𝑳𝑪
value)

Result:

Rise time, settling time, peak overshoot and peak time.

Challenge: Level-1

1. Identify transient state and steady state.


2. Which of the following is step input?
a) A square wave.
b) Sine wave.
c) Ramp wave.
3. Comment on the effect of increasing Inductor value, w.r.t rise time, peak over shoot, settling
time.
4. Plot unit step response of RLC series circuit if output is taken across resistor for following
values plot
(i) R=1 ohm, L= 1 Henry ,C= 1 Farad
(ii) R=2 ohm, L= 2 Henry ,C=2Farad
(iii) R=1 ohm, L= 1 Henry, C=2 Farad.
5. Comment on shape of graph.

Control Systems Lab- B18EC4050 Page | 17


REVA University School of ECE

EXPERIMENT-3
Stability Analysis Based on Pole Position

Aim:
To demonstrate relation between pole position on‘s’ plane and BIBO stability of system.

Introduction:
For our purposes, we will use the Bounded Input Bounded Output (BIBO) definition of
stability which states that a system is stable if the output remains bounded for all bounded (finite)
inputs. Practically, this means that the system will not “blow up” while in operation.
The transfer function representation is especially useful when analyzing system stability. If
all poles of the transfer function (values of s at which the denominator equals zero) have negative
real parts, then the system is stable. If any pole has a positive real part, then the system is unstable. If
we view the poles on the complex s-plane, then all poles must be in the left half plane (LHP) to ensure
stability. If any pair of poles is on the imaginary axis, then the system is marginally stable and the
system will oscillate.

Second Order Systems:


Second order systems are commonly encountered in practice, and are the simplest type of dynamic
system to exhibit oscillations. In fact many real higher order systems are modeled as second order to
facilitate analysis. Examples include mass-spring-damper systems and RLC circuits.

The general form of the first order differential equation is as follows

The second order transfer function is

DC Gain
The DC gain, , again is the ratio of the magnitude of the steady-state step response to the magnitude
of the step input, and for stable systems it is the value of the transfer function when . For second
order systems,

Damping Ratio
The damping ratio is a dimensionless quantity charaterizing the energy losses in the system due to
such effects as viscous friction or electrical resistance. From the above definitions,

Control Systems Lab- B18EC4050 Page | 18


REVA University School of ECE

Natural Frequency
The natural frequency is the frequency (in rad/s) that the system will oscillate at when there is no
damping, .

Poles/Zeros
The second order transfer function has two poles .

Under Damped System


If , then the system is under damped. Both poles are complex valued with negative real parts;
therefore the system is stable but oscillates while approaching the steady-state value.

Procedure to Simulate Pole Zero map for underdamped systems ( zeta<1) using LabVIEW
The given transfer function has coefficients as variables, there for the TF model has to be
implemented in LabVIEW symbolically.
 Open LabVIEW File New VI.
 Right click on Block Diagram window control and simulations control design model
construction CD construct transfer function model.VI  place the block on the Block
diagram window.
 Choose from the polymorphic instance single-input single-output (symbolically).
 Create controls for the CD construct transfer function model.VI Rclick on input terminals
of CD construct transfer function model.VI create control. (create controls for
numerator, denominator and variables)
 Right click on Block Diagram window  control and simulations control design model
construction CD draw transfer function model.VI  wire to CD construct transfer function
model.VI
 Right click on the output terminal of CD draw transfer function model.VI create
indicatorrename the indicator to be TF model
 Right click on Block Diagram window  control and simulations control design
dynamic response CD pole-zero map.VI place it on the block diagram
 Right click on the output terminals of CD pole-zero map.VI create indicators for pole zero
map, poles and zeros.
 Right click on Block Diagram window  control and simulations control design Time
response CD step response.VI place the block on Block diagram window
 Wire from the CD construct transfer function model.VI to input terminal of CD step
response.VIChoose polymorphic instance to be automatic.
 Right click on output terminal of CD step response.VI Create Indicator.
 Wire the error in and error out wires (optional)
 Input the values in the FP as per the given TF model.

Control Systems Lab- B18EC4050 Page | 19


REVA University School of ECE

 Assign the symbolic numerator and denominator with the given TF equation.
 Resize the variables window so that it has three variable names and values to be entered.
 Adjust the pole zero map by reentering the x-scale and y-scale.

Figure1: Block diagram display to plot pole zero map

Control Systems Lab- B18EC4050 Page | 20


REVA University School of ECE

Figure2: Front panel display to plot pole zero map of underdamped system

Control Systems Lab- B18EC4050 Page | 21


REVA University School of ECE

Over Damped Systems


If , then the system is over damped. Both poles are real and negative; therefore the system is
stable and does not oscillate. The step response and a pole-zero map of an over damped system are
calculated below:
Simulate Pole Zero map for over damped systems ( zeta>1) using LabVIEW

Figure3: Front panel display to plot pole zero map of Over damped system

Control Systems Lab- B18EC4050 Page | 22


REVA University School of ECE

Critically Damped Systems


If , then the system is critically damped. Both poles are real and have the same
magnitude, . Critically damped systems approach steady-state quickest without oscillating.
Now change the value of the damping to 1, and replot the step response and pole-zero map.
Simulate Pole Zero map for Critically damped systems ( zeta=1) using LabVIEW

Figure4: Front panel display to plot pole zero map of critically damped system

Control Systems Lab- B18EC4050 Page | 23


REVA University School of ECE

Undamped Systems
If , then the system is undamped. In this case, the poles are purely imaginary; therefore the
system is marginally stable and oscillates indefinitely.
Simulate Pole Zero map for undamped system( zeta=0)

Figure5: Front panel display to plot pole zero map of Undamped system

Control Systems Lab- B18EC4050 Page | 24


REVA University School of ECE

𝐾 𝑑𝑐 𝜔𝑛 2
Result: The transient response of TF G= 𝑠 2 +2𝜁𝜔 2 with step input and the following
𝑛 𝑠+𝜔𝑛
damping are
a) k_dc = 1;w_n = 10; zeta = 0.2 the
(i) The peak amplitude=
(ii) The rise time=
(iii) Settling time=
b) k_dc = 1;w_n = 10; zeta = 1.2 the
(i) The peak amplitude=
(ii) The rise time=
(iii) Settling time=
c) k_dc = 1;w_n = 10; zeta = 1 the
(i) The peak amplitude=
(ii) The rise time=
(iii) Settling time=
d) k_dc = 1;w_n = 10; zeta = 0 the
(i) The peak amplitude=
(ii) The rise time=
(iii) Settling time=

Control Systems Lab- B18EC4050 Page | 25


REVA University School of ECE

Experiment 4
Stability Analysis of system using Bode Plot
AIM: To obtain bode plot for a given transfer function of the system using LabVIEW and to find
stability of system.

Content:
 Bode calculations
 Terms used in bode plot
 Slopes contributed by various factors in transfer function.
 Stability conditions of bode plot.

THEORY:

Bode plots are used to analyze system properties such as the gain margin, phase margin, DC gain,
bandwidth and stability. A Bode diagram consists of two graphs: the magnitude plot and the phase
plot. The magnitude is plotted in decibels (dB), and the phase in degrees against the frequency on a
logarithmic scale.. The decibel calculation for mag is computed as 20log 10(|G(jw)|), where G(jw) is
the system's frequency response.

Bode Calculations :
The open loop transfer function of a closed loop control system can be expressed in the form

𝐾[(1 + 𝑠𝑇1 )(1 + 𝑠𝑇2 ) … . ]𝜔𝑛 2


𝐺 (𝑠) 𝐻 (𝑠) =
𝑆 𝑛 [(1 + 𝑠𝑇𝑎 )(1 + 𝑠𝑇𝑏 ) … . (𝑆 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛 2 )]

Substituting s = jω,

𝐾[(1 + 𝑗𝜔𝑇1 )(1 + 𝑗𝜔𝑇2 ) … . ]𝜔𝑛 2


𝐺(𝑗𝜔) 𝐻 (𝑗𝜔) =
(𝑗𝜔)𝑛 [(1 + 𝑗𝜔𝑇𝑎 )(1 + 𝑗𝜔𝑇𝑏 ) … . {(𝜔𝑛 2 − 𝜔 2 ) + 𝑗2𝜁𝜔𝑛 𝜔}]

The magnitude of the above transfer function can be expressed as


20 log10 | G(jω) H(jω)| = 20 log10 K + 20 log10 |1+jωT1| + 20 log10 |1+jωT2| +….
- 20 N log10 |jω| - 20 log10 |1+jωTa|- 20 log10 |1+jωTb|
- 20 log10 |(ωn2 - ω2 )/ ωn2 +( j2ζ ωn ω )/ ωn2 |
And for phase angle < G(jω) H(jω) = tan-1 ωT1 + tan-1 ωT2 + ….
- N <90o - tan-1 ωTa + tan-1 ωTb….. - tan-1 [2ζ ωn ω/ (ωn2 - ω2)] .

Terms related to bode plot that we use frequently:


1. Gain Margin: Greater will the gain margin greater will be the stability of the system. It refers
to the amount of gain, which can be increased or decreased without making the system
unstable. It is usually expressed in dB.

Control Systems Lab- B18EC4050 Page | 26


REVA University School of ECE

2. Phase Margin: Greater will the phase margin greater will be the stability of the system. It
refers to the phase which can be increased or decreased without making the system unstable. It
is usually expressed in phase.
3. Gain Cross Over Frequency: It refers to the frequency at which magnitude curve cuts the zero
dB axis in the bode plot.
4. Phase Cross Over Frequency: It refers to the frequency at which phase curve cuts the negative
times the 180 degree axis in this plot.
5. Corner Frequency: The frequency at which the two asymptotes cuts or meet each other is
known as break frequency or corner frequency.
6. Resonant Frequency: The value of frequency at which the modulus of G (jω) has a peak value
is known as resonant frequency.
7. Factors: Every loop transfer function (i.e. G(s) × H(s)) product of various factors like constant
term K, Integral factors (jω), first order factors ( 1 + jωT) (± n) where n is an integer, second order
or quadratic factors.

Slope contributed by constant term k, integral factor, first order factor, second order factor.

 Constant term K: This factor has a slope of zero dB per decade. There is no corner
frequency corresponding to this constant term. The phase angle associated with this constant
term is also zero.
 Integral factor 1/(jω)n: This factor has a slope of -20 × n (where n is any integer)dB per
decade. There is no corner frequency corresponding to this integral factor. The phase angle
associated with this integral factor is -90 × n here n is also an integer.
 First order factor 1/ (1+jωT): This factor has a slope of -20 dB per decade. The corner
frequency corresponding to this factor is 1/T radian per second. The phase angle associated
with this first factor is -tan- 1(ωT).
 First order factor (1+jωT): This factor has a slope of 20 dB per decade. The corner
frequency corresponding to this factor is 1/T radian per second. The phase angle associated
with this first factor is tan- 1(ωT) .
 Second order or quadratic factor : [{1/(1+(2ζ/ω)} × (jω) + {(1/ω 2)} × (jω)2)]: This factor
has a slope of -40 dB per decade. The corner frequency corresponding to this factor is ωn
radian per second. The phase angle associated with this first factor is - tan-1{ (2ζω / ωn) / (1-
(ω / ωn)2)} .

Stability Conditions of Bode Plots


Stability conditions are given below:
1. For Stable System: Both the margins should be positive. Or phase margin should be greater
than the gain margin.
2. For Marginal Stable System: Both the margins should be zero. Or phase margin should be
equal to the gain margin.
3. For Unstable System: If any of them is negative. Or phase margin should be less than the gain
margin.

Control Systems Lab- B18EC4050 Page | 27


REVA University School of ECE

Problem statement: Consider a unity feedback control system with the


𝟒.𝟐
following feed forward transfer characteristics. 𝑮(𝒔) = 𝒔(𝒔𝟐+𝟒𝒔 +𝟓) .
Plot bode plot and comment on the stability of the system.

Procedure To Create Block diagram for Stability Analysis of system using Bode Plot in
LabVIEW
 Right click on block diagram and go to control and simulationcontrol designmodel
constructionSelect CD Construct transfer function model.vi
 Right click on Left side of First terminal of CD construct Transfer Function
Model.viCreate control
 Right click on Left side of Second terminal of CD construct Transfer Function
Model.viCreate control
 Right click on block diagram and go to control and simulationcontrol designmodel
constructionSelect CD Draw transfer function Equation.vi
 Connect wire from CD Construct transfer function model.vi to first terminal of CD Draw
transfer function Equation.vi
 Right click on CD Draw transfer function Equation.viCreate indicator
 Right click on block diagram and go to control and simulationcontrol designFrequency
ResponseCD Gain and phase margin.vi
 Connect wire from CD Construct transfer function model.vi to left side of First terminal of
CD Gain and phase margin.vi
 Right click on first terminal of Right side of CD Gain and phase margin.viCreate
indicator
 Right click on Second terminal of Right side of CD Gain and phase margin.viCreate
indicator
 Right click on Third terminal of Right side of CD Gain and phase margin.viCreate
indicator

Control Systems Lab- B18EC4050 Page | 28


REVA University School of ECE

Figure1: Block diagram of Stability Analysis of system using Bode Plot using LabVIEW

Control Systems Lab- B18EC4050 Page | 29


REVA University School of ECE

Figure2: Front panel display of Stability Analysis of system using Bode Plot using
LabVIEW
Results:
(i) corner frequencies are:
(ii) gain margin and phase margin:
(iii) Comment on the stability of the system.

Challenge: Level-1
(i) Change the value of K and observe change in bode plot. Comment on effect of changing k value
on gain margin and phase margin.
(ii) Observe the effect of adding a pole or zero or changing pole zero value on gain margin and
phase margin.

Conclusion:

Control Systems Lab- B18EC4050 Page | 30


REVA University School of ECE

Experiment 5
Steady-State Error

Aim:
To reduce steady state error of a system.
Key MATLAB commands used are: lsim, feedback

Theory:
 Introduction:
 Calculating steady state error
 System type and steady state error
 Example: Meeting steady state error requirement.
Introduction:
Steady-state error is defined as the difference between the input (command) and the output of a system
in the limit as time goes to infinity (i.e. when the response has reached steady state). The steady-state
error will depend on the type of input (step, ramp, etc.) as well as the system type (0, I, or II).
Note: Steady-state error analysis is only useful for stable systems. You should always check the
system for stability before performing a steady-state error analysis. Many of the techniques
that we present will give an answer even if the error does not reach a finite steady-state value.

Calculating steady-state errors


Before talking about the relationships between steady-state error and system type, we will show how
to calculate error regardless of system type or input. Then, we will start deriving formulas we can
apply when the system has a specific structure and the input is one of our standard functions. Steady-
state error can be calculated from the open- or closed-loop transfer function for unity feedback
systems. For example, let's say that we have the system given below.

This is equivalent to the following system, where T(s) is the closed-loop transfer function.

Control Systems Lab- B18EC4050 Page | 31


REVA University School of ECE

We can calculate the steady-state error for this system from either the open- or closed-loop transfer
function using the Final Value Theorem. Recall that this theorem can only be applied if the subject
of the limit (sE(s) in this case) has poles with negative real part.

Now, let's plug in the Laplace transforms for some standard inputs and determine equations to
calculate steady-state error from the open-loop transfer function in each case.
 Step Input (R(s) = 1 / s):

 Ramp Input (R(s) = 1 / s^2):

 Parabolic Input (R(s) = 1 / s^3):

When we design a controller, we usually also want to compensate for disturbances to a system. Let's
say that we have a system with a disturbance that enters in the manner shown below.

Control Systems Lab- B18EC4050 Page | 32


REVA University School of ECE

We can find the steady-state error due to a step disturbance input again employing the Final Value
Theorem (treat R(s) = 0).

When we have a non-unity feedback system we need to be careful since the signal entering G(s) is
no longer the actual error E(s). Error is the difference between the commanded reference and the
actual output, E(s) = R(s) - Y(s). When there is a transfer function H(s) in the feedback path, the signal
being substracted from R(s) is no longer the true output Y(s), it has been distorted by H(s). This
situation is depicted below.

Manipulating the blocks, we can transform the system into an equivalent unity-feedback structure as
shown below.

Then we can apply the equations we derived above.


System type and steady-state error

If you refer back to the equations for calculating steady-state errors for unity feedback systems, you
will find that we have defined certain constants (known as the static error constants). These constants
are the position constant (Kp), the velocity constant (Kv), and the acceleration constant (Ka).
Knowing the value of these constants, as well as the system type, we can predict if our system is
going to have a finite steady-state error.

Control Systems Lab- B18EC4050 Page | 33


REVA University School of ECE

First, let's talk about system type. The system type is defined as the number of pure integrators in
the forward path of a unity-feedback system. That is, the system type is equal to the value of n when
the system is represented as in the following figure. It does not matter if the integrators are part of the
controller or the plant.

Therefore, a system can be type 0, type 1, etc. The following tables summarize how steady-state error
varies with system type.

Type 0 system Step Input Ramp Input Parabolic Input


Steady-State Error Formula 1/(1+Kp) 1/Kv 1/Ka
Static Error Constant Kp = constant Kv = 0 Ka = 0
Error 1/(1+Kp) infinity infinity

Type 1 system Step Input Ramp Input Parabolic Input


Steady-State Error Formula 1/(1+Kp) 1/Kv 1/Ka
Static Error Constant Kp = infinity Kv = constant Ka = 0
Error 0 1/Kv infinity

Type 2 system Step Input Ramp Input Parabolic Input


Steady-State Error Formula 1/(1+Kp) 1/Kv 1/Ka
Static Error Constant Kp = infinity Kv = infinity Ka = constant
Error 0 0 1/Ka

Control Systems Lab- B18EC4050 Page | 34


REVA University School of ECE

Example: Meeting steady-state error requirements

Consider a system of the form shown below.

For this example, let G(s) equal the following.

Since this system is type 1, there will be no steady-state error for a step input and there will be infinite
error for a parabolic input. The only input that will yield a finite steady-state error in this system is a
ramp input. We wish to choose K such that the closed-loop system has a steady-state error of 0.1 in
response to a ramp reference. Let's first examine the ramp input response for a gain of K = 1.
MATLAB code to plot response of system with transfer function
G=((s+3)*(s+5)/(s*(s+7)*(s+8)) for ramp input.
----------------------------------------------------------------------------------------------------------------
s = tf('s');
G = ((s+3)*(s+5))/(s*(s+7)*(s+8));
T = feedback(G,1);
t = 0:0.1:25;
u = t;
[y,t,x] = lsim(T,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
----------------------------------------------------------------------------------------------------------------

Control Systems Lab- B18EC4050 Page | 35


REVA University School of ECE

The steady-state error for this system is quite large, since we can see that at time 20 seconds the
output is approximately 16 as compared to an input of 20 (steady-state error is approximately equal
to 4). Let's examine this in further detail.
We know from our problem statement that the steady-state error must be 0.1. Therefore, we can solve
the problem following these steps:

Let's see the ramp input response for K = 37.33 by entering the following code in the MATLAB
command window.
----------------------------------------------------------------------------------------------------------------
K = 37.33 ;
s = tf('s');
G = (K*(s+3)*(s+5))/(s*(s+7)*(s+8));
sysCL = feedback(G,1);
t = 0:0.1:50;
u = t;
[y,t,x] = lsim(sysCL,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
----------------------------------------------------------------------------------------------------------------

Control Systems Lab- B18EC4050 Page | 36


REVA University School of ECE

In order to get a better view, we must zoom in on the response. We choose to zoom in between time
equals 39.9 and 40.1 seconds because that will ensure that the system has reached steady state.

axis([39.9,40.1,39.9,40.1])

Examination of the above shows that the steady-state error is indeed 0.1 as desired.
Now let's modify the problem a little bit and say that our system has the form shown below.

In essence we are no distinguishing between the controller and the plant in our feedback system. Now
we want to achieve zero steady-state error for a ramp input.

Control Systems Lab- B18EC4050 Page | 37


REVA University School of ECE

From our tables, we know that a system of type 2 gives us zero steady-state error for a ramp input.
Therefore, we can get zero steady-state error by simply adding an integrator (a pole at the origin).
Let's view the ramp input response for a step input if we add an integrator and employ a gain K = 1.
MATLAB code :
----------------------------------------------------------------------------------------------------------------
s = tf('s');
P = ((s+3)*(s+5))/(s*(s+7)*(s+8));
C = 1/s;
sysCL = feedback(C*P,1);
t = 0:0.1:250;
u = t;
[y,t,x] = lsim(sysCL,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
----------------------------------------------------------------------------------------------------------------

As you can see, there is initially some oscillation (you may need to zoom in). However, at steady
state we do have zero steady-state error as desired. Let's zoom in around 240 seconds (trust me, it
doesn't reach steady state until then).

Control Systems Lab- B18EC4050 Page | 38


REVA University School of ECE

axis([239.9,240.1,239.9,240.1])

As you can see, the steady-state error is zero. Feel free to zoom in on different areas of the graph to
observe how the response approaches steady state.

Control Systems Lab- B18EC4050 Page | 39


REVA University School of ECE

Result: For TF G=((s+3)*(s+5)/(s*(s+7)*(s+8)) with unity feed back and ramp input

(i) For K=1, steady state-error=


(ii) For K=37.33 ,steady state –error=
For a system with G and C in series and unity feed back and ramp input
(i) The steady state-error =

Challenge Level-1.(i) Explain for TF G=((s+3)*(s+5)/(s*(s+7)*(s+8)) with unity feed back and ramp
input we have steady state error and how it is eliminated.

Conclusion:

Control Systems Lab- B18EC4050 Page | 40


REVA University School of ECE

EXPERIMENT 6
Root Locus Analysis
Aim:
Create root locus for a given transfer function using MATLAB
To demonstrate how to design feedback controller using root locus that satisfy certain performance
criteria.
Key MATLAB commands used in this tutorial are: feedback, rlocus, step,
Theory:

 Closed-Loop Poles
 Plotting the Root Locus of a Transfer Function
 Choosing a Value of K from the Root Locus
 Closed-Loop Response

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 proportional gain K and unity feedback.

The closed-loop transfer function is:

and thus the poles of the closed-loop poles of the closed-loop system are values of such
that .

If we write , then this equation has the form:

Let = order of and = order of (the order of a polynomial is the highest power
of that appears in it).

Control Systems Lab- B18EC4050 Page | 41


REVA University School of ECE

We will consider all positive values of K. In the limit as , the poles of the closed-loop
system are or the poles of . In the limit as , the poles of the closed-loop
system are or the zeros of .

No matter what we pick K to be, the closed-loop system must always have poles, where is the
number of poles of . The root locus must have branches, each branch starts at a pole
of and goes to 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 poles minus the number of zeros, and
is the number of branches of the root locus that go to infinity (asymptotes).
Since the root locus is actually the locations of all possible closed-loop poles, from the root locus we
can select a gain such that our closed-loop system will perform the way we want. If any of the selected
poles are on the right half 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 though the
system has three or four poles, it may still act like a second or even 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 by using the root locus method? Say our
design criteria are 5% overshoot and 1 second rise time. Make a MATLAB file called rl.m.
Enter the transfer function, and the command to plot the root locus:

MATLAB program to plot root locus of transfer function H(s)=(s+5)/s(s+5)(s+15)(s+20)


tf('s');
sys = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));
rlocus(sys)
axis([-22 3 -15 15])
----------------------------------------------------------------------------------------------------------------

Control Systems Lab- B18EC4050 Page | 42


REVA University School of ECE

Choosing a Value of K from the Root Locus


The plot above shows all possible closed-loop pole locations for a pure proportional controller.
Obviously not all of those closed-loop poles will satisfy 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].

Problem Statement: 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).

Control Systems Lab- B18EC4050 Page | 43


REVA University School of ECE

Continuation of above MATLAB prog. The following instructions plot lines of constant
damping ratio and natural frequency 𝝎𝒏 on pole zero map or root locus.
----------------------------------------------------------------------------------------------------------------

Zeta = 0.7;

Wn = 1.8;

sgrid(Zeta,Wn)

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 the lines < 0.7. The semicircle
indicates pole locations with a natural frequency = 1.8; inside the circle, < 1.8 and outside 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 white dotted lines, and to make the rise time shorter than 1 second, the poles have to be outside
of the white dotted semicircle. So now we know only the part of the locus outside of the semicircle
and in betwen the two lines are acceptable. All the poles in this location are in the left-half plane, so
the closed-loop system will be stable.

Control Systems Lab- B18EC4050 Page | 44


REVA University School of ECE

From the plot above we see that there is part of the root locus inside the desired region. So 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
may want to find out where the other pole (poles) are. Remember they will affect the response too.
From the plot above, we see that all the poles selected (all the "+" signs) are at reasonable positions.
We can go ahead and use the chosen K as our proportional controller.

Closed-Loop Response

In order to find the step response, you need to know the closed-loop transfer function. You could
compute this using the rules of block diagrams, or let MATLAB do it for you (there is no need to
enter a value for K if the rlocfind command was used):

Control Systems Lab- B18EC4050 Page | 45


REVA University School of ECE

MATLAB command to find TF of closed loop system.


----------------------------------------------------------------------------------------------------------------

K = 350;

sys_cl = feedback(K*sys,1)

----------------------------------------------------------------------------------------------------------------

sys_cl =

350 s + 2450
--------------------------------------
s^4 + 40 s^3 + 475 s^2 + 1850 s + 2450
Continuous-time transfer function.

The two arguments to the function feedback are the numerator and denominator of the open-
loop system. You need to include the proportional gain that you have chosen. Unity feedback is
assumed.
If you have a non-unity feedback situation, look at the help file for the MATLAB
function feedback, which can find the closed-loop transfer function with a gain in the feedback
loop.
To Check out the step response of your closed-loop system:

----------------------------------------------------------------------------------------------------------------

step(sys_cl)

Control Systems Lab- B18EC4050 Page | 46


REVA University School of ECE

As we expected, this response has an overshoot less than 5% and a rise time less than 1 second.

Results:
(i) The order of given transfer function=
(ii) Number of poles = : Number of zeros=
(iii) For over shoot = ; Zeta= ; 𝜔𝑛 = ; K=
(iv) From step response of closed loop system : Rise time= ; Peak over shoot=
;Settling time=

Challenge:level 1

Challenge level-1: A single loop negative feedback system has loop transfer function
𝑘(𝑠+2)2
𝐺𝑐 (𝑠)𝐺 (𝑠) = 𝑠(𝑠2+1)(𝑠+8) (a) Sketch the root locus for 0≤k≤∞ to indicate the significant feature of the
locus(b) Determine the range of the gain k for which system is stable.(c) For what value of k in the range
k≥0 do purely imaginary roots exists. What are the values of these roots.(d) Would the use of dominant
root approximation for an estimate of settling time be justified in this case for the large magnitude of gain
(k>50).

Control Systems Lab- B18EC4050 Page | 47


REVA University School of ECE

EXPERIMENT-7
Stability Analysis of a system using Nyquist Plot
AIM:
To obtain Nyquist Plot for a given transfer function of the system using MATLAB and
comment on the stability.

Key MATLAB commands used in this tutorial are: nyquist

THEORY:
 Introduction
 Terminologies used in Nyquist plot:

Introduction:
The stability analysis of a feedback control system is based on identifying the location of the roots of
the characteristic equation on s-plane. The system is stable if the roots lie on left hand side of s-plane.
Relative stability of a system can be determined by using frequency response methods like Nyquist
plot and Bode plot. Nyquist criterion is used to identify the presence of roots of a characteristic
equation in a specified region of s-plane. To understand Nyquist plot we need to know about some
of the terminologies.
Terminologies used in Nyquist plot:
(i) Contour : Closed path in a complex plane is called contour

(ii) Nyquist path or Nyquist contour

The Nyquist contour is a closed contour in the s-plane which completely encloses the entire right
hand half of s-plane. In order to enclose the complete RHS of s-plane a large semicircle path is drawn
with diameter along jω axis and centre at origin. The radius of the semicircle is treated as infinity.

(iii) Nyquist Encirclement

A point is said to be encircled by a contour if it is found inside the contour.

(iv) Nyquist Mapping

The process by which a point in s-plane transformed into a point in F(s) plane is called mapping and
F(s) is called mapping function.
Nyquist criterion
𝑁(𝑠)
𝐺 (𝑠) 𝐻 (𝑠) = 𝑖𝑠 𝑡ℎ𝑒 𝑜𝑝𝑒𝑛 𝑙𝑜𝑜𝑝 𝑡𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 (𝑂. 𝐿. 𝑇. 𝐹)
𝐷(𝑠)

Control Systems Lab- B18EC4050 Page | 48


REVA University School of ECE

𝐺(𝑠)
𝑖𝑠 𝑡ℎ𝑒 𝑐𝑙𝑜𝑠𝑒𝑑 𝑙𝑜𝑜𝑝 𝑡𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 (𝐶. 𝐿. 𝑇. 𝐹)
1 + 𝐺 (𝑠)𝐻(𝑠)
N(s) = 0 is the open loop zero and D(s) is the open loop pole From stability point of view no closed
loop poles should lie in the RH side of s-plane . Characteristics equation 1 + G(s) H(s) = 0 denotes
closed loop poles
.
𝑁1 (𝑠)
𝐿𝑒𝑡, 𝑞(𝑠) = 1 + 𝐺 (𝑠)𝐻 (𝑠) =
𝐷1(𝑠)
Now as 1+ G(s) H(s) = 0 hence q(s) should also be zero.

𝑁1 (𝑠)
𝐼𝑓, 𝑞(𝑠) = 0, = 0 𝑖. 𝑒. 𝑁1 (𝑠) = 0
𝐷1(𝑠)

Therefore , from the stability point of view zeroes of q(s) should not lie in RHP of s-plane. To define
the stability entire RHP (Right Hand Plane) is considered. We assume a semicircle which encloses
all points in the RHP by considering the radius of the semicircle R tends to infinity. [R → ∞].
The first step to understand the application of Nyquist criterion in relation to determination of
stability of control systems is mapping from s-plane to G(s) H(s) - plane. s is considered as
independent complex variable and corresponding value of G(s) H(s) being the dependent variable
plotted in another complex plane called G(s) H(s) - plane. Thus for every point in s-plane there exists
a corresponding point in G(s) H(s) - plane. During the process of mapping the independent variable
s is varied along a specified path in s - plane and the corresponding points in G(s)H(s) plane are
joined. This completes the process of mapping from s-plane to G(s)H(s) - plane.
Nyquist stability criterion says that if the open loop transfer function has k poles in the right half
splane amd lim s-∞ G(s)H(s)= constant, then for stability G(jω)H(jω) locus must encircle the -1+j0
point k times in the counter clockwise direction. This criterion can be expressed as , Z=N+P. Where,
N is the total no. of clock wise encirclement about -1+j0, P is the total no. of poles and Z is the total
no. of zeroes of G(s)H(s) in the right half s-plane.
Case 1:- N = 0 (no encirclement), so Z = P = 0 & Z = P If N = 0, P must be zero therefore system is
stable.
Case 2:- N > 0 (clockwise encirclement), so P = 0 , Z ≠0 & Z > P For both cases system is unstable.
Case 3 :- N < 0 (counterclockwise encirclement), so Z = 0, P ≠0 & P > Z System is stable.

Note: Knowing the number of right-half plane (unstable) poles in open loop ( P), and the number of
encirclements of -1 made by the Nyquist diagram ( N), we can determine the closed-loop stability of
the system. If Z = P + N is a positive, nonzero number, the closed-loop system is unstable.

Control Systems Lab- B18EC4050 Page | 49


REVA University School of ECE

The objective of this experiment is to find the range of gains that will make this system
stable in the closed-loop.

Problem statement: Using Nyquist diagram find the range of gains for a closed-loop
unity feedback system to be stable. The system we will test looks as shown in fig: given
G(s) = s2+10s+24/s2-8s+15

The matlab code for the system for different value of gains K is as follows
%to find the number positive real poles in open loop tr fn

>> roots([1 -8 15])

ans =
5
3

MATLAB code for nyquist plot of the given system with TF(s^2 + 10*s + 24)/(s^2 - 8*s + 15)
----------------------------------------------------------------------------------------------------------------
% for gain of K=1 observe the plot
sys = (s^2 + 10*s + 24)/(s^2 - 8*s + 15);
nyquist(sys)
----------------------------------------------------------------------------------------------------------------

Control Systems Lab- B18EC4050 Page | 50


REVA University School of ECE

Nyquist Diagram
1.5

0.5
Imaginary Axis

-0.5

-1

-1.5
-1.5 -1 -0.5 0 0.5 1 1.5 2
Real Axis

nyquist(20*sys)--- ------for gain of 20 observe the plot

Nyquist Diagram
30

20

10
Imaginary Axis

-10

-20

-30
-30 -20 -10 0 10 20 30
Real Axis

nyquist(0.5*sys) ------for gain of )0.5 observe the plot

Control Systems Lab- B18EC4050 Page | 51


REVA University School of ECE

Nyquist Diagram
0.8

0.6

0.4

0.2
Imaginary Axis

-0.2

-0.4

-0.6

-0.8
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8
Real Axis

Result: Comment on stability of system for


(i) K=1
(ii) K=20
(iii) K=0.5

Observations: Whether The number of counterclockwise encirclements along -1+j0 is equal to


number of real poles
Conclusion:

Control Systems Lab- B18EC4050 Page | 52


REVA University School of ECE

EXPERIMENT-8
Time response Analysis of PID Controller

AIM:

To observe effect of each of the PID parameters on the closed-loop dynamics

THEORY:
 Introduction to PID controllers.
 Second order system with PID controller:
 PD control and PI control:
 Drawback of PID controller:

Introduction to PID controllers.

An automatic control system is used to maintain its output within desirable limits by means of a
control action. Any deviation of the output from the reference input is detected by an error detector .
The error thus detected is used in actuating signal for control action through a controller.

PID control stands for proportional plus derivative plus integral control. PID control is a feedback
mechanism which is used in control system. This type of control is also termed as three term control.
By controlling the three parameters - proportional, integral and derivative we can achieve different
control actions for specific work. PID is considered to be the best controller in the control system
family. For PID control the actuating signal consists of proportional error signal added with derivative
and integral of the error signal. Therefore, the actuating signal for PID control is –

𝑑𝑒(𝑡)
𝑒𝑎 (𝑡) = 𝑒(𝑡) + 𝑇𝑑 + 𝐾𝑖 ∫ 𝑒(𝑡)𝑑𝑡
𝑑𝑡
Second order system with PID controller:

R(s) + E(s) 1+ sTd + Ki/s


Ea(s) ωn2/ s2+ j2ζ ωn+ ωn2 Y(s)

- D(s)

The block diagram of a second order control system incorporating PID control is as shown:

The controller used here is a PID controller represented by a block PID and the system or plant
is represented by G(s). R(s) and D(s) are reference signal and disturbance signal respectively.
Y(s),E(s) and Ea(s) are the output, error and controller output of the system respectively. For
thepurpose of good control, we require the system output Y(s) to track any reference signal R(s) and
at the same time reject or suppress deviation due to the disturbance signal D(s). Hence the PID
controller can realize this objective.

Control Systems Lab- B18EC4050 Page | 53


REVA University School of ECE

The Laplace transform of the actuating signal incorporating PID control is

𝐾𝑖
𝐸𝑎 (𝑠) = 𝐸 (𝑠) + 𝑠𝑇𝑑 𝐸 (𝑠) + 𝐸(𝑠)
𝑠
OR
𝐾𝑖
𝐸𝑎 (𝑠) = 𝐸 (𝑠) [1 + 𝑠𝑇𝑑 + ]
𝑠
Many complex electronic systems are provided with PID control loop. In modern days PID
controllers are used in PLC (programmable logic controllers) in the industry. The proportional,
derivative and integral parameters can be expressed as - Kp, Kd and Ki. All these three parameters
have effect on the closed loop control system. It affects rise time, settling time and overshoot and
also the steady state error.

Table: effect of PID controller parameters (Kp, Kd and Ki.) on transient response performance and
Steady state error.

Control Settling Steady state


Rise time Overshoot
Response time error

small
Kp decrease increase decrease
change
small
Kd decrease decrease no change
change
Ki decrease increase increase eliminate

PID control combines advantages of proportional, derivative and integral control actions. Let us
discuss these control actions in brief. Proportional control : here actuating signal for the control action
in a control system is proportional to the error signal. The error signal being the difference between
the reference input signal and the feedback signal obtained from input.

PD control and PI control:

There are some control actions which can be achieved by using any of the two parameters of the
PID controller. Two parameters can work while keeping the third one to zero. So PID controller
becomes sometimes PI (Proportion integral), PD (proportional derivative) or even P or I. The
derivative term D is responsible for noise measurement while integral term is meant for reaching the
targeted value of the system.

Derivative Control : The actuating signal consists of proportional error signal added with
derivative of the error signal. Therefore, the actuating signal for derivative control action is given
by,
𝑑𝑒(𝑡)
𝑒𝑎 (𝑡) = 𝑒(𝑡) + 𝑇𝑑 𝑤ℎ𝑒𝑟𝑒, 𝑇𝑑 𝑖𝑠 𝑎 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡.
𝑑𝑡

Control Systems Lab- B18EC4050 Page | 54


REVA University School of ECE

Integral control: for integral control action the actuating signal consists of proportional error
signal added with integral of the error signal. Therefore, the actuating signal for integral control
action is given by

𝑒𝑎 (𝑡) = 𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒 (𝑡)𝑑𝑡 𝑤ℎ𝑒𝑟𝑒, 𝐾𝑖 𝑖𝑠 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡

Drawback of PID controller:

PID control is applicable to many control actions but it does not perform well in case of optimal
control. Main disadvantage is the feedback path. PID is not provided with any model of the process.
Other drawbacks are that PID is linear system and derivative part is noise sensitive. Small amount
of noise can cause great change in the output.

Problem statement:
Consider that the transfer function of a spring, mass and damper system is given by
𝑋(𝑠) 1
= 2
𝐹(𝑠) 𝑠 + 10𝑠 + 20
Using a PID controller, show how each of Kp,, Kd, and Ki contributes to obtain fast rise time,
minimum overshoot and no steady state error.

MATLAB code to plot step response of the system without PID controller.
----------------------------------------------------------------------------------------------------------------
𝑋(𝑠) 1
% step response of system with T F 𝐹(𝑠) = 𝑠2 +10𝑠+20 without PID controller

s = tf('s');
P = 1/(s^2 + 10*s + 20);
step(P)

Control Systems Lab- B18EC4050 Page | 55


REVA University School of ECE

--------------------------------------------------------------------------------------------------------------
System: P
Step Response (X(s))/(F(s))=1/(s2+10s+20) without PID controller Final Value: 0.05
0.05
System: P
Rise Time (sec): 1.01 System: P
0.045 Settling Time (sec): 1.59

0.04

0.035

0.03
Amplitude

0.025

0.02

0.015

0.01

0.005

0
0 0.5 1 1.5 2 2.5
Time (sec)

Result: Without PID controller:


Rise time 1.01 seconds, Settling time 1.5 9Seconds

Observe that the response of the system without PID is not a desirable response. Hence we include
PID controller.
MATLAB code with PID controller added to the system. Step response for the Kp= 300,
Kd=70 and Ki= 300.

s = tf('s');
P = 1/(s^2 + 10*s + 20);
Kp = 300;
Kd = 70;
Ki = 300;
C = Kp+ Ki/s+ Kd*s;
T = feedback(C*P,1);
t=0:0.01:2;
step(T,t);

Control Systems Lab- B18EC4050 Page | 56


REVA University School of ECE

Step Response of T F (X(s))/(F(s))=1/(s2+10s+20) with series PID controller


1
System: T System: T
0.9 Settling Time (sec): 0.951 Peak amplitude: 0.996
System: T Overshoot (%): 0
Rise Time (sec): 0.0454 At time (sec): 2
0.8

0.7

0.6
Amplitude

Kp=300, Kd=70, Ki=300


0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (sec)

Result: With PID controller:


Rise time 0.0454 seconds, Settling time 0.951 seconds

Conclusion:

Challenge level-1: plot unit step response for following PID parameters
(i) 𝐾𝑝 = 300, 𝐾𝑑 = 0 𝑎𝑛𝑑 𝐾𝑎 = 0
(ii) 𝐾𝑝 = 300, 𝐾𝑑 = 0 𝑎𝑛𝑑 𝐾𝑎 = 0

Challenge level-2: Problem statement: A machine tool control system consisting of


an amplifier, prime mover, moving carriage and tool bit with unity feedback is given
by transfer function.
50
𝐺(𝑠) =
𝑠 (𝑠 + 1)(𝑠 + 4)(𝑠 + 5)
The goal is to have an overshoot less than 25% for a step input while achieving a peak
time less than 3 seconds. Determine a suitable controller using (a) PD Control (b) PI
control and (c) PID control. Then select the best controller.

Control Systems Lab- B18EC4050 Page | 57


REVA University School of ECE

EXPERIMENT-9

State-Space Methods for Controller Design

Introduction: State-Space Methods for Controller Design


In this section, we will show how to design controllers and observers using state-space (or time-
domain) methods.
Key MATLAB commands used in this tutorial are: eig , ss , lsim , place , acker

Contents
 Modeling
 Stability
 Controllability and Observability
 Control Design Using Pole Placement
 Introducing the Reference Input
Observer Design

Modeling
There are several different ways to describe a system of linear differential equations. The state-space
representation was introduced in the Introduction: System Modeling section. For a SISO LTI
system, the state-space form is given below:

(1)
(2)
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. Note that there are
n first-order differential equations. A state-space representation can also be used for systems with
multiple inputs and multiple outputs (MIMO), but we will primarily focus on single-input, single-
output (SISO) systems in these tutorials.
To introduce the state-space control design method, we will 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).

Control Systems Lab- B18EC4050 Page | 58


REVA University School of ECE

The equations for the system are given by:

(3)

(4)
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:

(5)
(6)
where:

(7)
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 ( ). Enter the system matrices into an m-file.
A=[0 1 0

980 0 -2.8

0 0 -100 ];

Control Systems Lab- B18EC4050 Page | 59


REVA University School of ECE

B=[0

100 ];

C = [ 1 0 0 ];

Stability
One of the first things we want to do is analyze whether the open-loop system (without any control)
is stable. As discussed in the Introduction: System Analysis section, the eigenvalues of the system
matrix, , (equal to the poles of the transfer function) determine stability. The eigenvalues of
the matrix are the values of that are solutions of .
poles = eig(A)

poles =

31.3050
-31.3050

-100.0000

From inspection, it can be seen that one of the poles is in the right-half plane (i.e. has positive real
part), which means that the open-loop system is unstable.
To observe what happens to this unstable system when there is a non-zero initial condition, add the
following lines to your m-file and run it again:
t = 0:0.01:2;

u = zeros(size(t));

x0 = [0.01 0 0];

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

Control Systems Lab- B18EC4050 Page | 60


REVA University School of ECE

[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)')

It looks like the distance between the ball and the electromagnet will go to infinity, but probably the
ball hits the table or the floor first (and also probably goes out of the range where our linearization is
valid).
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)).
(8)
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

Control Systems Lab- B18EC4050 Page | 61


REVA University School of ECE

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)).

(9)
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
(10)
The state-space equations for the closed-loop feedback system are, therefore,
(11)
(12)
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

Control Systems Lab- B18EC4050 Page | 62


REVA University School of ECE

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:
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)')

Control Systems Lab- B18EC4050 Page | 63


REVA University School of ECE

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).

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)')

Control Systems Lab- B18EC4050 Page | 64


REVA University School of ECE

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:
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])

Control Systems Lab- B18EC4050 Page | 65


REVA University School of ECE

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 = ...).

Control Systems Lab- B18EC4050 Page | 66


REVA University School of ECE

Nbar = rscale(sys,K)

Nbar =

-285.7143

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, :
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])

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.

Control Systems Lab- B18EC4050 Page | 67


REVA University School of ECE

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).

(13)
(14)
The error dynamics of the observer are given by the poles of .

(15)
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.
op1 = -100;

op2 = -101;

Control Systems Lab- B18EC4050 Page | 68


REVA University School of ECE

op3 = -102;

Because of the duality between controllability and observability, we can use the same technique used
to find the control matrix by replacing the matrix by the matrix and taking the transposes of each
matrix:

L = place(A',C',[op1 op2 op3])';

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.

At = [ A-B*K B*K

zeros(size(A)) A-L*C ];

Bt = [ B*Nbar

zeros(size(B)) ];

Ct = [ C zeros(size(C)) ];

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, .
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)')

Control Systems Lab- B18EC4050 Page | 69


REVA University School of ECE

Responses of all the state variables are plotted below. Recall that lsim gives us and ; to get , we
need to compute .
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);

Control Systems Lab- B18EC4050 Page | 70


REVA University School of ECE

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)')

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.

Result:

Conclusion:

Control Systems Lab- B18EC4050 Page | 71

You might also like