Experimental Control Design for Ball and Beam System

Page 1

FACULTY OF E NGINEERING AND THE E NVIRONMENT ACADEMIC Y EAR 2012/2013 I NDIVIDUAL P ROJECT

Experimental Control Design for Ball and Beam System Author: N AINESH B UMB

Supervisor: D R . D INA S HONA L AILA

Student ID: 24456462

Second Assessor: P ROF. PAUL R. W HITE

April 23, 2013 This report is submitted in partial fulfilment of the requirements for the Degree of Bachelor/Master of Engineering, Faculty of Engineering and the Environment, University of Southampton


Individual Project Academic Integrity Statement

Declaration

I the undersigned confirm that that the material presented in this final project report is all my own work. References to, quotations from and the discussion of work of any other person have been correctly acknowledged or cited within the report in accordance with University guidelines on Academic Integrity.

Signed: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Name (Print in Full): . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

i


Acknowledgements

I would like to thank everyone who has helped towards the completion of this project. I am especially grateful towards Dr. Dina Shona Laila for her supervision, continued support and also for having the courage to entrust her hardware for this project. Without her help, this project would have never been realised. Much appreciation is directed towards my peers: Ayesha Ali, Mandvi Sharma, Rajneesh Shakti Gupta, Jaideep Thar and Vibhu Vyas for helping me write the report skillfully. I would also like to acknowledge my numerous cousins who kept me motivated throughout this project and also proof-read my report. Most of all I would like to thank my parents, Deepak Bumb and Asha Bumb, and my brother Aadesh Bumb who have given me continued support, both emotionally and financially.

ii


Abstract

Ball and beam system is one of the control engineering experiment bench marks used to illustrate balancing mechanism of dynamical systems and to apply control theory in lab. Compared to other experiments it is easier to assemble and is also easy to model theoretically. This system emulates the balancing mechanisms on a system where there is a shift of the centre of mass. The ball and beam system is a classic non-linear experiment. This means that the mathematical model consists of non-linear terms, but the system can be linearized. The linearized model can still be used to perform the experiment robustly. The position of the ball can be controlled by applying linear sensing techniques. In this case, the ball position and the tilting angle of the beam are measured. By this method, the information received from the sensors can be compared to the desired ball position. For instance, in PD control application, the actual and the desired values are compared. The difference between them can be fed back into the controller to obtain the desired position. In this report, an analytical study of the ball and beam system is carried out. It consists of deriving a model of the system by employing physical laws and numerical methods. Linear and non-linear control techniques are adopted to design a controller to achieve certain speed and performance criteria. Response of the closed-loop system is analysed and compared between the different controllers. The comparison is achieved through simulations and experiments.



Contents Statement of Originality

i

Acknowledgements

ii

Abstract

iii

1 Introduction

1

1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.2 Motivation for project . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.3 Aims and Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

1.4 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

2 Plant Modelling

15

2.1 Modelling Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

2.2 System Description . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

2.3 Overall Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

2.3.1 Modelling in Frequency Domain

. . . . . . . . . . . . . . . .

17

2.3.2 Modelling in the Time Domain . . . . . . . . . . . . . . . . . .

27

2.4 System Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

2.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

31

3 Design in Frequency Domain: PD Controller

33

3.1 Ball and Beam Series Control Design . . . . . . . . . . . . . . . . .

33

3.2 SRV02 Controller: Inner Loop Controller Design . . . . . . . . . . .

34

3.3 BB01 Controller: Outer Loop Controller Design . . . . . . . . . . . .

41

3.4 System Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

3.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

52

4 Design in Time Domain: State Space 4.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Simulation Analysis 5.1 Plant Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55 60 61 61

v


Contents 5.2 Frequency Domain Analysis: PD Controller . . . . . . . . . . . . . . 5.3 Time Domain Analysis: State Feedback . . . . . . . . . . . . . . . .

65 68

6 Experimental Analysis 6.1 Experiment Set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Experiment Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . .

71 71 72

7 Conclusion and Future Work 7.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

77 77 77

8 Appendix I 8.1 Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I 8.2 Appendix B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XVII 8.3 Appendix C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XXIII

Word Count - 9442

vi


List of Figures 1.1 This figure shows a chemical plant. .

3

-aircraft-yaw/7209 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4

http://www.123rf.com/photo3499648chemical-plant-site-with-stacks.html

1.2 This figure shows an aeroplane performing a roll. http://www.decodedscience.com/side-effect-of-rolling-an-airplane

1.3 This figure shows the CE106 Ball and beam system. . .

5

1.4 This figure shows the Lieberman Ball and beam system. http://bea.st/sight/rbbb/ . . . . . . . . . . . . . . . . . . . . . . . . .

6

http://www.tecquipment.com/Control/Control-Engineering/CE106.aspx

1.5 This figure shows the Lieberman Ball and beam system. http://www.imath-asia.com/assets/index.php/quanser/ball-and-beam/ . . .

7

1.6 This figure shows the Neural Network block diagram. http://www.cs.adfa.edu.au/research/details2.php?pageid=410 . . . . . . .

9

1.7 This figure shows the Fuzzy Logic block diagram. http://www.crazyengineers.com/threads/fuzzy-logic-and-fuzzy-logic-controllersa-beginners-guide.27248/page-2 . . . . . . . . . . . . . . . . . . . . . .

10

1.8 This figure shows the PID control block diagram. http://radhesh.wordpress.com/2008/05/11/pid-controller-simplified/ . . . .

12

1.9 This figure shows the pole placement controller. http://machinedesign.com/article/take-out-the-shake-0221 . . . . . . . . .

13

1.10 This figure shows the observer controller. http://www.atp.ruhr-uni-bochum.de/rt1/syscontrol/node109.html . . . . . .

14

2.1 This figure shows the relation between simulation model and dynamic model. http://diyhpl.us/ bryan/papers2/Introduction-to-physical-system-modelling.pdf 15

2.2 This figure shows the BB01 + SRV02 block diagram. Ball and Beam Workbook . . . . . . . . . . . . . . . . . . . . . . . . .

16

2.3 This figure shows the SRV02 motor armature circuit. SRV02 Workbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

2.4 This figure shows ball and beam model. Ball Beam Workbook . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

vii


List of Figures 2.5 This figure shows ball and beam model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

2.6 This figure shows ball and beam model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

2.7 This figure shows the state feedback plant without controller. http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction/section

. . . . . . . . . . . . . . . . . . . . . . . . . .

27

3.1 Cascade control system to control ball position in ball and beam system. Ball and Beam Workbook,Quanser . . . . . . . . . . . . . . . . . . . . .

34

=ControlStateSpace/24

3.2 SRV02 motor closed-loop system. Ball and Beam Workbook,Quanser . . . . . . . . . . . . . . . . . . . . .

35

3.3 Roots of the characteristic equation. Matlab figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37

3.4 SRV02 closed-loop block diagram. SRV02 Workbook,Quanser . . . . . . . . . . . . . . . . . . . . . . . . .

38

3.5 Inner Loop Plant Dynamics. . . . . . . . . . . . . . . . . . . . . . . . .

41

3.6 BB01 closed-loop block diagram. Ball and Beam Workbook,Quanser . . . . . . . . . . . . . . . . . . . . .

42

3.7 Ball and beam with ideal PD controller. Ball and Beam Workbook,Quanser . . . . . . . . . . . . . . . . . . . . .

44

3.8 Ball and beam with practical PD controller. Ball and Beam Workbook,Quanser . . . . . . . . . . . . . . . . . . . . .

46

4.1 This figure shows the state feedback with controller. http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction/section= ControlStateSpace/24 . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

5.1 This figure shows the impulse response of the plant. . . . . . . . . .

62

5.2 This figure shows the step response of the plant. . . . . . . . . . . .

63

5.3 This figure shows the root locus plot of the plant. . . . . . . . . . . .

63

5.4 This figure shows the bode plot plot of the plant.

. . . . . . . . . . . . .

64

5.5 This figure shows the impulse response of the PD controller. . . . . . . .

65

5.6 This figure shows the step response of the PD controller. . . . . . . . . .

66

5.7 This figure shows the root locus plot of the PD controller. . . . . . . . . .

66

5.8 This figure shows the bode-plot plot of the plant.

67

. . . . . . . . . . . . .

5.9 This figure shows the simulation results using PD controller.

. . . . . . .

68

5.10 This figure shows the impulse response of the state feedback controller. .

69

5.11 This figure shows the step response of the state feedback controller. . . .

70

5.12 This figure shows the step response of the state feedback controller. . . .

70

6.1 The figure shows the servo motor when connected..

71

viii

. . . . . . . . . . .


List of Figures 6.2 The figure shows the ball and beam system when connected.. . . . . . . 6.3 This figure illustrates the results of the Quanser experiment. . . . . . . . 6.4 This figure illustrates the results of the PD controller derived in this project. 8.1 This figure shows the SRV02 motor (SRV02) Simulink model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 This figure shows the SRV02 plant components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3 This figure shows the SRV02 plant components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4 This figure shows ball and beam model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5 This figure shows ball and beam plant components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6 This figure shows the SRV02 control simulink block. . . . . . . . . . . . 8.7 This figure shows the SRV02 control components. . . . . . . . . . . . . 8.8 This figure shows the BB01 control simulink block. . . . . . . . . . . . . 8.9 This figure shows the BB01 control components. . . . . . . . . . . . . . 8.10 This figure shows the complete simulink model. . . . . . . . . . . . . . . 8.11 This figure shows Rotary Servo Motor. . . . . . . . . . . . . . . . . . . 8.12 This figure shows the Ball and Beam Hardware. . . . . . . . . . . . . . 8.13 This figure shows the Voltpaq-X1 Power Amplifier. . . . . . . . . . . . . 8.14 This figure shows the Q2-USB Data Acquisition Board. . . . . . . . . . . 8.15 This figure shows the Different LED states. . . . . . . . . . . . . . . . . 8.16 This figure shows the connections of the different ball and beam components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ix

72 73 74

XVII XVII XVIII XIX XIX XIX XX XXI XXI XXII XXIII XXIV XXV XXVI XXVI XXVII



List of Tables 1.1 Controller Response [9]. . . . . . . . . . . . . . . . . . . . . . . . . .

12

2.1 System Parameters [8] . . . . . . . . . . . . . . . . . . . . . . . . . .

30

3.1 System Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

xi


1.2. Motivation for project

1 | Introduction

1.1 Introduction The Ball and Beam system is one of the most commonly used experiments in control laboratories. Real world applications modelled on this system include aircraft roll control and chemical plants [1]. The set-up consists of a ball rolling on a beam connected to a SRV02-motor. The rolling of the ball on the beam, and the rotation of the beam through its central axis give the system two degrees of freedom [2]. The aim of the linear 1 , time-invariant 2 experiment is to locate and stabalize the ball at any unstable point, and return the ball to a pre-defined reference point rejecting external disturbances like swinging the beam or pushing/pulling/holding the ball. It is not possible to achieve this using an open-loop control 3 (the system will become unstable). Thus, we introduce a feedback controller to stabilize the system and control the position of the ball [3].

1.2 Motivation for project I have been interested in how human interacts with the environment. It has changed from the time when human controlled every aspect of the system to now where the human interacts with it in a symbiotic way. Along with this, the method of interaction has also changed from physical contact only to gestures-based contact. This type of interaction has intrigued me, and though this project does not rely on gestures, it involves very little physical contact to control it. 1

Linear - A system is said to be linear if the principle of superposition applies, i.e. the input and output are proportional 2 Time-Invariant System - A differential equation in which the coefficients are constants or functions only of time independant variable 3 Open-Loop Control - In this system, the output does not influence the plant dynamics, i.e. the output is not fed back into the system

1


1.3. Aims and Objectives Along with my keen interest in this field, this project is also very beneficial in terms of career opportunities. At the end of the project, I will learn a lot of different skill sets. The project involves programming using Matlab, Simulink to design, analyse and simulate the system, along with creating the interface on Quarc software for the hardware experience. In order to model the ball and beam system, advanced knowledge about control theory, electronics and math is required. The overall knowledge gained from this project would help me in applying for a competitive job in the future. At the end of this project, I wish that this report gets published to educate other students about this system and how different aspects of control theory fit together like a puzzle.

1.3 Aims and Objectives The aim of this project is to effectively construct an experimental set for control design and analysis of a ball and beam balancing system. To achieve the overall target, the objectives are listed below: • Excel in Matlab, Simulink and Quarc programming. • Learn interfacing of hardware and software. • Design linear controller for the system and do thorough analysis of the same. • Make a comparative study between different controllers. • Write a report giving a brief description about the ball and beam system and different types of controllers, deriving the plant dynamics and controller dynamics and analysing the same through simulations and experiments.

2


1.4. Literature Review

1.4 Literature Review Application in different systems The ball and beam system is an open-loop unstable system [4]. This implies that the ball will roll continuously on the beam until there is external disturbance or a controller is introduced. In the real world, there are some modern systems that work on this principle. These are complicated systems especially due to the underactuated nature of the system. Hence, it is important to understand the control theory behind these unstable systems and develop a way to introduce feedback control to safely operate them [5]. Some important examples of such systems are: 1. Chemical Industry Most of the chemical plants involve exo-thermic reactions wherein heat is expelled. The expulsion of heat reduces the reaction speed and the temperature decreases. In some cases, the reaction speed increases and the temperature rises even though heat is being expelled. In this situation, it is important to reduce the effect of heat released due to the chemical reaction and to do this, control is used [5]. Figure 1.1 illustrates the application of ball and beam control in the chemical industry.

Figure 1.1: This figure shows a chemical plant. http://www.123rf.com/photo3499648chemical-plant-site-with-stacks.html

3


1.4. Literature Review 2. Aerospace Industry Feedback control gave the aerospace industry new wings. Before the invention of feedback control, vertical launch of an aircraft was a highly complicated process. It’s introduction elevated the whole industry. Control of a rocket or aircraft during the launch is achieved by controlling the angle of the thruster jets or diverters. Without control, there is a high risk of the aircraft tumbling or tipping over [5]. Figure 1.2 illustrates the application of ball and beam control in the aerospace industry.

Figure 1.2: This figure shows an aeroplane performing a roll. http://www.decodedscience.com/side-effect-of-rolling-an-airplane -aircraft-yaw/7209

The examples mentioned above work on the same principle as the ball and beam system. Learning the dynamics and control of a ball and beam system will help to understand the working mechanisms and control of these systems [5].

4


1.4. Literature Review

Different Ball and Beam Models There have been many iterations of the ball and beam system. Some of them are described in this section. 1. CE106 CE106 ball and beam system is created by TQ (Tecquipment) Education and Training Ltd. It is a popular system implemented in many universities throughout the world. This is a centre-pivoted system. This means that the beam is balanced at the centre. It is easy to understand and it has all the features to comprehend control theory thoroughly. It is used as a model to simulate control of unstable systems. The problem of stability of a rocket or missile during launch is solved using the ball and beam system [6].

Figure 1.3: This figure shows the CE106 Ball and beam system. http://www.tecquipment.com/Control/Control-Engineering/CE106.aspx

Features: The CE106 is an unstable control system. This means that when an input or disturbance is added to the system, the system does not return to its initial stable state. The apparatus is compact and portable. Since a person can see what part of the system they can control and affect, it can be used to demonstrate control theory (angle, velocity and position) to students. Real life application of CE106 system: Missile/ rocket take-off [6].

5


1.4. Literature Review The apparatus consists of a beam pivoted at the centre. The beam supports two parallel wires in tension, and a steel ball is rolled on the wire. The beam is connected to a SRV02 motor which controls the angle and sensors measure all parameters like ball position and beam angle [6]. There are two main control sections for this system. The first is to control the beam angle, which is done by manipulating the voltage that goes into the motor to ensure that the motor speed remains at required speed. Then, using this beam angle as the input, the position of the ball is controlled. The controller used is PD controller [5]. 2. Lieberman The Ball Balancing Beam shown in figure 1.4 is another example of a ball and beam system. It was built by Jeff Lieberman. The set-up of this system is similar to that of the CE106 i.e. the beam is centre-pivoted. Like CE106, Lieberman is easy to understand. The dynamics of the system are similar to those of the CE106 system. Also, the method to give control to the system is the same. This system also uses the PD controller [7].

Figure 1.4: This figure shows the Lieberman Ball and beam system. http://bea.st/sight/rbbb/

6


1.4. Literature Review 3. Quanser The ball and beam system provided by Quanser (figure 1.5) is described in detail in this report. The set-up of the apparatus is different to the two mentioned before. The pivot is placed on one end of the beam instead of the center. Due to the configuration, the dynamics of the system differs from the other systems. However, all of the systems described have the same path to gain control. This system is also quite popular with universities teaching control systems. The system can be controlled in the time-domain and frequency domain [8]. In this report, a detailed insight will be given for both cases.

Figure 1.5: This figure shows the Lieberman Ball and beam system. http://www.imath-asia.com/assets/index.php/quanser/ball-and-beam/

7


1.4. Literature Review

Types of Controller A control system is required to stabilise the open loop unstable ball and beam environment. There are many controller designs that could be incorporated with the ball and beam for this purpose. Some of the controllers are: • Neural Network • Fuzzy Logic • Linear Quadratic Regulator (LQR) • Linear Quadratic Gaussian (LQG) • Robust Control • Proportional Integral Derivative (PID) Control • State Observer with State Feedback Control [9] The controllers provide a fair performance depending on the level of design efficiency. The main crtieria for the controller is that it should be able to stabilise the ball. A major hinderance for the ball stability is the noise generated during the roll. Thus, the system is a good example where an understanding of designperformance compromise could be achieved [9]. Some of the controller designs are explained in brief. 1. Intelligent Control / Heuristic • Neural Network In neural networks, an unknown function is approximated for a given input. This is done by changing the values of the parameters to match the unknown function response. For the ball and beam system, the unknown function is the ball position (output) and the neural network is the plant model. If the unknown function corresponds to inverse of the system, then the neural network is the controller. There are many neural network architectures available. The most common architecture is the multilayer perceptron. Multilayer perceptron is a stack of single components. Multilayer neural networks are used to control systems, and this is achieved by implementing controllers. The three general neural networks are model predictive control, NARMA-L2 control and model

8


1.4. Literature Review reference control. All of the aforementioned controllers are based on standard linear control architectures [10]. Neural networks require two steps to achieve control: system identification and control design. Initially, a neural network model is developed of the plant to be controlled. Later, in the control design stage, the plant model is utilised to design the controller. For the three controllers mentioned above, the system identification stage is the same, however the control design stage differs for all of the above controllers [10].

Figure 1.6: This figure shows the Neural Network block diagram. http://www.cs.adfa.edu.au/research/details2.php?pageid=410

• Fuzzy Logic Fuzzy Logic tries to bring certainty to the answer of an uncertain logical question. It has been succesfully used commercially in consumer products. Fuzzy logic algorithm is easy to design and implement. It is not used to solve technical problems, but it is a popular method to solve simple and quick control problems [11]. Figure 1.7 illustrates the fuzzy logic controller block diagram. Consumer products that use Fuzzy Logic are air conditioner, washing machine/ dryers, vacuum machines, microwave ovens, refrigerators, television, still and video cameras, vehicle climate control, four-wheel steering and many more [11]. The advantage of using Fuzzy Logic controllers is that it doesn’t require a precise model and the code can be easily modified to compliment the system. It is a multi- input/output (MIMO) source [12].

9


1.4. Literature Review Fuzzy Logic controller can be created in the following three steps: 1. Create membership values 2. Specify rule table 3. Follow a procedure to defuzzify the result. [12]

Figure 1.7: This figure shows the Fuzzy Logic block diagram. http://www.crazyengineers.com/threads/fuzzy-logic-and-fuzzy-logiccontrollers-a-beginners-guide.27248/page-2

2. Analytical Control • Proportional Integrator Derivative Control Proportional Intergrator Derivative (PID) is the most typical feedback controller. It could be designed in the frequency domain and time domain. PID controllers are used in most of the fields where control is required. There are various iterations of the controller. It can be used as a stand-alone, i.e. P, I, D individually, or it can also be in combined form i.e. PI,PD,PID form. PID controller forms a part of the complex systems used in many fields. It is combined with other simple blocks like logic, sequential functions and other simple blocks to form the complex system [2]. Proportional control measures the deviation in the error in the system and controls it. It can be stated that the controller is proportional to the error in the system. It reacts to any deviation without lag and works only if there is a deviation. It depends on the amplitude of the error. The

10


1.4. Literature Review relation between the output and the error is given in equation 1.1 [13]. y = Kp · e

(1.1)

Here, y is the output, e is the error and Kp is the proportional control coefficient. Kp describes the gradient in the equation. This implies that a high Kp value results in a gradient that responds to small deviations in the system. The system response becomes faster due to the its immediate reaction when an error occurs. It makes the system more stable. A drawback of the control system is that steady state error is be achieved when a disturbance is introduced since the control only works when there is a system deviation present [13]. Integral control is used to reduce the steady state error in the system. It observes the error in the system and makes changes according to the amount of error in the input [14]. Mathematically, integral control is expressed in equation 1.2 [13]. Z y = Ki

e dt

(1.2)

Here, Ki is integral control coefficient. Ki is inversely proportional to integral time τn [13]. The effect of integral control is observed after the initial transient state is finished, .i.e in the steady state. The drawback of implementing integral control is that it makes the system’s response slower to an input. This happens at high integral time. At small τn , the system oscillates [13, 15]. Deriviative control is used in a case when the error in the system varies consistently. It adds an extra layer of stability to the system (upto a certain point). It depends on the rate of change of the error. So, it reduces the system’s response time to a given input. Hence, for a system where a fast response is critical, derivative controller is used [16]. The controller doesnot recognise steady-state error since its rate of change is always zero. For this reason derivative controller is usually used in combination with proportional controller. Mathematically, the PD control is expressed in equation 1.3 [13]. y = Kp · e + Kd

de dt

11

with : Kd = Kp · τv

(1.3)


1.4. Literature Review Here, Kd is derivative control coefficient. Kd is directly proportional to rate time (Ď„v ) [13]. A drawback of the using derivative controller is that it amplifies the noise4 generated by the system. A solution to this problem lies in using filters to filter out the noise [16]. A summary of the response characteristics of each controller is given in table 1.1.

CL Response kp ki Kd

Table 1.1: Controller Response [9]. Rise Time Overshoot Settling Time Decrease Decrease Small Change

Increase Increase Decrease

Small Deviation Increase Decrease

Steady State Error Decrease Eliminate Small Change

Figure 1.8: This figure shows the PID control block diagram. http://radhesh.wordpress.com/2008/05/11/pid-controller-simplified/

For the ball and beam system, the controller sends an output signal (Vm ) to the plant. The resultant output acquired from the plant is (X). This output is fed back to the sensor again to find a new error signal (e) i.e. e = Xd − X [9].

4

Noise - "Small, rapid changes in the process variable, and consequently rapid changes in the error [16]."

12


1.4. Literature Review • State-Space Feedback State-space feedback is designed in the time domain. The input/output relations are well defined in this technique. Feedback control is used to improve the performance of single-input-single-output (SISO) systems achieved initially through frequency-domain approach. The improvements are as follows: the output follows the reference inputs in the steady state and transient state, and it can reject the disturbance thus reducing the sensitivity of the system. Another advantage of using feedback control is the fact that pole locations can be pre defined. This ensures that the system can be made to perform according to the task at hand [17]. There are various types of controllers that can be implemented in the time domain. The first control method is known as the pole placement design method. This method is applicable to a linear time-invariant (LTI) system. If the LTI system is state controllable, then the closed-loop poles can be placed at any position in the s- or z-plane to procure the feedback gains [17]. The control law used to design the controller is u = −Kx and the pole locations are given by the eigenvalues of the matrices (A-BK). The pole locations can either be defined as real or complex-conjugate pairs. The system can be modified to accomodate a constant reference point and the addition of disturbance inputs. The control law modifies to u = −Kx + N yd where yd is a vector of reference inputs [17].

Figure 1.9: This figure shows the pole placement controller. http://machinedesign.com/article/take-out-the-shake-0221

13


1.4. Literature Review Another method to design feedback controllers is by implementing observers. These controllers satisfy separation property i.e. the eigenvalues of the observer and controller are the same, hence they can be fed to the observer-controller. The characteristic equation for such a configuration leads to det(sI − A + BK)det(sI − A + LC) = 0 Observers estimate the state of the controller at the cost of its performance. State feedback has a better transient response than such controllers. There is a decrease in the robustness of the controller [17].

Figure 1.10: This figure shows the observer controller. http://www.atp.ruhr-uni-bochum.de/rt1/syscontrol/node109.html

14


2.1. Modelling Types

2 | Plant Modelling

2.1 Modelling Types All dynamic systems fall under either of the two principle methods: 1. First Principles: The physical system is analysed using the fundamental physics laws. These laws are modified to simplify the particular system and provide the model in differential equation form [18]. 2. Database Model Identification: The physical system is observed and the data gathered is used to model the system [18].

Figure 2.1: This figure shows the relation between simulation model and dynamic model. http://diyhpl.us/ bryan/papers2/Introduction-to-physical-system-modelling.pdf

15


2.3. Overall Model

2.2 System Description The plant 1 system includes a solid ball, a beam, a SRV02 motor and various sensors. The main objective of the experiment is to control the position of the ball placed on the beam by controlling the beam angle. This is achieved by controlling the SRV02 motor speed since the beam is linked to the motor. The torque generated by the motor influences the beam to tilt. The ball rolls on the beam depending on the tilt angle. Using the sensors, the position of the ball can be controlled. In the following section, the plant dynamics of the system are analysed. As mentioned previously, the plant is an open-loop unstable system.

2.3 Overall Model The Ball and Beam experiment incorporates two sub-systems: Ball and Beam plant and SRV02 plant [19]. The whole system can be illustrated in Figure 2.2:

Figure 2.2: This figure shows the BB01 + SRV02 block diagram. Ball and Beam Workbook

In Figure 2.2, the measured input voltage Vm (s)(V) is fed to both plants i.e. SRV02 plant with transfer function Ps (s) and BB01 plant with transfer function Pbb (s). The output obtained is Xs (s) (V). The overall plant can be divided into two components: • Model of the beam angle θl (s) with respect to the motor voltage Vi (s) - Ps (s) • Model of ball position X(s) with respect to the beam angle θl (s) - Pbb (s) 1

Plant - A plant is defined as an entity, such as equipments, with the purpose to perform a particular operation [2]. The apparatus of the experiment is the plant for this system

16


2.3. Overall Model The transfer function of the overall model (i.e. the input voltage Vi (s) to the voltage that corresponds to the position of the ball Vm (s) [19].

P (s) = Ps (s) · Pbb (s)

(2.1)

2.3.1 Modelling in Frequency Domain Modelling SRV02 Plant Components In this section, the relation between the motor input voltage (Vm ) and the angle of the beam (θl ) is derived and is definedby the motor transfer function [19]. Ps (s) =

θl (s) K = Vm (s) s(τ s + 1)

(2.2)

In Equation 2.2, K is the nominal constant value and τ is the time constant. The values of K and τ are found using first principles method. Consider the following diagram:

Figure 2.3: This figure shows the SRV02 motor armature circuit.SRV02 Workbook

17


2.3. Overall Model Electrical equations: The current in the motor Im (t) is found using the electrical equations as [20]: Im (t) =

Vm (t) − km · ωm (t) Rm

(2.3)

In Equation 2.3, Vm (t) is the input motor voltage, km is the back-emf motor constant, ωm (t) is the motor shaft speed, Rm is the resistance provided by the motor. Mechanical equations: The mechanical equations describe the relation between the load shaft speed (ωt ) and motor torque (τm ).

• The total moment of inertia in the motor (Jeq ) is given by the following equation [20]: Jeq = ηg · Kg2 · Jm + Jl

(2.4)

In Equation 2.4, ηg is the gearbox efficiency, Kg is the gear ratio, Jm is the moment of inertia of the motor shaft, Jl is the moment of inertia of load shaft. • Similarly, the total effect of viscous friction on the shaft of the motor (Beq ) is given by the following equation [20]: Beq = ηg · Kg2 · Bm + Bl

(2.5)

In Equation 2.5, ηg is the gearbox efficiency, Kg is the gear ratio, Bm is the viscous friction on the motor shaft, Bl is the viscous friction on the load shaft.

The actuator gain (Am ) and damping term (Beq,ν ) are derived by solving the electrical and mechanical equations simultaneously [20]:

Beq,ν =

ηg · Kg2 · ηm · kt · km + Beq · Rm Rm

18

(2.6)


2.3. Overall Model

Am =

ηg · Kg · ηm · kt Rm

(2.7)

ηm is the motor efficiency and kt is the current-torque constant in equations 2.6 and 2.7. Now, the SRV02 plant transfer function can be obtained using the following Laplace equation [20]: Jeq sθl (s) + Beq,ν θl (s) = Am Vm (s)

Thus, the transfer function is: θl (s) Am = Vm (s) Jeq s + Beq,ν

(2.8)

Comparing the coefficients in Equation 2.2 and 2.8: Time constant parameter τ=

Jeq Beq,ν

(2.9)

K=

Am Beq,ν

(2.10)

Steady-state gain -

Evaluating the expressions to obtain the values of τ and K: The value of the viscous damping factor is found experimentally in high gear configuration and is equal to Beq = 0.015 N-ms / rad. Substituing all parameter values in Equation 2.6 gives Beq,ν = 0.0844 N-ms / rad, in Equation 2.7 gives the actuator gain value Am = 0.129 N-m / V and in Equation 2.4 gives the total moment of inertia acting on the shaft Jeq = 0.00213 kg-m2 Thus, the steady-state value is obtained by substituting the values obtained above in Equation 2.10: K = 1.53 rad/V s (2.11)

19


2.3. Overall Model Also, the time constant value is obtained by substituting the values in Equation 2.9 [20]: τ = 0.0253 s (2.12)

Modelling Ball and Beam Plant Components In this section, we derive the relation between the position of the ball X(s) and the angle of the beam α(s). Consider the following diagram:

Figure 2.4: This figure shows ball and beam model. Ball Beam Workbook

Let the inclination be in the x-direction. Hence, the acceleration of the ball in this direction can be denoted as d2 x = x¨ dt2 The equation of motion of the ball can be derived using Newton’s Laws of Motion, which states that “The sum of forces acting on the ball along the beam equals” [19] mb · x¨ =

X

F

(2.13)

In Equation 2.13, mb is the mass of the ball. By neglecting friction and viscous damping, the sum of forces can be reduced to the equation: mb · x¨ = Fx,t − Fx,r

20

(2.14)


2.3. Overall Model In Equation 2.14, Fx,t is the translational force due to gravity, Fx,r is the rotational force due to inertia. For the ball to be stationary at a given point, i.e. for the equation of motion to equal zero, the force due to gravity must be equal to the force due to inertia [19]. Fx,t = Fx,r

The translation force due to gravity (Fx,t ) can be found as: Fx,t = mb · x¨ = mb · g · sinα(t)

(since x¨ = g · sinα(t))

(2.15)

The torque produced by the rotation of the ball (Tr ): Tr = Fx,r · rb dωb =J· dt

(Linear Relation) (Angular Relation)

(2.16)

Using the relation, νb = ωb · rb , we can convert between linear and angular velocities. d(νb /rb ) dt d2 (x/rb ) =J· dt2 J = x¨ rb

Tr = J ·

(2.17)

Here, rb is the radius of the ball, J is the moment of inertia, ωb is the angular velocity of the ball and νb is the linear speed of the ball along x-direction. Thus, the force caused by the rotation of the ball is: Tr rb J = 2 x¨ rb

Fx,r =

21

(2.18)


2.3. Overall Model Substituting the translational and rotational forces obtained in Equations 2.17 and 2.18 to get the overall equation of motion: mb · x¨ = mb · g · sinα(t) −

J x¨ rb2

(2.19)

Solving for the acceleration: mb x¨ +

J x¨ = mb · g · sinα(t) rb2

x¨(mb +

J ) = mb · g · sinα(t) rb2

Thus: (2.20)

The final acceleration equation is [19]: x¨ =

mb · g · sinα(t) · rb2 mb rb2 + J

(2.21)

Linking SRV02 Plant Components to Ball and Beam Components In the previous sections, the equation of motion representing the beam angle relative to the motor voltage, and the position of the ball relative to the beam angle were derived. In this section, the relation between the motor voltage and the position of the ball is derived. Due to the involvement of a rotational component, the resulting equation will involve a trigonometric term and become non-linear. The height of the beam (h) influences the beam and motor angles. Refer to Figures 2.5 and 2.6 for the relations given below. A relationship can be formed between the beam angle and beam height by taking sine of the beam angle: sinα(t) =

22

h Lbeam

(2.22)


2.3. Overall Model

Figure 2.5: This figure shows ball and beam model.

A similar relation can be dervied between the motor angle and beam height by taking the sine of the motor angle:

sinθ(t) =

h rarm

(2.23)

Figure 2.6: This figure shows ball and beam model.

Comparing Equations 2.22 and 2.23, the relation between the beam and motor angle can be obtained: sinα(t) =

sinθl (t) · rarm Lbeam

23

(2.24)


2.3. Overall Model Plugging the value of sin α(t) found in Equation 2.24 into equation 2.21: x¨ =

mb · g · sin θl (t) · rarm · rb2 Lbeam (mb rb2 + Jb )

(2.25)

Using small angle approximations for the motor angle: sin θl (t) ≈ θl (t)

(2.26)

Using this approximation method to linearize the non-linear equation of motion: x¨ =

mb · g · θl (t) · rarm · rb2 Lbeam (mb rb2 + Jb )

(2.27)

Combining all the constant values together into a single parameter Kbb . Kbb =

mb · g · rarm · rb2 Lbeam (mb rb2 + Jb )

(2.28)

Using the value of Kbb found in Equation 2.28, the Equation 2.25 can be reduced to: x¨ = θl (t) · Kbb

(2.29)

It is difficult to model a system using differential equations. Laplace transform changes the function from time-domain, f (t), to a function in the s-domain, f (s) such that integration and differentiation are changed to algebraic operations. Taking Laplace Transform of Equation 2.29:

Consider L.H.S term:

x¨ =

d2 x 0 = s2 X(s) − sx(0) − x (0) 2 dt

Let x(t=0)=0):

d2 x = s2 X(s) dt2

(2.30)

24


2.3. Overall Model Consider R.H.S term:

For an impulse response function: (small angle θ can be considered as an impulse response function) θl (t) · Kbb = θl (s) · Kbb

(2.31)

Substituting the values obtained in the Equations 2.30 and 2.31: s2 X(s) = θl (s) · Kbb Thus: X(s) Kbb = 2 θl (s) s

(2.32)

Equation 2.32 describes the transfer function (Pbb (s)) that relates the motor voltage to ball position. Hbb (s) =

Kbb X(s) = 2 θl (s) s

(2.33)

The open loop block diagram suggests that both SRV02 Plant and BB01 Plant are in series. Thus, by inserting the BB01 Plant transfer function (Equation 2.33) and the SRV02 Plant transfer function (Equation 2.2) into Equation 2.1, the transfer function P(s) of the entire mechanism can be derived [19]: P (s) = Pbb (s) · Ps (s) X(s) θ(s) · θ(s) V (s) X(s) = V (s) Kbb K = 2 · s s(τ s + 1) Kbb K P (s) = 3 s (τ s + 1) =

25

(2.34)


2.3. Overall Model The value of Kbb obtained in Equation 2.34 can be further deduced:

Substituting the relation of Kbb found in Equation 2.28 Kbb =

mb · g · rarm · rb2 Lbeam (mb rb2 + Jb )

The moment of inertia (Jb ) of the ball: Jb =

2 · mb rb2 5

(2.35)

Substituting the value of (Jb ) in Equation 2.28, the equation reduces to Kbb =

g · rarm Lbeam (1 + 25 )

(2.36)

Thus, the final Kbb equation becomes: Kbb =

5 · g · rarm 7 · Lbeam

(2.37)

A numerical value of Kbb can be obtained by substituting the values of the specifications of the system giving in section (3.4):

Solving the equation: 5 · 9.8 · 0.0254 7 · 0.4255 = 0.4179 m/s2

Kbb =

26

(2.38)


2.3. Overall Model

2.3.2 Modelling in the Time Domain The block diagram of the plant is given in Figure 2.7.

Figure 2.7: This figure shows the state feedback plant without controller. http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction/section =ControlStateSpace/24

The dynamics equation of ball and beam system can be presented in state space form as: x(t) ˙ = Ax(t) + Bu(t)

(2.39)

y(t) = Cx(t) + Du(t)

(2.40)

Here matrix A represents the dynamics of the plant; matrix B denotes the position of system actuator; the relation between the state and the output is represents by matrix C; matrix D is equal to zero. The plant gain is given in transfer function form. Hence, to design the controller, state space form of the plant is formed. The gain of the plant is given by Equation 2.34. P (s) =

Kbb K Y (s) = 3 U (s) s (τ s + 1)

From the given transfer function, the differential equation for the system is; τ y 0000 + y 000 = Kbb Ku

27


2.3. Overall Model This can be modified to the following equation Kbb K 1 u y 0000 + y 000 = τ τ

(2.41)

Choosing the state variables as: x1 (s) = y(s) x2 (s) = sy(s) x3 (s) = s2 y(s) x4 (s) = s3 y(s) Taking derivative to obtain state space model sx1 (s) = x2 (s) = sy(s) sx2 (s) = x3 (s) = s2 y(s) sx3 (s) = x4 (s) = s3 y(s) Kbb K 1 u(s) sx4 (s) = s4 y(s) = − s3 y(s) + τ τ The state space form is sx(s) = Ax(s) + Bu(s)     0 0 1 0 0       0 0 1  0  x(s) + 0 u(s) sx(s) =  0 0 0  0 1     0 0 0 −40.3226 1 y(s) = Cx(s) + Du(s) h i y(s) = 25.8057 0 0 0 x(s) + 0 · u(s)

(2.42)

(2.43)

The state space representation given in Equations 2.42 and 2.43 is in the controllable canonical form. The controllable canonical form is important in discussing pole-placement method to design the controller [2]. The stability of the system can be determined by obtaining the eigenvalues of the system. The eigenvalues 2 are obtained by solving the determinant of the state space. 2

Eigenvalue - They are the roots of the characteristic equation.

28


2.3. Overall Model Consider the matrix A:  0  0 A= 0  0

1 0 0 0

 0 0   1 0   0 1  0 −40.3226

The eigenvalues are the roots of the characteristic equation sI − A = 0 Thus, the characteristic equation is:

s 1 0

0

0 s 1

0

sI − A =

1

0 0 s

0 0 0 s + 40.3226

s 1

0

0 = s 0 s 1

0 0 s + 40.3226

0 = s[s(s2 + 40.3226s)] 0 = s3 (s + 40.3226) 0 = s + 40.3226 s = −40.3226

−40.3226

0

s=

0

0

(2.44)

The eigenvector of the system is given in Equation 2.44. There is a negative pole that drives the system back to the steady-state position. There are also three poles at zero. This is a case of multiple eigenvalues appearing at the same point. This may represent an edge case where the system becomes extreme at that point. The system may fail at this point. The multiple eigenvalues occur at zero i.e. near the positive half of the plane. Thus, the system becomes unstable since the eigenvalue approaches infinity [21]. The system does not go back to the steady state condition after a disturbance occurs. Thus, it is considered to be an unstable system [22].

29


2.4. System Parameters

2.4 System Parameters Table 2.1 describes the main parameters used in the ball and beam experiment. [8] They are used to derive the mathematical model.

Symbol

Table 2.1: System Parameters [8] Description Units

Value

Matlab Variable

km

Back-emf constant of motor

V s / rad

7.68 e-3

km

kt

Current torque constant

Nm/A

7.68 e-3

kt

Kg

Gear ratio

70

Kgi

ωm

Motor shaft speed

rad / s

628.3

Rm

Motor armature resistance

Ohm

2.6

Rm

ηg

Gearbox efficiency

0.90

eta _g

ηm

Motor efficiency

0.69

eta _m

Jm

Motor shaft moment of inertia

kg m2

3.9 e-7

Jm _rotor

Jt

Load shaft moment of inertia

kg m2

7.06 e-8

Jtach

Beq

Equivalent Viscous friction on shaft

N m s / rad

0.015

Beq

Lbeam

Beam Length

m

0.4255

L _b

rarm

SRV02 output and beam distance

m

0.0254

r _arm

rb

Radius of Ball

m

0.0127

r _b

mb

Mass of Ball

kg

0.0640

m _b

30


2.5. Summary

2.5 Summary • SRV02 Transfer Function

Ps (s) =

K θ(s) = V (s) s(τ s + 1)

with: K = 1.53 τ = 0.0248 • BB01 Transfer Function

Pbb (s) =

X(s) Kbb = 2 θ(s) s

with: Kbb = 0.4179 • Overall Plant Transfer Function

P (s) =

Kbb K 3 s (τ s + 1)

P (s) =

0.6394 s3 (0.0248s + 1)

• State Space Form of Plant

sX(s) = Ax(s) + Bu(s) with:

 0  0 A= 0  0

1 0 0 0

   0 0 0       1 0  & B = 0  0 0 1    0 −40.3226 1

31


2.5. Summary

Y (s) = Cx(s) + Du(s) with: h

i C = 25.8057 0 0 0 & D = 0

32


3.1. Ball and Beam Series Control Design

3 | Design in Frequency Domain: PD Controller

3.1 Ball and Beam Series Control Design The block diagram of the ball and beam series control system is illustrated in Figure 3.1. The block diagram consists of two main parts: Control and plant wherein each system has BB01 and SRV02 blocks. There are two actuators processing the feedback input and outputting the steady state error value [19]. The system includes four variables : Input voltage Vl (s), ball position X(s), beam angle θl (s) and output voltage Vm (s). Consider the outer loop only- The ball and beam (BB01) control block, based on the output ball position X(s), the transfer function Cbb (s) of the block, computes the SRV02-motor angle θd (s) to get the desired ball position Xd (s). This system controls the angle of the beam based on the actual position of the ball X(s) and its desired position Xd (s). The SRV02 position (SRV02) control block forms the inner loop system. This system controls the voltage that is fed to the ball and beam plant model using the actual θl (s) and desired θd (s) values of the beam angle [19].

33


3.2. SRV02 Controller: Inner Loop Controller Design

Figure 3.1: Cascade control system to control ball position in ball and beam system. Ball and Beam Workbook,Quanser

3.2 SRV02 Controller: Inner Loop Controller Design The time-domain characteristics like steady-state error, peak time and percent overshoot, used to control the position of the SRV02-motor are: ess = 0

(3.1)

tp = 0.20s

(3.2)

P O = 5.0%

(3.3)

These characteristics help define the response of the system. Thus, to have a quick response from the SRV02-motor, Peak time (i.e. the response of the SRV02-motor to a given input) of the response should ideally be less than or equal to 0.15 sec. Similarly, the percent overshoot (i.e. the difference between the desired angle of the SRV02-motor arm to the actual angle) of the system should not cross 5% and there should not be any steady-state error [19]. The inner loop consists of the SRV02 controller and the servo motor plant. It uses a PV (position-velocity) controller to manage the position of the SRV02-motor shaft arm. In Figure 3.1 it is represented by Cs (s).

34


3.2. SRV02 Controller: Inner Loop Controller Design Calculating the proportional (Kp ) and velocity (Kv ) gains. These values show whether the controller matches the performance criteria specified in Section 3.2.

Figure 3.2: SRV02 motor closed-loop system. Ball and Beam Workbook,Quanser

Definitions: Peak time: Time the response takes to rise to first peak [19]. tp =

π p ωn 1 − ζ 2

(3.4)

Percent Overshoot: Maximum percentage of the response exceeding steady state value [19]. −πζ ) P O = 100exp( p 1 − ζ2

(3.5)

Using Equation 3.5 and the specifications for SRV02-motor given in Section 3.2, the damping ratio 1 needed to calculate the percent overshoot can be found. −πζ ) P O = 100exp( p 1 − ζ2 Substituting the value of PO and solving: −πζ exp( p ) = 0.05 1 − ζ2 Taking log on both sides: −πζ (p ) = ln(0.05) 1 − ζ2 1

Damping Factor-It gives the measure of how much the system has oscillated [2].

35

(3.6)


3.2. SRV02 Controller: Inner Loop Controller Design Thus: ζ p = −0.9536 ( 1 − ζ 2) Squaring both sides: ζ2 = 0.9093 (1 − ζ 2 ) On further simplification: ζ 2 + 0.9093 ζ 2 = 0.9093 This simplifies to: ζ 2 = 0.4762

(3.7)

ζ = 0.6901

(3.8)

The Damping Factor is:

Also, obtaining the value of natural frequency given in 3.4:

2

required to meet the peak time

tp =

π p ωn 1 − ζ 2

ωn =

π p tp 1 − ζ 2

ωn =

π √ 0.20 1 − 0.69012

Interchanging the values:

Substituting the values:

The natural frequency is [19]: ωn = 21.7048 rad/s

2

Natural Frequency-It is the frequency of the oscillation with no damping.

36

(3.9)


3.2. SRV02 Controller: Inner Loop Controller Design The characteristic equation 3 of the closed-loop transfer function is: s2 + 29.9573s + 471.1004 = 0

(3.10)

The roots (poles) 4 of the characteristic equation are: s1,2 =

−29.9573 ±

s1,2 =

p (−29.9573)2 − 4 · 1 · 471.1004 2·1

−29.9573 ± j 31.4159 2

The roots are: s1 = −14.9787 + 15.7079 j

(3.11)

s2 = −14.9787 − 15.7079 j

(3.12)

The following Figure 3.3 shows the plot of the roots of the equation.

Figure 3.3: Roots of the characteristic equation. Matlab figure

3

Characteristic equation - The relation formed by equating the denominator of a transfer function to zero. 4 Poles - Poles are the solution of the characteristic equation det(sI − A = 0)

37


3.2. SRV02 Controller: Inner Loop Controller Design The roots of the equation lie in the negative half of the s-plane i.e. the roots have negative real parts. Thus the system output is stable. The complex part of the roots have a positive and negative values. Also, there are no purely imaginary roots in the system i.e. the real part of the roots are equal to zero. This makes the system non-oscillatory. Equation 3.13 describes the role of the proportional-velocity (PV) controller in the control of the SRV02 position [20]: Vm (t) = kp [θd (t) − θl (t)] − kv (

d θl (t)) dt

(3.13)

Here, kp is the proportional control gain, kv is the velocity control gain, θd (t) is the desired load shaft angle, and θl (t) is the measured load shaft angle The block diagram for the SRV02 controller is given in the following Figure 3.4.

Figure 3.4: SRV02 closed-loop block diagram. SRV02 Workbook,Quanser

Taking the Laplace Transform of Equation 3.14 to acquire the closed-loop transfer function θl (s) / θd (s) Vm (s) = kp [θd (s) − kp θl (s)] − kv (s) θl (s)

38

(3.14)


3.2. SRV02 Controller: Inner Loop Controller Design From Equation 2.2, the SRV02 plant transfer function is given as: θl (s) K = Vm (s) s(τ s + 1) Plugging the value of Vm (s) found in Equation 3.15: θl (s) K = kp θd (s) − kp θl (s) − kv (s) θl (s) s(τ s + 1) Thus, θl (s)(s(τ s + 1)) = K[kp θd (s) − kp θl (s) − kv (s) θl (s)] Taking θl (s) common in R.H.S: θl (s)(s(τ s + 1)) = K[kp θd (s) − θl (s)(kp + kv (s))] Adding all θl (s) terms: θl (s)[τ s2 + (1 + K kv )s + K kp ] = Kkp θd (s) Therefore, the SRV02 controller transfer function is: θl (s) Kkp = 2 θd (s) τ s + (1 + K kv )s + K kp This can be written in the following form: θl (s) = θd (s) s2 +

Kkp τ (1+K kv )s τ

+

K kp τ

(3.15)

The standard second-order transfer function is: ωn2 θl (s) = 2 θd (s) s + 2 ζ ωn s + ωn2

(3.16)

Comparing Equations 3.15 and 3.16: ωn2 =

Kkp τ

(3.17)

kp =

ωn2 τ K

(3.18)

Rearranging the equation:

39


3.2. SRV02 Controller: Inner Loop Controller Design Thus, kp = 7.6361 V /rad

(3.19)

Similarly, 1 + Kkv τ

(3.20)

2 ζ ωn τ − 1 = kv K

(3.21)

kv = −0.1680 V /rad

(3.22)

2 ζ ωn = Rearranging the equation:

Thus,

It is a type 1 system controller i.e there is one integrator in the transfer function. For a type 1 system, there is a velocity error constant (ramp (1/s) input). Here, the gain kv = K kbb = 0.65. Thus: kp = ∞

(3.23)

kv = 1/0.65 = 1.53

(3.24)

ka = 0.00

(3.25)

Also, the steady state errors for the system are as follows: U nit step error = 0.00

(3.26)

U nit ramp error = 0.65

(3.27)

U nit parabolic error = ∞

(3.28)

40


3.3. BB01 Controller: Outer Loop Controller Design

3.3 BB01 Controller: Outer Loop Controller Design The characteristics like steady-state error, settling time, settling percentage and percent overshoot, used to control the position of the ball are [19]: |ess | ≤ 0.005m

(3.29)

tp = 3.5sec

(3.30)

cts = 4%

(3.31)

P O = 10.0%

(3.32)

Again, for this time for a given step reference, the percent overshoot (i.e. the difference between the desired position and the actual position) should not exceed 10%. The ball should settle down to within 4% of its stable value (i.e. to a complete stop) around 3.5 seconds. The steady-state error (i.e. the final position of the ball) should be inside 5 mm of the desired position [19]. Considering the dynamics of the outer loop only, i.e. dynamics of the inner loop are considered to be negligible (Cs (s) = 1) (see Figure 3.5). This implies that the inner loop control of the SRV02 system is in perfect condition and the desired shaft angle and actual shaft angle are equal [19]. θl (t) = θd (t)

(3.33)

Figure 3.5: Inner Loop Plant Dynamics.

Hence, the overall system reduces to the block diagram shown in Figure 3.6.

41


3.3. BB01 Controller: Outer Loop Controller Design

Figure 3.6: BB01 closed-loop block diagram. Ball and Beam Workbook,Quanser

For the outer loop, the error given by the difference between the desired ball position Xd (s) and the actual ball position X(s) is used to generate θd (s) which is treated as the input to the inner loop controller Cs (s). As the inner loop controller is assumed to be working in perfect condition, the input will be transformed to θl (s) position. A modification is made to the traditional PD controller for this system as shown in Figure 3.7. The modification lies in the fact that the new controller does not input sXd (s) directly as shown in Figure 3.6, but instead goes through zero location. The idea behind passing the signal through z is to reduce the noise produced by the signals. Where z is the zero location and Kc is the gain of the system. The value of z can be varied to optimise the settling time and overshoot specifications. The Percent overshoot and peak time values obtained in Equations 3.30 and 3.32 are used to find the damping factor and natural frequency.

−πζ ) P O = 100 exp( p 1 − ζ2 Substituting the value of PO and solving: −πζ exp( p ) = 0.1 1 − ζ2

42

(3.34)


3.3. BB01 Controller: Outer Loop Controller Design Taking log on both sides: −πζ (p ) = ln(0.1) 1 − ζ2 Thus: ζ p = 0.7329 ( 1 − ζ 2) Squaring both sides: ζ2 = 0.5372 (1 − ζ 2 ) On further simplification: ζ 2 + 0.5372 ζ 2 = 0.5372 This simplifies to: ζ 2 = 0.3495

(3.35)

ζ = 0.5912

(3.36)

The Damping Factor is:

Also, obtaining the value of natural frequency given in Equation 3.4:

5

required to meet the peak time

tp =

π p ωn 1 − ζ 2

ωn =

π p tp 1 − ζ 2

ωn =

π √ 3.5 1 − 0.592

Interchanging the values:

Substituting the values:

5

Natural Frequency-It is the frequency of the oscillation with no damping.

43


3.3. BB01 Controller: Outer Loop Controller Design The natural frequency is: ωn = 1.1129 rad/s

(3.37)

Ideal PD control design

Figure 3.7: Ball and beam with ideal PD controller. Ball and Beam Workbook,Quanser

The outer-loop controller given in Figure 3.7 is equated as [19]: θd (s) = Kc (z(Xd (s)) − sX(s))

(3.38)

θl (t) = θd (t)

(3.39)

We know that:

Substituting Equation 3.38 into transfer function of SRV02 voltage and ball position given in Equation 2.33: Kbb X(s) = 2 Kc (z(Xd (s)) − sX(s)) s

(3.40)

Kc Kbb X(s) = z(Xd (s) − X(s)) − sX(s) s2

(3.41)

X(s) Kc Kbb = zXd (s) − X(s)(z + s) s2

(3.42)

Solving for X(s)/Xd (s):

44


3.3. BB01 Controller: Outer Loop Controller Design X(s)s2 = Kc Kbb zXd (s) − Kc Kbb X(s)(z + s)

(3.43)

X(s)s2 + Kc Kbb X(s)(z + s) = Kc Kbb zXd (s)

(3.44)

X(s)(s2 + Kc Kbb (z + s)) = Kc Kbb zXd (s)

(3.45)

Hence, the BB01 closed-loop transfer function is: X(s) Kc Kbb z = 2 Xd (s) s + Kc Kbb s + Kc Kbb z

(3.46)

Comparing this equation with the standard second order system: Y (s) ωn2 = 2 R(s) s + 2ζωn s + ωn2

(3.47)

Comparing the co-efficients of the above two equations to find the value of z and Kc in terms of ωn and ζ:

Zero location: ωn2 Kc Kbb

(3.48)

z = 0.9413

(3.49)

z=

Gain: Kc =

2ζωn Kbb

Kc = 3.1456V /rad

(3.50) (3.51)

The transfer function of the ideal controller is: Cci = s + 0.9413

45

(3.52)


3.3. BB01 Controller: Outer Loop Controller Design Practical PD controller

Figure 3.8: Ball and beam with practical PD controller. Ball and Beam Workbook,Quanser

Ideal controller needs to be further modified as it produces a high frequency noise whenever the ball rolls. This happens because the ball position is measured using an analog sensor and it has a noise associated with it. So, whenever this measured value is fed back in the motor, it produces an amplified noise if it is passed through a derivative. This problem can be prevented by using a high pass filter 6 [20]. The transfer function of a first order high pass filter is:

H(s) =

ωf s s + ωf

(3.53)

where: ωf is the cut-off frequency. Setting cut-off frequency to 1 Hz to filter the noise. i.e. ωf = 1Hz Converting to rad/s ωf = 2 · π · frequency ωf = 2 · π · 1 = 6.28

6

rad/s rad/s

(3.54)

High Pass Filter - High pass filter passes high frequency signals and rejects those lower than the cut-off frequency [2]

46


3.3. BB01 Controller: Outer Loop Controller Design Another parameter added to the practical controller is the setpoint weight parameter bsp . It varies the setpoint value used to compute the error velocity.

The practical PD controller filters out the high frequency noise reducing the grinding noise that occurs with the ideal PD controller. This makes the controller more complicated, but the system becomes more robust as there is no work be dissipated into noise. The dynamics of the system have been modified by the addition of the filter. Hence, the gain and zero location have to be re-computed to meet the time-domain specifications. The following equation is derived from Figure 3.8. θd (s) = Kc

ωf s(bsp Xd (s) − X(s)) z(Xd (s) − X(s)) + s + ωf

(3.55)

The SRV02 dynamics are not present in this case as well, i.e. θd (s) = θl (s). Hence, the closed-loop transfer function of practical PD controller can be formulated by substituting the Equation 3.55 into Equation 2.33: X(s)

Kc z(Xd (s) − X(s)) +

ωf s(bsp Xd (s)−X(s)) s+ωf

=

Kbb s2

Kbb Kc X(s)(s + ωf ) = z(s + ωf )(Xd (s)X(s)) s2

X(s) Kbb Kc = 2 (Xd (s)X(s))(z(s + ωf ) + sωf bsp ) s (s + ωf )

X(s) Kbb Kc (z(s + ωf ) + sωf bsp ) = Xd (s) − X(s) s2 (s + ωf )

Inverting the equations: Xd (s) − X(s) s2 (s + ωf ) = X(s) Kbb Kc (z(s + ωf ) + sωf bsp )

Xd (s) s2 (s + ωf ) −1= X(s) Kbb Kc (z(s + ωf ) + sωf bsp )

47

(3.56)


3.3. BB01 Controller: Outer Loop Controller Design Xd (s) s2 (s + ωf ) + Kbb Kc (z(s + ωf ) + sωf bsp ) = X(s) Kbb Kc (z(s + ωf ) + sωf bsp ) Inverting the equation again: X(s) Kbb Kc (z(s + ωf ) + sωf bsp ) = 2 Xd (s) s (s + ωf ) + Kbb Kc (z(s + ωf ) + sωf bsp )

(3.57) Rearranging the terms [19]: X(s) Kbb Kc (s(z + ωf bsp ) + zωf ) = 3 2 Xd (s) s + s ωf + s(Kbb Kc z + Kbb Kc ωf bsp ) + Kbb Kc zωf

(3.58)

Let the setpoint value be 1, i.e. bsp = 1, the BB01 controller transfer function is found to be [19]: Cbb (s) =

θd (s) Xd (s) − X(s)

(3.59)

Plugging the value of bsp = 1 in Equation 3.55: ωf s(Xd (s) − X(s)) θ(s) = Kc z(Xd (s) − X(s)) + s + ωf

θ(s) =

Kc (Xd (s) − X(s))(z(s + ωf ) + ωf s)) s + ωf

(3.60)

From Equation 3.59 and 3.60: Cbb (s) =

Kc (s(z + ωf ) + ωf z) s + ωf

(3.61)

The zero and pole locations can be obtained from Equation 3.61. The constant term in the equation locates the zeros and poles [19]: Zero: zc =

−zωf z + ωf

zc = −0.8186

48

(3.62) (3.63)


3.3. BB01 Controller: Outer Loop Controller Design Pole: pc = −ωf

(3.64)

pc = −6.2832

(3.65)

Since pc <zc , the pole is closer to the origin along the negative real-axis. The zero has less effect on the compensator, and hence this is a lead type compensator. Dynamic performance of the system can be deduced from zero and pole locations: For a stable system, the poles must lie in the left half of the s-plane. Also, time constant and settling time can be reduced by increasing the distance between the poles. The imaginary part of the poles give the resonant natural frequency. To increase the speed of the system, the poles must shift to the left. The speed of the system increases as the zero moves towards the origin from the left half of the plane. However, when the zero becomes dominant, the system overshoots.

General third order characteristic equation is written as: (s2 + 2ζωn s + ωn2 )(1 + Tp s)

(3.66)

where Tp is the Time Decay 7 in seconds On expansion: s3 +

(2ζωn Tp + 1)S 2 (ωn2 Tp + 2ζωn )s ωn2 + + Tp Tp Tp

(3.67)

The characteristic equation of the closed-loop system using the practical PD controller (Equation 3.57): s3 + s2 ωf + s(Kbb Kc z + Kbb Kc ωf bsp ) + Kbb Kc zωf

7

Time Decay -It is an exponential quantity that decays over time.

49

(3.68)


3.3. BB01 Controller: Outer Loop Controller Design Equating coefficients of S 2 terms in Equations 3.67 and 3.68: ωn =

2ζωn Tp + 1 Tp

(3.69)

Knowing the desired response specifications, solving Tp gives the required pole location ωn = 2ζωn +

1 Tp

(3.70)

ωn − 2ζωn =

1 Tp

(3.71)

Tp =

1 ωn − 2ζωn

(3.72)

Tp =

1 ωf − 2ζωn

(3.73)

Tp = 0.2013 sec

(3.74)

Decay time also gives the measure of the speed of the system. Long decay time corresponds to a slow system response [2]. Here the decay time is 0.2013 seconds. Hence the system will have a quick response to the input. Equating the s0 coefficients in equation (3.67) and (3.68):

ωn2 = Kbb Kc zωf Tp

(3.75)

The gain of the system can be found using Equation 3.75. ωn2 = Kc Tp Kbb zωf Kc = 2.4869

50

(3.76)


3.4. System Parameters

3.4 System Parameters Table 3.1 describes the main parameters used in the ball and beam experiment. [8] They are used to derive the mathematical model.

Symbol

Table 3.1: System Parameters Description Units Value

Matlab Variable

ess

Steady state error

0

tp

Peak time

sec

0.20 3.5

tp

PO

Percent overshoot

%

5.0 10.0

PO

ωn

Natural frequency

rad / s

21.7048 1.1129

Wn

ζ

Damping factor

0.6901 0.5912

zeta

kp

Proportional control gain

V / rad

7.6361

kp

kv

Velocity control gain

V / rad

-0.1680

kv

z

Zero location of ideal controller

0.9413

z

zc

Zero location of practical controller

-0.8186

Zc

Kc

Gain of ball and beam system

3.1456 2.4869

Kc

Tp

Pole decay time

sec

0.2013

Tp

ωf

Cut-off frequency

rad / s

6.28

wf

51


3.5. Summary

3.5 Summary • SRV02 Controller: Inner Loop Controller Design – Damping Factor

ζ = 0.6901 – Natural Frequency

ωn = 21.7048 rad/s – Pole Locations

s1 = −14.9787 + 15.7079j s2 = −14.9787 − 15.7079j – Proportional Control Gain

kp = 7.6361V /rad – Velocity Control Gain

kv = −0.1680V /rad • BB01 Controller: Outer Loop Controller Design – Damping Factor

ζ = 0.5912 – Natural Frequency

ωn = 1.1129 rad/s – Zero Location for Ideal PD Controller

52


3.5. Summary z = 0.9413 – Zero Location for Practical PD Controller

zc = −0.8186 – Pole Location for Practical PD Controller

pc = −6.2832 – Ideal PD Controller Gain

kc = 3.1456V /rad – Practical PD Controller Gain

Kc = 2.4869V /rad – Pole Time Decay

Tp = 0.2013sec – Cut-off Frequency

ωf = 6.28rad/s

53



CHAPTER 4. DESIGN IN TIME DOMAIN: STATE SPACE

4 | Design in Time Domain: State Space

The time-domain characteristics that have to be met by the closed-loop system with the designed controller are steady-state error, peak time and percent overshoot. The ball and beam system is a marginally stable, but controllable system. An assumption is made that the state variables are measurable i.e. the controller measures all the variables in the system at all times. For the ball and beam system, the controller measures the current of the motor, velocity and position of the ball [23,24]. Hence, pole placement technique can be applied to control the system. With this method, the poles of the closed loop system are placed at the desired locations using state feedback. According to this technique, the state of the system are fed back to the plant input u, through gain Ki [23]. The method that this report concentrates on to design the state feedback is Ackermann Formula. The state feedback system is given in Figure 4.

Figure 4.1: This figure shows the state feedback with controller. http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction/section= ControlStateSpace/24

55


CHAPTER 4. DESIGN IN TIME DOMAIN: STATE SPACE The controllable system given was derived in Section 2.3.2. x(t) ˙ = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t)

The Ackermann formula [23] is given by Equation 4.1. K = %Tn %−1 αc (A)

(4.1)

u = −Kx

(4.2)

The input to the system is

and state-space feedback equations are x˙ = (A − BK)x y = (C − DK)x.

and

(4.3) (4.4)

Selecting the right poles is an important factor in state feedback design. Placing the poles far left in the s-plane, the response of the system becomes sharper and a large effort is required to control the system. There are many problems associated with trying to attain large control. It may turn out to be expensive or dangerous to achieve [23]. Also, as the poles go closer to zero from the negative half of the splane, the system becomes more unstable. Thus, a compromise must be achieved for the system to meet the design criteria. All the matrices are 4 × 4 matrix. Hence, there are four poles in the system. Let −2 ± 4j, −25, −40 be chosen as the desired pole locations. They are chosen such that two poles are dominating in the left half of the s-plane. For the ball and beam project, the system response could be a detrimental factor. The speed of the system increases as the poles move away from the origin. However, there is a threshold point where the hardware cannot react quickly to the given input and this can lead to damage to the harware. Thus, two poles that satisfy the design requirements can be placed at s = -20 and s = -40 respectively. The imaginary part of the dominating poles affect the oscillations of the system (in this case the ball position). On increasing the imaginary part, the ball oscillates more frequently, thus more control is required to bring the ball to a stable position. Also, the real part of the dominating poles affect overshoot. Placing the poles further into the negative half causes the system to be more stable, reducing the overshoot. However, as

56


CHAPTER 4. DESIGN IN TIME DOMAIN: STATE SPACE mentioned before, this value is limited to the hardware capabilities. The characteristic equation αc is [23], αc = (s + 2 − 4j)(s + 2 + 4j)(s + 40)(s + 25) αc = (s2 + 2s + 4js + 2s + 4 + 8j − 4js − 8j − 16j 2 )(s2 + 25s + 40s + 1000) αc = (s2 + 4s + 20)(s2 + 65s + 1000) αc = s4 + 65s3 + 1000s2 + 4s3 + 260s2 + 4000s + 20s2 + 1300s + 20000 αc = s4 + 693 + 1280s2 + 5300s + 20000

(4.5)

Substituting matrix A into the characteristic equation: 4  1 0 0 0 1 0     0 1 0  + 69 0 0 1  0 0 0 0 0 1   0 0 −40.3226 0 0 0  2  0 1 0 0 0    0 0 1   0  + 5300 0 + 1280  0 0 0  0 1    0 0 0 −40.3226 0

 0  0 αc (A) =  0  0

 0  0 αc (A) =  0  0  0  0 + 0  0

1 0 0 0

  0 0 1     1 0  +20000 0  0 0 1   0 −40.3226 0

0 1 0 0

0 0 1 0

   0 69 0 0 1280 0    0 0  0 −2781  0 1280 +    0 112063  0 0 0 −51584   0 −4516133 0 0 0 2078848    5300 0 0 20000 0 0 0      0 0 5300 0 20000 0 0  +    0 0 5300   0 0 20000 0   0 0 −223590 0 0 0 20000 0 0 0 0

  0 −40 0    0 1624   + 0  0 −65451   0 0 2637683 0

3 0   0   1  −40.3226

0 0 0 0

  20000 5300 1280 29    0  20000 5300 123  αc (A) =   0  0 20000 328   0 0 0 2551

57

(4.6)

 0  0  0  1


CHAPTER 4. DESIGN IN TIME DOMAIN: STATE SPACE Also, the controllability matrix is given as [23]: h i−1 %− 1 = B AB A2 B A3 B  −1 0 0 0 1   0  0 1 −40 −  % 1= 0 1 −40.3 1612    1 −40.3 1624 −65447   3 −12 40 1   −12 40 1 0 −  % 1=  40 1 0 0   1 0 0 0

(4.7)

Plugging the values dervied in Equations 4.6 and 4.7 in Equation 4.1.   3 −12 40 1 20000 5300 1280 29   h i −12 40 1 0  0 20000 5300 123      K= 0 0 0 1   0  40 1 0 0 0 20000 328    1 0 0 0 0 0 0 2551 

h i K = 20000 5300 1280 29

(4.8)

Thus, the controller is designed as u = −Kx h i u = − K1 K2 K3 K4 x

(4.9)

The gains obtained in Equation 4.8 are fed back to the input u. The robustness of the system depends on the value of the gains.

Thus, the closed-loop system is given by Equation 4.10. x˙ = (A − BK)x y = Cx

58

(4.10)


CHAPTER 4. DESIGN IN TIME DOMAIN: STATE SPACE This reduces to the following relation:  0  0  x˙ =  0  0

    0 0 0   h i   0 1 0  −   20000 5300 1280 29  x  0  0 1     0 −40.3226 1

1 0 0 0

 0  0  x˙ =  0  0

   0 0 0 0 0 0      0  1 0 0 0 0 −  x   0  0 1 0 0 0    0 −40.3226 20000 5300 1280 29

1 0 0 0

 0 1 0 0    0  0 1 0  x x˙ =   0 0 1  0  −20000 −5300 −1280 −69.3226

Also, the output of the controlled system is y = Cx h i y = 25.8057 0 0 0 x

Hence, the complete state space segments are 

 0 1 0 0    0  0 1 0 x x˙ =   0  0 0 1   −20000 −5300 −1280 −69.3226 h i y = 25.8057 0 0 0 x

59

(4.11)

(4.12)


4.1. Summary

4.1 Summary • Ackermann Formula

K = %Tn %−1 αc (A) h i = 20000 5300 1280 29 • State-Space Feedback

x˙ = (A − BK)x

and

y = (C − DK)x   0 1 0 0    0  0 1 0  x˙ =   0  0 0 1   −20000 −5300 −1280 −69.3226 h i y = 25.8057 0 0 0

60


5.1. Plant Analysis

5 | Simulation Analysis This chapter of the report concentrates on the performance of the control structures derived in earlier chapters. The performance is measured through results gathered from simulation using Matlab/Simulink. The chapter is divided into sections: plant analysis, frequency baseed (PD) controller and time based (State Feedback) controller. Simulations are performed on the plant with PD controller and state feedback controller. Simulation is an important aspect of modern engineering. The final performance of the system can be generally assessed through simulation. This implies that the final design of the system can be modelled based on the results obtained from simulation. This process is vital to reduce the final cost of the system.

5.1 Plant Analysis This section focuses on the analysis of the plant model derived in Chapter 2. The analysis indicates the performance of the plant in open loop. Based on the result, the configuration of controller required to stabilise the ball on the beam is designed. The Matlab/Simulink analysis of the plant is achieved using transient and steady state response analysis and frequency response analysis.

61


5.1. Plant Analysis Analysis using transient and steady state response: The impulse response of system is shown in Figure 5.1. It is the response of the system to an impulse i.e. small pulse of input. Since the beam is linked to the SRV02 motor, a small change in the motor voltage results in a shift in the beam angle. The graph on the left in Figure 5.1 shows that the system is unstable in open loop. As soon as an impulse is provided, the beam angle changes and it shifts through an angle of 32◦ within 10 seconds and as result the ball moves along the beam. As it is an open loop, the beam angle does not return to its initial state and the ball remains at the point it shifts to. The closed loop system is more unstable than open loop system. The graph on the left in Figure 5.1 includes the effect of the feedback loop due to which the output has a negative beam angle value after 5 seconds. This implies that the beam tilts 14◦ in one direction along with the ball for the first 5 seconds. Then after about 8 seconds, the beam tilts in the other direction. Around 10 seconds, the beam shifts to about 24◦ in the other direction. After 8 seconds, the graph behaves in the same manner as the open loop impulse response graph. Closed Loop Response: impulse input

35

25

30

20 Beam Angle (theta)

Beam Angle (theta)

Open Loop Response: impulse input

25 20 15 10

10 5 0 −5

5 0

15

−10

0

1

2

3

4

5 Time (sec)

6

7

8

9

−15

10

0

1

2

3

4

5 Time (sec)

6

7

8

9

10

Figure 5.1: This figure shows the impulse response of the plant. The step response of open loop system is shown in Figure 5.1. It is the response of the system to a Heavyside step change. The graph on the left in Figure 5.1 shows that the system is unstable in open loop. The output of the system has an exponential form. the graph of the open loop step response is similar to the graph of the open loop impulse reponse. This implies that the system does not change the state from impulse response to the step response.

62


5.1. Plant Analysis Thus, a closed loop configuration is necessary for the stabilization of the system. The graph on the right in Figure 5.1 shows the closed loop system. For the closed loop, the system is stable for 130 seconds after which it becomes unstable quickly. The unstability of the closed loop system is similar to that of the open loop. Open Loop Response: step input

12

Closed Loop Response: step input

25

x 10

x 10

16

3

14 12 Beam Angle (theta)

Beam Angle (theta)

2.5

2

1.5

1

10 8 6 4 2 0

0.5

−2

0

0

0.5

1

1.5 Time (sec)

2

2.5

−4

3

0

20

40

60

80

100

120

140

Time (sec)

4

x 10

Figure 5.2: This figure shows the step response of the plant. The root locus diagram of the plant is given in Figure 5.1. It can be seen from the root-locus graph on the left in Figure 5.1 that this system is unstable for open loop. There are four poles in the system with three poles at zero and the fourth pole at -40.3226. Also, there are no zeros in the system, thus the system becomes unstable as the number poles exceed the number of zeroes by four. This generates a gain K where the root loci move to the right side of the s-plane [2]. Root Locus for open loop without controller is:

Root Locus for closed loop without controller is:

200

200 0.64

0.5

0.34

0.16

150 0.64

175

0.76

0.5

0.34

0.16

0.76

120

150

150

100

100

125 0.86

0.86

80

100

100

60

75 0.94

50 0.94 50

50 0.985

Beam Angle (theta)

Beam Angle (theta)

140

25

0 25

0.985 −50

40

0.985

20

0.985

20

0

50

40

−50 0.94

0.94 75 −100

60

100 0.86

80

0.86 125

−150

−100

100

150 0.76

−200 −200

120

0.76 0.64 −150

0.5 −100

0.34

0.16 −50

175 2000 Time(sec)

0.64 50

100

150

−150 −150

200

0.5 −100

0.34 −50

0.16

140 0 Time(sec)

50

Figure 5.3: This figure shows the root locus plot of the plant.

63

100

150


5.1. Plant Analysis It can also be seen from the root-locus graph on the left in Figure 5.1 that this system is unstable for closed loop. LIke the open loop, there are four poles and no zeroes in the system. Two of the poles are real and in the negative half of the s-plane (-40.3222, -0.8680). The other two poles have imaginary parts and are in the positive half of the s-plane (0.4338 + 0.7410i, 0.4338 - 0.7410i). The poles in the positive half of the s-plane tend to infinity and thus make the system unstable. By examining the time response graphs in Figures 5.1 and 5.2 and the root loci graphs in Figure 5.3, it can be stated that the ball and beam system is an unstable system. The implications of this in the actual experiment is that for any value of gain, the system will become unstable and the ball will roll and stop at either end. Thus, in order to stabilise the system, a controller is required. Analysis using frequency response: The frequency response of the system is shown by the bode plot in Figure 5.4. The gain margin of the bode plot is at negative infinity (dB) as the phase plot begins at -180◦ . Also, the phase margin of the system is -0.614◦ as the gain crosses the 0 dB mark at -180.614◦ . For a control system in general, 12 dB gain margin and 45◦ phase margin is a design requirement [25]. The results gathered from the bode plot indicate that the system is appreciably unstable.

Bode Diagram Gm = −Inf dB (at 0 rad/sec) , Pm = −0.614 deg (at 0.422 rad/sec) 50

Magnitude (dB)

0

−50

−100

−150

−200

Phase (deg)

−180

−225

−270 −1

10

0

10

1

10 Frequency (rad/sec)

2

10

Figure 5.4: This figure shows the bode plot plot of the plant.

64

3

10


5.2. Frequency Domain Analysis: PD Controller

5.2 Frequency Domain Analysis: PD Controller This section focuses on the analysis of the SRV02 and BB01 controller derived in Chapter 3. The analysis indicates the performance of the PD controller in closed loop. The objective of the controller is to stabilise the ball and beam plant model. The Matlab analysis of the PD controller is done using transient and steady state response analysis and frequency response analysis. Analysis using transient and steady state response: The impulse response of system is shown in Figure 5.5. Closed Loop Response: impulse input 0.6

0.5

Beam Angle (theta)

0.4

0.3

0.2

0.1

0

−0.1

−0.2

0

1

2

3

4

5 Time(sec) (sec)

6

7

8

9

10

Figure 5.5: This figure shows the impulse response of the PD controller.

Figure 5.5 illustrates the impulse response of the PD controller. When the simulation begins, the output shifts a negligible angle of 0.57â—Ś and it instantly attempts to recover to its original position. The amplitude decreases with every oscillation period. This suggests that the system will reach a steady state value at a particular time. The step response of system is shown in Figure 5.6 Figure 5.6 illustrates the step response of the PD controller. When a step input of 1 is provided to the PD controller, it results in an overshoot with the output. At 4 seconds, the output starts recovering to the value provided by the step input. The

65


5.2. Frequency Domain Analysis: PD Controller system becomes stable around 20 seconds. This suggests that the system is quick to react to any small disturbance. Closed Loop Response: step input 1.5

Beam Angle (theta)

1

0.5

0

0

5

10

15 Time(sec) (sec)

20

25

30

Figure 5.6: This figure shows the step response of the PD controller.

The root locus diagram of the plant is given in Figure 5.7. Root Locus for closed loop without controller is: 15

0.38

0.26

0.19

0.13

0.085

0.04

14 12

10

10 0.52 8 6

Beam Angle (theta)

5

0.8

4 2

0 2

−5

4

0.8

6 8 −10

0.52 10 12

−15 −6

0.26

0.38 −5

−4

0.19 −3

0.13 −2

0.085 −1

0.04

14 0

1

Time(sec)

Figure 5.7: This figure shows the root locus plot of the PD controller.

Figure 5.7 illustrates the root locus plot of the PD controller. There is one zero and 3 poles in the PD controller. The zero is a constant point of -0.8186 and it pulls the

66


5.2. Frequency Domain Analysis: PD Controller pole located at -6.28 closer to it, thus increasing the stability of the system. The remaining poles are also in the left half of the s-plane at -0.223+0.612i and -0.2230.612i. These poles cause the system to oscillate in the beginning, but it reaches steady state at around 19 seconds. The results plotted in Figures 5.5, 5.6 and 5.7 shows that the system becomes stable with the addition of the PD controller. The frequency response is performed to confirm the same. Analysis using frequency response: Bode Diagram Gm = −Inf dB (at 0 rad/sec) , Pm = 34.9 deg (at 0.722 rad/sec) 100 80 60 Magnitude (dB)

40 20 0 −20 −40 −60 −80 −100

Phase (deg)

−120

−150

−180 −2

10

−1

10

0

10 Frequency (rad/sec)

1

10

2

10

Figure 5.8: This figure shows the bode-plot plot of the plant.

The frequency response of the system is shown by the bode plot in figure (5.8). The gain margin of the bode plot is at negative infinity (dB) as the phase plot never crosses -180◦ . Also, the phase margin of the system is 34.9◦ as the gain crosses the 0 dB mark at -145.1◦ . The results gathered from the bode plot indicate that conifguration meets the criteria of gain and phase margins for the system to be stable.

Simulations Simulations were carried out on Simulink and its results are shown graphically in Figure 5.9. The simulations were carried out for 120 seconds. The performance of the system throughout the simulations matched the criteria set upon it.

67


x (cm)

5.3. Time Domain Analysis: State Feedback

10 0 −10

0

20

40

60

80

100

120

0

20

40

60

80

100

120

0

20

40

60

80

100

120

θl (deg)

100 0

Vm (V)

−100 10 0 −10

time (s)

Figure 5.9: This figure shows the simulation results using PD controller.

The voltage Vm (V ) transitioned between the maximum and minimum values in a smooth manner and it remained in a steady state between each transition. The change in beam angle θl (rad) corresponded to the change in voltage i.e. at maximum voltage, the beam tilted to its maximum value in one direction and it tilted the other way to its maximum value when the voltage decreases to the minimum value. The beam returned to its equilibrium position after each transition and remained there until the next change. The ball tracked the setpoint (ideal) value throughout the simulations. There was no overshoot and the settling time of the ball was approximately 3.5 seconds. Thus, the simulation results verified the choice of design specifications put upon the system and the PD controller stabalized the ball and beam plant.

5.3 Time Domain Analysis: State Feedback This section focuses on the analysis of the state feedback controller derived in Chapter 4. It indicates the performance of the state feedback controller in closed loop. The impulse response of the state feedback controller is given in Figure 5.10.

68


5.3. Time Domain Analysis: State Feedback Impulse Response of Feedback Controller 2.5

2

1.5

x (m)

1

0.5

0

−0.5

−1

0

5

10

15

20

25

t (sec)

Figure 5.10: This figure shows the impulse response of the state feedback controller.

When an impulse input is given to the system, it results in an instant overshoot of the ball. The controller begins to stabilize the system and as the effect of the input decreases, the ball returns to its original position and stays there. When a step input is provided to the system, it can be seen that an overshoot is present. The overshoot here is less than that of an impulse input. Hence the controller recovers quickly and maintains the step input position. Figure 5.11 illustrates the same. The stability of the system can further be determined from analysing the pole locations. From Figure 5.12, it can be seen that the poles lie in the negative (left) half of the s-plane. Also, there are two dominant poles to control the system and two poles deep into the negative half to increase the response of the system. The controller satisfies the design criteria described in Chapter 3.2. Further, using simulations, the performance of the controller can be determined. On analysing the simulations, further action of hardware control can be achieved.

69


5.3. Time Domain Analysis: State Feedback

Step Response of Feedback Controller 1.4

1.2

1

x (m)

0.8

0.6

0.4

0.2

0

0

5

10

15

20

25

t (sec)

Figure 5.11: This figure shows the step response of the state feedback controller.

Root Locus 100 0.76

0.64

0.5

0.34

0.16

80 0.86 60

Imaginary Axis

40

20

0.94

0.985

120 0

−20

−40

100

80

60

40

20

0.985

0.94

−60 0.86 −80 0.76 −100 −120

0.64 −100

−80

0.5 −60

0.34 −40

0.16 −20 Real Axis

0

20

40

60

80

Figure 5.12: This figure shows the step response of the state feedback controller.

70


6.1. Experiment Set-up

6 | Experimental Analysis Having completed the simulations, the design is tested in real hardware experiment. The hardware for the experiment is provided by Quanser. The hardware can be divided into two parts; ball and beam and the servo-motor. In this chapter, an overview of the experimental hardware is provided and results of the experiment are analysed.

6.1 Experiment Set-up The SRV02 can be setup in two configurations; low gear and high gear. For this experiment, high gear configuration is chosen. The high gear is configured in the following manner: the load shaft houses the 120-tooth gear followed by the 72tooth gear. The 20-tooth gear is placed on the motor shaft. The small gear is placed next to both the gears on the load shaft. The 72-tooth gear is connected to the potentiometer gear. Tighten the screws on each shaft using the Allen Key.

Figure 6.1: The figure shows the servo motor when connected..

71


6.2. Experiment Analysis The calibration base is placed on a flat surface. There is a cut-out section in the calibration base. The SRV02 is placed in such a way that the potentiometer gear fits in that section. Insert the coupling screw into the screw hole of the large gear. The same is done for the ball and beam support on the other end of the calibration base [8]. To calibrate the BB01 device, the following procedure is adopted. First loosen the screws on the support arm using a 9/64 Allen Key. On the other end, rotate the servo load gear to the 0 degree mark. Keeping the load gear at this position, move the support arm so that the beam is horizontal. At this point, place the ball in the center of the beam and ensure that it does not move. When this is achieved, screw on the support arm [8].

Figure 6.2: The figure shows the ball and beam system when connected..

The steps required to link the virtual design with the hardware are provided in Quanser Ball and Beam Workbook [19].

6.2 Experiment Analysis The experiments carried out for the project were compared to the ones provided by Quanser. This report analysis both the controllers and discusses the difference in the results.

72


6.2. Experiment Analysis In both the experiments, the setpoint on the potentiometer had a maximum range of ±20 cm from the equilibrium. This corresponded to the ends of the beam with the centre acting as the 0 set point. The run time between each setpoint phase change was set at 10 seconds. The servo motor angle were limited to ±54 degree range. Also, the measured voltage was restricted to a range of ±15 V. The experiment using Quanser parameters were carried out and the following results were attained.

x (cm)

20 0 −20 50

55

60

65

70

75

80

85

90

55

60

65

70

75

80

85

90

55

60

65

70 time (s)

75

80

85

90

θ (deg)

100

l

0 −100 50

Vm (V)

10 0 −10 50

Figure 6.3: This figure illustrates the results of the Quanser experiment. Figure 6.2 shows the graphs for the ball position x(cm), beam angle θl (deg) and measured voltage Vm (V). All three graphs began at 50 seconds. This ensured that the system achieved its steady state and there were no discrepancies in the results. The measured voltage was restricted to ±10 V range due to saturation of the voltage. After every 10 seconds, the voltage changed its state from +10 V to -10 V and vice-versa. The filter caused the voltage to fluctuate slightly between every transition. The voltage reached its steady state value around 3.5 seconds. The change in beam angle corresponds to the voltage change in the system. In the beginning, the beam angle was at +54 degrees and slowly it decreased to 0 degrees. There was a slight overshoot, but it recovered to its equilibrium point. It attained a steady state value around 3.5 seconds and maintained that position till the 60 seconds mark. At this point, the beam angle changed to -54 degrees and the process continued. The beam did not transition smoothly from one state to another. This may be due to an error in the hardware itself or its set-up.

73


6.2. Experiment Analysis For this experiment, the setpoint were set at +10 cm and -10 cm on the potentiometer. They correspond to the ideal transition of the ball position. Selecting these values meant that the ball had enough time to recover to meet the equilibrium point and also cause enough change in its position. The setpoint transition correspond to the change in beam angle. At the start, the setpoint changed from -10 cm to +10 cm, and the beam tilted towards one side. The ball nearly rolled to that point in about 3.5 seconds and maintained its position.This implied that the settling time for the system was around 3.5 seconds. After 7 seconds, i.e. at the 60 seconds mark, the setpoint changed from +10 cm to -10 cm and the beam tilted towards the other side. There wass a slight overshoot in this case (PO = 11%), but the ball recovered at 3.5 seconds again and maintained its position. The system continued in this manner. The experiment met the settling time requirement, but did not meet the percent overshoot requirement. The addition of the filter resulted in a higher overshoot and also delayed the settling time. The experiment using the parameters derived in this project were carried out and the following results were attained.

0 −20

0

5

10

15

20

25

30

35

40

45

50

−100 0 10

5

10

15

20

25

30

35

40

45

50

5

10

15

20

25

30

35

40

45

50

100 0

Vm (V)

θl (deg)

x (cm)

20

0 −10

0

time (s)

Figure 6.4: This figure illustrates the results of the PD controller derived in this project.

The ball was rolled from the end of the beam furthest away from the servo motor. This corresponds to the +20 setpoint value on the graph. This was set as an initial condition for the experiment.

74


6.2. Experiment Analysis The measured voltage output in this graph suggests that the actuator was not well implemented in the experiment. There is some disturbance present after every setpoint transition compared to the Quanser experiment measured voltage output. The beam angle results obtained in this experiment were better than the ones gathered from the Quanser experiment. The transitions here were sharper and less turbulent compared to the transitions in the Quanser experiment. The initial condition caused the ball to overshoot significantly in the first setpoint cycle and the controller could not bring the ball on track. After the transition of phase at 10 seconds, the ball only managed to reach +3 setpoint value and could not reach the +10 setpoint. At the next transition, the ball managed to follow the setpoint value of -10 and this cycle continued. Throughout the experiment, the settling time for the ball was 3.5 seconds, but the percent overshoot kept changing. There was an undershoot present everytime the ball went away from the servo motor. This may be due to various reasons, such as friction between the ball and resistive wires, calibration issues, or even the weight of the ball. The friction becomes an important factor when the angle of beam and velocity of the ball are small. Calibration is an important factor since ball position and beam angle are the outputs. If the hardware is not calibrated correctly, the output of the experiment yields incorrect results. Weight of the ball plays an important role if the beam angle and ball velocity are small. A higher amount of force is required to move a heavy ball compared to a light ball. The Quanser experiment had better ball position outputs compared to PD controller, but PD controller had a better beam angle result. However, both controllers obeyed the specifications provided.

75



7.2. Future Work

7 | Conclusion and Future Work

7.1 Conclusion Various ball and beam systems and controllers were studied and PD controller (classical approach) and State Feedback controller (modern approach) were selected to be designed in this report. A mathematical model of the system was derived using electrical laws and mechanical laws and a basic state space model was developed based on the design specifications. Simulations and experiments were performed to verify if the controllers stabalized the ball within the specification limits. It was found that both the controllers performed well in these aspects. Hardware of the experiment was investigated to understand the limitations of the experiment. All of the aforementioned components i.e. the ball and beam plant (system), PD controller, and the State Feedback controller were designed on Matlab, Simulink and Quarc environment.

7.2 Future Work A simplified State Feedback controller using pole placement technique was developed. A more comprehensive design can be formulated by incorporating a reference input to the system and also by adding an observer to the state feedback system. This report focused on PD controller and State Feedback controller. However, the ball and beam system can be controlled using more advanced techniques, such as nonlinear control, robust control, neural control, and fuzzy logic control. These

77


7.2. Future Work control techniques should have advantages to control the ball and beam system since the ball and beam system is a nonlinear system. A Graphical User Interface (GUI) could be designed to help analyse and understand the ball and beam system in a visual manner.

78


Bibliography

[1] Better Engineering Starts with the right Tools.

Quanser Inc.

[2] K. Ogata, Modern Control Engineering. Upper Saddle River, New Jersey 07458, U.S.A: Pearson Education, Inc., 2010. [3] W. Wang, Control of Ball and Beam System, University of Adelaide, South Australia 5005, Australia, 2007. [4] A. Ataei-Esfahani, “Ball-on-beam balancer system.” [Online]. Available: http://www.personal.psu.edu/axa943/bobb.html [5] P. Wellstead, “Ball and beam 1.” [Online]. Available: http: //www.control-systems-principles.co.uk/whitepapers/ball-and-beam1.pdf [6] “Ce106 ball and beam / apparatus control engineering / sensors and instrumentation.” [Online]. Available: http://www.tecquipment.com/ Datasheets/CE106.pdf [7] J. Lieberman, “A robotic ball balancing beam,” February 2004. [Online]. Available: http://bea.st/sight/rbbb/rbbb.pdf [8] Ball and Beam User Manual. Canada: Quanser Inc., 2011.

119 Spy Court, Markham L3R 5H6, Ontario,

[9] P. Sanjay and I. S. Vamsi, “A report on ball and beam balancing,” April 2012, accessed December 06, 2012. [Online]. Available: http://sriramvamsi. blogspot.co.uk/2012/04/report-on-ball-and-beam-balancing-by.html [10] M. Hagan, H. Demuth, and O. Jesus, “An introduction to the use of neural networks in control systems.” [Online]. Available: http://saba.kntu.ac.ir/eecd/ fatehi/lectures/intelligent20systems/NeuNet/Papers/NNControl.pdf

79


Bibliography [11] J. Vernon, “Fuzzy logic systems.” [Online]. Available: http: //www.controlsystemsprinciples.co.uk/whitepapers/fuzzylogicsystems.pdf [12] S. Lancaster, “Fuzzy logic controllers.” [Online]. Available: http://web.cecs. pdx.edu/~mperkows/CLASSROBOTICS/FEBR19/fuzzy.pdf [13] Samson, “Integral control systems.” [Online]. Available: @Misc{integralinfo, author="Bucknell-University",title="IntegralControlSystems",url="http: //www.facstaff.bucknell.edu/mastascu/econtrolhtml/Intro/Intro3.html"} [14] “Integral control action.” [Online]. Available: http://www.businessdictionary. com/definition/integral-control-action.html [15] Bucknell-University, “Integral control systems.” [Online]. Available: //www.facstaff.bucknell.edu/mastascu/econtrolhtml/Intro/Intro3.html

http:

[16] J. Smuts, “Control notes, reflections of a process control practitioner.” [Online]. Available: http://blog.opticontrols.com/archives/153 [17] K. Srinivasan, Mechanical Engineer’s Handbook: Instrumentation, Systems, Controls, and MEMS. John Wiley & Sons, Inc., 2006, vol. 2. [18] P. Wellstead, “Introduction to physical system modelling,” 2000. [Online]. Available: http://diyhpl.us/~bryan/papers2/Introduction [19] Ball and Beam Workbook. 119 Spy Court, Markham L3R 5H6, Ontario, Canada: Quanser Inc., 2011. [20] J. Apkarian, M. Levis, and H. Gurocak, SRV02 Workbook. Markham L3R 5H6, Ontario, Canada: Quanser Inc., 2011.

119 Spy Court,

[21] T. DiRaimondo, R. Carr, M. Palmer, and M. Pickvet, “Eigenvalues and eigenvectors,” 6 October 2006, accessed December 06, 2012. [Online]. Available: https://controls.engin.umich.edu/wiki/index.php/EigenvaluesEigenvectors [22] D. Katzman, J. Moreno, J. Noelanders, and M. Winston-Galant, “Using eigenvalues and eigenvectors to find stability and solve odes,” accessed December 06, 2012. [Online]. Available: https://controls.engin.umich.edu/ wiki/index.php/EigenvalueStability [23] P. S. M. Veres, “State feedback design by pole placement,” 2012, accessed December 06, 2012. [Online]. Available: https:

80


//blackboard.soton.ac.uk/bbcswebdav/pid-1844952-dt-content-rid-841919_1/ courses/SESM3003-12082-12-13/lecture05 [24] “Introduction: State-space methods for controller design,” 2012, accessed December 06, 2012. [Online]. Available: http://ctms.engin.umich.edu/CTMS/ index.php?example=Introduction&section=ControlStateSpace24 [25] M. Engineering, “Bode tools 04.00, filter simulation,” 2001-2009, accessed December 06, 2012. [Online]. Available: http://support.motioneng.com/ utilities/bode/bode [26] J. Apkarian, M. Levis, and H. Gurocak, SRV02 Rotary Servo Base Unit User Manual. 119 Spy Court, Markham L3R 5H6, Ontario, Canada: Quanser Inc., 2011. [27] VoltPAQ-X1 User Manual. 119 Spy Court, Markham L3R 5H6, Ontario, Canada: Quanser Inc., 2010. [28] Q2-USB Data Acquisition Board User Manual. 119 Spy Court, Markham L3R 5H6, Ontario, Canada: Quanser Inc., 2010.

81



8.1. Appendix A

8 | Appendix

8.1 Appendix A Matlab Files for Simulations and Experiments Plant Initialisation Code 1 % BB01_specs 2 % Sets the model variables of the BB01 plant . 3 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% 4 function [ L_b , r_arm , r_b , m_b , J_b , g , K , tau , Theta_min , Theta_max ] = model_specs () 5 clc ; 6 % Beam Length ( m ) : 7 L_b = 0.4255; 8 % Distance between SRV02 output gear shaft and coupled joint ( m ) : 9 r_arm = 0.0254; 10 % Radius of ball ( m ) : 11 r_b = 0.0127; 12 % Mass of ball ( kg ) : 13 m_b = 0.064; 14 % Acceleration due to gravity ( m / s ^2) : 15 g = 9.81; 16 % Nominal constant 17 K = 1.53; 18 % Time constant 19 tau = 0.0248; 20 % Moment of inertia ( kg * m ^2) : 21 J_b = (2* m_b *( r_b ) ^2) /(5) ; 22 % Minimum SRV02 Load Angle ( rad ) 23 Theta_min = - 56.0 * pi /180; 24 % Maximum SRV02 Load Angle ( rad ) 25 Theta_max = 56.0 * pi /180; 26 end

I


8.1. Appendix A

Plant Parameter Kbb 1 % BB01_plant_parameter 2 3 % Sets the gain of the BB01 model transfer function . 4 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% 5 6 7 8 9 10 11 12 13 14

function [ K_bb ] = model_parameter () clc ; % Call BB01_specs function . [ L_b , r_arm , r_b , m_b , J_b , g ] = model_specs () ; % Model gain ( m / s ^2/ rad ) K_bb = ( m_b * g * r_arm *( r_b ) ^2) / ( L_b *( m_b *( r_b ) ^2 + J_b ) ) ; disp ( ’ The gain ( K_bb ) for the model is : ’) , K_bb ; end

Plant Response without Controller 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

% no_controller_response % Describes the response of the plant without controller . %% % Loading previous functions [ L_b , r_arm , r_b , m_b , J_b , g , K , tau ] = model_specs () ; [ K_bb ] = model_parameter () ; %% % Time of experiment t =0:0.1:60; % Transfer function coefficients numo = [ K_bb * K ]; deno = [ tau 1 0 0 0]; numc = [ K_bb * K ]; denc = [ tau 1 0 0 K_bb * K ]; % create transfer function % open loop transfer function disp ( ’ The open loop transfer function without controller is : ’) oltf_bb = tf ( numo , deno ) % closed loop transfer function [ numc , denc ] = cloop ( numo , deno , -1) disp ( ’ The closed loop transfer function without controller is : ’)

II


8.1. Appendix A 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

cltf_bb = tf ( numc , denc ) % poles of the system OLP = pole ( oltf_bb ) CLP = pole ( cltf_bb ) %% % - - - - - - - - - - - - - - - - - - - - - - - - - - - Response Graphs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% % Step Signal % Simulating the step response of the open loop system figure (1) ; clf ; step ( numo , deno ) grid title ( ’ Open Loop Response : step input ’) xlabel ( ’ Time ( sec ) ’) ylabel ( ’ Beam Angle ( theta ) ’) print - dpsc olstep . eps % Simulating the step response of the closed loop system figure (2) ; clf ; step ( numc , denc ) grid title ( ’ Closed Loop Response : step input ’) xlabel ( ’ Time ( sec ) ’) ylabel ( ’ Beam Angle ( theta ) ’) print - dpsc clstep . eps % Impulse Signal % Simulating the impulse response of the open loop system figure (3) ; clf ; ti =0:0.1:10; impulse ( oltf_bb , ti ) grid title ( ’ Open Loop Response : impulse input ’) xlabel ( ’ Time ( sec ) ’) ylabel ( ’ Beam Angle ( theta ) ’) print - dpsc olimpulse . eps % Simulating the impulse response of the closed loop system figure (4) ; clf ;

III


8.1. Appendix A 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

ti =0:0.1:10; impulse ( cltf_bb , ti ) grid title ( ’ Closed Loop Response : impulse input ’) xlabel ( ’ Time ( sec ) ’) ylabel ( ’ Beam Angle ( theta ) ’) print - dpsc climpulse . eps % Drawing Root locus for open loop figure (5) ; clf ; rlocus ( numo , deno ) grid title ( ’ Root Locus for open loop without controller is : ’) xlabel ( ’ Time ( sec ) ’) ylabel ( ’ Beam Angle ( theta ) ’) print - dpsc rootlocusol . eps % Drawing Root locus for closed loop figure (6) ; clf ; rlocus ( numc , denc ) grid title ( ’ Root Locus for closed loop without controller is : ’) xlabel ( ’ Time ( sec ) ’) ylabel ( ’ Beam Angle ( theta ) ’) print - dpsc rootlocuscl . eps

PD Controller Response 1 2 3 4 5

% pd_controller % Sets the model variables for the SRV02 and BB01 controllers . The % controller characteristics are also obtained .

% - - - - - - - - - - - - - - - - - - - - - - - - - - - PD Controller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% 6 function [ Wn_in , Zeta_in , chareq , kp , kv , Wn_out , Zeta_out ]= pd_controller () 7 8 % Loading earlier files 9 [K , tau ] = model_specs () ; 10 [ K_bb ] = model_parameter () ; 11 12 % Inner loop design 13 14 % Design Criteria 15 16 % Overshoot < 5%

IV


8.1. Appendix A 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

PO_in =0.05; % Peak time ( sec ) tp_in =0.15; % Time of simulation ( sec ) t =0:0.1:60;

% Damping ratio abs ( roots ([1+((( - log ( PO_in ) ) / pi ) ^2) 0 -((( - log ( PO_in ) ) / pi ) ^2) ]) ) ; Zeta_in = ans (1) ; % Natural frequency ( rad / sec ) Wn_in = pi /( tp_in *((1 -( Zeta_in ) ^2) ^0.5) ) ; disp ( ’ Desired Damping ratio is : ’) , Zeta_in disp ( ’ Desired Natural Frequency is : ’) , Wn_in % Desired Characteristic Equation : chareq =[1 2* Zeta_in * Wn_in Wn_in ^2]; disp ( ’ Desired Characteristic Equation is : ’) , chareq % Pole - Zero Map nch =[0 0 0]; dch =[1 39.9431 837.5118]; figure (1) ; clf ; pzmap ( nch , dch ) % The characteristic equation of the CLTF Ct = 0.999 -1.042* exp ( -1.595* t ) +0.043* exp ( -38.725* t ) ; % Plot characteristic equation vs time graph figure (2) ; clf ; plot (t , Ct ) ; title ( ’ Inner Loop Plant Dynamics ’) ; xlabel ( ’t ( sec ) ’) ; ylabel ( ’C ( t ) ’) ; grid ; % Desired Poles location Pl = roots ( chareq ) ; disp ( ’ Desired Pole locations : ’) , Pl % SRVO Steady State Errors num =[0 0 K ]; den =[ tau 1 0]; % Call ssetf function ssetf ( num , den )

V


8.1. Appendix A 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

% Position and velocity based controllers kp =( Wn_in ^2* tau ) / K ; kv =[((2* Zeta_in * Wn_in * tau ) -1) / K ]; disp ( ’ The position control gain is : ’) , kp disp ( ’ The velocity control gain is : ’) , kv

% - - - - - - - - - - - - - - - - - - - - - - - - - Outer Loop Design - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% % Design Criteria % Overshoot < 10% PO_out =0.10; % Peak Time ( sec ) tp_out =3.5;

% Damping ratio abs ( roots ([1+((( - log ( PO_out ) ) / pi ) ^2) 0 -((( - log ( PO_out ) ) / pi ) ^2) ]) ) ; Zeta_out = ans (1) ; % Natural frequency Wn_out = pi /( tp_out *((1 -( Zeta_out ) ^2) ^0.5) ) ; disp ( ’ Desired Damping ratio is : ’) , Zeta_out disp ( ’ Desired Natural Frequency is : ’) , Wn_out % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111

% Ideal PD Controller % Model Variables % Ideal Compensator Gain Kci =(2* Zeta_out * Wn_out ) / K_bb ; % Ideal Compensator Zero Location z = Wn_out ^2/( Kci * K_bb ) ; % Ideal Compensator Transfer Function Ci_bb = tf ([1 z ] ,[1]) ; disp ( ’ The gain for the ideal compensator is : ’) , Kci disp ( ’ Zero Location for ideal compensator is : ’) , z disp ( ’ Transfer Function for ideal compensator is : ’) , Ci_bb

VI


8.1. Appendix A 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138

% Practical PD Controller % Model Variables % Cut - Off Frequency ( rad / sec ) Wf =6.2832; % Pole Decay Time ( sec ) Tp =1/( Wf -2* Zeta_out * Wn_out ) ; % Practical Compensator Zero Location Zc =( - z * Wf ) /( z + Wf ) ; % Practical Compensator Pole Location Pc = - Wf ; % Practical Compensator Gain Kcp = Wn_out ^2/( Tp * K_bb * z * Wf ) ; % Practical Compensator Zero Location Cp_bb = tf ([ z + Wf z * Wf ] ,[1 Wf ]) ; disp ( ’ Pole Decay in seconds is : ’) , Tp disp ( ’ Pole Location for the practical compensator is : ’) , Pc disp ( ’ Zero Location for practical compensator is : ’) , Zc disp ( ’ Gain for practical compensator is : ’) , Kcp disp ( ’ Transfer Function for practical compensator is : ’) , Cp_bb

% - - - - - - - - - - - - - - - - - - - - - - - - - - System Response - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% 139 % s = tf ( ’s ’) ; 140 % H_bb = K_bb / s ^2; 141 142 % Ideal controller 143 % ideal_cl = feedback ( I_bb * H_bb ,1) ; 144 % figure (2) ; 145 % clf ; 146 % step (0.25* ideal_cl ) 147 148 149 % Practical controller 150 % prac_cl = feedback ( P_bb * H_bb ,1) ; 151 % figure (3) ; 152 % clf ; 153 % step (0.25* prac_cl ) 154 end

State Space Feedback Response 1 % - - - - - - - - - - - - - - - - - - - - - - - - Time Domain Analysis

VII


8.1. Appendix A - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% 2 % function [] = sscontroller () 3 % calling the functions loaded previously 4 [ L_b , r_arm , r_b , m_b , J_b , g , K , tau , Theta_min , Theta_max ] = model_specs () ; 5 [ K_bb ] = model_parameter () ; 6 t = 0:0.1:25; 7 % T = 0:0.1:50; 8 % --- Transfer Function to Steady State Transform for phase variable form - - -% 9 num = [0 0 0 0 K * K_bb ]; 10 den = [ tau 1 0 0 0]; 11 [A ,B ,C , D ] = tf2ss ( num , den ) 12 13 14 % - - - - - - - - - - - - - - - - Phase variable form with eigenvalue results - - - - - - - - - - - - - -% 15 16 P = [0 0 0 1; 0 0 1 0; 0 1 0 0; 1 0 0 0]; 17 Ap = inv ( P ) * A * P 18 Bp = inv ( P ) * B 19 Cp = C * P 20 Dp = D 21 eig ( A ) 22 23 % - - - - - - - - - - - - steady state form with routh array stability criteria - - - - - - - -% 24 p = poly ( Ap ) 25 routh ( p ) ; 26 27 % - - - - - - - - - - - - - - - - - - - Ackermann formula for controller - - - - - - - - - - - - - - - - - - - - - -% 28 J = [ -2+ j *4 -2 - j *4 -40 -25]; 29 K = acker ( Ap , Bp , J ) 30 AA = Ap - Bp * K ; 31 BB = Bp *20000; 32 CC = [1 0 0 0]; 33 DD = [0]; 34 35 % - - - - - - - - - - steady state model with steady state error correction - - - - - - - - - -% 36 ball_ss = ss ( Ap , Bp , Cp , Dp ) ; 37 u = 0.25* ones ( size ( t ) ) ; 38 sys_cl = ss ( AA , Bp , Cp , Dp ) ; 39 [ Nbar ]= rscale ( AA , Bp , Cp , Dp , K ) ; 40 [y ,t , x ] = lsim ( Nbar * sys_cl ,u , t ) ; 41 output = step ( AA , BB , CC , DD ,1 , t ) ; 42 Y = impulse ( AA , BB , CC , DD ,1 , t ) ; 43 % - - - - - - - - - - - - - - - - - - - - - - - Response + Root Locus Graphs

VIII


8.1. Appendix A - - - - - - - - - - - - - - - - - - - - - -% 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

figure (1) ; clf ; rlocus ( Ap , Bp , Cp , Dp ) grid ; figure (2) ; clf ; plot (t , output ) grid title ( ’ Step Response of Feedback Controller ’) xlabel ( ’t ( sec ) ’) ylabel ( ’x ( m ) ’) figure (3) ; clf ; plot (t , Y ) grid title ( ’ Impulse Response of Feedback Controller ’) xlabel ( ’t ( sec ) ’) ylabel ( ’x ( m ) ’) figure (4) ; clf ; rlocus ( AA , BB , CC , DD ) grid ; figure (5) ; clf ; plot (t , y ) grid title ( ’ Reference Input Response of Feedback Controller ’) xlabel ( ’t ( sec ) ’) ylabel ( ’x ( m ) ’)

% end

PD Controller Simulink Initialisation Code 1 2 3 4 5 6 7

% % simulink_model % External Gear Configuration : set to ’ HIGH ’ or ’LOW ’ EXT_GEAR_CONFIG = ’ HIGH ’; % Encoder Type : set to ’E ’ or ’EHR ’ ENCODER_TYPE = ’E ’; % Is SRV02 equipped with Tachometer ? ( i . e . option T ) : set to ’YES ’ or

IX


8.1. Appendix A

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

’NO ’ TACH_OPTION = ’ YES ’; % Type of Load : set to ’ NONE ’ , ’ DISC ’ , or ’BAR ’ LOAD_TYPE = ’ NONE ’; % Amplifier Gain used : % VoltPAQ - X1 users : set K_AMP to 1 and Gain switch on amplifier to 1 % VoltPAQ - X2 users : set to K_AMP 3 K_AMP = 1; % Amplifier Type : set to ’ VoltPAQ ’ or ’Q3 ’ AMP_TYPE = ’ VoltPAQ ’; % Digital - to - Analog Maximum Voltage ( V ) VMAX_DAC = 10; % % % Lab Configuration % Type of controller : set it to ’ AUTO ’ , ’ MANUAL ’ CONTROL_TYPE = ’ AUTO ’; % CONTROL_TYPE = ’ MANUAL ’; % For ’ AUTO ’ mode : set to 1 to plot root - locus . PLOT_RL = 1; % For ’ AUTO ’ mode : set to 0 for IDEAL PD and to 1 for PRACTICAL PD compensator . PD_TYPE = 0; % % % Control specifications % SRV02 Position Control specifications if strcmp ( AMP_TYPE , ’ Q3 ’) % Peak time ( s ) tp_srv02 = 0.15; % Percentage overshoot (%) PO_srv02 = 10.0; % BB01 Position Control Specifications % Settling time percentage c_ts = 0.04; % Settling time ( s ) ts_bb = 3.5; % Percentage overshoot (%) PO_bb = 10.0; else % Peak time ( s ) tp_srv02 = 0.15; % Percentage overshoot (%) PO_srv02 = 5.0; % BB01 Position Control Specifications % Settling time percentage c_ts = 0.04; % Settling time ( s ) ts_bb = 3.5; % Percentage overshoot (%) PO_bb = 10.0;

X


8.1. Appendix A 55 56 57 58 59

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

end % % % System Parameters % Sets model variables according to the user - defined system configuration [ Rm , kt , km , Kg , eta_g , Beq , Jm , Jeq , eta_m , K_POT , K_TACH , K_ENC , VMAX_AMP , IMAX_AMP ] = config_servo ( EXT_GEAR_CONFIG , ENCODER_TYPE , TACH_OPTION , AMP_TYPE , LOAD_TYPE ) ; % Load BB01 model specifications . [ L_b , r_arm , r_b , m_b , J_b , g , K , tau , Theta_min , Theta_max ] = model_specs () ; % if strcmp ( AMP_TYPE , ’ Q3 ’) K_BS = 2 * K_BS ; end % % Filter Parameters % SRV02 High - pass filter in PD control used to compute velocity % Cutoff frequency ( rad / s ) Wcf = 314.1593; % Servo Damping ratio Zetas = 0.9; % BB01 High - pass filter in PD control used to compute velocity % Cutoff frequency ( rad / s ) Wf = 6.2832; % Ball and Beam Damping ratio Zetab = 0.6901; % % % Calculate Control Parameters if strcmp ( CONTROL_TYPE , ’ MANUAL ’ ) % Load model parameters based on SRV02 configuration . [ K , tau ] = model_specs () ; % Calculate SRV02 PV control gains given specifications . Kp = 0; Kv = 0; % Calculate SRV02 + BB01 model gain . K_bb = 0; % Calculate natural frequency and damping ratio given specifications . Wn = 0; Zeta = 0; % Design BB01 compensator z = 1; Kc = 0; % elseif strcmp ( CONTROL_TYPE , ’ AUTO ’ ) % Load model parameters based on SRV02 configuration . [ K , tau ] = model_specs () ; % Calculate SRV02 PV control gains given specifications . [ Kp , Kv ] = pd_controller () ;

XI


8.1. Appendix A 99 100 101 102 103 104 105 end

% Calculate SRV02 + BB01 model gain . [ K_bb ]= model_parameter () ; % Calculate natural frequency and damping ratio given specifications . [ Wn , Zeta ] = pd_controller () ; % Design BB01 compensator [ Kc , z ] = pd_controller () ;

User Defined Function to Create a Routh Array to check the Stability of the system. 1 % - - - - - - - - - - - - - - - - - - - - - - - - - - - Routh Array Criterion - - - - - - - - - - - - - - - - - - - - - - - - -% 2 function routh ( poly ) 3 % ROUTH ( POLY ) makes a routh array and checks the stability of the system 4 % ( whose characteristic polynomial is POLY ) by finding if there are any 5 % roots on right half of the s - plane . It also displays the routh array and 6 % the reports about the stability of the system . 7 dim = size ( poly ) ; 8 % get size / dimensions of the characteristic polynomial , x 9 coeff = dim (2) ; 10 % find no . of coefficients of the char . Polynomial , x 11 n = coeff - 1; % degree of x 12 if mod (n ,2) == 0 , % If no . of columns in routh array 13 ncol = ( n /2) + 1; % ncol - - - no . of columns in routh array 14 else 15 ncol = ( n + 1) /2; 16 end ; 17 a = zeros ( n + 1 , ncol ) ; % initialize routh array 18 for i = 1: coeff , 19 RA (2 - rem (i ,2) , ceil ( i /2) ) = poly ( i ) ; 20 % assemble 1 st and 2 nd rows of routh array 21 end ; 22 rows = coeff - 2; % no . of rows that need determinants 23 index = zeros ( rows - i + 1) ; % initialize columns - per - row index vector 24 for i = 1: rows , 25 index ( rows - i + 1) = ceil ( i /2) ; 26 % form index vector from bottom to top 27 end ; 28 for i = 3: coeff , % go from 3 rd row to last 29 if ( all ( RA ( i - 1 , :) == 0) ) , % row of zeros 30 fprintf ( ’\ n Special Case : Row of zeros detected . \ n \ n ’) ; 31

XII


8.1. Appendix A 32 % - - - - - - - - - - - - - - - Display the original routh array - - - - - - - - - - - - - - - - - - - - - - - - - -% 33 disp ( ’ - - - - - - - - - - - - - - - - - - Routh Hurwitz Array - - - - - - - - - - - - - - - - - - - - - - - - - - ’) 34 format short ; 35 disp ( RA ) ; 36 fprintf ( ’\ n Routh Hurwitz Array is modified and is given as \ n \ n ’) ; 37 38 % - - - - - - - - - - - - - - - - - - - - Check the number of sign changes - - - - - - - - - - - - - - - - - - - - -% 39 a = coeff -i + 2; % order of auxiliary equation 40 b = ceil ( a /2) - rem (a , 2) + 1; 41 % numberr of auxiliary coefficients 42 temp1 = RA ( i - 2 , 1 : b ) ; % get auxiliary polynomial 43 temp2 = a : -2 : 0; % auxiliary polynomial powers 44 RA ( i - 1 , 1 : b ) = temp1 .* temp2 ; % derivative of auxiliary 45 elseif ( RA ( i - 1 , 1) == 0) , % first element in row is zero 46 fprintf ( ’\ n Special Case : First element of row % d is zero and is replaced ... with 0.0001. \ n \ n \ ’ ,i -1) ; 47 48 % - - - - - - - - - - - - - - - - - - - - - Display the Original Routh array - - - - - - - - - - - - - - - - - - - -% 49 disp ( ’ - - - - - - - - - - - - - - - - - Routh Hurwitz Array - - - - - - - - - - - - - - - - - - - - - - - - - - ’) 50 format short ; 51 disp ( RA ) ; 52 fprintf ( ’\ n Routh Hurwitz Array is modified and is gvien as \ n \ n ’) ; 53 RA ( i - 1 , 1) = 0.0001; % replace by small value 54 end ; 55 % Compute the routh array elements and display the array 56 for j = 1 : index ( i - 2) , 57 RA (i , j ) = - det ([ RA ( i - 2 , 1) RA ( i - 2 , j + 1) ; 58 RA ( i - 1 , 1) RA ( i - 1 , j + 1) ]) / RA ( i - 1 , 1) ; 59 end ; 60 end ; 61 disp ( ’ - - - - - - - - - - - - - - - - - Routh Hurwitz Array - - - - - - - - - - - - - - - - - - - - - - - - - - ’ ) 62 format short ; 63 disp ( RA ) ; 64 65 % - - - - - - - - - - - - - - - - Check the number of sign changes - - - - - - - - - - - - - - - - - - - - - - - - -% 66 k = 0; 67 c = 0;

XIII


8.1. Appendix A 68 for l = 1: coeff 69 if RA (l , 1) >= 0 , 70 if k == 1 , 71 c = c + 1; 72 k = 0; 73 end ; 74 elseif k == 0; 75 c = c + 1; 76 k = 1; 77 end ; 78 end ; 79 if c == 0 , 80 fprintf ( ’ There is no change of signs in entries of first column . \ n ’) ; 81 fprintf ( ’ Therefor no root lie in the right half of s - plane . \ n ’) ; 82 fprintf ( ’ Hence , system is stable . \ n \ n ’) ; 83 else 84 fprintf ( ’ There are % g sign changes in entries of first column . \ n ’ ,c ) ; 85 fprintf ( ’ Therefore % g roots lie in the right half of s - plane . \ n ’ ,c ) ; 86 fprintf ( ’ Hence , system is unstable . \ n \ n ’) ; 87 end ;

User Defined Function to add a reference input point to the State Feedback Controller 1 2 3 4 5 6 7 8 9 10 11 12 13

function [ Nbar ]= rscale ( AA , Bp , Cp , Dp , K ) % % % % % % % % % % %

Given the single - input linear system : . % x = Ax + Bu y = Cx + Du and the feedback matrix K ,

the function rscale ( sys , K ) or rscale (A ,B ,C ,D , K ) finds the scale factor N which will eliminate the steady - state error to a step reference for a continuous - time , single - input system with full - state feedback using the schematic below : % / - - - - - - - - -\ % R + u | . | % ---> N - - - >() - - - - >| X = Ax + Bu | - - > y = Cx ---> y 14 % -| \ - - - - - - - - -/ % | | % | < - - - - K < - - - -| % 15 % 8/21/96 Yanjie Sun of the University of Michigan % under the supervision of Prof . D . Tilbury 16 % 6/12/98 John Yook , Dawn Tilbury revised 17 18 error ( nargchk (2 ,5 , nargin ) ) ; 19

XIV


8.1. Appendix A 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

% --- Determine which syntax is being used --nargin1 = nargin ; if ( nargin1 ==2) , % System form [A ,B ,C , D ] = ssdata ( a ) ; K=b; elseif ( nargin1 == 5) , % A ,B ,C , D matrices A = AA ; B = Bp ; C = Cp ; D = Dp ; K = K ; else error ( ’ Input must be of the form ( sys , K ) or (A ,B ,C ,D , K ) ’) end ; % compute Nbar s = size (A ,1) ; Z = [ zeros ([1 , s ]) 1]; N = inv ([ A , B ;C , D ]) *Z ’; Nx = N (1: s ) ; Nu = N (1+ s ) ; Nbar = Nu + K * Nx ;

User Defined Function to determine the type of Controller 1 % ssetf 2 % User defined function to determine the type of system plant . 3 4 % - - - - - - - - - - - - - - - - - - - - - - - - Steady State Errors - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% 5 function ssetf ( num , den ) 6 [z ,p , k ]= tf2zp ( num , den ) ; 7 % - - - - - - - - - - - - - - - - - - - - Initializing the parameters - - - - - - - - - - - - - - - - - - - - - - - - -% 8 p=-p;z=-z; 9 psys =0; zsys =0; 10 type =0; 11 prodz =1; prodp =1; 12 % - - - - - - - - - - - - - - - - Finding the type and Kc of system - - - - - - - - - - - - - - - - - - - - - - -% 13 a = length ( p ) ; 14 b = length ( z ) ; 15 for n =1: b ; 16 if ( z ( n ) ) ==0 17 zsys = zsys +1; 18 else 19 end ; 20 end 21 for n =1: a ; 22 if ( p ( n ) ) ==0 23 psys = psys +1;

XV


8.1. Appendix A 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

elseif ( p ( n ) ) ~= - inf prodp = prodp * p ( n ) ; end end prod = k * prodz / prodp ; type = psys - zsys ; format short % -- -- --- -- Defining the error constants and steady - state errpes - - - - - - - - - - -% if ( type <1) Kp =0; Kv =0; Ka =0; Stepess = inf ; Rampess = inf ; Parbess = inf ; end switch type case 0 Kp = prod ; Kv =0; Ka =0; Stepess = 1/(1+ Kp ) ; Rampess = inf ; Parbess = inf ; case 1 Kp = inf ; Kv = prod ; Ka =0; Stepess = 0; Rampess = 1/ Kv ; Parbess = inf ; case 2 Kp = inf ; Kv = inf ; Ka = prod ; Stepess = 0; Rampess = 0; Parbess = 0; end fprintf ( ’ The type of system is %2.0 f \ n \ n ’ , type ) ; fprintf ( ’ The Error Constants are given as : \ n ’) ; fprintf ( ’ Kp =%6.2 f \ nKv =%6.2 f \ nKa =%6.2 f \ n \ n ’ ,Kp , Kv , Ka ) ; fprintf ( ’ The Steady State Errors for the system are as : \ n ’) ; fprintf ( ’ Unit Step Error \ t =\ t %6.2 f \ nUnit Ramp Error \ t =\ t %6.2 f \ nUnit Parabolic Error \ t =\ t %6.2 f \ n ’ , Stepess , Rampess , Parbess ) ; end

XVI


8.2. Appendix B

8.2 Appendix B Simulink BB01 + SRV02 Plant Figure (8.1) illustrates the simulink model of the SRV02 plant.

Figure 8.1: This figure shows the SRV02 motor (SRV02) Simulink model.

The SRV02 plant uses the voltage it receives to rotate the beam through an angle. The input voltage (Vi ) of the SRV02 plant corresponds to the output of the SRV02 (SRV02) controller. The model has two outputs: beam angle (θi ) which acts as the input to the ball and beam plant and the measured voltage (Vm ).

Figure 8.2: This figure shows the SRV02 plant components.

The sub-system of the SRV02 plant consists of an actuator dynamic model, the transfer function and an integrator. The plant uses actuator dynamics to control the saturation limit. The components of the actuator are given in figure (8.3). The voltage entering the actuator is digital and this voltage is converted into an analog one using the digital-to-analog converter (Vdac (t)) (DACB Saturation). The voltage

XVII


8.2. Appendix B is then passed through an amplifier with the gain factor of 1 / KAM P . If this voltage is greater than the maximum voltage that can pass through the amplifier, the output is limited to the maximum voltage value of the amplifier (Vmax ). The voltage is again ampliflied with the factor Kamp to nullify the effect of the inverse amplifier applied earlier. The output of the actuator is the measured voltage Vm . [20] According to the set-up, Vmax = 10 V

(8.1)

Figure 8.3: This figure shows the SRV02 plant components.

The measured voltage obtained from the actuator dynamics model is displayed as an output and it also acts an input to the transfer function of the plant. The transfer function describes the state of the SRV02 plant i.e. the output of the plant with respect to the input provided. It is a first order transfer function that gives a state of angular velocity as an output. An integrator is used to obtain the beam angle (θl ) as the output. The Simulink model of the ball and beam plant is shown in the following figure (8.4). The Ball and Beam plant uses the beam angle (θl ) obtained from the SRV02 plant to determine the position of the ball (x).

XVIII


8.2. Appendix B

Figure 8.4: This figure shows ball and beam model.

The input angle is passed through the gain of the ball and beam plany (Kbb ). The output yielded is in acceleration form. In order to get the position of the ball, the output is passed through two integrators.

Figure 8.5: This figure shows ball and beam plant components.

PD Controller Figure (8.6) illustrates the simulink model of the SRV02 control structure.

Figure 8.6: This figure shows the SRV02 control simulink block.

The input to the SRV02 control is provided by the BB01 control in the form of desired beam angle (θd ) rad and also beam angle (θl ) rad. θl is the output of the

XIX


8.2. Appendix B ball and beam plant that is fed back into the system. This is done to fine tune the SRV02 controller further. This control block converts the beam angle inputs to a voltage output (Vi ) volt. The sub-system of the control consists of the proportional (Kp) and velocity (Kv) gain. The gains control the voltage that will be fed to the plant system. The proportional gain is is connected directly to the output setpoint parameter. The input to the velocity gain is passed through a high-pass filter. The high-pass filter is used to create the velocity signal (Vi ) inputted to the plant. The SRV02 control sub-system is shown in figure (8.7).

Figure 8.7: This figure shows the SRV02 control components.

Figure (8.8) illustrates the simulink model of the BB01 control structure. A signal generator creates signals that are fed into the BB01 controller. The signals are in the form of the desired ball position (Xd ) m. The output of the ball and beam plant is fed back into the controller thus becoming another input parameter. This is done to fine tune the BB01 controller further. The output generated by the controller is in the form of desired beam angle (θd ). The BB01 sub-system is illustrated in figure (8.9) The inputs are measured through two set point parameters. One set point provides the zero location of the system with the controller, and the other set point is passed through either a derivative or high pass filter using a manual switch. In practical PD it is recommended to use the high pass filter to decrease the error created by the noise generated by the ball while rolling. The output of the zero location and high pass filter are controlled through an additional set point control parameter. The cumulative output is fed by the set point to the proportional gain. The gain amplifies the output and this amplified output is given to the angle saturation block. This block converts the

XX


8.2. Appendix B

Figure 8.8: This figure shows the BB01 control simulink block.

position input to an angle output. This desired angle then acts as the input to the SRV02 control structure.

Figure 8.9: This figure shows the BB01 control components.

The ball and beam system using PD control is shown in the figure (8.10). The desired position of the ball can be determined by the user using the SRV02 signal generator. The value determined is then passed to the ball and beam system and 3 outputs are obtained: the ball position x (cm), beam angle θl (deg) and the measured voltage vm (V). The status of the system can be analysed from their results.

XXI


8.2. Appendix B

Figure 8.10: This figure shows the complete simulink model.

XXII


8.3. Appendix C

8.3 Appendix C Hardware The rotary SRV02 plant is shown in Figure 8.11. It is an aluminium frame that houses a DC motor and a gearbox. The gearbox depends on the internal gearbox placed inside the motor to drive it. There are four gears in the gear box: 72-tooth gear, 120-tooth gear, 20-tooth gear and a small gear. All of the gears are pinion shaped. The function of the SRV02 is to measure the angular position and velocity of the load gear. This is achieved by inserting three sensors in the hardware: angular position is measured using potentiometer and encoder, whereas the velocity is measured using tachometer. For this experiment, SRV02-ET model is used [26].

Figure 8.11: This figure shows Rotary Servo Motor.

The SRV02 uses a Faulhaber Coreless DC Motor 2338S006 model. It is faster than conventional DC motors in the market. The motor has a voltage range of Âą5 V. The DC motor comes with a tachometer connected to it. Doing this makes sure that there is no lag in the response time and reaffirms that motor speed is accurately measured. The potentiometer used is Vishay Spectrol model 132. The voltage outputted by is has a range of Âą5V over 352 degree range. It shows the true measurement of the position of the load gears [26].

XXIII


8.3. Appendix C The BB01 device consists of a track formed by a steel rod in parallel configuration with a nickel-chromium resistor. The resistor is wound with a wire and this combination is glued to a plastic covering the metal frame.The steel rod acts like a potentiometer and the measurement of the voltage passing through it gives the position of the ball [8].

Figure 8.12: This figure shows the Ball and Beam Hardware.

A power amplifier is used to run the experiment. In this case, VoltPAQ-X1 amplifier is used. The suffix X1 defines the number of load channels used i.e. one channel is used with this experiment. The amplifier can supply upto 24V of voltage. It requires analog inputs. The VoltPAQ has some advantages over general power amplifiers. It has the capability to sense the current supplied and indicates if there is more current supplied than required by the system. This prevents over heating [27].

XXIV


8.3. Appendix C

Figure 8.13: This figure shows the Voltpaq-X1 Power Amplifier.

A control board is used in conjunction with VoltPAQ-X1 and QUARC software for rapid prototyping and Hardware-in-the-Loop (HIL) environment. Quanser utilises the Q2-USB data acquisition board for this purpose. Q2-USB has a number of features that include: QUARC or custom made functions, CPU processing, a quickconnect terminal board, timer for safety and flexibility. It can sync with multiple interfaces like C, C++, LabVIEW,MatLab, and Simulink [28].

XXV


8.3. Appendix C

Figure 8.14: This figure shows the Q2-USB Data Acquisition Board.

The Q2-USB interface is shown in Figure 8.14. There is a slot in Q2-USB to connect it to the computer using a standard USB mini cable. There are two encoder slots labelled 1 and 2. There are four RCA connectors. Two connectors function as the analog outputs and two as analog inputs. A LED is provided to indicate the different states of the device. Table () gives a description of the different states.

Figure 8.15: This figure shows the Different LED states.

Ground lug provides the ground reference for testing and rapid prototyping purpose. It is connected to analog and digital grounds [28].

XXVI


8.3. Appendix C The connections to the hardware are provided in Figure 8.16.

Figure 8.16: This figure shows the connections of the different ball and beam components.

XXVII


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.