0% found this document useful (0 votes)
2 views

Control System

The EEE325 Control Systems Lab Manual for Fall 2024 at COMSATS University Islamabad provides a comprehensive guide for practical sessions, including 12 experiments that integrate both software and hardware aspects of control systems. Key focuses include the application of theoretical concepts to real-world systems, with significant updates made to enhance the learning experience. The manual also outlines grading policies, safety instructions, and the necessary equipment and software resources for successful lab execution.

Uploaded by

Saad Mughal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Control System

The EEE325 Control Systems Lab Manual for Fall 2024 at COMSATS University Islamabad provides a comprehensive guide for practical sessions, including 12 experiments that integrate both software and hardware aspects of control systems. Key focuses include the application of theoretical concepts to real-world systems, with significant updates made to enhance the learning experience. The manual also outlines grading policies, safety instructions, and the necessary equipment and software resources for successful lab execution.

Uploaded by

Saad Mughal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 118

COMSATS University Islamabad (CUI), Lahore Campus

Department of Electrical & Computer Engineering

EEE325 – Control Systems


Lab Manual for Fall 2024

Lab Resource Person


Abu Bakar Talha

Theory Resource Person


Dr. Mujtaba

Supervised By

Name: __________________________ Registration Number: CIIT/ - - /LHR

Program: _______________________ Batch: _____________________________________

Semester ___________________________
Revision History

Sr
Update Date Performed by
No.

1 Lab Manual Preparation January 07, 2015 Mr. Salman Javid


Dr. Mujtaba Hussain Jaffery, Dr. Mirza Tariq
2 Lab Manual Review February 20, 2015
Hamayun, Mr. Athar Hanif, Mr. Salman Ijaz
3 Layout modifications February 23, 2015 Mr. Salman Javid
Dr. Mujtaba Hussain Jaffery, Dr. Mirza Tariq
4 Lab Manual Review February 25, 2015
Hamayun, Mr. Athar Hanif, Mr. Salman Ijaz
Dr. Mujtaba Hussain Jaffery, Dr. Mirza Tariq
5 Lab Manual Review March 03, 2015
Hamayun, Mr. Athar Hanif, Mr. Salman Ijaz

6 Lab Manual Update August 28, 2016 Mr. Salman Javid

Lab Manual Update as per


7 March 15, 2018 Mr. Salman Javid
OBE Format
Lab Manual Experiment
8 October 10, 2019 Mr. Sarmad Hassan
Sequence Update
9 Lab Manual Layout update Feb 2020 Mr. Sarmad Hassan

10 Lab Manual update Sep 2021 Mr. Sarmad Hassan

11 Lab Manual update Sep 2022 Mr. Abubakar Talha Jalil


Mr. Sarmad Hassan
12 Lab Manual update Oct 2023
Mr. Abubakar Talha Jalil

|EEE325 | Control Systems Lab Manual


i
Preface
This manual supports the practical sessions of the course “Control Systems” for under-graduate
engineering degrees. The manual comprises of 12 experiments which cover software as well as hardware
aspects of control systems. The hardware experiments consist of working with platforms like speed and
position control of servo motor by using PID controller, temperature control by using QNET HVACT,
Inverted Pendulums and Vertical Take-Off and Landing. The software-based experiments mainly use NI
LabVIEW and Matlab/Simulink. This new edition offers significant improvements from previous manual as
it included 7 hardware experiment covering a comprehensive portion of the lab. In an attempt to make
the students capable of correlating theoretical concepts with physical systems, new experiments have
been included in this edition. While writing this manual, the two main focuses were systematic
explanation and problem-solving methodology.

|EEE325 | Control Systems Lab Manual


ii
Books
Text Books
1. Control Systems Engineering by Norman S. Nise
2. Modern Control Systems by Katsuhiko Ogata
Reference Books
1. Design of feedback control systems by R.T Stefani
2. Linear Systems Theory by CT Chen

Learning Outcomes
Theory CLOs:
After successfully completing this course, the students will be able to:
1. Apply the concept of physical laws to describe the dynamical behaviour and to analyze the
performance of Electrical, Mechanical and Electromechanical Systems. (PLO1, C4)
2. Analyze and improve the transient and steady state performance of different dynamical
systems using frequency response approach. (PLO2, C4)
3. Synthesis of classical controllers to improve the transient and steady state performance of
different dynamical systems according to the desired/given specifications. (PLO3, C5)
4. Evaluate a real-life control system problem in a systematic manner, which contains system
design, process information gathering through conduction of experiments/simulations with
appropriate consideration for safety and environmental considerations. (PLO3, C6)
Lab CLOs:
After successfully completing this course, the students will be able to:
1. Design of various linear control algorithms to control the performance of various systems to be
demonstrated both on simulation and the prototype. (PLO3, C5)
2. Follow the instructions to construct various Mechanical, Electrical and Electromechanical Systems
in simulations and using the hardware modules to Display their behaviour by sketching their plots
in runtime. (PLO5, P3)
3. Compile an effective Report using experimental results, aided by graphical and tabular data
analysis. (PLO10, A2)

CLOs – PLOs Mapping change according to CDF


PLO10

PLO Cognitive Affective Psychomotor


PLO1

PLO2

PLO3

PLO5

CLO Domain Domain Domain

CLO1 x C4
CLO2 x C4
CLO3 x C5
CLO4 x C6
Lab CLO1 x C5
Lab CLO2 x P3
Lab CLO3 X A2

|EEE325 | Control Systems Lab Manual


iii
Lab CLOs – Lab Experiment Mapping
Lab

Lab 10

Lab 11

Lab 12
Lab 1

Lab 2

Lab 3

Lab 4

Lab 5

Lab 6

Lab 7

Lab 8

Lab 9
CLO
CLO4 C5 C5 C5 C5 C5 C5 C5 C5 C3 C4
CLO5 P2 P2 P3 P2 P3 P3 P3 P3 P3 P3 P3 P3

Grading Policy
The final marks for lab would comprise of Lab Assessment (25%), Lab Midterm (25%), and Lab Terminal
(50%).

Lab Assignments:

i. Lab Assignment 1 Marks (Lab marks from Labs 1-3)


ii. Lab Assignment 2 Marks (Lab marks from Labs 4-6)
iii. Lab Assignment 3 Marks (Lab marks from Labs 7-9)
iv. Lab Assignment 4 Marks (Lab marks from Labs 10-12)
Lab Mid Term = 0.5*(Lab Mid Term exam) + 0.5*(average of lab evaluation of Lab 1-6)
Lab Terminal = 0.5*(Complex Engineering Problem) +0.375*(average of lab evaluation of Lab 7-12)
+ 0.125*(average of lab evaluation of Lab 1-6)

The minimum pass marks for both lab and theory shall be 50%. Students obtaining less than 50% marks
(in either theory or lab, or both) shall be deemed to have failed in the course. The final marks would be
computed with 75% weight to theory and 25% to lab final marks.

List of Equipment
1. Personal Computers for Simulation (Preferably Core i-5 or above)
2. NI ELVIS
3. QNET HVACT
4. Vertical Take-Off and Landing (VTOL) Complete Setup
5. Rotatory Pendulum Complete Setup

Software Resources
1. LabVIEW
2. Matlab

Lab Instructions
• This lab activity comprises of three parts: Pre-lab, Lab Tasks and Viva session.
• The students should perform and demonstrate each lab task separately for step-wise evaluation.
• Only those tasks that are completed during the allocated lab time will be credited to the students.
• Students are however encouraged to practice on their own in spare time for enhancing their skills.

|EEE325 | Control Systems Lab Manual


iv
Safety Instructions
The following general rules and precautions are to be observed at all time in the laboratory. These rules
are for the benefit of the experimenter as well as those around him/her. Additional rules and precautions
may apply to a particular laboratory.

1. Keep pathways clear and place extra items (books, bags, etc.) on the shelves or under the
worktables. If under the tables, make sure that these items cannot be stepped on.
2. Report all accidents, injuries, breakage of equipment and any defective item to the lab instructor
or staff immediately.
3. Make sure that the last connection to be made in your circuit is the power supply.
4. No part of a live circuit should be touched by the bare hand.
5. Do not disturb the system while it is executing a commanded trajectory.
6. Whenever you are reconfiguring the plant setup, be sure to check that your VI is not running and
that the amplifier box is turned off.
7. Keep the work area and workbench clear of the items not used in the experiment to avoid short
circuiting possibilities.
8. When unplugging a power cord, pull on the plug, not on the cable.
9. If in doubt about electrical safety, see the lab instructor. Information regarding safe use and
possible hazards should be studied carefully from instruction manual.
10. Be aware of emergency procedures, location of fire extinguisher and emergency exit.
11. It is prohibited to eat, drink and smoke in the lab. Do not run or engage in reckless behaviour in
or near the lab.
12. Make sure that equipment is turned OFF when not in use and before leaving the laboratory.

|EEE325 | Control Systems Lab Manual


v
Table of Contents
Revision History ...................................................................................................................................................... i
Preface .................................................................................................................................................................. ii
Books .................................................................................................................................................................... iii
Learning Outcomes ............................................................................................................................................... iii
CLOs – PLOs Mapping change according to CDF .................................................................................................... iii
Lab CLOs – Lab Experiment Mapping .................................................................................................................... iv
Grading Policy ....................................................................................................................................................... iv
List of Equipment .................................................................................................................................................. iv
Software Resources .............................................................................................................................................. iv
Lab Instructions .................................................................................................................................................... iv
Safety Instructions ................................................................................................................................................. v
Table of Contents.................................................................................................................................................. vi
1 LAB # 1: Mathematical Modelling of Mechanical, Electrical, Electronic and Electromechanical Systems using
MATLAB/LabVIEW ................................................................................................................................................. 1
1.1 Objectives ..................................................................................................................................................... 1
1.2 Lab Instructions ............................................................................................................................................ 1
1.3 Theory and Pre-Lab Exercises: ...................................................................................................................... 1
1.3.1 Introduction .............................................................................................................................................1
1.3.2 Transfer Function Representation ...........................................................................................................2
1.3.3 Modelling a Translational Mechanical System ........................................................................................2
1.3.4 Modelling an Electrical System ................................................................................................................6
1.3.5 Modelling an Electronic System...............................................................................................................6
1.3.6 Modelling an Electro-Mechanical System (Armature Controlled DC Motor) ..........................................8
1.4 In-Lab Experiments ..................................................................................................................................... 10
1.4.1 Analysing the Electronic Systems ..........................................................................................................10
1.4.2 Analysing the Electrical System .............................................................................................................11
1.4.3 Analysing the Electromechanical System ..............................................................................................12
1.5 Post-Lab Exercise ........................................................................................................................................ 12
2 LAB # 2: Block Diagram Reduction Techniques and Measuring Time-Domain Performance Parameters &
Effect of Disturbance in Open/Closed-Loop Control System using MATLAB ......................................................... 14
2.1 Objectives ................................................................................................................................................... 14
2.2 Lab Instructions .......................................................................................................................................... 14
2.3 Theory and Pre-Lab Exercises: .................................................................................................................... 14
2.3.1 The block diagrams ................................................................................................................................15
2.3.2 Series Function.......................................................................................................................................15
2.3.3 Parallel Function ....................................................................................................................................15
2.3.4 Feedback System ...................................................................................................................................16
2.3.5 Time-domain specifications ...................................................................................................................17
2.3.6 Closed Loop Control System Subject to Disturbance .............................................................................18
2.4 In-Lab Experiments ..................................................................................................................................... 21
2.4.1 Disturbance Analysis ..............................................................................................................................21
2.4.2 Performance Analysis ............................................................................................................................21
2.4.3 Results....................................................................................................................................................22
2.5 Post-Lab Exercise ........................................................................................................................................ 22
3 LAB # 3: Design of Proportional-Integral-Derivative (PID) Controller using MATLAB ................................... 24

|EEE325 | Control Systems Lab Manual


vi
3.1 Objectives ................................................................................................................................................... 24
3.2 Lab Instructions .......................................................................................................................................... 24
3.3 Pre-Lab Theory and Exercises: .................................................................................................................... 24
3.3.1 PID Controller ........................................................................................................................................24
3.4 In-Lab Experiments ..................................................................................................................................... 26
3.4.1 Mass-Spring-Damper Model ..................................................................................................................26
3.4.2 Design Problem: Ball & Beam System ....................................................................................................26
3.5 Post-Lab Exercises ...................................................................................................................................... 27
4 LAB # 4: Introduction to Vertical Take-off and landing (VTOL) and Design of a Current Controller using
LabVIEW .............................................................................................................................................................. 29
4.1 Objectives ................................................................................................................................................... 29
4.2 Lab Instructions .......................................................................................................................................... 29
4.3 Theory and Pre-Lab Exercises ..................................................................................................................... 29
4.3.1 Introduction ...........................................................................................................................................29
4.3.2 Current Control ......................................................................................................................................30
4.4 In-Lab Experiments ..................................................................................................................................... 33
4.4.1 Finding Resistance .................................................................................................................................33
4.4.2 Qualitative Current Control ...................................................................................................................33
4.4.3 Current Control Design ..........................................................................................................................34
4.5 Post Lab Exercise ........................................................................................................................................ 35
5 LAB # 5: Mathematical Modelling of the Vertical Take-Off and Landing System for the flight Control Operation
and its validation using LabVIEW ......................................................................................................................... 37
5.1 Objectives ................................................................................................................................................... 37
5.2 Lab Instructions .......................................................................................................................................... 37
5.3 Theory and Pre-Lab Exercises ..................................................................................................................... 37
5.3.1 Introduction and Background ................................................................................................................37
5.3.2 Torque Acting on VTOL ..........................................................................................................................37
5.3.3 Equation of Motion ................................................................................................................................38
5.3.4 Process Transfer Function Model ..........................................................................................................38
5.3.5 Modelling Virtual Instrument ................................................................................................................39
5.4 In Lab Experiments ..................................................................................................................................... 40
5.4.1 Measuring the Equilibrium Current .......................................................................................................40
5.4.2 Finding Natural Frequency .....................................................................................................................41
5.4.3 Model Validation ...................................................................................................................................41
5.4.4 Using the System Identification Tool .....................................................................................................43
5.4.5 Results....................................................................................................................................................44
5.5 Post Lab Exercise ........................................................................................................................................ 44
6 LAB # 6: Design of a PID Controller for Pitch Control operation of VTOL ...................................................... 46
6.1 Objectives ................................................................................................................................................... 46
6.2 Lab Instructions .......................................................................................................................................... 46
6.3 Theory and Pre-Lab Exercises ..................................................................................................................... 46
6.3.1 Introduction and Background ................................................................................................................46
6.3.2 Steady-state Error Analysis ....................................................................................................................46
6.3.3 PID Control Design .................................................................................................................................47
6.3.4 Flight Control Virtual Instrument ...........................................................................................................48
6.4 In Lab Experiments ..................................................................................................................................... 49

|EEE325 | Control Systems Lab Manual


vii
6.4.1 PD Steady State Analysis ........................................................................................................................49
6.4.2 PID Steady State Analysis .......................................................................................................................51
6.4.3 PID Control Design .................................................................................................................................51
6.4.4 Results....................................................................................................................................................53
6.5 Post Lab Exercise ........................................................................................................................................ 53
7 LAB # 07: Design of a Switch (ON/OFF) Controller and Mathematical Modelling of QNET HVAC System and its
validation using LabVIEW .................................................................................................................................... 55
7.1 Objectives ................................................................................................................................................... 55
7.2 Lab Instructions .......................................................................................................................................... 55
7.3 Theory and Pre-Lab Exercises ..................................................................................................................... 55
7.3.1 Introduction ...........................................................................................................................................55
7.3.2 Pre Lab Theory and Exercises ................................................................................................................56
7.3.3 Modelling ...............................................................................................................................................57
7.3.4 On-Off Control Virtual Instrument .........................................................................................................57
7.4 In Lab Experiments ..................................................................................................................................... 58
7.4.1 Calibration..............................................................................................................................................58
7.4.2 Relay Control .........................................................................................................................................59
7.4.3 Determination of Kvin Mathematical Model .........................................................................................60
7.5 Post-Lab Exercise ........................................................................................................................................ 60
8 LAB # 08: Mathematical Modelling of the QNET HVAC System and Design of PI Controller for the System . 62
8.1 Objectives ................................................................................................................................................... 62
8.2 Lab Instructions .......................................................................................................................................... 62
8.3 Theory and Pre-Lab Exercises ..................................................................................................................... 62
8.3.1 Introduction ...........................................................................................................................................62
8.3.2 Background ............................................................................................................................................62
8.3.3 Speed Control Virtual Instrument ..........................................................................................................63
8.4 In Lab Experiments ..................................................................................................................................... 64
8.4.1 Calibration..............................................................................................................................................64
8.4.2 Qualitative PI Control.............................................................................................................................64
8.4.3 Saturation and Windup ..........................................................................................................................65
8.4.4 Set-Point Weight ....................................................................................................................................66
8.4.5 PI Control According to Specifications ...................................................................................................66
8.5 Post-Lab Exercise ........................................................................................................................................ 67
9 LAB # 9: Design of Proportional Controller and Lead/Lag Compensator using Root Locus Method on MATLAB
69
9.1 Objectives ................................................................................................................................................... 69
9.2 Lab Instructions .......................................................................................................................................... 69
9.3 Pre-Lab Theory and Exercises ..................................................................................................................... 69
9.3.1 Root Locus and Controller Design ..........................................................................................................69
9.3.1.1 Obtaining a root locus plot ................................................................................................................69
9.3.1.2 Continuous Root Locus Plot...............................................................................................................70
9.3.1.3 Comments on the Root Locus Plot ....................................................................................................70
9.3.1.4 Constant ζ and Constant wn Loci.......................................................................................................71
9.3.1.5 Plotting Polar Grids in the Root Locus Diagram ................................................................................71
9.3.1.6 Preliminary Design Considerations ....................................................................................................72
9.3.2 Bode Plot................................................................................................................................................73

|EEE325 | Control Systems Lab Manual


viii
9.3.2.1 Why Sine Waves? ..............................................................................................................................73
9.3.2.2 Determining system output given input and transfer function ........................................................73
9.3.2.3 Magnitude and Phase Plots ...............................................................................................................75
9.3.2.4 Bode Plot in Matlab ...........................................................................................................................76
9.3.2.5 Terminologies in Bode Plot (Frequency Domain Requirements) ......................................................76
9.3.3 System Compensation ...........................................................................................................................77
9.3.3.1 Types of Compensators .....................................................................................................................77
9.3.3.2 Root Locus Approach to Control System Design ...............................................................................77
9.3.3.3 Effects of the Addition of Poles and Zeros ........................................................................................78
9.3.3.4 Lead Compensator Design .................................................................................................................78
9.3.3.5 Lag Compensator Design ...................................................................................................................80
9.4 In-Lab Experiments ..................................................................................................................................... 81
9.4.1 Design Using Root Locus ........................................................................................................................81
9.4.2 Analyses of Designed Lead Compensator on MATLAB ..........................................................................82
9.4.3 Analyses of Designed Lag Compensator on MATLAB ............................................................................82
9.5 Post-Lab Exercise ........................................................................................................................................ 82
10 Lab #10: State Feedback Controller Design for a DC Motor Using Pole Placement Technique ..................... 84
10.1 Objectives ................................................................................................................................................... 84
10.2 Lab Instructions .......................................................................................................................................... 84
10.3 Theory and Pre-Lab Exercises: .................................................................................................................... 84
10.3.1 Introduction.......................................................................................................................................84
10.3.2 State-space analysis ..........................................................................................................................84
10.3.3 State-Space to transfer function conversion and vice versa .............................................................85
10.3.4 State-Feedback controller .................................................................................................................87
10.4 In Lab Experiments ..................................................................................................................................... 90
10.5 Post-Lab Exercise ........................................................................................................................................ 90
11 LAB # 11: Introduction to Rotary Pendulum System and to analyse the dynamical behaviour of the System
using LabVIEW ..................................................................................................................................................... 92
11.1 Objectives ................................................................................................................................................... 92
11.2 Theory and Pre-Lab Exercises ..................................................................................................................... 92
11.2.1 Introduction and Background ............................................................................................................92
11.2.2 Simple Modelling Virtual Instrument ................................................................................................95
11.3 In Lab Experiments ..................................................................................................................................... 96
11.3.1 Damping ............................................................................................................................................96
11.3.2 Friction...............................................................................................................................................96
11.3.3 Moment of Inertia .............................................................................................................................97
11.3.4 Results ...............................................................................................................................................98
11.4 Post-Lab Exercise ........................................................................................................................................ 99
12 LAB # 12: Design and Implementation of a Hybrid Controller for Rotary Pendulum .................................. 101
12.1 Objectives ................................................................................................................................................. 101
12.2 Lab Instructions ........................................................................................................................................ 101
12.3 Theory and Pre-Lab Exercises ................................................................................................................... 101
12.3.1 Introduction and Background ..........................................................................................................101
12.3.1.1 Energy Control .................................................................................................................................101
12.3.1.2 Hybrid Swing-Up Control .................................................................................................................102
12.3.2 Swing-Up Control VI ........................................................................................................................103

|EEE325 | Control Systems Lab Manual


ix
12.4 In-Lab Experiments ................................................................................................................................... 104
12.4.1 Energy Control .................................................................................................................................104
12.4.2 Hybrid Swing-Up Control .................................................................................................................105
12.5 Post Lab Exercise ...................................................................................................................................... 106

|EEE325 | Control Systems Lab Manual


x
1 LAB # 1: Mathematical Modelling of Mechanical, Electrical, Electronic
and Electromechanical Systems using MATLAB/LabVIEW
1.1 Objectives
• To Construct mathematical models of various systems such as, Electrical, Electronic and
Mechanical.
• To implement the developed models on LabVIEW/MATLAB to Display their characteristics such as
stability, step response and impulse response.
• To Assemble the model of an electro-mechanical (Permanent Magnet DC Motor) system to Sketch
its speed and position characteristics

1.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

1.3 Theory and Pre-Lab Exercises:

1.3.1 Introduction
“All models are wrong but some are useful” (George Box)
Mathematical Modelling means describing a physical system using mathematical concepts and language.
It is the first step in studying the behaviour of the system at hand. These mathematical models help the
designers in not only analysing an existing system but also designing new systems with more desirable
behaviour as per the specific needs of an application. Unfortunately, we can never make a completely
precise model of a physical system. There are always phenomena which we will not be able to model.
Thus, there will always be model errors or model uncertainties. But even if a model describes just a part
of the reality it can be very useful for analysis and design — if it describes the dominating dynamic
properties of the system.

There may be various representations of a mathematical model for a system each with their own inherent
advantages. After modelling a system, we will learn two representations of the developed model. Either
representation gives us insight into the system from a different perspective. Two of the most important
types of mathematical modelling that we are going to explore in this course are, Transfer Function and
State Space Modelling. In this lab, we will study only transfer function implementation of various physical
systems. We will study three types of systems which include Mechanical system, Electrical System and
Electronic System. First of all, we will derive the transfer function of these systems on paper, and after
that we will learn to implement these models on MATLAB/LabVIEW and finally we will see how to analyse
the systems through their mathematical models. For details, you can study chapter two of Control systems
by Ogata.

|EEE325 | Control Systems Lab Manual


1
1.3.2 Transfer Function Representation
A transfer function is a mathematical representation of the relationship between the input and output of
a system. This function allows separation of the input, system, and the output into three separate and
distinct parts. The general form of a transfer function, H(s), is:
R(s)
H(s) =
E(s)
Where 𝑅(𝑠) 𝑎𝑛𝑑 𝐸(𝑠) are Laplace Transforms of Response (output) and Excitation (input) respectively.

1.3.3 Modelling a Translational Mechanical System


A shock absorber, commonly found in motorbikes and automobile, can be represented by a mass-spring
system shown in Figure 1.1. This system can be mathematically modelled by Newton’s second law of
motion which states that the acceleration ′𝑎′ of a body is parallel and directly proportional to the net force
F acting on it and inversely proportional to the mass M of the body. (Here in below figure 𝑥 is displacement).

Fa(t) Fa(t)
(a) (b)
Figure 1.1
Let we apply a force 𝐹𝑎 (𝑡) on the mass 𝑀 and displace it from its mean position, say 𝑥0 , to a new position,
say 𝑥1 . At this point there will be other forces acting on the mass 𝑀 besides our applied force.

One of these three forces is Friction Force, 𝐹𝑓 (𝑡). For the simplicity we assume here that the wall friction
𝑏 is a viscous damper, that is, the friction force is linearly proportional to the velocity of the mass. In
reality, however, this friction force may behave as a coulomb damper, also known as dry friction, which is
a nonlinear function of the mass velocity. For a well-lubricated, sliding surface, the viscous friction is an
appropriate approximation. Hence for friction force, 𝐹𝑓 (𝑡)., we can write that

𝐹𝑓 (𝑡) = 𝑏𝑣(𝑡) (1.1)

This friction force will obviously be in the reverse direction of applied force.

Another force acting on the mass is the spring force which is also in the opposite direction to the applied
force. According to Hook’s Law the extension of a spring is directly proportional to the applied load as
long as the load does not exceed spring’s elastic limits. Mathematically Hook’s law can be stated as
𝐹𝑠 (𝑡) = 𝑘𝑥(𝑡) (1.2)
Here 𝐹𝑠 (𝑡) is spring force, k is the spring constant and x is the displacement as a result of applied force.

|EEE325 | Control Systems Lab Manual


2
Finally, from Newton’s second law of motion we know that
∑ 𝐹 = 𝑀𝒂 (1.3)

from Figure 1.1(b) we note that there are a total of three forces acting on the mass M. So,
∑ 𝐹 = 𝐹𝑎 − 𝐹𝑓 − 𝐹𝑠 (1.4)

Putting (1.1) and (1.2) in (1.4) and then putting the resulting equation in (1.3) and rearranging the term,
we get
𝑑2 𝑥(𝑡) 𝑑𝑥(𝑡)
𝑀 2
+ 𝑏 + 𝑘𝑥(𝑡) = 𝐹𝑎 (𝑡) (1.5)
𝑑𝑡 𝑑𝑡
Equation (1.5) is a second-order linear constant-coefficient differential equation which completely models
the behaviour of the given shock absorber system. Converting it into transfer function representation
greatly eases the manipulation of the model and gives extended liberty to investigate various hidden
aspects of the system in rather greater detail. To make transfer function out of equation (1.5) first we
need to identify input and output variables from the model and then we need to take Laplace Transform
of the equation.
For the system given above we take applied force Fa to be input to the system and let displacement 𝑥(𝑡)
be output. So after taking Laplace transform we get following expression assuming zero initial conditions.

𝑀𝑠 2 𝑋(𝑠) + 𝑏𝑠𝑋(𝑠) + 𝑘𝑋(𝑠) = 𝐹𝑎 (𝑠) (1.6)

(𝑀𝑠 2 + 𝑏𝑠 + 𝑘)𝑋(𝑠) = 𝐹𝑎 (𝑠) (1.7)

𝑋(𝑠)
Hence the transfer function 𝐹 will be,
𝑎 (𝑠)

𝑋(𝑠) 1 (1.8)
= 2
𝐹𝑎 (𝑠) 𝑀𝑠 + 𝑏𝑠 + 𝑘

a) Transfer Function Representation in LabVIEW


To represent the transfer function of Mechanical System in LabVIEW, go to block diagram and press right
click than programming >> Structures >>Mathscript and we need to store its numerator and denominator
coefficients in two separate vectors like

>> M = 200; b = 25; k = 10;


>> num = [1];
>> den = [M b k];

Now use tf command as follows


>> sys = tf(num, den)
You will get the following output

Transfer function:
1
-------------------
200 s^2 + 25 s + 10

|EEE325 | Control Systems Lab Manual


3
Figure 1.2

Note that we have also used while loop for our VI. Go to programming >> Structures >> while loop and
place it on your block diagram. If we have a transfer function object sys and we want to find the numerator
and denominator polynomials we can use the following command
>> [num, den] = tfdata(sys)
Please note that in transfer function model you have direct control over coefficients or weights of each
and every term involved in the system. By changing these parameters, we can observe the change in the
system response. You may remember from your DSP course that these weights in a filter transfer function
are of utmost importance and having direct access to these coefficients means that you can easily change
the gain response of the filter as per your requirement.

b) Pole-Zero-Gain Representation in LabVIEW


While transfer function allows us to examine the effects of coefficients of a system, it does not give any
explicit information about the poles and zeros of the system. Poles and zeros are vital parameters for
determining system’s stability and they can never be overlooked. We can find the poles and zeros of any
system either by applying roots() function on numerator and denominator polynomials separately or by
using pole() and zero() functions as

>> p = pole(sys)
>> z = zero(sys)

We can also use pzmap() function to find both poles and zeros in one go as
>> [p, z] = pzmap(sys)

When used without left-hand-side arguments, pzmap() command plots the poles and zeros in s-plane
where poles are represented by cross (×) and zeros are shown by circles (o).

We can also store the complete system in pole-zero-gain form in a single object. Explore the following
command
>> sys2 = zpk(z,p,k)

This command will create and store a mathematical model by using given locations of zeros (stored in z
vector), poles (stored in p vector) and a scalar value k.

|EEE325 | Control Systems Lab Manual


4
We can infer from the above command that this model gives direct access to the poles’ and zeros’
locations and designer can easily change these locations to study the response and stability of a system.

Figure 1.3
As with transfer function model we have a reciprocal command for zpk() function that takes system object
as an input and returns zeros, poles and gain.

>> [z,p,k] = zpkdata(sys1)

However, there are commands that can transform one model representation to the other. Explore the
following commands

[z,p,k] = tf2zp(num, den)


[num,den] = zp2tf(z,p,k)

You can now describe this system in LabVIEW either by tf() command or zpk() command. One very simple
way is shown in Figure 1.4 to get Transfer Function in LabVIEW.

Figure 1.4

|EEE325 | Control Systems Lab Manual


5
1.3.4 Modelling an Electrical System
Now let’s take an example of commonly used electrical circuit and try to develop its mathematical model.
Given below is a series RLC circuit. By applying Kirchhoff’s voltage law in the single loop, we obtain

𝑑𝑖 1 (1.9)
𝐿 + 𝑅𝑖 + ∫ 𝑖 𝑑𝑡 = 𝑒𝑖
𝑑𝑡 𝐶

Figure 1.5

If we are interested in observing the capacitor voltage, then our output will be

1 (1.10)
𝑒𝑜 = ∫ 𝑖 𝑑𝑡
𝐶

Taking Laplace transform of (1.9) and (1.10) will yield,

1 (1.11)
𝐿𝑠𝐼(𝑠) + 𝑅𝐼(𝑠) + 𝐼(𝑠) = 𝐸𝑖 (𝑠)
𝐶𝑠
1 (1.12)
𝐼(𝑠) = 𝐸𝑜 (𝑠)
𝐶𝑠

Now substituting (1.12) in (1.11), we will get the transfer function of this RLC Circuit

𝐸𝑜 (𝑠) 1 (1.13)
= 2
𝐸𝑖 (𝑠) 𝐿𝐶𝑠 + 𝑅𝐶𝑠 + 1

1.3.5 Modelling an Electronic System


In today’s industry almost all of the controllers are electronic in nature. Operational Amplifiers are the
most common circuit elements that are used in these controllers. Besides controllers, many of the control
system elements are implemented using Op-Amps. In this section we shall discuss electronic controllers
using operational amplifiers.

Operational Amplifiers are frequently used to amplify signals in sensor circuits. They are also used in filters
for compensation purpose. Another beauty of Op-Amps is that they can be easily cascaded with other
circuits because of their relatively high (near to infinity) input impedance.

|EEE325 | Control Systems Lab Manual


6
(a) (b)
Figure 1.6
Consider simple Op-Amp circuits shown above in Figure 1.6. The configuration in Figure 1.6(a) is known
as an integrator because it integrates the given signal over time and the circuit in 1.6(b) is a differentiator.
These two circuits along with the most basic configuration of Op-Amp as an amplifier constitute majority
of the electronic controllers commonly referred to as PID controllers (PID stands for Proportional plus
Integral plus Differential). PID controllers will be studied in depth in the forthcoming labs. For now, let’s
find transfer function for these simple controllers.

An important fact about Op-Amps to remember is that as their input impedance is very high so the current
going into the Op-Amp is normally negligible. Also the voltage difference at the terminals of Op-Amp is
nearly zero. Considering these characteristics, we can write input and output equations for Op-Amp as
follows,
𝑣𝑖𝑛 − 𝑣′ (1.14)
𝑖1 =
𝑅
𝑑(𝑣 ′ − 𝑣𝑜𝑢𝑡 )
𝑖2 = 𝐶
𝑑𝑡

As no current flows into the Op-Amp, we can say that 𝑖1 = 𝑖2 , hence

𝑣𝑖𝑛 − 𝑣 ′ 𝑑(𝑣′ − 𝑣𝑜𝑢𝑡 ) (1.15)


= 𝐶
𝑅 𝑑𝑡

Since𝑣 ′ = 0, so

𝑣𝑖𝑛 𝑑(− 𝑣𝑜𝑢𝑡 ) (1.16)


= 𝐶
𝑅 𝑑𝑡

Taking Laplace transform and rearranging the terms gives the transfer function.
𝑉𝑖𝑛 (1.17)
= −𝐶𝑠𝑉𝑜𝑢𝑡
𝑅
𝑉𝑜𝑢𝑡 1 (1.18)
= −
𝑉𝑖𝑛 𝑅𝐶𝑠

Similarly, we can find the transfer function of Differentiator as


𝑉𝑜𝑢𝑡 (1.19)
= −𝑅𝐶𝑠
𝑉𝑖𝑛
Derivation of this differentiator is left as a home assignment.

|EEE325 | Control Systems Lab Manual


7
1.3.6 Modelling an Electro-Mechanical System (Armature Controlled DC Motor)
DC motors that are used in feedback controlled devices are called DC servomotors. Applications of DC
servomotors abound, e.g. in robotics, computer disk drives, printers, aircraft flight control systems,
machine tools, flexible manufacturing systems, automatic steering control etc. DC motors are classified as
armature-controlled DC motors and field-controlled DC motors.

This experiment will focus on modelling, identification, and position control of an armature-controlled DC
servomotor. In particular, we will first develop the governing differential equations and the Laplace
domain transfer function model of an armature controlled DC motor. Next, we will tend to the
identification of the unknown system parameters that appear in the transfer function model of the DC
servomotor. Finally, we will develop and implement a position-plus-velocity feedback controller to ensure
that the DC motor angular position response tracks a step command.

The motor, we would be discussing, is a permanent-magnet type and has a single armature winding.
Current flow through the armature is controlled by power amplifiers as in Figure 1.7 so that rotation in
both directions is possible by using one, or both of the inputs.

Figure 1.7: Armature Control of Permanent Magnet DC Motor

As the motor accelerates, the armature generates an increasing back-emf, Vb, which tends to oppose the
driving voltage Va . The armature current is thus roughly proportional toVa − Vb . If the speed drops (due
to loading) Vb reduces, the current increases and so does the motor torque. This tends to oppose the
speed drop. That is why this mode of control is called 'armature-control' and gives a speed proportional
to Va .

Figure 1.8: Separately Excited DC Motor

|EEE325 | Control Systems Lab Manual


8
To derive a mathematical model for the motor under discussion, consider the schematic shown in Figure
1.8. As we know that a motor is an electro-mechanical device so its mathematic model consists of two
differential equations each representing one of its aspects.

First, we observe that the torque of a permanent-magnet DC motor is directly proportional to its armature
current. Stating mathematically, we say,
𝑇𝑚 = 𝐾𝑡 𝑖𝑎 (𝑡) (1.20)

Here 𝐾𝑡 is motor torque constant.

We also note that the back-emf produced in armature-controlled DC motor is directly proportional to the
angular velocity of armature. Thus,
𝑉𝑏 = 𝐾𝑏 𝜔𝑎 (𝑡) (1.21)

Here 𝐾𝑏 is motor constant. In SI units, however, the value of 𝐾𝑏 and 𝐾𝑡 is equal.

When the motor rotates and produces a torque as given in equation 1.22, there emerges a retarding
torque, because of friction, in response to𝑇𝑚 . If we assume the friction to be viscous friction, as we
assumed for the case of mass-spring model in previous labs, we get

𝑇𝑟 = 𝑏𝜔𝑎 (𝑡) (1.22)

Newton’s second law of motion, when translated into angular mechanics, takes the following form.

∑ 𝑇 = 𝐽𝛼(𝑡) (1.23)

Here 𝐽 is moment of inertia and 𝛼(𝑡) is angular acceleration. Putting value, we get

𝑑𝜔(𝑡)
𝑇𝑚 − 𝑏. 𝜔(𝑡) = 𝐽 (1.24)
𝑑𝑡
Or,
𝑑𝜔(𝑡) 1
= (𝐾𝑡 𝑖𝑎 (𝑡) − 𝑏. 𝜔(𝑡)) (1.25)
𝑑𝑡 𝐽

Equation 1.25 is the mechanical equation for an armature-controlled DC motor.

Now we turn to the electrical aspect of this motor. Applying Kirchhoff’s Voltage Law to Figure 1.8, we get,

𝑑𝑖𝑎 (𝑡)
𝑉𝑎 = 𝑅𝑖𝑎 (𝑡) + 𝐿 + 𝑉𝑏 (1.26)
𝑑𝑡
Substituting equation 1.21 and rearranging the terms gives,

𝑑𝑖𝑎 (𝑡) 1
= (𝑉𝑎 − 𝑅𝑖𝑎 (𝑡) − 𝐾𝑏 𝜔𝑎 (𝑡)) (1.27)
𝑑𝑡 𝐿
Equation 1.27 gives electrical equation of the motor. Combining these two equations results in a complete
model of armature-controlled DC motor.

|EEE325 | Control Systems Lab Manual


9
1.4 In-Lab Experiments

1.4.1 Analysing the Electronic Systems


Using Mathematical Models of Integrator and Differentiator Circuits described in pre lab session, do the
following. Assume the following parameters
𝐶 = 0.1 𝑢𝐹; L = 0.01𝐻; 𝑅 = 47𝐾𝛺;

a) Implement the models in MATLAB/LabVIEW. Write down the expression below


Integrator Differentiator

b) Represent the system in Pole-Zero-Gain Form. Write down the expression below
Integrator Differentiator

c) Evaluate and plot poles and zeros of the systems. Write numeric value below
Integrator Differentiator

d) Find out Step Response of Systems


Integrator Differentiator

e) Comment on stability
Integrator Differentiator

|EEE325 | Control Systems Lab Manual


10
1.4.2 Analysing the Electrical System
Using Mathematical Model of 𝑅𝐿𝐶 Circuit described in pre lab session, do the following. Assume the
following parameters
𝐶 = 0.1 𝑢𝐹; L = 0.01𝐻; 𝑅 = 47𝐾𝛺;

a) Implement the model in MATLAB/LabVIEW. Write down the expression below

b) Represent the system in Pole-Zero-Gain Form. Write down the expression below

c) Evaluate and plot poles and zeros of the system. Write numeric value below

d) Find out Step Response of System

e) Comment on stability

|EEE325 | Control Systems Lab Manual


11
1.4.3 Analysing the Electromechanical System
Using Mathematical Models of DC Motor derived in pre lab session and assuming following parameters.

Ra=Armature Resistance=8 Ω, L a=Armature Inductance=1.2 x 10-3 H


Kt=Motor torque Constant=0.04 N.mA-1, Kb=Motor Back Emf constant=0.04
.
b=Motor viscous friction constant=0.00002 N/m.s , J=Moment of Inertia=4 x 10-6Kg.m2
-1

a) Implement the Simulink Model for Speed of the System on Matlab Simulink

b) Find out Step Response of the System.

c) Implement the Simulink Model for Position of the System on Matlab Simulink

d) Find out Step Response of the System.

(Please Note that Recommended stop time for simulink simulation is 3s at given parameter values)

1.5 Post-Lab Exercise

Exercise 1:
Consider the Mass Spring System given in Pre Lab section. Find its step response using Simulink.

|EEE325 | Control Systems Lab Manual


12
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


13
2 LAB # 2: Block Diagram Reduction Techniques and Measuring Time-
Domain Performance Parameters & Effect of Disturbance in
Open/Closed-Loop Control System using MATLAB
2.1 Objectives
• To Construct equivalent mathematical model of a complicated system using MATLAB
• To Measure performance of the system through time domain performance parameters using
MATLAB
• To compare the performance of an open-loop and closed-loop system by measuring the Effect of
Disturbance, using LabVIEW

2.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

2.3 Theory and Pre-Lab Exercises:


In this exercise our prime objective is to simulate Linear Time-Invariant Systems. We will start by
understanding the interconnection of various system components and methods to reduce a rather
complex-looking system to a simple transfer function. These techniques facilitate the control engineers
to analyse the whole system as a single unit and study its overall behaviour.

Primary concerns in control system design are performance and stability. In order to design and analyse
control systems, we must first establish adequate performance specifications. Performance specifications
can be presented in the time domain or the frequency domain. Time-domain specifications generally take
the form of settling time, percent overshoot, rise time, and steady-state error. Stability and frequency-
domain specifications are addressed in coming labs.
As we have learned so far, the advantages and disadvantages of open loop control systems over the closed
loop control systems. One of the major advantage of closed loop control system over the open loop
control system is that the closed loop control system is less sensitive to disturbance. In this pre lab session
we are going to prove it mathematically. We will also observe the same during the simulation in lab.

In general, we use feedback in a control system to


1. Decrease the sensitivity of the system to plant variations,
2. Enable adjustment of the system’s transient response,
3. Reject disturbance, and
4. Reduce steady-state tracking error.
The aforementioned advantages of feedback come at the cost of increased number of components and
system complexity, reduced closed-loop gain, and the introduction of possible instabilities. However, the
advantages of feedback outweigh the disadvantages to such an extent that feedback control systems are
found everywhere. In this lab, the advantages of feedback are illustrated with two examples. As always,
our prime focus would be to emphasis the use of Matlab in the control system analysis.

|EEE325 | Control Systems Lab Manual


14
Figure 2.1

2.3.1 The block diagrams


A block diagram is a specialized, high-level type of flow chart. Its highly structured form presents a bird’s
eye view of major process steps and key process participants, as well as their relationships and interfaces
involved. Various components in a system may be related to one another in different fashions, like series,
parallel, or feedback. We shall first learn how to deal with these relations in MATLAB.

2.3.2 Series Function


Two or more blocks are said to be connected in series only if the output of one block is not affected by
the next following block. Any number of cascaded blocks representing non-loading components can be
replaced by a single block, the transfer function of which is simply the product of the individual transfer
functions. Figure 2.2 shows a system comprising of two subsystems, represented by their transfer
functions G1(s) and G2(s), connected in series.

Let the 𝐺1 (𝑠) and 𝐺2 (𝑠) is of the form,

num1 num2
G1 (s) = , G2 (s) =
den1 den2

Figure 2.2: Series Connection

Then the overall transfer function, T(s), can be represented by,


num
T(s) =
den
If we know the transfer functions of the subsystems, 𝐺1 (𝑠) and 𝐺2 (𝑠), then we can find the transfer
function of 𝑇(𝑠) by using the following Mathscript command.
>>𝑠𝑦𝑠 = 𝑠𝑒𝑟𝑖𝑒𝑠 (𝑠𝑦𝑠1, 𝑠𝑦𝑠2)

2.3.3 Parallel Function


Block diagrams quite often have transfer functions in parallel configuration as shown in Figure 2.3.

To solve this problem, we use the following Math script command,


>>𝑠𝑦𝑠 = 𝑝𝑎𝑟𝑎𝑙𝑙𝑒𝑙(𝑠𝑦𝑠1, 𝑠𝑦𝑠2)

It will consume both transfer functions and the summing junction and give a single block between
𝑈(𝑠) 𝑎𝑛𝑑 𝑌(𝑠) equivalent to the consumed components. A similar way can also be performed for parallel
connection.

|EEE325 | Control Systems Lab Manual


15
Figure 2.3: Parallel Combination

2.3.4 Feedback System


Feedback paths are present in every other control system. They enable us to continuously monitor the
response of a system and make necessary changes in the reference input to get the desired output. Figure
2.4 shows a typical control system with G2(s) in feedback path.

Figure 2.4: Feedback Combination

The overall transfer function of this system can be calculated as,


Y(s) G1 (s)
T(s) = =
U(s) 1 ∓ G1 (s)G2 (s)
Matlab command feedback is used to resolve transfer functions connected in feedback style.
>>𝑠𝑦𝑠 = 𝑓𝑒𝑒𝑑𝑏𝑎𝑐𝑘(𝑠𝑦𝑠1, 𝑠𝑦𝑠2)

Figure 2.5: Unity Feedback Combination

By default feedback (𝑠𝑦𝑠1, 𝑠𝑦𝑠2) assumes negative feedback and is equivalent to


𝑓𝑒𝑒𝑑𝑏𝑎𝑐𝑘(𝑠𝑦𝑠1, 𝑠𝑦𝑠2, −1). For positive feedback +1 has to be written explicitly as third argument.

Now assume that 𝐺2 (𝑠) = 1, that means we have connected output back to the input directly without
any transfer function involved. It would result in a special feedback loop, called unity feedback, as shown
in Figure 2.5. Total transfer function, T(s), in this case would then be,
Y(s) G1 (s)
T(s) = =
U(s) 1 ∓ G1 (s)
Now we can use the same feedback command to calculate T(s),

>>𝑠𝑦𝑠 = 𝑓𝑒𝑒𝑑𝑏𝑎𝑐𝑘(𝑠𝑦𝑠1, 1)

Here 1 represents unity feedback.

|EEE325 | Control Systems Lab Manual


16
2.3.5 Time-domain specifications
Time-domain performance parameters are generally given in terms of the transient response of a system
to a given input signal. Since the actual input, which the system will be subjected to in practice, is generally
unknown, a standard test input signal is used. The test signals are of the general form
r(t) = t n
And the corresponding Laplace transform is
n!
R(s) =
s n+1
When 𝑛 = 0, 1 𝑎𝑛𝑑 2, we have step, ramp, and parabolic inputs respectively. An impulse function may
also be used as a test signal.
The standard performance measures are usually defined in terms of the step response and the impulse
response. The most common step response performance measures are percent overshoot (𝑃. 𝑂), rise
time (𝑡𝑟 ), peak time (𝑡𝑝 ), settling time (𝑡𝑠 ) and steady-state error (𝑒𝑠𝑠 ) as shown in figure 2.6.

Figure 2.6: Step Response of a second order system


The performance parameters depicted in the Figure 2.6 above can be described as follows.

a) Rise Time
Rise time refers to the time required for a signal to rise from a specified low value to a specified high value.
Typically, these values are 10% and 90% of the step height. The 0 − 100% rise time, 𝑇𝑟 , measures the
time to reach 100% of the input magnitude. Alternatively, 𝑇𝑟1 , may measure the time from 10% − 90%
of the response to the step input.

b) Peak Time
The peak time is the time required for the response to reach the highest peak of the overshoot. Peak time
is inversely proportional to the amount of overshoot.

c) Settling Time
The time required for the system’s output to settle within a certain percentage of the input amplitude
(which is usually taken as 2%) is called settling time. Settling time, 𝑇𝑠 , is calculated as
4
Ts =
ζωo

|EEE325 | Control Systems Lab Manual


17
d) Overshoot
Overshoot is the maximum peak value of the response curve measured from the desired response of the
system. It is calculated as
Mp − fv
P. O = × 100%
fv
Where 𝑀𝑝 is the highest peak magnitude of output and 𝑓𝑣 is the final value of the output.

e) Steady-State Error
It is the difference between the desired final output and the actual one. Practically this difference can
never be reduced to zero. However, a suitable tolerance range may be defined to assume that the system
has reached its desired value. It is calculated as 𝑎𝑏𝑠(𝑑𝑐𝑔𝑎𝑖𝑛(1 − 𝑠𝑦𝑠𝑡𝑒𝑚)).

2.3.6 Closed Loop Control System Subject to Disturbance


Figure 2.1 shows closed loop control systems subject to disturbance. When two inputs (reference and the
disturbance) are present in an LTI system, each input can be treated separately according to super
position theorem and the output can be calculated by adding individual outputs because of both inputs.

Examining the effect of disturbance, we get

𝐶𝐷 (𝑆) 𝐺2 (𝑆)
=
𝐷(𝑆) 1 + 𝐺1 (𝑆)𝐺2 (𝑆)𝐻(𝑆)
Now examining the effect of reference input

𝐶𝑅 (𝑆) 𝐺1 (𝑆)𝐺2 (𝑆)


=
𝑅(𝑆) 1 + 𝐺1 (𝑆)𝐺2 (𝑆)𝐻(𝑆)

The response to the simultaneous application of the reference input and disturbance can be calculated
by adding the individual responses
𝐺2 (𝑆)
𝐶(𝑆) = 𝐶𝑅 (𝑆) + 𝐶𝐷 (𝑆) = [𝐺 (𝑆)𝑅(𝑆) + 𝐷(𝑆)]
1 + 𝐺1 (𝑆)𝐺2 (𝑆)𝐻(𝑆) 1

Consider now the case where|𝐺1 (𝑠)𝐻(𝑠)| >> 1 𝑎𝑛𝑑 |𝐺1 (𝑠)𝐺2 (𝑠)𝐻(𝑠)| >> 1. In this case, the closed-
loop transfer function 𝐶𝐷 (𝑠)/𝐷(𝑠) becomes almost zero, and the effect of the disturbance is suppressed.
This is an advantage of the closed-loop system. On the other hand, the closed-loop transfer function
𝐶𝑅 (𝑠)/𝑅(𝑠) approaches 1/𝐻(𝑠)as the gain of 𝐺1 (𝑠)𝐺2 (𝑠)𝐻(𝑠) increases.This means that
if |𝐺1 (𝑠)𝐺2 (𝑠)𝐻(𝑠)| >> 1, then the closed-loop transfer function 𝐶𝑅 (𝑠)/𝑅(𝑠) becomes independent of
𝐺1 (𝑠) 𝑎𝑛𝑑 𝐺2 (𝑠)and inversely proportional to H(s), so that the variations of 𝐺1 (𝑠) 𝑎𝑛𝑑 𝐺2 (𝑠)do not affect
the closed-loop transfer function 𝐶𝑅 (𝑠)/𝑅(𝑠). This is another advantage of the closed-loop system. It can
easily be seen that any closed-loop system with unity feedback, 𝐻(𝑠) = 1, tends to equalize the input and
output.

2.3.7 Electric Traction Motor Control


If you ever have visited Khewra Salt Mines, you would definitely have caught sight of a little electric train
which was once used to draw salt out of the mine but today it serves as a tourist transit train. The basic
principle of such an electric train is given in Figure 2.7

|EEE325 | Control Systems Lab Manual


18
Figure 2.7: Electric Train Propulsion System

The substation at the right of Figure 2.7 performs the task of taking the power provided by an electric
utility power plant and converting it into a form of power that the electric rail car can use to operate its
traction motors. The two terminals of this substation are connected via a trolley wire and the two rails
that the train runs on. The electric train has a spring-loaded arm called a pantograph on its roof that
touches the trolley wire, allowing electrical current to flow into a speed control system housed under the
train. This speed control system performs the task of varying the flow of electrical current to the traction
motors, enabling the car to move, before it eventually exits the motor through its wheels, then back to
the substation where it originated, thus completing an electrical circuit.

Figure 2.8: Block Diagram of the System shown in Figure 2.7

The speed control system of an electric train is shown in Figure 2.8. Our goal in this problem is to find the
closed-loop transfer function and investigate the response of ω to a commanded ωd . The first step in this
direction would be to apply block diagram reduction techniques learnt in previous labs to compute the
closed-loop transfer functionω/ ωd . We observe that closed-loop characteristic equation is second-order
with ωn = 52 and ξ = 0.012. Since the damping is low, we might expect the response to be highly
oscillatory as shown in Figure 2.9.

Figure 2.9: Step Response of an Electric Traction Motor

|EEE325 | Control Systems Lab Manual


19
Figure 2.10: Implementation of Electric Traction System on LabVIEW

To quantitatively observe step response parameters of this system we may use CD Parametric Time
Response block which, in this case, yields,
RiseTime: 0.0202
SettlingTime: 6.2294
SettlingMin: 0.0728
SettlingMax: 1.9624
Overshoot: 96.2920
Undershoot: 0
Peak: 1.9624
PeakTime: 0.0605

|EEE325 | Control Systems Lab Manual


20
2.4 In-Lab Experiments
The open-loop block diagram description of the armature-controlled DC motor with a load torque
disturbance, Td (s), is shown in Figure 2.11. The values for various parameters are given below.

Figure 2.11: Speed Control Tachometer System


Ra = 1
K t = 10
K b = 0.1
J=2
b = 0.5

2.4.1 Disturbance Analysis


1. Calculate the steady state speed of the motor due to disturbance (ideally it should be zero) in the
above system, assume the system to be linear (which means you can ignore the input while calculating
the effect of disturbance, as per superposition principle). Note this value in Table 3.1. Attach
snapshots
2. Now apply a feedback path to the system with transfer function of the feedback block to be 𝐾𝑡𝑎𝑐 = 1
and calculate the steady state speed due to disturbance. Again Note this value in Table 2.1. Attach
snapshots
3. Compare these values. What conclusion can be drawn based on these values?

2.4.2 Performance Analysis


1. Now apply step input to the system used in part 1 of 2.5.1(Assume disturbance to be zero) and find
out the values performance parameters in the system. Note these values in Table 2.1. Attach snapshot
2. Calculate the performance parameters of the system used in Part 2 of 2.5.1. Note these values in
Table 2.1. Attach snapshot
3. Compare the results obtained in Part 1 and 2 of this section.

|EEE325 | Control Systems Lab Manual


21
2.4.3 Results
Table 2-1
Parameter Symbol Value Unit

Rise Time of OL System 𝑇𝑟 𝑠


Peak Time of OL System 𝑇𝑝 𝑠
Settling Time of OL System 𝑇𝑠 𝑠
Percentage Overshoot of OL System 𝑃. 𝑂 −
Steady State Error of OL System 𝑒𝑠𝑠 𝑉
Steady State Value of OL System 𝑉𝑠𝑠 𝑉
Rise Time of CL System 𝑇𝑟 𝑠
Peak Time of CL System 𝑇𝑝 𝑠
Settling Time of CL System 𝑇𝑠 𝑠
Percentage Overshoot of CL System 𝑃. 𝑂 −
Steady State Error of CL System 𝑒𝑠𝑠 𝑉
Steady State Value of CL System 𝑉𝑠𝑠 𝑉

2.5 Post-Lab Exercise


Exercise 1
Implement given block diagram on Simulink and verify that the plot shown on scope is same as the step response of
given transfer function which verifies that the given transfer function is simplifed form of given block diagram, obtained
after applying block diagram reduction techniques.
X(s) 1
= 2
R(s) 200s + 25s + 10

Figure 2.12

|EEE325 | Control Systems Lab Manual


22
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


23
3 LAB # 3: Design of Proportional-Integral-Derivative (PID) Controller
using MATLAB
3.1 Objectives
• To Design PID Controller for different systems
3.2 Lab Instructions
✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

3.3 Pre-Lab Theory and Exercises:


A proportional–integral–derivative controller (PID controller) is the most commonly used feedback
controller in industrial control systems. A PID controller calculates an error value as the difference
between measured output and a desired set point. The controller attempts to minimize the error by
adjusting the process control inputs.
The popularity of PID controller can be attributed partly to their robust performance in a wide range of
operating conditions and partly to their functional simplicity, which allows engineers to operate them in
a simple and straightforward manner.

3.3.1 PID Controller


The transfer function of the PID controller looks like the following;
Ki Kds2 + Kps + Ki
Kp + + K ds =
s s
here,
𝐾𝑝 = 𝑃𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙 𝐺𝑎𝑖𝑛
𝐾𝑖 = 𝐼𝑛𝑡𝑒𝑔𝑟𝑎𝑙 𝐺𝑎𝑖𝑛
𝐾𝑑 = 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐺𝑎𝑖𝑛
First, let’s take a look at how the PID controller works in a closed-loop system using the schematic shown
below.

Figure 3.1:A block Diagram of a PID Controller

The signal 𝑒(𝑡) represents the tracking error, the difference between the reference input 𝑟(𝑡) and the
actual output 𝑦(𝑡). This error signal will be sent to the PID controller, and the controller computes both
the derivative and integral of this error signal. The signal 𝑢(𝑡) just past the controller is now equal to the
proportional gain (𝐾𝑝 ) times the magnitude of the error signal plus the integral gain (𝐾𝑖 ) times the
integral of the error signal plus the derivative gain (𝐾𝑑 ) times the derivative of the error signal.

|EEE325 | Control Systems Lab Manual


24
de(t)
u(t) = K p e(t) + K i ∫ e(t)dt + K d
dt
This signal, 𝑢(𝑡), will now be sent to the plant, and the new output, 𝑦(𝑡), will be obtained. This new output
will be sent back to the sensor again to find the new error signal. The controller takes this new error signal
and computes its derivative and it’s integral again. This process goes on and on.

a) Characteristics of P, I, and D Controller


A proportional controller (𝐾𝑝 ) will have the effect of reducing the rise time and will reduce but never
eliminate the steady-state error. An integral control (𝐾𝑖 ) will have the effect of eliminating the steady-
state error, but it may make the transient response worse. A derivative control (𝐾𝑑 ) increases the stability
of the system, reduces the overshoot, and improves the transient response. Effects of each controller on
closed-loop system are summarized in the table below.
Table 3-1
CL Response Rise Time Overshoot Settling Time S-S Error
Kp Decrease Increase Small Change Decrease
Ki Decrease Increase Increase Eliminate
Kd Small Change Decrease Decrease Small Change

Note that these correlations may not be exactly accurate, because 𝐾𝑝 , 𝐾𝑖 , 𝑎𝑛𝑑 𝐾𝑑 are dependent on each
other. In fact, changing one of these variables can change the effect of the other two. For this reason, the
table should only be used as a reference when you are determining the values for 𝐾𝑖 , 𝐾𝑝 𝑎𝑛𝑑 𝐾𝑑 .

b) General Tips for Designing a PID Controller


When you are designing a PID controller for a given system, follow the steps shown below to obtain a
desired response.
1. Obtain an open-loop response and determine what needs to be improved
2. Add a proportional control to improve the rise time
3. Add a derivative control to improve the overshoot
4. Add an integral control to eliminate the steady-state error
5. Adjust each of 𝐾𝑝 , 𝐾𝑖 , 𝑎𝑛𝑑 𝐾𝑑 until you obtain a desired overall response. You can always refer to
the table shown above to find out which controller controls what characteristics.

Figure 3.2 Step Response of the System with K_p=350,K_i=300 and K_d=50:

Lastly, keep in mind that you do not need to implement all three controllers (proportional, derivative, and
integral) into a single system, if not necessary. For example, if a PI controller gives a good enough response
(like the above example), then you don't need to implement a derivative controller on the system. Keep
the controller as simple as possible.

|EEE325 | Control Systems Lab Manual


25
3.4 In-Lab Experiments

3.4.1 Mass-Spring-Damper Model


Consider the Mass Spring System as discussed in Lab 1, with transfer function
X(s) 1
= 2
Fa (s) Ms + bs + k
Let the system parameters be,
𝑀 = 1 𝑘𝑔
𝑏 = 10 𝑁. 𝑠/𝑚
𝑘 = 20 𝑁/𝑚
𝐹𝑎 = 1𝑁
1. Design a PID controller using any technique learned in this course to achieve the following
 Rise Time ≤ 2 𝑠
 Overshoot ≤ 5%
 No Steady-State Error
Note down the values of proportional, integral and derivative control gains calculated

2. Implement the designed controller in MATLAB and analyse the response of your system before
and after designing the controller. Attach Matlab code and Results

3.4.2 Design Problem: Ball & Beam System


The open-loop transfer function of the plant for a ball and beam System is:
X(s) −mgd 1
=
Ɵ (s) L( J + m) s 2
R2
Where m = 0.111 , R = 0.015, g = −9.8, L = 1.0 , d = 0.03, J = 9.99 × 10−6
The design criteria for this problem are:
 𝑇𝑠 ≤ 3 𝑠
 𝑃𝑂 ≤ 5%

Figure 3.3: Ball and Beam Control System

1. Design a PID Controller to achieve the above criteria. Note down the values of proportional,
integral and derivative control gains calculated

2. Implement the designed controller in MATLAB and analyse the response of your system before
and after designing the controller. Attach Matlab code and Results

|EEE325 | Control Systems Lab Manual


26
3.5 Post-Lab Exercises

Exercise 1:
The open-loop transfer function of the DC Motor speed is

Ɵ̇ K
=
U (Js + b)(Ls + R) + K 2

For a 1 rad/sec step input, design a PID controller that satisfies the given criteria:
• Settling time less than 2 seconds
• Overshoot less than 5%
• Steady-stage error less than 1%

Exercise 2:
The open-loop transfer function of the DC Motor position is
Ɵ K
=
U s((Js + b)(Ls + R) + K 2 )

For a 1 rad/sec step input, design a PID controller


• Settling time less than 0.04 seconds
• Overshoot less than 16%
• No steady-state error
• No steady-state error due to a disturbance

Note: For exercise 1 and 2 refer to the Figure below.

Figure 3.4

|EEE325 | Control Systems Lab Manual


27
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


28
4 LAB # 4: Introduction to Vertical Take-off and landing (VTOL) and
Design of a Current Controller using LabVIEW
4.1 Objectives
• To introduce the VTOL system and open-loop and closed-loop operations on the system
• Design of a current controller to control the amount of current drawn by the propeller motor.

4.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

4.3 Theory and Pre-Lab Exercises

4.3.1 Introduction
The QNET vertical take-off and landing (VTOL) trainer is shown in Figure 4.1. The system consists of a
variable speed fan with a safety guard mounted on an arm. At the other end of the arm, an adjustable
counterweight is attached. This allows the position of the weight to be changed, which in turn affects the
dynamics of the system. The arm assembly pivots about a rotary encoder shaft. The VTOL pitch position
can be acquired from this setup. Some examples of real-world VTOL devices are helicopters, rockets,
balloons, and harrier jets. Aerospace devices are typically more difficult to model. Usually this will involve
using software system identification tools to determine parameters or actual dynamics. Due to their
inherent complexity, flight systems are usually broken down into different subsystems to make it more
manageable. These subsystems can be dealt with individually and then integrated to provide an overall
solution.

Figure 4.1

|EEE325 | Control Systems Lab Manual


29
4.3.2 Current Control

a) Block Diagram and Mathematics


The VTOL device is broken down into two subsystems: the voltage-current dynamics of the motor and the
current position dynamics of the VTOL body. The cascade control implemented in the VTOL trainer is
depicted in Figure 4.2 below. A PI current controller, the inner loop, is designed to regulate the current
inside the motor according to a desired current reference. This current reference is generated from the
outer-loop controller: a PID compensator that controls the pitch of the VTOL trainer.

Figure 4.2

In cases where the actuator has relatively slow dynamics, such as an electromagnet with a large
inductance, it is favourable to design a current controller. Typically, a proportional-integral compensator
is used to regulate the current flowing in the load. This basically makes the actuator dynamics negligible
and simplifies the control design of the outer-loop. In this case, the voltage-current relationship of the
VTOL trainer motor can be described, in the time-domain, by the equation

𝑉𝑚 = −𝑅𝑚 𝑖𝑚 + 𝐿𝑚 𝑖𝑚
And by transfer function
𝑉𝑚 (𝑠)
𝐼𝑚 (𝑠) =
𝑅𝑚 + 𝐿𝑚 𝑠
Figure 4.3 shows the VTOL current control system implemented. The PI compensator computes the
voltage necessary to reach the desired current.

Using the PI controller


𝑣𝑚 (𝑡) = 𝑘𝑝,𝑐 (𝑖𝑟𝑒𝑓 (𝑡) − 𝑖𝑚 (𝑡)) + 𝑘𝑖,𝑐 ∫ 𝑖𝑟𝑒𝑓 (𝑡) − 𝑖𝑚 (𝑡)𝑑𝑡

Figure 4.3

|EEE325 | Control Systems Lab Manual


30
We obtain the following closed-loop transfer function
𝑘𝑝,𝑐 + 𝑘𝑖,𝑐
𝐺𝐼𝑟𝑒𝑓 ,𝐼𝑚 (𝑠) =
𝑠 2 𝐿𝑚 + (𝑘𝑝,𝑐 + 𝑅𝑚 )𝑠 + 𝑘𝑖,𝑐

To match the standard second-order characteristic equation

𝑠 2 + 2𝜉⍵𝑛 𝑠 + ⍵2𝑛
We need a proportional gain of

𝑘𝑝,𝑐 = -𝑅𝑚 +2𝜉⍵𝑛 𝐿𝑚


And an integral gain of
𝑘𝑖,𝑐 = ⍵2𝑛 𝐿𝑚

These gains can then be designed according to a desired natural frequency ⍵𝑛 and damping ratio 𝜉

b) Introduction to Current Control VI


This VI is used to feed an open-loop voltage or current to the QNET-VTOL Trainer. The VI when in current
mode is shown in Figure 4.4. In this mode, a current-controller is used to regulate the current in the motor,
as discussed in previous section and the user chooses the reference current. In voltage mode, shown in
Figure 4.5, the voltage chosen is applied directly to the QNET amplifier, which in turn drives the motor. As
a quick VI description, Table 4.1 lists and describes the main elements of the QNET VTOL Current Control
VI. Every element is uniquely identified by an ID number located in Figure 4.4 and Figure 4.5, for both
current and voltage mode.

Figure 4.4

|EEE325 | Control Systems Lab Manual


31
Figure 4.5

Table 4-1

|EEE325 | Control Systems Lab Manual


32
4.4 In-Lab Experiments

4.4.1 Finding Resistance


1. Open the QNET_VTOL_Current_Control.vi Ensure the correct device is chosen
2. Run the VI
3. Set the Current Control ON switch to OFF
4. Set the Open-loop Voltage knob to 4.0 V. The VTOL Trainer propeller should begin turning as a
voltage is applied to the motor.
5. Vary the voltage between 4.0 V and 8.0 V by steps of 1.0 V and measure the current at each
voltage. Enter the results in the Table below and calculate the average resistance

Table 4-2
Sr. Voltage (V) Current (I) Resistance (R=V/I)
1 4V
2 5V
3 6V
4 7V
5 8V
Average Resistance

6. Click on Stop button to stop running the VI

4.4.2 Qualitative Current Control


1. Open the QNET_VTOL_Current_Control.vi
2. Ensure the correct device is chosen
3. Run the VI
4. Set the Current Control ON switch to ON
5. In the Current Set point section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.20 𝐴
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.40 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.90 𝐴
6. In the Control Parameters section set the PI current gains to:
 𝐾𝑝𝑐 = 0.250
 𝐾𝑖𝑐 = 10
The VTOL Trainer propeller should begin turning at various speeds according to the current
command. Examine the reference and measured current response obtained in the Current (A)
scope.
7. Show and explain the effects of having no integral gain. Attach a sample response

8. Show and explain the effects of having no proportional gain. Attach a sample response

9. Click on the Stop button to stop running the VI

|EEE325 | Control Systems Lab Manual


33
4.4.3 Current Control Design
1. Calculate the PI gains, 𝑘𝑝 𝑎𝑛𝑑 𝑘𝑖 , necessary to satisfy the following design criteria

 ⍵𝑛 = 42.5 𝑟𝑎𝑑/𝑠
 𝜉 = 0.7

Refer to section 5.4.2 (a) for calculations. Use the value of armature resistance as calculated in section
5.5.1 and inductance as given in the table below. Do all the calculations in the space provided below. Also
fill the table below.
Table 4-3
Parameter Value Unit
𝑅𝑚 ⍵
𝐿𝑚 53.8 mH
ξ 0.7
⍵𝑛 42.5 rad/s
𝑘𝑝,𝑐 V/A
𝑘𝑖,𝑐 V/(A.s)

2. Open the QNET_VTOL_Current_Control.vi


3. Ensure the correct device is chosen
4. Run the VI
5. Set the Current Control ON switch to ON
6. In the Current Set point section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.20 𝐴
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.40 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.90 𝐴
7. In Current Control Parameters section, set the PI current gains to what you found above.
8. Run the VI. The VTOL Trainer propeller should begin turning at various speeds according to the
current command. Examine the reference and measured current response obtained in the
Current (A) scope. They should be tracking
9. Include a plot showing the current response with your designed PI gains. Does it satisfy the design
criteria? Discuss below.

10. Click on Stop button to stop running the VI.

|EEE325 | Control Systems Lab Manual


34
4.5 Post Lab Exercise

Exercise 1
Design a PI controller to control the current drawn by propeller motor using the criteria given below and
validate the designed controller by using the calculated values of proportional and integral gain in current
control VI in terms of performance specifications. Attach the responses.

Settling Time =5s


Overshoot = 5%

|EEE325 | Control Systems Lab Manual


35
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


36
5 LAB # 5: Mathematical Modelling of the Vertical Take-Off and Landing
System for the flight Control Operation and its validation using
LabVIEW
5.1 Objectives
• To Create an open-loop mathematical model of the system for flight control operation, using the
free body diagram
• To calculate the unknown parameters in the model
• To Design and Validate the model with the hardware prototype available in the lab using LabVIEW

5.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

5.3 Theory and Pre-Lab Exercises

5.3.1 Introduction and Background


Unlike a DC motor, this system has to be characterized with at least one second-order mode. The equation
of motion is derived from first principles and then used to obtain the transfer function representing the
current to position VTOL dynamics.
Various methods can be used to find the modelling parameters. In the laboratory, the parameters are first
found manually by performing a few experiments and taking measurements. Thereafter, the LabVIEW ®
Systems Identification Toolkit is used to automatically find the model. This demonstrates how to use
software tools to identify parameters or even entire models (especially important for higher order
systems). The model is then validated by running it in parallel with the actual system.

5.3.2 Torque Acting on VTOL


The free-body diagram of a 1-DOF Vertical Take-Off and landing device that pivots about the pitch axis is
shown in Figure 5.1

Figure 5.1:Free Body Diagram of 1-DOF VTOL

|EEE325 | Control Systems Lab Manual


37
As shown in Figure 5.1, the torque acting on the rigid body system can be described by the equation
1
𝜏𝑡 + 𝑚2 𝑔𝑙2 𝑐𝑜𝑠𝜃(𝑡) − 𝑚1 𝑔𝑙1 𝑐𝑜𝑠𝜃(𝑡) − 𝑚ℎ 𝑔𝐿ℎ 𝑐𝑜𝑠𝜃(𝑡) = 0
2
The thrust force, 𝐹𝑡 , is generated by propeller and acts perpendicular to the fan assembly. The thrust
torque is given by
𝜏𝑡 = 𝐹𝑡 𝑙1
Where 𝑙1 is the length between the pivot and centre of the propeller, as depicted in Figure 5.1. In terms
of current, the thrust torque equals
𝜏𝑡 = 𝐾𝑡 𝐼𝑚
Where 𝐾𝑡 is the thrust current-torque constant. With respect to current, the torque equation becomes
1
𝐾𝑡 𝐼𝑚 + 𝑚2 𝑔𝑙2 cos 𝜃(𝑡) − 𝑚1 𝑔𝑙1 cos𝜃(𝑡) − 𝑚ℎ 𝑔𝐿ℎ cos𝜃(𝑡) = 0
2
The torque generated the propeller and the gravitational toque acting of the counter-weight act in the
same direction and oppose the gravitational torque on the helicopter body and propeller assembly.
We define the VTOL trainer as being in equilibrium when the thrust is adjusted until the VTOL is horizontal
and parallel to the ground. At equilibrium, the torques acting on the system are described by the equation
1
𝐾𝑡 𝐼𝑒𝑞 + 𝑚2 𝑔𝑙2 − 𝑚1 𝑔𝑙1 − 𝑚ℎ 𝑔𝐿ℎ = 0
2
Where 𝐼𝑒𝑞 is the current required to reach the equilibrium.

5.3.3 Equation of Motion


The angular motions of the VTOL trainer with respect to a thrust torque, 𝜏𝑡 , can be expressed by the
equation
𝐽𝜃′′ + 𝐵𝜃′ + 𝐾𝜃 = 𝜏𝑡
Where 𝜃 is the pitch angle, 𝐽 is the equivalent moment of inertia acting about the pitch axis, 𝐵 is the
viscous damping, and 𝐾 is the stiffness. With respect to current, this becomes
𝐽𝜃 ′′ + 𝐵𝜃 ′ + 𝐾𝜃 = 𝐾𝑡 𝐼𝑚
As opposed to finding the moment of inertia by integrating over a continuous body, when finding the
moment of inertia of a composite body with 𝑛 point masses its easiest to use formula
𝑛

𝐽 = ∑ 𝑚𝑖 𝑟𝑖2
𝑖=𝑖

5.3.4 Process Transfer Function Model


The transfer function representing the current to position dynamics of the VTOL trainer is
𝐾𝑡
𝑃(𝑠) =
𝐵 𝐾
𝐽 (𝑠 2 + 𝐽 𝑠 + 𝐽 )

This is obtained by taking the Laplace Transform of Equation for angular motion and thrust torque of VTOL
𝐵 𝐾
given in previous section and solving for Ω(𝑠)/𝐼𝑚 (𝑠). Notice the denominator 𝑠 2 + 𝐽 𝑠 + 𝐽
matches the
characteristic second order transfer function. By determining the natural frequency of the system, one
can find the stiffness using
𝐾 = ⍵2𝑛 𝐽

|EEE325 | Control Systems Lab Manual


38
5.3.5 Modelling Virtual Instrument
The virtual instrument used to validate a transfer function model on the QNET VTOL trainer is shown in
Figure 5.2. This VI can also be used to find the VTOL device transfer function using the system identification
toolkit

Figure 5.2:LabVIEW virtual instrument used to find and validate a model for the QNET VTOL trainer

Table 5-1

|EEE325 | Control Systems Lab Manual


39
5.4 In Lab Experiments

5.4.1 Measuring the Equilibrium Current


1. Open the QNET_VTOL_Current_Control.vi
2. Ensure that the correct device is chosen
3. Make sure that the VTOL counter-weight is places as far from the propeller assembly as possible
without lifting the propeller itself. The base of the propeller assembly should reset lightly on the
surface of the QNET board as shown in Figure 5.3

Figure 5.3: VTOL Initial Position

4. Set the Current Control ON switch to ON


5. Run the VI
6. In the Current Control Parameters section, set the PI current gains found in previous experiment
(section 4.4.3)
7. In the Current Set point section, set:
 Amplitude = 0.00 A
 Frequency = 0.40 Hz
 Offset = 1.00 A
8. Gradually increase the offset current until the VTOL Trainer is horizontal
9. The pitch should read 0 degrees when the VTOL is horizontal. You may need to adjust the pitch
offset by varying the VTOL Offset control. By default, this is set to 25.0 degrees.
10. The current required to make the VTOL Trainer horizontal is called the equilibrium current, 𝐼𝑒𝑞 .
Capture the pitch and current response and record this current. Note down this value here.

11. Click on Stop button to stop running the VI

|EEE325 | Control Systems Lab Manual


40
5.4.2 Finding Natural Frequency
1. Ensure the QNET VTOL Current Control VI is open. Make sure the correct device is chosen
2. Make sure that the VTOL counter weight is placed as far from the propeller assembly as possible
without lifting the propeller itself. The base of the propeller assembly should rest lightly on the
surface of the QNET board as shown in Figure 5.3
3. Set the Current Control ON? switch to ON
4. In the Current Control parameters, set the PI current gains found in previous experiment (Section
4.4.3)
5. In the current set point section, set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.00 𝐴
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.40 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 𝐼𝑒𝑞 (equilibrium current found in section 5.4.1)
6. Run the VI
7. When the VI starts and the equilibrium current step is applied, the VTOL Trainer will shoot upward
quickly and then oscillate about its horizontal. Capture this response and measure the natural
frequency. Note down this value here

8. Click on Stop button to stop running the VI

5.4.3 Model Validation

a) Derivation of Model
1. Using the VTOL Trainer Model given in section 5.3.4 and the specifications enlisted in Table 5.2,
compute the moment of inertia acting about the pitch axis. Enter this value in Table 6.3. Show all
the calculations in the space provided below
Table 5-2

|EEE325 | Control Systems Lab Manual


41
2. Based on the natural frequency found in section 5.4.2 and the moment of inertia calculated above,
find the stiffness of the VTOL Trainer. Enter this value in Table 5.3. Show all the calculations below

3. Using the equations presented in section 5.3.4 and equilibrium current found in section 5.4.1,
calculate the thrust current-torque constant 𝐾𝑡 . Enter this value in Table 5.3. Show all the
calculations below

4. Compute the VTOL Trainer Transfer Function based on the previously found parameters:
𝐾𝑡 , 𝐽, 𝐵, 𝑎𝑛𝑑 𝐾. Show all the calculations below

|EEE325 | Control Systems Lab Manual


42
b) Testing the Derived Model
1. Ensure the QNET VTOL Modelling VI is open. Make sure the correct device is chosen
2. Make sure that the VTOL counter weight is placed as far from the propeller assembly as possible
without lifting the propeller itself. The base of the propeller assembly should rest lightly on the
surface of the QNET board as shown in Figure 5.3
3. In the Current Control parameters, set the PI current gains found in previous experiment (Section
4.5.2)
4. In the current set point section, set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.00 𝐴
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.20 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 𝐼𝑒𝑞 (equilibrium current found in section 5.4.1)
5. Run the VI
6. Let the VTOL Trainer stabilizes about the horizontal
7. In the Current set point section set
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.10 𝐴
8. In the Transfer Function Simulation Parameters section, enter the parameters computed in
section 5.4.3(a). Is the simulation matching the measured signal? Capture the response and Also
compute steady state error

9. Click on the Stop button to stop running the VI

5.4.4 Using the System Identification Tool


1. Ensure the QNET VTOL Modelling VI is open. Make sure the correct device is chosen
2. Make sure that the VTOL counter weight is placed as far from the propeller assembly as possible
without lifting the propeller itself. The base of the propeller assembly should rest lightly on the
surface of the QNET board as shown in Figure 5.3
3. In the current set point section, set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.10 𝐴
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.20 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 𝐼𝑒𝑞 (equilibrium current found in section 5.4.1)
Which should perturb the VTOL Trainer is about its horizontal equilibrium point with a current
amplitude of ± 0.10 A
4. Let the VI run for at least 20 seconds
5. Click on stop button to stop running the VI. When the VI is stopped, the Estimated Transfer
Function displays a newly identified transfer function VTOL system based on the 20 seconds of
current (i.e. stimulus signal) and pitch angle (i.e. response signal) data
6. Write the identified transfer function below

7. Enter the identified TF parameters into the Transfer Function Simulation Parameters section
8. Go through steps 7-9 in section 5.4.3(b). That is, bring the VTOL Trainer up to 0 degrees and then
feed ± 0.1 A

|EEE325 | Control Systems Lab Manual


43
9. How is the simulation matching the measured signal compared to the transfer function with the
manually estimated parameters? Capture the response

10. Click on the Stop button to stop the VI


11. Assume the moment of inertia is as calculated in section 6.4.3(a). Then from the identified transfer
function, find the stiffness(𝐾𝑖 𝑑), the viscous damping(𝐵𝑖 𝑑), and the current-torque
constant(𝐾𝑡,𝑖𝑑 ). Note these values in Table 5.3. How do they compare with the parameters you
estimated manually?

5.4.5 Results
Table 5-3
Parameters Symbol Value Units
Equilibrium Current 𝐼𝑒𝑞 𝐴
Torque Thrust Constant 𝐾𝑡 (𝑁. 𝑚)/𝐴
Moment of Inertia 𝐽 𝐾𝑔. 𝑚2
Viscous Damping 𝐵 (𝑁. 𝑚. 𝑠)/𝑟𝑎𝑑
Natural Frequency ⍵𝑛 𝑟𝑎𝑑
Stiffness 𝐾 (𝑁. 𝑚)/𝑟𝑎𝑑
Sys ID: Torque Thrust Constant 𝐾𝑡,𝑖𝑑 (𝑁. 𝑚)/𝐴
Sys ID: Viscous Damping 𝐵𝑖𝑑 (𝑁. 𝑚. 𝑠)/𝑟𝑎𝑑
Sys ID: Stiffness 𝐾𝑖𝑑 (𝑁. 𝑚)/𝑟𝑎𝑑

5.5 Post Lab Exercise

Exercise Question 1
Describe the major difference between VTOL setup and an actual helicopter, in terms of degree of
freedom. Does the system provide good realization of helicopter?

|EEE325 | Control Systems Lab Manual


44
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


45
6 LAB # 6: Design of a PID Controller for Pitch Control operation of VTOL
6.1 Objectives
• To Design a PID Controller on VTOL Flight
• To Tell the effects of a PID controller on System

6.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

6.3 Theory and Pre-Lab Exercises

6.3.1 Introduction and Background


It is expected at this point that after passing through two comprehensive lab sessions on VTOL which
include closed loop current control operation, open loop voltage control operation, determination of
various system parameters and system identification toolkit, students would be feeling easy on the
apparatus. In flight control operation, all we are interested in is to control the pitch of the VTOL. We will
start off with developing the mathematical model of the system which will lead to the steady state error
analysis and finally controller design.

6.3.2 Steady-state Error Analysis


Steady-state error is the difference between the reference and output signals after the system response
has settled. Thus for a time 𝑡 when the system is in steady-state, the steady-state error equals

𝑒𝑠𝑠 = 𝑟𝑠𝑠 (𝑡) − 𝑦𝑠𝑠 (𝑡)

Where 𝑟𝑠𝑠 is the value of the steady-state reference and 𝑦𝑠𝑠 is the steady-state value of the process output

The block diagram shown in Figure 6.1 is general unity feedback system with a compensator 𝐶(𝑠) and a
transfer function representing the plant, 𝑃(𝑠). The measured output, 𝑌(𝑠), is supposed to track the
reference signal 𝑅(𝑠) and the tracking has to yield certain specifications.

Figure 6.1:Unity Feedback System

The error of the system shown in Figure 6.1 is

𝐸(𝑠) = 𝑅(𝑠) − 𝑌(𝑠)

And by solving for 𝐸(𝑠) the resulting closed-loop transfer function is obtained.

|EEE325 | Control Systems Lab Manual


46
𝑅(𝑠)
𝐸(𝑠) =
1 + 𝐶(𝑠)𝑃(𝑠)

The error transfer function of the VTOL trainer when subject to step of

𝑅(0)
𝑅(𝑠) =
𝑠
and using the PID compensator
𝑘𝑖
𝐶(𝑠) = 𝑘𝑝 + 𝑘𝑑 𝑠 +
𝑠
𝑅0
𝐸(𝑠) =
𝑘
(𝑘𝑝 + 𝑘𝑑 𝑠 + 𝑠𝑖 ) 𝐾𝑡
𝑠 (1 + 𝐵 𝐾 )
𝐽 (𝑠 2 + 𝑠 + )
𝐽 𝐽

If transfer function is stable, then the steady-state error can be found using the final value theorem (FVT)

𝑒𝑠𝑠 = lim 𝑠𝐸(𝑠)


𝑠→0

Using FVT, the steady-state error of the VTOL trainer closed-loop PID step response is

𝑠(𝑠 2 𝐽 + 𝐵𝑠 + 𝐾)
𝑒𝑠𝑠 = 𝑅0 (lim )
𝑠→0 𝑠 3 𝐽 + 𝐵𝑠 2 + 𝐾𝑡 𝑘𝑠 2 + 𝑠𝐾 + 𝐾𝑡 𝑘𝑝 𝑠 + 𝐾𝑡 𝑘𝑖

6.3.3 PID Control Design


The PID control loop used for the VTOL device is depicted in Figure 6.2

Figure 6.2: VTOL PID Control Loop

The transfer function representing the VTOL trainer position-current relation in previous lab session is
used to design the PID controller. The input-output relation in the time-domain for a PID controller is

𝑑
𝑢 = 𝑘𝑝 (𝜃𝑑 − 𝜃) + 𝑘𝑖 ∫ (𝜃𝑑 − 𝜃)𝑑𝑡 − 𝑘𝑣 (𝜃)
𝑑𝑡
Where 𝑘𝑝 is the proportional gain, 𝑘𝑖 is the integral gain and 𝑘𝑣 is the velocity gain. Remark that only the
measured velocity is used, i.e. instead of using the derivation of the error. The close-loop transfer function
from the position reference, 𝑟, to the angular VTOL position output, 𝜃, is

|EEE325 | Control Systems Lab Manual


47
𝐾𝑡 (𝑘𝑝 𝑠 + 𝑘𝑖 )
𝐺𝜃,𝑟 (𝑠) =
𝐽𝑠 3 + (𝐵 + 𝐾𝑡 𝑘𝑣 )𝑠 2 + (𝐾 + 𝐾𝑡 𝑘𝑝 )𝑠 + 𝐾𝑡 𝑘𝑖

The prototypic third order polynomial is

(𝑠 2 + 2𝜉⍵𝑛 𝑠 + ⍵2𝑛 )(𝑠 + 𝑝0 ) = 𝑠 3 + (2𝜉⍵𝑛 + 𝑝0 )𝑠 2 + (⍵2𝑛 + 2𝜉⍵𝑛 𝑝0 )𝑠 + ⍵2𝑛 𝑝0

Where ⍵𝑛 is the natural frequency, 𝜉 is the damping ratio, and 𝑝0 is a zero.

Comparing the characteristic polynomial in closed-loop transfer function of the VTOL with the above
equation yields the following expressions of gains

−𝐾 + 2𝑝0 𝜉⍵𝑛 𝐽 + ⍵2𝑛 𝐽


𝑘𝑝 =
𝐾𝑡

𝑝0 ⍵2𝑛 𝐽
𝑘𝑖 =
𝐾𝑡
−𝐵 + 𝑝0 𝐽 + 2𝜉⍵𝑛 𝐽
𝑘𝑣 =
𝐾𝑡

6.3.4 Flight Control Virtual Instrument


This VI runs the PID based cascade control system to control the position of the VTOL pitch. As a quick VI
description, Table 6.1 lists and describes the main elements of the QNET VTOL Flight Control VI and every
element is uniquely identified by an ID number in Figure 6.3

Figure 6.3

|EEE325 | Control Systems Lab Manual


48
Table 6-1

6.4 In Lab Experiments

6.4.1 PD Steady State Analysis

a) Theoretical Prediction
Calculate the theoretical VTOL Trainer steady-state error when using a PD control with 𝑘𝑝 = 2 and 𝑘𝑑 =
1 and a step amplitude of 𝑅0 = 4.0 𝑑𝑒𝑔𝑟𝑒𝑒𝑠. Use thrust current-torque and stiffness found in previous
Lab Session. Show all the calculation in the space provided below. Enter the value of calculated steady-
state error in Table 6.2

|EEE325 | Control Systems Lab Manual


49
b) Experimental Observation
1. Open the QNET_VTOL_Flight_Control.vi. Make sure the correct device is chosen
2. Make sure that the VTOL counter-weight is placed as far from the propeller assembly as possible
without lifting the propeller itself. The base of the propeller assembly should rest lightly on the
surface of the QNET board.
3. Run the VI
4. In Position set point Section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.0 𝑑𝑒𝑔
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.15 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.0 𝑑𝑒𝑔
5. In the Position Control Parameters section set:
 𝑘𝑝 = 1.0 𝐴/𝑟𝑎𝑑
 𝑘𝑖 = 2 𝐴/(𝑟𝑎𝑑. 𝑠)
 𝑘𝑑 = 1.0 𝐴. 𝑠/𝑟𝑎𝑑
6. Let the VTOL system stabilize about the 0.0 rad set point. Examine if the VTOL Trainer body is
horizontal. If not, then you can adjust the pitch offset by varying the VTOL offset control. By
default this is set to 25.0 degrees.
7. To use a PD control, in the Position Control Parameters section set:
 𝑘𝑝 = 2.0 𝐴/𝑟𝑎𝑑
 𝑘𝑖 = 0 𝐴/(𝑟𝑎𝑑. 𝑠)
 𝑘𝑑 = 1.0 𝐴. 𝑠/𝑟𝑎𝑑
8. In Position set point Section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 2.0 𝑑𝑒𝑔
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.40 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 2.0 𝑑𝑒𝑔
The VTOL trainer should be going up and down and tracking the square wave set point.
9. Capture the VTOL device step response when using this PD controller and measure the steady-
state error. Enter this measured value in table 6.2. How does it compare with the computed value
in section 𝑎?

10. In the Signal Generator section set Amplitude (rad) to 0 rad and slowly decrement Offset (rad) t0
-8.0 rad.
11. Click on the Stop button to stop running the VI.

|EEE325 | Control Systems Lab Manual


50
6.4.2 PID Steady State Analysis

a) Theoretical Prediction
Calculate the theoretical VTOL Trainer steady-state error when using a PD control with 𝑘𝑝 = 2 , 𝑘𝑖 =
4.0 𝐴/(𝑟𝑎𝑑. 𝑠) and 𝑘𝑑 = 1 and a step amplitude of 𝑅0 = 4.0 𝑑𝑒𝑔𝑟𝑒𝑒𝑠. Use thrust current-torque,
stiffness and moment of inertia as found in previous Lab Session. For viscous damping refer to Table 5.2.
Show all the calculation in the space provided below. Enter the value of calculated steady-state error in
Table 6.2

b) Experimental Observation
1. Go through steps 1-8 in Section 6.5.1 (b) to run the PD controller
2. In the Position Control Parameters section, increment the integral gain until you reach 𝑘𝑖 =
4.0 𝐴/(𝑟𝑎𝑑. 𝑠).
3. Capture the VTOL device step response when using a PID controller and measure the steady-state
error. Enter this measured value in table 6.2. How does it compare with the computed value in
section 𝑎?

4. In the Signal Generator section set Amplitude (rad) to 0 rad and slowly decrement Offset (rad) t0
-8.0 rad.
5. Click on the Stop button to stop running the VI.

6.4.3 PID Control Design

a) Theoretical Design
1. Find the natural frequency, ⍵n , and damping ratio, ξ, required to meet a peak time of 1.0 seconds
and a percent overshoot of 20%. Show all the necessary calculations below. Enter these values in
Table 6.2.

|EEE325 | Control Systems Lab Manual


51
2. Calculate the corresponding values of PID gains 𝑘𝑝 , 𝑘𝑖 𝑎𝑛𝑑 𝑘𝑣 , needed to meet the VTOL
specifications. Enter these values in Table 6.2. Show all the calculations below.

b) Experimental Validation
1. Open the QNET_VTOL_Flight_Control.vi. Make sure the correct device is chosen
2. Make sure that the VTOL counter-weight is placed as far from the propeller assembly as possible
without lifting the propeller itself. The base of the propeller assembly should rest lightly on the
surface of the QNET board.
3. Run the VI
4. In Position set point Section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.0 𝑑𝑒𝑔
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.15 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.0 𝑑𝑒𝑔
5. In the Position Control Parameters section, enter PID gains found in Section 6.5.3(a)
6. Let the VTOL system stabilize about the 0.0 rad set point. Examine if the VTOL Trainer body is
horizontal. If not, then you can adjust the pitch offset by varying the VTOL offset control. By
default this is set to 25.0 degrees.
7. In Position set point Section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 2.0 𝑑𝑒𝑔
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.40 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 2.0 𝑑𝑒𝑔
The VTOL trainer should be going up and down and tracking the square wave set point.
8. Capture the response of the VTOL system when using your designed controller
9. Measure the peak time and percent overshoot of the measured response. Show all the steps
below. Enter these values in Table 6.2. Are the VTOL Trainer response specifications satisfied?

10. If the specifications were not given, what could be done to improve the response?

11. In the Signal Generator section set Amplitude (rad) to 0 rad and slowly decrement Offset (rad) t0
-8.0 rad.
12. Click on the Stop button to stop running the VI.

|EEE325 | Control Systems Lab Manual


52
6.4.4 Results
Table 6-2
Parameters Symbol Value Units
PD steady-state error 𝑒𝑠𝑠,𝑝𝑑 𝑑𝑒𝑔
Measured PD steady-state error 𝑒𝑠𝑠,𝑚𝑒𝑎𝑠,𝑝𝑑 𝑑𝑒𝑔
PID steady-state error 𝑒𝑠𝑠,𝑝𝑖𝑑 𝑑𝑒𝑔
Measured PID steady-state error 𝑒𝑠𝑠,𝑚𝑒𝑎𝑠,𝑝𝑖𝑑 𝑑𝑒𝑔
Desired peak time 𝑡𝑝 𝑠
Desired percentage overshoot 𝑃𝑂 %
Desired pole location 𝑝0 𝑟𝑎𝑑/𝑠
Natural frequency ⍵𝑛 𝑟𝑎𝑑/𝑠
Damping ratio 𝜉 -
Proportional gain 𝑘𝑝 𝐴/𝑟𝑎𝑑
Integral gain 𝑘𝑖 𝐴/(𝑟𝑎𝑑. 𝑠)
Derivative gain 𝑘𝑣 (𝐴. 𝑠)/𝑟𝑎𝑑
Measured peak time 𝑡𝑝,𝑚𝑒𝑎𝑠 𝑠
Measured percentage overshoot 𝑃𝑂𝑚𝑒𝑎𝑠 %

6.5 Post Lab Exercise

Exercise Question 1
Design a PID controller to meet the following design criteria of VTOL pitch
 Settling Time = 5 seconds
 Percentage Overshoot = 5%

Validate the designed controller on experimental setup. Does it satisfy the design criteria?

|EEE325 | Control Systems Lab Manual


53
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


54
7 LAB # 07: Design of a Switch (ON/OFF) Controller and Mathematical
Modelling of QNET HVAC System and its validation using LabVIEW
7.1 Objectives
• Design of Switch/On-Off Controller
• To implement the Switch Controller on QNET HVAC Plant using LabVIEW

The purpose of this experiment is to implement one of the most fundamental and traditional control
strategy – switch control or ON/OFF control– to control the temperature of the chamber in HVAC – an NI
laboratory setup available in the lab. Students will also be given a pleasant chance to get a hands-on
experience to implement the hysteresis gap in switch control operation where they will practically be able
to observe how switching speed can be adjusted by introducing the hysteresis gap which in turns leads to
the longer life of the plant. Moreover, mathematical model of the process will also be estimated
analytically and experimentally.

7.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

7.3 Theory and Pre-Lab Exercises

7.3.1 Introduction
The QNET heating and ventilation trainer (HVACT) is shown in Figure 7.1. The system consists of a Plexiglas
duct, with a heater in one end and a blower in the other end. The heater is a halogen lamp and the blower
is a variable-speed fan. There is a thermistor sensor placed inside the duct to measure the temperature
of the chamber and another thermistor sensor outside the chamber to measure the room temperature.

Figure7.1: QNET Heating and Ventilation Trainer (HVACT)

The temperature measured at the thermistor inside the chamber is to be controlled using the heater
voltage while the fan is run at a constant speed. Heat is transferred to the thermistor by radiation from
the heater and by convection from the air stream. Radiative heat transfer is highly non-linear and it is
therefore difficult to model the system by first principles. As a result, empirical tuning will be used to
control the system. This heat transfer plant is very similar to the systems that are used to control wafer
temperature in semiconductor manufacturing.

|EEE325 | Control Systems Lab Manual


55
7.3.2 Pre Lab Theory and Exercises
On-off control or relay feedback is one of the simplest control strategies. The heater is switched on when
the temperature is lower than the desired value, and the heater is switched off when the temperature is
higher than the desired value. To avoid rapid switches, it is common to introduce a hysteresis in the relay
switch. A block diagram of a system with relay feedback is shown in Figure 7.2.

Figure 7.2: Block Diagram of the Heater System with Relay Feedback

The error, variable ‘e’ in Figure 7.2, is the difference between the reference temperature, 𝑇𝑟 and the actual
chamber temperature 𝑇𝑐 . The on-off controller is implemented using a relay switch with hysteresis, as
shown in Figure 7.3. The heater actuator is represented by a saturation block and the chamber plant is
represented by the transfer function P(s).

Figure 7.3: Input and Output Relation for an On-Off Controller with Hysteresis

The hysteresis width, ∆𝑇ℎ in Figure 7.3, has to be chosen such that a large measurement noise does not
generate any unintentional switches. As depicted in Figure 7.3, the output control signal voltage of the
on-off controller can be adjusted using a mean or offset 𝑉ℎ,𝑜𝑓𝑓 and an amplitude 𝑉ℎ,𝑎𝑚𝑝 .

In the experiment, the behaviour of the heater system will be investigated for different values of controller
parameters. More specifically, the control signal and the measured temperature will be observed.

|EEE325 | Control Systems Lab Manual


56
7.3.3 Modelling
The on-off control input and the measured temperature output from the experiment have an interesting
property that makes it possible to find a simple model for the process. The temperature response is a
ramp due a voltage step therefore the temperature is the integral of the voltage. Under certain conditions,
the process can be modelled by a simple transfer function
𝐾𝑣
𝑃(𝑆) =
𝑆
Where the parameter 𝐾𝑣 is the slope of ramp.

7.3.4 On-Off Control Virtual Instrument


Tracking a reference temperature using a relay control is first examined in this laboratory. Then, when
commanding a fixed reference, the system can be modelled. The LabVIEW virtual instrument for on-off
temperature control is shown in Figure 7.4.

Figure 7.4: Virtual instrument for on-off heater control

|EEE325 | Control Systems Lab Manual


57
7.4 In Lab Experiments

7.4.1 Calibration
After powering up the ELVIS and before running any of the procedure, follow this procedure to calibrate
the QNET HVACT system.
1. Open the QNET_HVACT_On_Off_Control.vi
2. Make sure that the correct device is chosen.
3. Run the QNET_HVACT_On_Off_Control.vi shown in Figure 7.4.
4. The cooling fan is automatically activated when the Prototyping Board Power switch on the ELVIS
unit is ON. Let the actual temperature,𝑇𝑐 , in the Temperature (C) scope settle until it stops
decreasing.
5. Adjust the Temperature (C) scope scales to see both the reference and actual temperatures.
6. As illustrated in Figure 7.5, calibrate the temperature sensors by clicking on the Calibrate button.
This will align the chamber temperature, Tc, to the measured ambient temperature, Ta.
7. Activate the control by clicking on the Heater OFF button (in the top-right corner of Figure 7.5).

Figure 7.5: Calibrating the temperature in the QNET HVACT On-Off Control VI

|EEE325 | Control Systems Lab Manual


58
7.4.2 Relay Control

1. Make sure the QNET_HVACT_On_Off_Control.vi is running and has been calibrated as instructed
in section 7.4.1.
2. In the Signal Generator section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0 ᵒ𝐶
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.008 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.5 ᵒ𝐶
3. Examine the actual temperature (red) and reference temperature (blue) responses in the
temperature (C) scope.
4. Gradually vary the offset in the Signal Generator between 0.5ᵒC and 2ᵒC. How is the reference
temperature,𝑇𝑟 in the temperature (C) scope is set? Attach a sample temperature response.

5. Vary the relay amplitude, 𝑉ℎ_𝑎𝑚𝑝, in the Control Parameters section. Explain how the heater
voltage affects the temperature variation and, in particular, observe the frequency and amplitude
of the chamber temperature. Attach a representative temperature response.

6. Explain the effect of changing the relay mean, 𝑉ℎ_𝑜𝑓𝑓. Attach a temperature response

7. Examine the effects of changing the relay width (or hysteresis), 𝐷𝑡ℎ, between 0.01ᵒC and 1.00ᵒC.
Give a short explanation and attach a temperature response with a narrow and wide hysteresis.

8. Click on the Stop button to stop running the VI

|EEE325 | Control Systems Lab Manual


59
7.4.3 Determination of Kvin Mathematical Model
1. Make sure that QNET_HVACT_On_Off_Control.vi is running and has been calibrated as instructed
in section 7.4.1. When running, the VI should look similar to figure 7.4.
2. In the Signal Generator section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0 ᵒ𝐶
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.008 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0 ᵒ𝐶
3. In this Control Parameters section set:
 𝑉ℎ_𝑎𝑚𝑝 = 4 𝑉
 𝑉ℎ_𝑜𝑓𝑓 = 4𝑉
 𝐷𝑡ℎ = 0.50 ᵒ𝐶
4. Adjust Temperature (C) scope scales to see both the reference and actual temperature
5. Adjust the Offset on the Signal Generator to obtain a relatively symmetrical oscillation (i.e., the
rate of increase and decrease should be similar)
6. Observe the heater voltage and the chamber temperature. As discusses in Section 7.3.3, this can
be modelled by the simple transfer function 𝑃(𝑆) = 𝐾𝑣 /𝑠. Find parameter 𝐾𝑣 that would describe
the relation between the voltage and the temperature signals. Attach both the temperature and
voltage responses used to find 𝐾𝑣 and show your calculations in the space provided below

7.5 Post-Lab Exercise

Exercise Question 1.
Give a real-world example of switch control operation and how a trade-off between hysteresis and better
control can improve the System’s life expectancy?

|EEE325 | Control Systems Lab Manual


60
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


61
8 LAB # 08: Mathematical Modelling of the QNET HVAC System and
Design of PI Controller for the System

8.1 Objectives
• To Create the Mathematical Model of the QNET HVAC System
• To Design a PI Controller on the System

8.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

8.3 Theory and Pre-Lab Exercises

8.3.1 Introduction
During the previous lab, we developed mathematical model of the process and developed switch control
strategy to control the temperature of the chamber. In this experiment, we will move one step ahead to
implement a PI controller to control the process temperature. The controller aims to adjust the lamp
intensity to control the temperature through control input 𝑉ℎ . The reason as to why PID Controller is not
implemented instead of PI Controller can be best understood by examining the dynamics of the process.
To make the process fast enough, as per our requirements, we will need to have very sharp values of
control input which might in turn lead to damage the system.

8.3.2 Background
The oscillations that occur with on-off control can be avoided by using a linear proportional and
integrating controller. To design such a controller analytically a simple model representing the actual plant
is needed. Since the conditions shown in Figure 8.2 are representative for what happens when the
temperature is controlled, transfer function derived in previous experiment can be used for the model-
based approach to find the controller. The block diagram of the closed loop system is shown in Figure 8.1

Figure 8.1: Block Diagram of Heater PI Closed-Loop System

|EEE325 | Control Systems Lab Manual


62
The process transfer function is the transfer function in equation and the input-output relation for a PI
Controller with set point weighting is
𝐾𝑖 (𝑅(𝑠) − 𝑌(𝑠))
𝑈(𝑠) = 𝐾𝑝 (𝑏𝑠𝑝 𝑅(𝑠) − 𝑌(𝑠)) +
𝑠
The closed loop transfer function from the relative temperature reference, ∆𝑇𝑟 = 𝑇𝑟 − 𝑇𝑎 , to the output
temperature measured relative to the ambient temperature 𝐶 = 𝑇𝑐 − 𝑇𝑎 , is

𝐾𝑝 𝑏𝑠𝑝 𝑠 + 𝐾𝑖
𝐺∆𝑇𝑐 ,∆𝑇𝑟 (𝑠) = 𝐾𝑣
𝑠 2 + 𝐾𝑣 𝐾𝑝 𝑠 + 𝐾𝑣 𝐾𝑖

The closed-loop system has the characteristic polynomial

𝑠 2 + 𝐾𝑣 𝐾𝑝 𝑠 + 𝐾𝑣 𝐾𝑖

And the desired closed-loop characteristic polynomial is

𝑠 2 + 2𝜉⍵0 + ⍵20

Where ⍵0 is the undamped closed-loop frequency and 𝜉 is the damping ratio. Comparing the two
characteristic equations gives us following expressions of the controller parameters

2𝜉⍵0
𝐾𝑝 =
𝐾𝑣
⍵20
𝐾𝑖 =
𝐾𝑣

Large values of ⍵0 give large values of controller gain. This implies noise will create large variations in the
control signal. The set-point weight parameter 𝑏𝑠𝑝 can be used to adjust the overshoot of the response.

The sensor signal is noisy and it is therefore necessary to filter the measured signal. A simple first order
filter has the transfer function
𝑇𝑐,𝑚𝑒𝑎𝑠
𝑇𝑐 =
𝑇𝑓 𝑠 + 1

Where 𝑇𝑐,𝑚𝑒𝑎𝑠 is the measured temperature from thermistor and 𝑇𝑓 is the transfer function time constant.
Increasing 𝑇𝑓 decreased the cut-off frequency and minimizes noises in the signal at the expense of
changing the shape of the signal.

Temperature control typically admits high controller gains. A consequence of this is that the controller
output may saturate and result in integrator windup. The heater is therefore useful to illustrate the
usefulness of integrator feedback.

8.3.3 Speed Control Virtual Instrument


The LabVIEW virtual instrument that implements the heater PI control is shown in Figure 8.2. The control
paramters 𝐾𝑝 , 𝐾𝑖 , 𝑏𝑠𝑝 , the anti-windup tracking time constant 𝑇𝑟 , and the filter time constant 𝑇𝑓 can all
be adjusted

|EEE325 | Control Systems Lab Manual


63
Figure 8.2: Virtual instrument for PI heater control

8.4 In Lab Experiments

8.4.1 Calibration
After powering up the ELVIS and before running any of the procedure, follow this procedure to calibrate
the QNET HVACT system.
1. Open the QNET_HVACT_PI_Control.vi
2. Make sure that the correct device is chosen.
3. Run the QNET_HVACT_On_Off_Control.vi shown in Figure 7.4.
4. The cooling fan is automatically activated when the Prototyping Board Power switch on the ELVIS
unit is ON. Let the actual temperature,𝑇𝑐 , in the Temperature (C) scope settle until it stops
decreasing.
5. Adjust the Temperature (C) scope scales to see both the reference and actual temperatures.
6. As illustrated in previous experiment, calibrate the temperature sensors by clicking on the
Calibrate button. This will align the chamber temperature, Tc, to the measured ambient
temperature, Ta.
7. Activate the control by clicking on the Heater OFF button (in the top-right corner of Figure 7.5).

8.4.2 Qualitative PI Control

1. Ensure the QNET_HVACT_PI_Control.vi is running and has been calibrated as instructed in section
7.4.1
2. In the Signal Generator section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.5 ᵒ𝐶
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.02 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 1.5 ᵒ𝐶

|EEE325 | Control Systems Lab Manual


64
3. In Control Parameters section set:
 𝐾𝑝 = 4 𝑉/ ᵒ𝐶
 𝐾𝑖 = 0.5 𝑉/(ᵒ𝐶. 𝑠)
 𝑏𝑠𝑝 = 1
 𝑇𝑟 = 1s
4. Examine the temperature response to the square wave input
5. Set 𝐾𝑖 𝑡𝑜 0 𝑉/(ᵒ𝐶. 𝑠) and change the proportional gain between 2 𝑉/ ᵒ𝐶 and 10 𝑉/ ᵒ𝐶. Explain
the effect proportional gain has on the temperature control performance. Attach a temperature
response when using a low and high proportional gain.

6. Set 𝐾𝑝 to 0.5 𝑉/ ᵒ𝐶 and change the integral gain𝐾𝑖 between 0.25 𝑉/(ᵒ𝐶. 𝑠) and 2.0 𝑉/(ᵒ𝐶. 𝑠) and
observe its effect on the temperature control performance. Show the temperature response with
a low and high integral gain.

8.4.3 Saturation and Windup

1. Ensure the QNET_HVACT_PI_Control.vi is running and has been calibrated as instructed in section
8.4.1
2. In the Signal Generator section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.75 ᵒ𝐶
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.02 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 1.5 ᵒ𝐶
3. In Control Parameters section set:
 𝐾𝑝 = 8 𝑉/ ᵒ𝐶
 𝐾𝑖 = 4 𝑉/(ᵒ𝐶. 𝑠)
 𝑏𝑠𝑝 = 1
 𝑇𝑟 = 100s
4. What effect does increasing the anti-windup reset parameter have on the control signal and on
the temperature response? Attach a response of the temperature and heater voltage.
5. In the Control Parameters section, set 𝑇𝑟 = 1.0𝑠
6. What effect does decreasing 𝑇𝑟 have on the control signal and on the temperature response?
Attach a response of the temperature and heater voltage.

|EEE325 | Control Systems Lab Manual


65
8.4.4 Set-Point Weight
1. Ensure the QNET_HVACT_PI_Control.vi is running and has been calibrated as instructed in section
8.4.1
2. In the Signal Generator section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.5 ᵒ𝐶
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.02 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 1.5 ᵒ𝐶
3. In Control Parameters section set:
 𝐾𝑝 = 8 𝑉/ ᵒ𝐶
 𝐾𝑖 = 1 𝑉/(ᵒ𝐶. 𝑠)
 𝑏𝑠𝑝 = 0
 𝑇𝑟 = 1s
4. Examine the response of the measured temperature in the temperature (C) scope as well as the
input heater voltage in the Voltage (V) scope. Attach the temperature and heater voltage
responses.
5. Try the controller with a set-point weight of 1.
6. Study what effects raising 𝑏𝑠𝑝 has on the measured temperature signal in the Temperature (C)
scope and the control signal shown in Voltage (V) scope. Capture the temperature response and
its corresponding heater voltage.

7. Click on the stop button to stop running the VI

8.4.5 PI Control According to Specifications

a) Designing the Controller


Find proportional and integral gains, i.e., 𝐾𝑝 𝑎𝑛𝑑 𝐾𝑖 , needed for the response to satisfy the following
specifications
𝜉 = 0.60
⍵0 = 0.125 𝑟𝑎𝑑/𝑠
Use the model gain 𝐾𝑣 found in previous experiment and the design principle outlines in section 8.3.2.
Show all the steps and calculations in the space provided below

|EEE325 | Control Systems Lab Manual


66
b) Testing the Controller
1. Ensure the QNET_HVACT_PI_Control.vi is running and has been calibrated as instructed in section
8.5.1
2. In the Signal Generator section set:
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0.5 ᵒ𝐶
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.02 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 1.5 ᵒ𝐶
3. Enter the control gains calculated in part a in the Control Parameters Section of the VI
4. Examine the measured temperature response using your designed PI gains. How is the
performance of the controller compared to the previous controller? Attach the temperature and
heater voltage responses

5. Click on the Stop button to stop running the VI

8.5 Post-Lab Exercise

Exercise Question 1.
Describe the effects of following parameters on the temperature response observed during the
experiment

a) Proportional 𝐺𝑎𝑖𝑛 𝐾𝑝

b) Integral Gain 𝐾𝑖

c) Anti-Windup Reset Parameter𝑇𝑟

d) Set-point Weight 𝑏𝑠𝑝

|EEE325 | Control Systems Lab Manual


67
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


68
9 LAB # 9: Design of Proportional Controller and Lead/Lag Compensator
using Root Locus Method on MATLAB
9.1 Objectives
• To Design Root-Locus of a System
• To Design the Proportional Controller and Lead-Lag Compensators

9.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

9.3 Pre-Lab Theory and Exercises

9.3.1 Root Locus and Controller Design


In the previous sessions, we discussed absolute stability of a closed-loop feedback control system using
Routh-Hurwitz method. We also studied how the performance of a feedback system can be described in
terms of the location of the roots of the characteristic equation in the s-plane. We know that the response
of a closed-loop feedback control system can be adjusted to achieve the desired performance by judicious
selection of one or more system parameters. It is, therefore, very useful to determine how the roots of
the characteristic equation move around the s-plane as we change one parameter.

The Root Locus method, as the name suggests, looks at the loci of the roots as some parameter of interest,
within the system, is varied. Since we already know that the position of the roots of the characteristic
equation strongly influence the step response of the system, we can find values of the parameter which
will position the roots appropriately, using the method of Root Locus. This method involves root locus
diagrams which the students are expected to have learnt in the theory class. In this lab we will use
Matlab’s powerful computing capability to find and trace root locus of a given system.

9.3.1.1 Obtaining a root locus plot


Let we have a unity feedback system as shown in Figure 9.1. In plotting root loci with Matlab we need the
characteristic equation of this system defined as

(s + 3)
1+K =0
s(s + 1)(s 2 + 4s + 16)

Figure 9.1:A unity Feedback System

|EEE325 | Control Systems Lab Manual


69
9.3.1.2 Continuous Root Locus Plot
Matlab provides us with 𝑟𝑙𝑜𝑐𝑢𝑠 command to compute and display root locus of any system. The syntax
of this command is as follows
>>𝑟𝑙𝑜𝑐𝑢𝑠(𝑛𝑢𝑚, 𝑑𝑒𝑛)
Here 𝑛𝑢𝑚 is array of open-loop numerator coefficients and den is array of open-loop denominator
coefficients. Using this command, the root locus is plotted on the Figure window as shown in Figure 9.2.
The gain vector K is automatically determined and contains all the gain values for which the closed-loop
poles are to be computed. However, we can define vector K as per our own will and provide it to 𝑟𝑙𝑜𝑐𝑢𝑠
command as
>>𝑟𝑙𝑜𝑐𝑢𝑠 (𝑛𝑢𝑚, 𝑑𝑒𝑛, 𝐾)
If this command is invoked with left-hand arguments, like
[𝑟, 𝑘] = 𝑟𝑙𝑜𝑐𝑢𝑠(𝑛𝑢𝑚, 𝑑𝑒𝑛)
[𝑟, 𝑘] = 𝑟𝑙𝑜𝑐𝑢𝑠(𝑛𝑢𝑚, 𝑑𝑒𝑛, 𝑘)
[𝑟, 𝑘] = 𝑟𝑙𝑜𝑐𝑢𝑠(𝑠𝑦𝑠)
the command window will show the matrix r and gain vector K. The columns of matrix r are equal to length
of K and its rows are den-1, containing the complex root locations. Each row of the matrix corresponds to
a gain from vector K. We can then plot the loci by using the plot command

>>𝑝𝑙𝑜𝑡(𝑟, ’ − ’)

Figure 9.2: Root Locus of the system shown in Figure 9.1

9.3.1.3 Comments on the Root Locus Plot


In root locus, we examine system’s stability against all possible values of K. No matter what we pick K to
be, the closed-loop system must always have n poles, where n is the number of poles of open-loop transfer
function, 𝐺(𝑠)𝐻(𝑠). The root locus must have n 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), m < n, we say
that 𝐺(𝑠)𝐻(𝑠) has zeros at infinity. In this case, the limit of 𝐺(𝑠)𝐻(𝑠) as s → ∞ is zero. The number of
zeros at infinity are𝑛 − 𝑚 and is the number of branches of the root locus that go to infinity (asymptotes).

|EEE325 | Control Systems Lab Manual


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

9.3.1.4 Constant ζ and Constant wn Loci


Recall that in the complex plane the damping ratio ζ of a pair of complex-conjugate poles can be expressed
in terms of the angle φ, which is measured from the negative real axis.

ζ = cos φ

In other words, lines of constant damping ratio are radial lines passing through the origin as shown in
Figure 4.3. For example, a damping ratio of 0.5 requires that the complex poles lie on the lines drawn
through the origin making angles of ± 60ᵒ with negative real axis. If the real part of a pair of complex
poles is positive, which means that the system is unstable, the corresponding ζ is negative. The damping
ratio determines the angular location of the poles, while the distance of the pole from the origin is
determined by the un-damped natural frequency ωn . The constant ωn loci are circles.

9.3.1.5 Plotting Polar Grids in the Root Locus Diagram


To draw constant ζ lines and constant ωn circles on the root locus diagram with Matlab, we use the sgrid
command. This command overlays lines of constant damping ratio (ζ = 0 ~ 1 with 0.1 increment) and
circles of constant ωn on the root locus plot. Run the following code in Matlab and observe the output.

𝑠𝑔𝑟𝑖𝑑
𝑎𝑥𝑖𝑠 ([−2 2 − 2 2])
𝑎𝑥𝑖𝑠 (′𝑠𝑞𝑢𝑎𝑟𝑒′)
𝑡𝑖𝑡𝑙𝑒 (′𝐶𝑜𝑛𝑠𝑡𝑎𝑛𝑡 \𝑧𝑒𝑡𝑎 𝐿𝑖𝑛𝑒𝑠 𝑎𝑛𝑑 𝐶𝑜𝑛𝑠𝑡𝑎𝑛𝑡 \𝑜𝑚𝑒𝑔𝑎_𝑛 𝐶𝑖𝑟𝑐𝑙𝑒𝑠′)
𝑥𝑙𝑎𝑏𝑒𝑙 (′𝑅𝑒𝑎𝑙 𝐴𝑥𝑖𝑠′)
𝑦𝑙𝑎𝑏𝑒𝑙(′𝐼𝑚𝑎𝑔𝑖𝑛𝑎𝑟𝑦 𝐴𝑥𝑖𝑠′)

If only a particular constant ζ lines and particular constant ωn circles are desired, we may use the following
variant of sgrid command

>> 𝑠𝑔𝑟𝑖𝑑 ([0.5, 0.707], [ 0.5, 1, 1.5])

Enter the following code into Matlab and show that the resulting plot is similar to the one shown in Figure
9.3.

𝑛𝑢𝑚 = [ 0 0 0 1 ]
𝑑𝑒𝑛 = [ 1 4 5 0 ]
𝑎𝑥𝑖𝑠 (′𝑠𝑞𝑢𝑎𝑟𝑒′)
𝑟𝑙𝑜𝑐𝑢𝑠 (𝑛𝑢𝑚 , 𝑑𝑒𝑛)
𝑎𝑥𝑖𝑠 ([− 3 1 − 2 2])
𝑠𝑔𝑟𝑖𝑑 ([0.5 , 0.707], [0.5 , 1.0 , 1.5])
𝑡𝑖𝑡𝑙𝑒 (′𝑅𝑜𝑜𝑡 𝐿𝑜𝑐𝑢𝑠 𝑃𝑙𝑜𝑡 𝑤𝑖𝑡ℎ \𝑧𝑒𝑡𝑎 = 0.5 𝑎𝑛𝑑 0.707 𝐿𝑖𝑛𝑒𝑠 𝑎𝑛𝑑 \𝑜𝑚𝑒𝑔𝑎_
= 0.5, 1.0 𝑎𝑛𝑑 1.5 𝐶𝑖𝑟𝑐𝑙𝑒𝑠′)

|EEE325 | Control Systems Lab Manual


71
Figure 9.3: Root Locus with damping ratio =0.5 and 0.707 lines and natural frequency = 0.5, 1.0 and 1.5 circles

If we want to omit either the entire constant ζ lines or entire constant ωn circles, we may use empty
brackets [] in the arguments of the sgrid command. For example, if we want to overlay only the constant
damping ratio lines corresponding to ζ = 0.5 and no constant ωn circles to the root locus plot shown in
Figure 4.3, then we may use the command

𝑠𝑔𝑟𝑖𝑑 (0.5, [])

And if you want to get the value of poles and gain at any particular point in root locus, you may use the
following command.

[𝑘, 𝑝𝑜𝑙𝑒𝑠] = 𝑟𝑙𝑜𝑐𝑓𝑖𝑛𝑑(𝑛𝑢𝑚, 𝑑𝑒𝑛)

Click on any point in the root locus, you will get the value of Gain and Poles at that point

9.3.1.6 Preliminary Design Considerations


Control systems are designed to perform specific tasks. The requirements imposed on the control systems
are usually spelled out as performance specifications. These specifications are given before the design
process begins and are generally in terms of transient response requirements (such as the maximum
overshoot and settling time in step response) and of steady-state requirements (such as steady-state error
in following a ramp input).

For routine design problems, the performance specifications (which relate to accuracy, relative stability,
and speed of response) may be given in terms of precise numerical values or in terms of qualitative
statements. In latter case the specifications may have to be modified during the course of design, since
the given specifications may never be satisfied (because of conflicting requirements) or may lead to a very
expensive system. Generally, the performance specifications should not be more stringent than necessary
to perform the given task.

|EEE325 | Control Systems Lab Manual


72
9.3.2 Bode Plot

9.3.2.1 Why Sine Waves?


One of the most commonly used test functions for a circuit or system is the sine wave. This is not because
sine waves are a particularly common signal. They are in fact quite rare - the transmission of electricity (a
60 𝐻𝑧 sine wave in the U.S., 50 𝐻𝑧 in much of the rest of the world) is one example. The reason sine
waves are important is complex and involve a branch of Mathematics called Fourier Theory. Briefly put:
any signal going into a circuit can be represented by a sum of sine waves of varying frequency and
amplitude (often an infinite sum).This is why sine waves are important. Not because they are common,
but because we can represent arbitrarily complex functions using only these very simple function.

9.3.2.2 Determining system output given input and transfer function


Given that sine waves are important, how can we analyse the response of a circuit or system to sinusoidal
inputs (after all transients have died out - the so-called sinusoidal steady state)? There are many ways to
do this, depending on your mathematical sophistication. Let's use a fairly basic explanation that uses
phasors. If you are unfamiliar with phasors, you can find a description in almost any circuits or systems
textbook. A technique using Laplace Transforms is given here.

For a system of the type we are studying (linear constant coefficient) if the input to a system is a sinusoid
at a particular frequency, then the output of the system is also a sinusoid at the same frequency, but
typically with a different amplitude or phase. Put another way, if the input to a system (described by the
transfer function H(s)) is 𝐴 · 𝑠𝑖𝑛(𝜔𝑡 + 𝜑) then the output is 𝑀𝐴𝑠𝑖𝑛(𝜔𝑡 + 𝜑 + 𝜃). This is likewise true for
cosine - only the magnitude and phase of the output relative to the input changes. This is shown below.

Figure 9.4
In this diagram the magnitude of the sinusoid has changed by a factor of M (which we will take to be a
positive real number) and the phase has changed by a factor of θ (a real number, not necessarily
positive). It is our task to find the value of M and θ for a particular system, H(s), at a particular frequency,
ω. We call M the magnitude of the system (or transfer function) at ω, and we call θ the phase of the
system at that frequency. Using complex impedances, it is possible to find the transfer function of a
circuit. For example, the circuit below is described by the transfer function, 𝐻(𝑠), where 𝑠 = 𝑗𝜔.

Circuit Transfer Function

Figure 9.5

|EEE325 | Control Systems Lab Manual


73
Consider the case where 𝑅 = 1 𝑎𝑛𝑑 𝐶 = 0.1. In that case:
𝑉0 (𝑠) 1 1
𝐻(𝑠) = = =
𝑉𝑖 (𝑠) 1 + 0.1𝑠 1 + 𝑗. 0.1. ⍵
Generally we know the input 𝑉𝑖 and want to find the output 𝑉0 . We can do this by simple multiplication
1 1
𝑉0 (𝑠) = 𝑉𝑖 (𝑠). 𝐻(𝑠) = 𝑉𝑖 (𝑠). = 𝑉𝑖 (𝑗⍵).
1 + 0.1𝑠 1 + 𝑗. 0.1⍵

If we have a phasor representation for the input and the transfer function, the multiplication is simple
(multiply magnitudes and add phases). Finding the output becomes easy. Let's look at some examples:

Example 1
𝑉𝑖 = 3 sin(30. 𝑡) = 3 ∠ 0ᵒ
and the transfer function evaluates to
1 1 1
= = = 0.1 − 0.3𝑗 = 0.316 ∠ − 71.6ᵒ
1 + 𝑗. 0.1. ⍵ 1 + 𝑗. 0.1.30 1 + 3𝑗
The output is just the product of the input and the transfer function (evaluated as phasors). Thus the
magnitude will change by a factor of 0.316 (this is the gain of the system) and the phase will change by
−71.6° (this is the phase of the system).
𝑉0 = 𝑉𝑖 . 𝐻 = (3 ∠0ᵒ). (0.316∠ − 71.6ᵒ) = 0.95∠ − 71.6ᵒ = 0.95sin (30𝑡 − 71.6ᵒ)

Figure 9.6
Note that 𝑉0 has an amplitude of 0.95 and lags 𝑉𝑖 by72°. It is a phase "lag" because the output lags, or
follows, the input (the input goes up before the output so the output is following the input).

Example 2
Change input phase
𝑉𝑖 = 3 sin(30. 𝑡 + 40ᵒ) = 3∠40ᵒ
So the output is
1 1
𝑉0 = 𝑉𝑖 = 3∠40ᵒ. = 3∠40ᵒ(0.1 − 0.3j) = (3∠40ᵒ)(0.316∠ − 71.6ᵒ)
1 + 𝑗. 0.1. ⍵ 1 + j. 3
= 0.95∠ − 31.6ᵒ = 0.95sin (30t − 31.6ᵒ)

Figure 9.7: Both input and output have shifted 40° from those in Example 1.

|EEE325 | Control Systems Lab Manual


74
Example 3
Change input frequency
𝑉𝑖 = 3 sin(10𝑡 + 40ᵒ) = 3∠40ᵒ
So the output is
1 1
𝑉0 = 𝑉𝑖 . = 3∠40ᵒ.
1 + 𝑗. 0.1. ⍵ 1+j
1
= 3∠40ᵒ(0.5 − 0.5j) = 3∠40ᵒ. ∠ − 45ᵒ
√2
= 2.12∠ − 5ᵒ = 2.12sin (10. t − 5ᵒ)

Figure 9.8: Frequency has changed, magnitude of output has increased, but phase lag has decreased (to 45°).

9.3.2.3 Magnitude and Phase Plots


The difficulty in representing the transfer function comes about because we need to plot a complex
number, 𝐻(𝑠) 𝑜𝑟 𝐻(𝑗𝜔), as a function of frequency. Consider the transfer function
1
𝐻(𝑠) = 𝐻(𝑗⍵) =
1 + 𝑗. 0.1. ⍵
To show how the magnitude and phase vary we need two plots one for magnitude (magenta, in the
plot below) and one for phase (cyan).

Figure 9.9
Standard Bode plots are logarithmic on the frequency axis and plot the magnitude in dB's (decibels). We
can use these plots to determine the solutions to the examples 1 to 3 without resorting to algebra.

The frequency response of a system is presented as two graphs: one showing magnitude and one
showing phase. The phasor representation of the transfer function can then be easily determined at
any frequency. The magnitude of the output is the magnitude of the phasor representation of the
transfer function (at a given frequency) multiplied by the magnitude of the input. The phase of the
output is the phase of the transfer function added to the phase of the input.

|EEE325 | Control Systems Lab Manual


75
9.3.2.4 Bode Plot in Matlab
Given a transfer function, such as
𝑆+1 𝑆+1
𝐻(𝑠) = 100 = 100 2
(𝑠 + 10)(𝑠 + 100) 𝑠 + 110𝑠 + 1000
The question naturally arises: "How can we display this function?" The most useful way to display this
function is with two plots, the first showing the magnitude of the transfer function and the second
showing its phase. One way to do this is by simply entering many values for the frequency, calculating
the magnitude and phase at each frequency and displaying them. This is what a computer would
naturally do. For example if you use MATLAB® and enter the commands

>> MySys=tf(100*[1 1],[1 110 1000])


Transfer function:
100 s + 100
------------------------------
s^2 + 110 s + 1000
>> bode(MySys)

you get a plot like the one shown below.

Figure 9.10

9.3.2.5 Terminologies in Bode Plot (Frequency Domain Requirements)

a) Phase Margin:
It is the difference between your phase and −180 degrees of phase at the point where gain crosses 0𝑑𝑏
b) Gain Margin:
It is the difference between gain and 0𝑑𝑏 at the point where phase crosses −180 degrees
c) Gain Cross Over
The point where gain crosses 0𝑑𝑏 is called Gain Crossover Frequency
d) Bandwidth
It is the point where gain drops to −3𝑑𝑏
e) DC Gain
The magnitude in 𝑑𝑏𝑠 at 0 𝑟𝑎𝑑/𝑠𝑒𝑐 frequency

|EEE325 | Control Systems Lab Manual


76
9.3.3 System Compensation
Altering a control system to meet relative stability and performance specifications is called compensation
and a device inserted into the system for the purpose of satisfying the specifications is called
compensator. Figure 9.11 (a) and (b) show compensation schemes commonly used for feedback control
system. The choice between cascade compensation and feedback compensation depends in the nature
of the signals in the system, the power levels at various points, available components, the designer’s
experience, and economic considerations etc.

Figure 9.11: (a) Cascade Compensation (b) Feedback Compensation

Normally, cascade (or series) compensation may be simpler than feedback (or parallel) compensation;
however, series compensation frequently requires additional amplifiers to increase the gain and/or to
provide isolation. Note that, in general, the number of components required in parallel compensation will
be less than the number of components in series compensation, provided a suitable signal is available. In
this lab we will discuss series compensation in detail.

9.3.3.1 Types of Compensators


If a compensator is needed to meet the performance specifications, the designer must realize a physical
device that has the prescribed transfer function of the compensator.

If a sinusoidal input is applied to a network, and the steady-state output (which is also sinusoidal) has a
phase lead, then the network is called a lead network and the device to eliminate this phase lead is called
lead compensator. The amount of phase lead angle is a function of the input frequency. If the steady-state
output has a phase lag, then the network is called a lag network and the corresponding device to remove
this phase lag is called lag compensator. These compensators may be electronic devices, such as
operational amplifiers, or RC networks and amplifiers.

9.3.3.2 Root Locus Approach to Control System Design


As discussed earlier, the root locus plot of a system may indicate that the desired performance or stability
cannot be achieved just by the adjustment of gain. Then it is necessary to reshape the root loci to meet
the performance specifications.
In designing a control system, if other than a gain adjustment is required, we must modify the original
root loci by inserting a suitable compensator so that a pair of dominant closed-loop poles can be placed
at the desired location. Often, the damping ratio and undamped natural frequency of a pair of dominant
closed-loop poles are specified.

|EEE325 | Control Systems Lab Manual


77
9.3.3.3 Effects of the Addition of Poles and Zeros
When we add a pole to the open-loop transfer function of a system it
• Pulls the root locus to the right
• Tends to lower the system’s relative stability
• Slows down the settling of the response

On the contrary, addition of a zero to the open-loop transfer function


• Pulls the root locus to the left
• Tends to make the system more stable
• Speeds up the settling of the response

9.3.3.4 Lead Compensator Design


A first-order lead compensator can be designed using the root locus. The transfer function of a lead
compensator is given by
s+z
G(s) = K c
s+p
Where the magnitude of z is less than the magnitude of p. A phase-lead compensator tends to shift the
root locus toward the left-half plane. This results in an improvement in the system's stability and an
increase in the response speed.

How is this accomplished? If you recall finding the asymptotes of the root locus that lead to the zeros at
infinity, the equation to determine the intersection of the asymptotes along the real axis is:
∑ poles − ∑ zeros
α=
(No. of poles) − (No. of zeros)
When a lead compensator is added to a system, the value of this intersection will be a larger negative
number than it was before. The net number of zeros and poles will be the same (one zero and one pole
are added), but the added pole is a larger negative number than the added zero. Thus, the result of a lead
compensator is that the asymptotes' intersection is moved further into the left half plane, and the entire
root locus will be shifted to the left. This can increase the region of stability as well as the response speed.

c) Solving Ball and Beam Problem using Lead Compensator


The ball and beam system is one of the most enduringly popular and important laboratory models for
teaching control systems engineering. The ball and beam system is widely used because it is very simple
to understand as a system, and yet the techniques that can be studies to control it cover many important
classical and modern design methods. It has a very important property – it is open-loop unstable.

Figure 9.12: The Ball and Beam System

|EEE325 | Control Systems Lab Manual


78
The system is shown in Figure 9.12. A steel ball is rolling on top of a long beam. The beam is mounted on
the output shaft of an electric motor and so the beam can be tilted about its centre axis by applying an
electrical control signal to the motor amplifier. The position of the ball on the beam can be measured
using a special sensor.

The control job is to automatically regulate the position of the ball on the beam by changing the angle of
the beam. This is a difficult task because the ball does not stay in one place on the beam but moves with
an acceleration that is proportional to the tilt of the beam. In control technology this system is open-loop
unstable because the system output (the ball position) increases without limit for a fixed input (beam
angle). Feedback control must be used to keep the ball in desired position on the beam.

The complete description of the dynamics of the ball rolling on the beam is quite complicated and for
control system perspective a simplified derivation is used to give a model that is good for controller design.

The force that accelerates the ball as it rolls on the beam comes from the component of gravity that acts
parallel to the beam. The dotted line in Figure 9.13 shows this force to be mgsinθ. The ball actually
accelerates along the beam by rolling, but we can simplify the derivation by assuming that the ball is
sliding without friction along the beam. Then, using the second law of Newton, the simplified ball and
beam model is,

Figure 9.13: The Ball and Beam System Dynamics

d2 x
mgsinθ = m
dt 2
Where m is the mass of the ball, g is the gravitational constant, θ is the beam angle and x is the position
of the ball on the beam.
For small angles, sinθ ≈ θ, so the model becomes,
d2 x
= gθ
dt 2
This simple model of the ball and beam is a good approximation to the true system dynamics, and is the
one normally used in text books and design studies for controller design. Combining actuator and sensor
constants with the gravity constant, we get a single constant b. This represents the overall gain of the
response from control voltage input to measured output acceleration. The transfer function
representation of the above equation is
X(s) b
= (1)
Ɵ (s) s2
Where
−mgd
b=
J
L( 2 + m)
R

|EEE325 | Control Systems Lab Manual


79
Let’s now set the design criteria and system parameter of this problem as,
 𝑒𝑠𝑠 < 0.02 𝑓𝑜𝑟 𝑎 𝑢𝑛𝑖𝑡 𝑟𝑎𝑚𝑝 𝑖𝑛𝑝𝑢𝑡
 𝑃ℎ𝑎𝑠𝑒 𝑀𝑎𝑟𝑔𝑖𝑛 > 48ᵒ

And the parameters are


m = 0.111
R = 0.015
g = −9.8
L = 1.0
d = 0.03
J = 9.99 × 10−6

Pre Lab Exercise 1


Design a lead compensator for the above ball and beam system which meets the given design criteria.

9.3.3.5 Lag Compensator Design


A first-order lag compensator can be designed using the root locus. A lag compensator in root locus form
is given by
s−z
G(s) = K c
s−p
where the magnitude of z is greater than the magnitude of p. A lag compensator tends to shift the root
locus to the right, which is undesirable. For this reason, the pole and zero of a lag compensator must be
placed close together (usually near the origin) so they do not appreciably change the transient response
or stability characteristics of the system.

How does the lag controller shift the root locus to the right? The answer is the same as that to lead
compensator. Again recall finding the asymptotes of the root locus that lead to the zeros at infinity, the
equation to determine the intersection of the asymptotes along the real axis is

∑ poles − ∑ zeros
α=
(No. of poles) − (No. of zeros)

When a lag compensator is added to a system, the value of this intersection will be a smaller negative
number than it was before. The net number of zeros and poles will be the same (one zero and one pole
are added), but the added pole is a smaller negative number than the added zero. Thus, the result of a lag
compensator is that the asymptotes' intersection is moved closer to the right-half plane, and the entire
root locus will be shifted to the right.

It was previously stated that that lag controller should only minimally change the transient response
because of its negative effect. If the phase-lag compensator is not supposed to change the transient
response noticeably, what is it good for? The answer is that a phase-lag compensator can improve the
system's steady-state response. It works in the following manner. At high frequencies, the lag controller
will have unity gain. At low frequencies, the gain will be z/p which is greater than 1. This factor z/p will
multiply the position, velocity, or acceleration constant (𝐾𝑝 , 𝐾𝑣 , 𝑜𝑟 𝐾𝑎 ), and the steady-state error will
thus decrease by the factor z/p.

|EEE325 | Control Systems Lab Manual


80
a) DC Motor Speed Control using Lag Compensator
The open-loop transfer function of a DC motor speed is given by

Ɵ̇ K
= (Js+b)(Ls+R)+K2
(2)
U

And the schematic looks like Figure 9.14.

Figure 9.14: DC Motor Speed Control System

With a 1 rad/sec step reference, the design criteria are:


 Settling time less than 2 seconds
 Overshoot less than 5%
 Steady-state error less than 1%

Pre Lab Exercise 2


Design a Lag Compensator to meet the given criteria

9.4 In-Lab Experiments

9.4.1 Design Using Root Locus


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

Y(s) K(s + 7)
T(s) = =
R(s) s(s + 5)(s + 15)(s + 20)

We want to design a feed-back controller for the system by using the root locus method and our design
criteria are 5% overshoot and 1 second rise time.

Design a controller in MATLAB which meets the given criteria. Show its response and verify that it meets
the designed criteria. Attach Matlab Code and Results

|EEE325 | Control Systems Lab Manual


81
9.4.2 Analyses of Designed Lead Compensator on MATLAB
For the system defined by equation 1, implement the lead compensator designed in Pre Lab Exercise 1, in
MATLAB and verify the results

9.4.3 Analyses of Designed Lag Compensator on MATLAB


For the system defined by equation 2, implement the lag compensator designed in Pre Lab Exercise 2, in
MATLAB and verify the results

9.5 Post-Lab Exercise

Exercise 1
Consider the following unity feedback system,

Design a Compensator to tailor the transient response as per the given criteria
 𝑃𝑂 ≤ 10%
 𝑇𝑠 ≤ 2𝑠

|EEE325 | Control Systems Lab Manual


82
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


83
10 Lab #10: State Feedback Controller Design for a DC Motor Using Pole
Placement Technique
10.1 Objectives
• To Construct State-Space Model of the System
• Design of state feedback controller for a dc motor system.

10.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for stepwise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

10.3 Theory and Pre-Lab Exercises:

10.3.1 Introduction
We have been analyzing and designing control systems by using a transfer-function approach (which
allowed us to conveniently model the system, and use techniques such as root-locus, Bode plots and
Nyquist plots). These techniques were developed and studied during the first half of the twentieth century
in an effort to deal with issues such as noise and bandwidth issues in communication systems. Transfer
function methods have various drawbacks however, since they cannot deal with nonlinear systems, are
not very convenient when considering systems with multiple inputs and outputs and are difficult to use
for formulating ‘optimal’ control strategies. Starting in the 1950’s (around the time of the space race),
control engineers and scientists started turning to state-space models of control systems in order to
address some of these issues. These are purely time-domain ordinary differential equation models of
systems and are able to effectively represent concepts such as the internal state of the system, and also
present a method to introduce optimality conditions into the controller design procedure. This lab will
provide an introduction to the state-space approach to control design (sometimes referred to as “modern
control”).

10.3.2 State-space analysis


State space analysis enables us to represent and analyze systems that may have multiple inputs, outputs,
and state variables. In control systems, state space representation can help designers to determine the
required controller and the interactions between the state variables, inputs, and outputs. State space
analysis is particularly important in control systems engineering, where it is used to design and analyse
feedback control systems. By using state space analysis, engineers can design controllers that can regulate
the behaviour of a system and ensure that it operates within specified performance limits.

Continuous state-space models use first-order differential equations to describe the system. We analyse
state-space models in the time domain. The following equations define a continuous state-space model.
State and output equations are given below:
x ′ = Ax + Bu
y = Cx + Du

|EEE325 | Control Systems Lab Manual


84
Where
x = state vector
x ′ = derivative of the state vector with respect to time
y = output vector
u = input or control vector
A = System matrix
B = input matrix
C = output matrix
D = feedforward matrix
To get state-space of a system. Use math-script and write the following code:

Figure 1.1

10.3.3 State-Space to transfer function conversion and vice versa


To obtain the transfer function from state-space equations, use the following MATH-Script code

[𝑛𝑢𝑚, 𝑑𝑒𝑛] = 𝑠𝑠2𝑡𝑓(𝐴, 𝐵, 𝐶, 𝐷, 𝑛𝑢𝑚_𝑖𝑛)

where 𝑛𝑢𝑚_𝑖𝑛 must be specified for systems with more than one input. For example, if there is only one
input, then 𝑛𝑢𝑚_𝑖𝑛 = 1, if there are two inputs then 𝑛𝑢𝑚_𝑖𝑛 = 2, etc. For systems with only one input,
then the following code is allowed
[𝑛𝑢𝑚, 𝑑𝑒𝑛] = 𝑠𝑠2𝑡𝑓(𝐴, 𝐵, 𝐶, 𝐷)
Given the state-space equations:
𝑥1 ′ 0 1 0 𝑥1 0
[𝑥2 ′] = [ 0 0 1 ] [𝑥2 ] + [ 25 ] 𝑢
𝑥3 ′ −5 −25 −5 3 𝑥 −120
𝑥1
𝑦 = [1 0 0] [𝑥2 ]
𝑥3
Matlab produces the following system transfer function
25𝑠 + 5
𝐻(𝑠) = 3
𝑠 + 5𝑠 2 + 25𝑠 + 5
The Matlab implementation of this is given by
𝐴 = [0 1 0; 0 0 1; −5 − 25 − 5];
𝐵 = [0; 25; −120];
𝐶 = [1 0 0];
𝐷 = [0];
[𝑛𝑢𝑚, 𝑑𝑒𝑛] = 𝑠𝑠2𝑡𝑓(𝐴, 𝐵, 𝐶, 𝐷)

𝑛𝑢𝑚 = 0.0000 25.0000 5.0000


𝑑𝑒𝑛 = 1.0000 5.0000 25.0000 5.0000

|EEE325 | Control Systems Lab Manual


85
MATALB can be used to obtain a state-space representation of the transfer function with the following
command
[𝐴, 𝐵, 𝐶, 𝐷] = 𝑡𝑓2𝑠𝑠(𝑛𝑢𝑚, 𝑑𝑒𝑛)
It is important to note that the state space representation is not unique, i.e. there are many state-space
representations for the same system. The MATLAB command gives just one possible state-space equation.
Consider the transfer function
𝐵(𝑠) 𝑠
𝐻(𝑠) = = 2
𝐴(𝑠) (𝑠 + 10)(𝑠 + 4𝑠 + 16)
A possible state-space representation of this system is
𝑥1 ′ 0 1 0 𝑥1 0
[𝑥2 ′] = [ 0 0 1 ] [𝑥 2 ] + [ 1 ]𝑢
𝑥3 ′ −160 −56 −14 3 𝑥 −14
𝑥1
𝑦 = [1 0 0] [𝑥2 ] + [0]𝑢
𝑥3
For the given example, Matlab produces the following state-space representation
𝑥1 ′ −14 −56 −160 𝑥1 1
[𝑥2 ′] = [ 1 0 0 ] [𝑥2 ] + [0] 𝑢
𝑥3 ′ 0 1 0 𝑥3 0
𝑥1
𝑦 = [0 1 0] [𝑥2 ] + [0]𝑢
𝑥3
Following code may be used to get the state-space conversion
𝑛𝑢𝑚 = [0 0 1 0];
𝑑𝑒𝑛 = [1 14 56 160];
[𝐴, 𝐵, 𝐶, 𝐷] = 𝑡𝑓2𝑠𝑠(𝑛𝑢𝑚, 𝑑𝑒𝑛)
A =
-14 -56 -160
1 0 0
0 1 0
B =
1
0
0
C =
0 1 0
D =
0

|EEE325 | Control Systems Lab Manual


86
10.3.4 State-Feedback controller
Full state feedback (FSF), or pole placement, is a method employed in feedback control system theory to
place the closed-loop poles of a plant in pre-determined locations in the s-plane. Placing poles is desirable
because the location of the poles corresponds directly to the eigenvalues of the system, which control the
characteristics of the response of the system. The system must be considered controllable in order to
implement this method.

Full state feedback assumes the closed-loop dynamics of a system to be on the form:
x ′ = Ax + Bu
y = Cx + Du
If D=0, we can place the poles of the system arbitrarily by solving the characteristic equation, as long as
the system is controllable.
Then the open loop eigen values of the system are the roots of the characteristic equation given by
|𝑠𝐼 − 𝐴| = 0
Full state feedback is utilized by commanding the input vector u. Consider an input proportional to the
state vector.
𝑢 = −𝐾𝑥 (K is the state feedback gain matrix)
Substituting in state space equation we get:
x ′ = (A − BK)x
𝑦 = (C − DK)x
The eigen values of Full state feedback system is given by: |sI−(𝐴−𝐵K)
Comparing the terms of this equation with those of the desired characteristic equation yields the value of
the feedback matrix K which force the closed loop eigen values to the pole locations specified by the
desired characteristic equation.

Pole placement method:


The pole placement method is a method of designing a state feedback controller to place the closed-loop
poles of the system at specific locations. The closed-loop poles of the system are the eigenvalues of the
matrix A−BK, where A is the system matrix, B is the input matrix, and K is the state feedback gain matrix.
The state feedback gain matrix K is designed such that the poles of the closed-loop system are placed in
the desired locations.

To design a state feedback controller using the pole placement method, we first need to determine the
desired closed-loop poles. The desired closed-loop poles should be chosen to achieve the desired
performance of the system. For example, if we want the system to have a fast response time, we would
place the closed-loop poles far to the left in the complex plane.

Once we have determined the desired closed-loop poles, we can use the Ackerman's formula to calculate
the state feedback gain matrix, K. The Ackerman's formula is a recursive formula that can be used to
calculate K for any system that is controllable.

The following is an example of how to use the pole placement method to design a state feedback
controller for a simple linear system:

x' = Ax + Bu
y = Cx

|EEE325 | Control Systems Lab Manual


87
A = [[1, 2], [3, 4]]
B = [[1], [2]]
C = [[5, 6]]

We want to place the poles of the closed-loop system at s=−2±j2. To do this, we can use the following
MATLAB code:

K = place(A, B, [-2+2j, -2-2j])


This code computes the state feedback gain matrix K such that the poles of the closed-loop system are
placed at s=−2±j2. The state feedback gain matrix is given by:

K = [[1, 0], [2, 1]]


We can now implement the state feedback controller by using the following equation:

u = -Kx
This will place the poles of the closed-loop system at s=−2±j2, which will give the system a desired
response.

Controllability of State Space Model

Controllability is defined as the ability of a control system to reach a definite state from a fixed (initial)
state in a finite time. It is considered as an important property of the control system as it defines the
behaviour of the control system. A system is completely controllable if any initial state can be driven to
any final state in a finite time using only the available control inputs. This means that the controller has
the ability to manipulate the system's internal dynamics to achieve the desired output.

Controllability is an important property for many control problems, such as:

• Stabilization: Controllability is necessary to stabilize an unstable system. An unstable system is


one that will diverge from its initial state over time, even if no disturbances are present. A
controller can use its control inputs to keep an unstable system from diverging and to drive it to
a desired state.
• Tracking: Controllability is also necessary for tracking problems. In a tracking problem, the
controller is required to drive the system's output to follow a desired reference signal.
Controllability ensures that the controller can always drive the system's output to follow the
reference signal, even if the reference signal is changing.
• Optimal control: Controllability is also important for optimal control problems. In an optimal
control problem, the controller is required to find the control inputs that minimize a cost function,
while satisfying certain constraints. Controllability ensures that there exists a feasible solution to
the optimal control problem.

To check controllability and find the controllability matrix in MATLAB, you can follow these steps

1. Define your system in state-space representation. You need to have matrices A and B that
describe the system's dynamics.
2. Use the ctrb function to calculate the controllability matrix.
3. Check the rank of the controllability matrix to determine if the system is fully controllable.

|EEE325 | Control Systems Lab Manual


88
Here's a step-by-step example:

% Step 1: Define your system (example)


A = [1 2; 0 1]; % State matrix
B = [1; 0]; % Control input matrix

% Step 2: Calculate the controllability matrix


Ctrb = ctrb(A, B);

% Step 3: Check the rank of the controllability matrix


n = size(A, 1); % Number of states in the system
rank_Ctrb = rank(Ctrb);

if rank_Ctrb == n
disp('The system is fully controllable.');
else
disp('The system is not fully controllable.');
end
In this example, the code defines a simple 2-state system with matrices A and B. It then calculates the
controllability matrix Ctrb using the ctrb function and checks the rank of this matrix. If the rank is equal to
the number of states (n), the system is fully controllable. If the rank is less than n, the system is not fully
controllable.

You can replace the A and B matrices with those representing your own system to check its controllability.
If the rank of the controllability matrix is less than the number of states, it may indicate that additional
control inputs or modifications to the system dynamics are needed to achieve full controllability.

Benefits of state feedback control


State feedback control has a number of benefits over other control methods, including:

• It can be used to design a controller to achieve any desired closed-loop response.


• It can be used to control systems with multiple inputs and outputs.

Drawbacks of state feedback control


State feedback control also has some drawbacks, including:

• It requires the full state of the system to be measured.


• It can be sensitive to noise in the state measurements.
• It can be complex to design and implement.

Overall, state feedback control is a powerful control method that can be used to achieve a wide range of
control objectives.

|EEE325 | Control Systems Lab Manual


89
10.4 In Lab Experiments
Consider the following mechanical (eq. 1) and electrical (eq. 2) equation for a Dc motor system:

𝑑𝜔(𝑡) 1
= (𝐾𝑡 𝑖𝑎 (𝑡) − 𝑏. 𝜔(𝑡)) (eq. 1)
𝑑𝑡 𝐽

𝑑𝑖𝑎 (𝑡) 1
𝑑𝑡
= 𝐿
(𝑉𝑎 − 𝑅𝑖𝑎 (𝑡) − 𝐾𝑏 𝜔𝑎 (𝑡)) (eq. 2)

Assume the following parameters for simulation:

a) Using the above equations 1 & 2, Develop a state space model for a Dc motor system.
b) Design a full state feedback controller for a dc motor system to meet the following design criteria:
• Settling time less than 2 seconds
• Overshoot less than 5%
• Steady-state error less than 1%

10.5 Post-Lab Exercise

Exercise 1:

Consider the following plant: G(s) = (s + 15)/ (s + 1)(s + 2)(s + 4).

Design a state feedback controller to yield a 16.3% overshoot and settling time of 4s by choosing
the third desired closed-loop pole to cancel the closed-loop zero.

|EEE325 | Control Systems Lab Manual


90
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


91
11 LAB # 11: Introduction to Rotary Pendulum System and to analyse the
dynamical behaviour of the System using LabVIEW
11.1 Objectives
• To introduce the rotary inverted pendulum system
• To determine unknown parameters in the Rotary Pendulum Model
• To Tell the dynamics of the Rotary Pendulum System

11.2 Theory and Pre-Lab Exercises

11.2.1 Introduction and Background


Regulations and Servo Problems are very common, but feedback can be used in many other useful ways.
The name task-based control is used as a common classification of a wide variety of problems. For
instance, stabilization of an unstable system can be considered as a task based problem. However, it is a
border line example since it can also be viewed as a regulation problem. The Segway transporter is a
typical example where the stabilization is a key task. In that case stabilization is also merged with the
steering functions. Other examples are damping of a swinging load on a crane, stabilization of a rocket
during take-off, and the human posturing systems. There are many examples of task-based control in
aerospace such as automatic landing and orbit transfer of satellites. Robotics is a rich field for task-based
control with challenges such as collision avoidance, motion planning, and vision based control. Task based
control is typically more complicated than regulation and serving but they may contain servo and
regulation functions as sub-tasks. We have chosen the rotary pendulum system to illustrate task-based
control. The QNET rotary inverted pendulum trainer is shown in Figure 11.1. The motor is mounted
vertically in a metal chamber. An L-shaped arm is connected to the motor shaft and pivots between +-180
degrees. A pendulum is suspended on a horizontal axis at the end of the arm. The pendulum angle is
measured by an encoder. The control variable is the input voltage to the pulse-width modulated amplifier
that drives the motor. The output variables are the angle of the pendulum and the angle of the motor.

|EEE325 | Control Systems Lab Manual


92
Figure 11.1

The experiment illustrates some control tasks for gantry cranes. The gantry is a moving platform or trolley
that transports the crane about the factory floor or harbour. The load hangs from the crane using wires
and is moved by the gantry crane. Typically, the problem is to move the load quickly and move it to the
correct position. The fast motion necessary for production makes it more difficult to move the load to the
correct location given the swinging motions of the crane. This problem can be mimicked using the rotary
pendulum system by viewing the tip of the L-shaped arm as the moving trolley and the pendulum tip as
the load being carried. In this experiment we will begin by modelling the system and determine strategies
to dampen the oscillations of the system.

Figure 11.2

|EEE325 | Control Systems Lab Manual


93
Figure 11.2 shows the free-body diagram of the pendulum assembly that is composed of two rigid bodies:
the pendulum link with mass 𝑀𝑝1 and length𝐿𝑝1 , and the pendulum weight with mass 𝑀𝑝2 and a length
𝐿𝑝2 . The center of mass of the pendulum link and the pendulum weight are calculated separately using
the general expression
∫ 𝑝𝑥𝑑𝑥
𝑥𝑐𝑚 =
∫ 𝑝𝑑𝑥

Where 𝑥 is the linear distance from the pivot axis and 𝑝 is the density of the body. The circle in the top-
left corner of Figure 11.2 represents the axis of rotation or the pivot axis that goes into the page. The
pendulum system is then expressed as one rigid body with a single centre of mass, as shown in Figure 11.3

Figure 111.3

The centre of mass of a composite object that contains n bodies can be calculated using

∑𝑛𝑖=𝑖 𝑚𝑖 𝑥𝑐𝑚,𝑖
𝑥𝑐𝑚 =
∑𝑛𝑖=𝑖 𝑚𝑖

where 𝑥𝑐𝑚,𝑖 is the known centre of mass of body 𝑖 and 𝑚𝑖 is the mass of body 𝑖. From the free-body
diagram in Figure 11.3, the resulting nonlinear equation of motion of the pendulum is

𝐽𝑝 ἄ(𝑡) = 𝑀𝑝 𝑔𝑙𝑝 𝑠𝑖𝑛 ∝ (𝑡) + 𝑀𝑝 𝑢𝑙𝑝 𝑐𝑜𝑠 ∝ (𝑡)

where 𝐽𝑝 is the moment of inertia of the pendulum at the pivot axis 𝑧0 ,𝑀𝑝 is the total mass of the
pendulum assembly, 𝑢 is the linear acceleration of the pivot axis, and 𝑙𝑝 is the centre of mass position as
depicted in Figure 11.3. Thus as the pivot accelerates towards the left, the inertia of the pendulum causes
it to swing upwards while the gravitation force 𝑀𝑝 𝑔 and the applied force 𝑀𝑝 𝑢 pull the pendulum
downwards.

|EEE325 | Control Systems Lab Manual


94
The moment of inertia of the pendulum can be found experimentally. Assuming the pendulum is
unactuated, linearizing above equation and solving for the differential equation gives the expression

𝑀𝑝 𝑔𝑙𝑝
𝐽𝑝 =
4𝑓 2 𝜋 2

Where 𝑓 is the measured frequency of the pendulum as the arm remains rigid. The frequency is calculated
using
𝑛𝑐𝑦𝑐
𝑓=
∆𝑡

Where 𝑛𝑐𝑦𝑐 is the number of cycles and ∆𝑡 is the duration of these cycles. Alternatively, 𝐽𝑝 can be
calculated using the moment of inertia expression

𝐽 = ∫ 𝑟 2 𝑑𝑚

Where 𝑟 is the perpendicular distance between the element mass𝑑𝑚, and the axis of rotation. In addition
to finding the moment of inertia, this laboratory investigates the friction that is present in the system. The
rotor of the DC motor that moves the system requires a certain amount of current to begin moving. In
addition, mass from the pendulum system requires even more current to actually begin moving the
system. The friction is particularly severe for velocities around zero because friction changes sign with the
direction of rotation.

11.2.2 Simple Modelling Virtual Instrument


The virtual instrument for studying the physics of the pendulum when in the gantry configuration is shown
in Figure 11.4

Figure 111.4

|EEE325 | Control Systems Lab Manual


95
11.3 In Lab Experiments

11.3.1 Damping
1. Ensure the QNET ROTPENT Simple Modelling VI is open. Make sure the correct device is chosen
2. Run the VI
3. Hold the arm of the rotary pendulum system stationary and manually perturb the pendulum
4. While still holding the arm, examine the response of Pendulum Angle in Angle scope. This is the
response from the pendulum system
5. Repeat step 3 above but release the arm after several swings
6. Examine the Pendulum Angle (deg) response when the arm is not fixed. This is the response from
the rotary pendulum system. Given the response from the pendulum and rotary pendulum
system, which converges faster towards angle zero? Why does one system dampen faster than
other?

7. Stop the VI by clicking on the stop button

11.3.2 Friction
1. Run the QNET_ROTPENT_Simple_Modelling.vi
2. In the Signal Generator section set
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 0 𝑉
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.25 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.0 𝑉
3. Change the Offset in steps of 0.10 𝑉 until the pendulum beings moving. Record the voltage at
which pendulum moved.
4. Repeat step 3 above for steps of −0.10 𝑉
5. Enter positive 𝑉𝑓𝑝 and negative voltage 𝑉𝑓𝑛 values needed to get the pendulum moving. Why does
the motor need a certain amount of voltage to get the motor shaft moving? Enter these values in
table 12.2.

6. Stop the VI by clicking on the Stop button

|EEE325 | Control Systems Lab Manual


96
11.3.3 Moment of Inertia

a) Theoretical Calculations
Find the moment of inertia acting about the pendulum pivot using the free body diagram. Make sure you
evaluate numerically using the parameters defined in the table below. Show all the calculations below.
Enter this value in Table 11.2

Table 111-1

|EEE325 | Control Systems Lab Manual


97
b) Experimental Observation
1. Run the QNET_ROTPENT_Simple_Modelling.vi
2. In the Signal Generator section set
 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 = 1.0 𝑉
 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 = 0.25 𝐻𝑧
 𝑂𝑓𝑓𝑠𝑒𝑡 = 0.0 𝑉
3. Click on the Disturbance toggle switch to perturb the pendulum and measure the amount of time
it takes for the pendulum to swing back-and-forth in a few cycles (e.g., 4 cycles)
4. Find the frequency and moment of inertia of the pendulum using the observed results. Use
equations given in 12.4.1. Enter this value in Table 11.2

5. Compare the moment of inertia calculated analytically in section 12.5.3(a) and the moment of
inertia found experimentally. Justify if there exists a large discrepancy between them.

11.3.4 Results
Table 111-2
Description Symbol Value Unit
Positive Coulomb Friction
𝑉𝑓𝑝 𝑉
Force
Negative Coulomb Friction
𝑉𝑓𝑛 𝑉
Force
Calculated Inertia 𝐽𝑝 𝑘𝑔. 𝑚2
Experimentally Found
𝐽𝑝,𝑒𝑥𝑝 𝑘𝑔. 𝑚2
Inertia

|EEE325 | Control Systems Lab Manual


98
11.4 Post-Lab Exercise

Exercise Question 1
An inverted pendulum is highly nonlinear system. Consider we want to design a linear controller to control
it. For this first of all we will need to linearize its mathematical model. Do you see any feasible point where
it could be linearized? What assumptions would we need to make?

|EEE325 | Control Systems Lab Manual


99
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


100
12 LAB # 12: Design and Implementation of a Hybrid Controller for
Rotary Pendulum
12.1 Objectives
• To understand the working of a Hybrid Controller
• Design and Implementation of a hybrid controller for the System

12.2 Lab Instructions


✓ This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva session.
✓ The students should perform and demonstrate each lab task separately for step-wise evaluation
✓ Only those tasks that completed during the allocated lab time will be credited to the students.
Students are however encouraged to practice on their own in spare time for enhancing their skills.

12.3 Theory and Pre-Lab Exercises

12.3.1 Introduction and Background

12.3.1.1 Energy Control


If the arm angle is kept constant and the pendulum is given an initial position it would swing with constant
amplitude. Because of friction there will be damping in the oscillation. The purpose of energy control is to
control the pendulum in such a way that the friction is constant. The potential energy of the pendulum is

𝐸𝑝 = 𝑀𝑝 𝑔𝑙𝑝 (1 − 𝑐𝑜𝑠 ∝)
And the kinetic energy is
1
𝐸𝑘 = 𝐽𝑝 ά2
2
The potential energy is zero when the pendulum is at rest at α = 0 (see free body diagram in lab 12), and
equals 2𝑀𝑝 𝑔𝑙𝑝 when the pendulum is upright at α = ±π. The sum of the potential and kinetic energy of
the pendulum is
1
𝐸 = 𝐽𝑝 ά2 + 𝑀𝑝 𝑔𝑙𝑝 (1 − 𝑐𝑜𝑠 ∝)
2
Differentiating above equation results in the differential equation

𝐸 ′ = ά(𝐽𝑝 ἄ2 + 𝑀𝑝 𝑔𝑙𝑝 𝑠𝑖𝑛 ∝)

Substituting the pendulum nonlinear equation of motion given in lab 12 in above equation gives

𝐸 ′ = 𝑀𝑝 𝑢𝑙𝑝 ά 𝑐𝑜𝑠 ∝

Since the acceleration of the pivot is proportional to current driving the arm motor and thus also
proportional to the drive voltage we find that it is easy to control the energy of the pendulum. The
proportional control law
𝑢 = (𝐸𝑟 − 𝐸) ά 𝑐𝑜𝑠 ∝

|EEE325 | Control Systems Lab Manual


101
drives the energy towards the reference energy 𝐸𝑟 . Notice that the control law is nonlinear because the
proportional gain depends on the pendulum angle, 𝛼. Also, notice that the control changes sign when
άchanges sign and when the angle is ±90 𝑑𝑒𝑔.

However, for energy to change quickly the magnitude of the control signal must be large. As a result the
following swing-up controller is implemented in the LabVIEW VI

𝑢 = 𝑠𝑎𝑡𝑢𝑚𝑎𝑥 (µ(𝐸𝑟 − 𝐸)𝑠𝑖𝑔𝑛(ά 𝑐𝑜𝑠 ∝)

Where μ is a tuneable control gain and the 𝑠𝑎𝑡𝑢𝑚𝑎𝑥 function saturates the control signal at the maximum
acceleration of the pendulum pivot, 𝑢𝑚𝑎𝑥

12.3.1.2 Hybrid Swing-Up Control


The energy swing-up control law discussed in previous section can be combined with the balancing control
law discussed in lab 12 to obtain a control law which performs the dual tasks of swinging up the pendulum
and balancing it. As illustrated in Figure 12.1, this can be accomplished by switching between two control
systems.

Figure 122.1: Swing-Up hybrid Control

This system can be modelled as a hybrid system. Hybrid systems are systems with both continuous and
discrete parts. There are two continuous part: the closed-loop system using the swing-up energy
controller and the closed loop system using the PD balance controller. The switching strategy is the
discrete element that chooses which controller, or system, to run. The switching logic can be obtained by
determining a region in state space where the balancing works well. Balancing control is then used inside
this region and energy control is used outside the region. Figure 12.2 is a called a hybrid automaton and,
for this specific task, can be used to describe the system model and the switching logic.

|EEE325 | Control Systems Lab Manual


102
Figure 122.2: Hybrid Swing-Up Controller Automation

The circles in Figure 12.2 are called locations and represent the two different continuous system. The
arrows are called edges and represent the discrete jumps taken when certain condition are satisfied. The
angle used in the switching logic in Figure 12.2 is called the upright angle. It is defined as zero when the
pendulum is about its upright vertical position and expressed mathematically using

∝𝑢𝑝 =∝ 𝑚𝑜𝑑(2𝜋 − 𝜋)

The various switching parameters shown in Figure 12.2 can then be set as:

ɛ = 2 𝑑𝑒𝑔
𝜂 = 720 𝑑𝑒𝑔/𝑠
𝛾 = 30 𝑑𝑒𝑔

Given that the pendulum starts in the downward vertical position, it is in the swing-up location of the
hybrid automaton. The swing-up controller pumps energy into the pendulum until it swings within
±2 𝑑𝑒𝑔 of its upright vertical position. Once the pendulum is within that that range and does not exceed
720 𝑑𝑒𝑔/𝑠 in either direction, the edge is taken to engage the balance controller. It remains in the Balance
PD control location until the pendulum goes beyond the ±30 𝑑𝑒𝑔 position range or beyond ±720 𝑑𝑒𝑔/𝑠.

12.3.2 Swing-Up Control VI


The virtual instrument used to run the swing-up controller on the QNET rotary pendulum system is the
same as the balance control.

|EEE325 | Control Systems Lab Manual


103
12.4 In-Lab Experiments

12.4.1 Energy Control


1. Open the QNET_ROTPENT_Swing_Up_Control.vi
2. Run the VI
3. In the Balance Control Parameters section set:
𝑉
 𝑘𝑝𝑡ℎ𝑒𝑒𝑡𝑎 = −6.5
𝑟𝑎𝑑
 𝑘𝑝𝑎𝑙𝑝ℎ𝑎 = 80 𝑉/𝑟𝑎𝑑
 𝑘𝑑𝑡ℎ𝑒𝑒𝑡𝑎 = −2.75 𝑉𝑟𝑎𝑑−1 𝑠 −1
 𝑘𝑑𝑎𝑙𝑝ℎ𝑎 = 10.5 𝑉𝑟𝑎𝑑−1 𝑠 −1
4. In the Swing-Up Control Parameters section set:
 𝑚𝑢 = 55𝑚𝑠 −2 𝐽−1
 𝐸𝑟 = 20.0 𝑚𝐽
 max 𝑎𝑐𝑐𝑒𝑙 = 10𝑚𝑠 −2
 𝐴𝑐𝑡𝑖𝑣𝑎𝑡𝑒 𝑆𝑤𝑖𝑛𝑔 − 𝑈𝑝 = 𝑂𝐹𝐹 (𝑑𝑒 − 𝑝𝑟𝑒𝑠𝑠𝑒𝑑)
5. Adjust the Angle/Energy (deg/mJ) scope scales to see between -250 and 250
6. Manually rotate the pendulum in the upright position until the 𝐼𝑛 𝑅𝑎𝑛𝑔𝑒? LED in the Control
Indicators section turns bright green. Ensure the encoder cable does not interfere with the
pendulum arm motion.
7. What do you notice about the energy when the pendulum is moved at different positions? Record
the energy when the pendulum is being balanced (i.e., fully inverted in the upright vertical
position). Note down the value

8. Click on the Stop button to stop running the VI


9. In the Swing-Up Control Parameters section, turn ON the Activate Swing-Up switch(the pressed
down position)
10. If the pendulum is not moving, click on the Disturbance button in the Signal Generator section to
perturb the pendulum
11. In Swing-Up Control Parameters, change the reference energy 𝐸𝑟 between 5.0 𝑚𝐽 and 50.0 𝑚𝐽.
As it is varied, examine the control signal in the Voltage (V) scope as well as the blue Pendulum
Angle (deg) and the red Pendulum Energy (mJ) in the Angle/Energy (deg/mJ) scope. Attach the
response of the Angle/Energy (deg/mJ) and Voltage (V) scopes. Discuss below

|EEE325 | Control Systems Lab Manual


104
12. In Control Parameters fix 𝐸𝑟 to 20.0 𝑚𝐽 and vary the swing-up control gain 𝑚𝑢 between 10 and
100𝑚𝑠 −2 𝐽−1. Describe how this changes the performance of the energy control

13. Click on the Stop button to stop running the VI

12.4.2 Hybrid Swing-Up Control


1. Open the QNET_ROTPENT_Swing_Up_Control.vi
2 Run the VI
3. In the Balance Control Parameters section set:
𝑉
 𝑘𝑝𝑡ℎ𝑒𝑒𝑡𝑎 = −6.5
𝑟𝑎𝑑
 𝑘𝑝𝑎𝑙𝑝ℎ𝑎 = 80 𝑉/𝑟𝑎𝑑
 𝑘𝑑𝑡ℎ𝑒𝑒𝑡𝑎 = −2.75 𝑉𝑟𝑎𝑑−1 𝑠 −1
 𝑘𝑑𝑎𝑙𝑝ℎ𝑎 = 10.5 𝑉𝑟𝑎𝑑−1 𝑠 −1
4. In the Swing-Up Control Parameters section set:
 𝑚𝑢 = 55𝑚𝑠 −2 𝐽−1
 𝐸𝑟 = 20.0 𝑚𝐽
 max 𝑎𝑐𝑐𝑒𝑙 = 10𝑚𝑠 −2
 𝐴𝑐𝑡𝑖𝑣𝑎𝑡𝑒 𝑆𝑤𝑖𝑛𝑔 − 𝑈𝑝 = 𝑂𝐹𝐹 (𝑑𝑒 − 𝑝𝑟𝑒𝑠𝑠𝑒𝑑)
5. Adjust the Angle/Energy (deg/mJ) scope scales to see between -250 and 250
6. Make sure the pendulum is hanging down motionless and the encoder cable is not interfering
with the pendulum.
7. In the Swing-Up Control Parameters, set the Activate Swing-Up switch to ON(Pressed down
position)
8. The pendulum should begin going back and forth. If not, click on the disturbance button in the
Signal generator section to perturb the pendulum. Turn off the Active Swing-Up Switch if the
pendulum goes unstable or if the encoder cable interferes with the pendulum arm motion.
9. Gradually increase the reference energy 𝐸𝑟 in the Control Parameters section until the pendulum
swings up in the vertical position. What energy was required to swing-up the pendulum? Was this
the expected value? Attach sample response.

10. Click on the Stop button to stop running the VI

|EEE325 | Control Systems Lab Manual


105
12.5 Post Lab Exercise

Exercise Question 1
Discuss the position sensor used in the system assembly to measure the pendulum and the arm position.
Propose a method if sensor was not available.

|EEE325 | Control Systems Lab Manual


106
Rubric for Lab Assessment

The student performance for the assigned task during the lab session was:
The student completed assigned tasks without any help from the
Excellent 4
instructor and showed the results appropriately.
The student completed assigned tasks with minimal help from the
Good 3
instructor and showed the results appropriately.
The student could not complete all assigned tasks and showed
Average 2
partial results.
Worst The student did not complete assigned tasks. 1

Instructor Signature: ______________________________ Date: ____________________

|EEE325 | Control Systems Lab Manual


107

You might also like