Senior Project / Final Report 2009
Chapter I
Problem Description and Outlines
1
Senior Project / Final Report 2009
1.1
Problem Description
In today’s competitive world, organizations and individuals thrive to achieve their maximum
potential. California University of Pennsylvania offers a feedback control course. The course’s
instructor is a very competent scholar. Likely, the students possess a very good understanding of
control theorem and the software applications required to simulate their concepts. However, the
hands on laboratory experience could dramatically be enhanced. In order for the university to
preserve their competitive nature in the field of education, they have acquired several precision
control plants along with the necessary software.
This project aims towards enhancing the students’ learning process of control design through
utilizing the control plants. This document contains laboratory materials and guidance for proper
equipment operation. The project is designed to show the user how to operate a position servo,
rate servo, ball and beam experiment, gantry pendulum, inverted pendulum, and self-erecting
pendulum. It also summarizes the mathematical concept of most experiments. A chapter about
PID controllers is also provided in this document.
1.2 Outline
This report is outlined as follows:
Chapter two consists of literature and back ground information about the software and
hardware used to perform various experiments that will be utilized in a feedback control course
at the university.
Chapter three will provide an insight to the PID controller. It will provide the students
with proper needed literature to develop a conceptual understanding of this type of controller.
This chapter includes an exercise that will enable the student to understand the characteristics of
the controllers’ three components in terms of; what do they stand for and what effect do they
have on the entire system.
Chapter three will summarize to the students the process of mathematically modeling the
SRV02 plant. They will see how the dynamical equation that represents the position of the rotary
servo. They will also see how the transfer function can be obtained through a mathematical
process.
Chapter four represents the outlines for a servo position control laboratory experiment.
This experiment will give the students the chance to implement a PID controller on the Quanser
SRV01 device and evaluate its performance.
2
Senior Project / Final Report 2009
Chapter five is a representation of an experiment that tends to control the speed of the
SRV02 plant. The students will get to know how to develop a PI controller for the sake of
controlling the speed of the SRV02. The students will also have the opportunity to simulate and
implement the controller on the plant.
In chapter six the students will learn how to stabilize a ball to a desired position along a
beam. They will achieve that through a cascade control system that is designed to meet a set of
specifications. They will also simulate and implement the controllers on the real plant.
Chapter seven includes brief literature about inverted pendulum. This chapter will only
give a general introduction to the demonstration process, in the user’s manual, of GIP, IP, and
SEIP.
Chapter eight will discuss the social and ethical impacts of the project. It will discuss
effect of this project on the targeted society.
Chapter nine will state the conclusion of the project, recommendations and future
expansion ideas for the project. This includes ideas to implement more experiments and
strategies to help students develop a better understanding of controls.
3
Senior Project / Final Report 2009
Chapter II
Product Literature
4
Senior Project / Final Report 2009
2.1. Quansers’s Introduction
Quanser is a world leader in the design and manufacture of advanced systems for real-time
control design and implementation used in education and research. Their control challenges and
solutions are ideal for implementing and evaluating feedback strategies such as PID, LQG, H
infinity, fuzzy, neural nets, adaptive and nonlinear controllers. Quanser control challenges and
solutions are operational in over 500 institutions worldwide including universities, research
laboratories and commercial organizations.
Quanser’s control experiments are distinctively modular which enable you to cost effectively
employ the same power plant to perform experiments of varying complexity. By coupling the
appropriate module to the plant you achieve configurations ranging from simple position servo
control to advanced MIMO systems such as the Seesaw/Pendulum.
Quanser's systems are uniquely modular and use the same base components that can be multipurposed throughout a wide range of experiment configurations. So by adding and removing
various modules you extend the functionality of your investment and more importantly create a
greater variety of experiments and challenges to explore: no other solution provider comes close
to providing this kind of flexibility.
Quanser systems are fully compatible with MATLAB, Simulink and Real-Time Workshop and
operate in a variety of computing environments including: Windows 95/98/Me/NT/2000.
Quanser produce their own software and the fully support it. Their software is called QuaRC.
Quanser was able to reach a sampling rate of 80KHz. They have an outstanding engineering
support department whom has been a critical resource during the phases of this project.
2.2 Hardware
The following hardware components were used:
Quanser’s Q4 data acquisition card.
Quanser’s Q4terminal board.
UPM-1503 universal power module.
SRV02 plant.
IP02 plant.
BB01 plant.
SS01 remote sensor.
Other minor components such as cables and sticks.
For further information about the hardware components, please see the User Manual.
5
Senior Project / Final Report 2009
2.3 Software
2.3.1 MATLAB & Simulink (Real-Time Workshop)
Matlab and simulink have been the tool for the structure of the controllers’ design
during the phases of this project. The Real-Time Workshop product generates and
executes stand-alone C code for developing and testing algorithms modeled in
Simulink and embedded MATLAB code. The resulting code can be used for many realtime and non-real-time applications, including simulation acceleration, rapid prototyping,
and hardware-in-the-loop testing. You can tune and monitor the generated code using
Simulink blocks and built-in analysis capabilities.
2.3.2 QuaRC 1.1
QuaRC is a multi-functional software suite that seamlessly integrates with
Simulink for rapid controls prototyping and hardware-in-the-loop testing. QuaRC can
operate under Windows-based operating systems, generating soft real-time code, with
performance parameters sufficient for use with most of Quanser educational experiments.
Using QuaRC, a Simulink-designed controller can be not only converted into realtime code that can run on many target processor and operating systems combinations.
The control parameters may be varied while the code is running, allowing for a rapid
design and test iterations, with little recompilation required. Emphasizing Quanser’s
open-architecture philosophy, QuaRC allows not only running of multiple controllers on
the same processor at the same time, but also running of controllers distributed across
many processors and controlled independently, even on different chipsets running
different operating systems.
6
Senior Project / Final Report 2009
Chapter III
Introduction to PID Controller
7
Senior Project / Final Report 2009
3.1 Introduction
An example of a control loop is the automobile cruise control. The goal of this process is to keep
a vehicle moving at a desired speed. This process involves two factors, engage or disengage the
throttle. A speed sensor determines the speed of the wheel shaft. According to reading from the
sensor, the controller will decide whether to engage or disengage the throttle. The controller will
repeat the process of comparing (control loop) the input (measured speed) to the output (throttle
manipulation) until the speed of the vehicle is set to the desired value.
Determining the speed of the wheel’s shaft represents the measured process variable (PV). The
speed that was set by the driver represents the set point (SP). The difference between the
measured speed and the desired speed represents the error.
In a cruise control system, a proportional control will estimate how far to engage the throttle. The
integral control will can be effective by manipulating the throttle when the desired speed is
almost reached. The derivative control’s duty will be sensing the rate of the vehicle’s speed (Is it
going high or low and by how much). This process predicts future changes and will insure a
smooth achievement of the desired speed.
Making a change that is too large when the error is small is equivalent to a high gain controller
and will lead to overshoot. If the controller were to make continues changes that were too large
and repeatedly overshoot the target, this control loop would be termed unstable and the output
would oscillate around the set point in either a constant, growing, or decaying sinusoid. Selecting
the correct gains for effective control is known as tuning the controller.
The PID controller has three different components or parameters; the proportional, the integral
and derivative terms. The proportional term determines the reaction to the current error, the
integral term determines the reaction based on the sum of recent errors, and the derivative term
determines the reaction based on the rate at which the error has been changing. The weighted
sum of these three actions is used to adjust the process via a control element such as the position
of a DC motor.
Figure 3.1: An open-loop system such as this does not have the required data to correct the error.
8
Senior Project / Final Report 2009
Figure3.2: A closed-loop system includes a feedback mechanism to correct error.
3.1.1 Proportional (P)
The proportional term, also called gain, must have a value greater than zero for the control loop
to operate. The value of the proportional term is multiplied by the error (e) to generate the
proportional contribution to the output. If proportional is acting alone, with no integral, there
must always be an error or the output will go to zero. A great deal must be known about the load,
sensor, and controller to compute a proportional setting (P). The proportional term is presented
by the following formula:
𝑃𝑡𝑒𝑟𝑚 = 𝜅𝑝 𝑒(𝑡)
Note that 𝜅𝑝 is proportional gain and e represents the error.
3.1.2 Integral (I)
In the control loop, the integral term looks at error over time to build the integral contribution to
the output. By adding integral to the proportional contribution, the error can be eliminated. When
the error is at zero, controlling at the set point, the output is held constant by the integral
contribution. The integral setting (I) is more predictable than the proportional setting. The
integral term is presented by the following formula:
𝑡𝑖
𝐼𝑡𝑒𝑟𝑚 = 𝜅𝑖 ∫ 𝑒(𝑡)𝑑𝑡
0
9
Senior Project / Final Report 2009
3.1.3 Derivative (D)
The derivative term, also called rate, acts on the change in error with time to make its
contribution to the output. By reacting to a fast changing error signal, the derivative can work to
boost the output when the setpoint changes quickly. It can also see the error decreasing rapidly,
closer to the setpoint, and reduce the output for less overshoot. The derivative term can be useful
in fast changing systems, but it is often turned off during steady state control because it reacts too
strongly to small disturbances or noise. The integral term is presented by the following formula:
𝐷𝑡𝑒𝑟𝑚 = 𝜅𝑑
𝑑
𝑒(𝑡)
𝑑𝑡
3.2 Characteristics of PID
The proportional, integral, and derivative terms are summed to calculate the output of the PID
controller. Defining u(t) as the controller output, the final form of the PID algorithm is:
𝑡
𝑢(𝑡) = 𝜅𝑝 𝑒(𝑡) + 𝜅𝑖 ∫0 𝑖 𝑒(𝑡)𝑑𝑡 + 𝜅𝑑
𝑑
𝑑𝑡
𝑒(𝑡)
The effects of each PID controller term on a closed-loop system are expressed in the table shown
below.
Table 1: characteristics of PID terms
Term
𝜿𝒑
𝜿𝒊
𝜿𝒅
Rise Time
Decrease
Decrease
Small Change
O.S%
Increase
Increase
Decrease
Settling Time
Small Change
Increase
Decrease
𝒆𝒔𝒔
Decrease
Eliminate
Small Change
Be careful that the effects of the terms above are to be referred to only when you try to set the
initial values for the three gains. These terms are very dependent on each others and changing
one of them can extremely affect the other two.
10
Senior Project / Final Report 2009
3.3 Example
In this example, you will learn about the characteristics and the three components of a PID
controller. Suppose you have to come up with the best possible step response for the SRV02 DC
Figure 1.3: SRV02 system
motor.
The transfer function of the SRV02 module is:
𝜃𝑙 (𝑠)
𝐾
=
𝜃𝑑 (𝑠) (𝜏𝑠 + 1)𝑠
Assume that K=1.53/ τ =0.0254.
The goal of this exercise is to show you how each of the terms: 𝜅𝑝 , 𝜅𝑖 ,and 𝜅𝑑 contributes to
obtain: fast rise time, minimum overshoot, and no steady-state error.
11
Senior Project / Final Report 2009
3.3.1 Open-loop step response
Create the following Matlab code:
num=1.53;
den=[0.0254 1
step(num,den)
];
When you run the code, you will see the response shown below:
As you can see, the output has a large steady-state error, rise time, and settling time. The
following steps will show you how implementing a controller could achieve better results.
3.3.2 P controller
From the table shown above, we see that the proportional controller (Kp) reduces the rise
time, increases the overshoot, and reduces the steady-state error. The closed-loop transfer
function of the above system with a proportional controller is:
𝐾𝜅𝑝
𝜃𝑙 (𝑠)
= 2
𝜃𝑑 (𝑠) 𝜏𝑠 + 𝑠 + 𝐾𝜅𝑝
12
Senior Project / Final Report 2009
Let the proportional gain (Kp) equals 500. Create and run the following code:
Kp=500;
K=1.53;
num=[Kp*K];
den=[.0254 1 K*Kp];
t=0:0.01:1;
step(num,den,t)
Figure 3.4: P controller (O.S%=66.6, S.T=0.183, R.T=0.00775)
The above plot shows that the proportional controller reduced both the rise time and the
steady-state error, increased the overshoot, and decreased the settling time by small amount.
3.3.3 PD controller
Now, let's take a look at a PD controller. From the table shown above, we see that the
derivative controller (Kd) reduces both the overshoot and the settling time. The closed-loop
transfer function of the given system with a PD controller is:
𝐾𝜅𝑝
𝜃𝑙 (𝑠)
= 2
𝜃𝑙 (𝑠) 𝜏𝑠 + (1 + 𝐾𝜅𝑣 )𝑠 + 𝐾𝜅𝑝
13
Senior Project / Final Report 2009
Let Kp equals to 500 as before and let Kd equals 1. Create the following code and run it.
Kp=500;
Kv=1;
K=1.53;
num=[Kp*K];
den=[.0254 1+K*Kv K*Kp];
t=0:0.01:1;
step(num,den,t)
Figure 3.5: PD controller (O.S%=38.3, S.T=0.065, R.T=0.0093)
This plot shows that the derivative controller reduced both the overshoot and the settling
time, and had small effect on the rise time and the steady-state error.
3.3.4 PID Control
Now, let's take a look at a PID controller. The closed-loop transfer function of the given
system with a PID controller is:
𝐾(𝜅𝑝 𝑠 + 𝜅𝑖 )
𝜃𝑙 (𝑠)
= 3
𝜃𝑑 (𝑠) 𝑠 𝜏 + (1 + 𝐾𝜅𝑣 )𝑠 3 + 𝐾𝜅𝑝 𝑠 + 𝐾𝜅𝑖
After trying several sets of values, the gains were determined to be:Kp=350, Ki=300, and
Kd=50. Create the following code and run it.
14
Senior Project / Final Report 2009
Kp=1400;
Ki=5;
Kv=10;
K=1.53;
num=[Kp*K K*Ki];
den=[.0254 1+K*Kv K*Kp K*Ki];
t=0:0.01:1;
step(num,den,t)
Figure 3.6: PID controller (O.S%=0.0027, S.T=0.033, R.T=0.021)
Finally, we have obtained a system with no overshoot, fast rise time, and no steady-state error.
15
Senior Project / Final Report 2009
Chapter IV
SRV02 Modeling
16
Senior Project / Final Report 2009
4.1 Introduction
The goal of this experiment is to find a transfer function that describes the rotary motion of the
SRV02 load shaft. The dynamic model is derived analytically from the classical mechanic
principles and using experimental methods. In this laboratory, the student will cover the
following subjects:
Derive the dynamical equation representing the position of the rotary servo plant.
Obtain the transfer function that describes the load shaft position with respect to
the motor input voltage from the equation previously found.
The angular rate of the SRV02 load shaft with respect to the input motor voltage can be obtained
by the following first-order transfer function:
Where the Ω𝑙 (𝑠) is the Laplace transform of the load shaft rate 𝜔𝑙 (𝑡), 𝑉𝑚 (𝑠) is the Laplace
transform of the motor input voltage 𝑉𝑚 (𝑡). 𝐾 is the steady state gain, τ is the time constant and s
is the Laplace operator.
4.2 Electrical Equation
The DC motor armature circuit schematic and gear train is illustrated in figure 1.
Figure 4.1: SRV02 DC motor armature circuit and gear train.
17
Senior Project / Final Report 2009
Q. Using Kirchoff’s Voltage law, find the electrical equation that describes the amount of current
that runs through the motor leads, 𝐼𝑚 , when a motor voltage of 𝑉𝑚 is applied and a back-emf
voltage of:
Solution:
The electrical equation of the DC motor using Kirchoff's Voltage Law is:
Given that the motor inductance is much less than the resistance, the equation becomes:
Solve for the motor current
4.3 Mechanical Equation
Newton's Second Law of Motion adapted for a one-dimensional rotary system is:
The load motion equation when taking into account the inertia and the viscous friction is:
The mechanical equation of the DC motor shaft taken into account the viscous friction and the
torque from the load is:
Torque generated at the output shaft relative to the torque applied at the motor is:
Gear ratio of the planetary gearheads mounted on the motor shaft, called the internal gear box
and it is expressed by:
Gear ratio of the planetary gearheads mounted on the motor shaft, called the external gear box
and it is expressed by:
The gear ratio of the SRV02 gear train is:
18
Senior Project / Final Report 2009
Torque applied from the load seen at the motor shaft through the gears is
The position relationship between the load and the motor shafts is:
Q. Find the relationship between the angular rate of the motor shaft, 𝜔𝑚 , an the angular rate of
the load shaft, 𝜔𝑙 .
Solution:
Speed of the load shaft to the speed of the motor is:
Switch around the load equation in order to substitute in motor equation.
Q. Using the format of the following equation, find 𝐽𝑒𝑞 and 𝐵𝑒𝑞 parameters.
𝐽𝑒𝑞 (
𝑑
𝜔 (𝑡)) + 𝐵𝑒𝑞 𝜔𝑙 (𝑡) = 𝜂𝑔 𝐾𝑔 𝜏𝑚 (𝑡)
𝑑𝑡 𝑙
Solution:
Sub load equation into the motor equation and the 𝜔𝑚 (𝑡) = 𝐾𝑔 𝜔𝑙 (𝑡) relationship to get
the following equation:
Group the load rate coefficients
From the above equation, the equivalent moment of inertia and the viscous damping
parameters are:
19
Senior Project / Final Report 2009
4.4 Adding actuator dynamics
Q. Using the equation below, express the motor torque-current relationship in terms of input
voltage and load shaft rate.
Solution:
Torque generated by motor input voltage is:
The applied motor torque with respect to the load speed is.
Add actuator dynamics:
Isolate the load rate term in the right-hand side in order to re-arrange the equation.
Re-arrange the equation.
The equation of motion with respect to input motor voltage is:
From this, the new equivalent damping term is:
And the actuator gain is:
20
Senior Project / Final Report 2009
4.5 Obtaining a Transfer Function
Q. Find the transfer function that represents the load shaft rate with respect to an applied motor
voltage. Assume the motor speed is initially zero.
Solution:
By taking the Laplace form of the voltage to load shaft equation of motion, we have:
By solving for Ω𝑙 (𝑠)/𝑉𝑚 (𝑠), we have:
Q. Express τ and K in terms of the found parameters. Then, calculate the viscous damping
parameter and the actuator gain.
Solution:
a. The time constant parameter is:
The steady state gain is:
b. The calculated values are:
𝑠
𝐵𝑒𝑞,𝑣 = 0.0844 𝑁. 𝑚.
𝑟𝑎𝑑
𝐴𝑚 = 0.129 (𝑁. 𝑚)/𝑣
Q. Based on the calculated and given system’s parameters, calculate the steady-state model gain
and the time constant values.
Solution:
K = 1.53
21
τ = 0.0253 s
Senior Project / Final Report 2009
Chapter V
SRV02 Position Control Experiment
22
Senior Project / Final Report 2009
5.1 Overview
Consider the system shown below:
Figure 5.1:SRV02 DC Motor Armature Circuit & Gear Train
Figure 5.2: Unity Feedback System
23
Senior Project / Final Report 2009
5.2 Lab Procedure
The output of the system above:
Y(s) = C(s) P(s) (R(s) – Y(s))
𝐶(𝑠)𝑃(𝑠)𝑅(𝑠)
Y(s) =
1+𝐶(𝑠)𝑃(𝑠)
The open-loop voltage to load gear position transfer function is:
P(s) =
𝜅
(𝜏 𝑠+1)𝑠
𝑌(𝑠)
𝜔𝑛2
= 2
𝑅(𝑠)
𝑠 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
𝑅(𝑠) =
𝑃𝑂 =
𝑅0
𝑠
100 ( 𝑌𝑚𝑎𝑥 − 𝑅0 )
𝑅0
𝑡𝑝 = 𝑡𝑚𝑎𝑥 − 𝑡0
𝑃𝑂 = 100𝑒
𝑡𝑝 =
{−
𝜋𝜁
}
√1−𝜁 2
𝜋
𝜔𝑛 √1 − 𝜁 2
𝑒𝑠𝑠 = 𝑟𝑠𝑠 (𝑡) − 𝑦𝑠𝑠 (𝑡)
𝐸(𝑠) = 𝑅(𝑠) − 𝑌(𝑠)
𝐸(𝑠) =
𝑅(𝑠)
1 + 𝐶(𝑠)𝑃(𝑠)
𝑅0
𝐸(𝑠) =
𝑠 {1 +
𝜅
}
(𝜏𝑠 + 1)𝑠
(𝜏𝑠 + 1)𝑠
}
𝑠→0 𝜏𝑠 2 + 𝑠 + 𝜅
𝑒𝑠𝑠 = 𝑅0 {lim
𝑒𝑠𝑠 = 0
24
Senior Project / Final Report 2009
The time –domain specifications for controlling the servo’s position are:
𝑒𝑠𝑠 = 0
𝑡𝑝 = 0.20𝑠
𝑃𝑂 = 5.0%
Q. By using the following expressions, calculate the maximum overshoot of the response (in rad)
given a step setpoint of 45°.
𝜃𝑑 (𝑡) =
𝜋
4
𝜃(𝑡𝑝 ) = 𝜃𝑑 (𝑡) {1 +
𝑃𝑂
}
100
Solution:
𝜃𝑑 (𝑡) = 0.785 𝑟𝑎𝑑
𝜃(𝑡𝑝 ) = 0.823 𝑟𝑎𝑑
The PV compensator to control the position of the servo is:
𝑉𝑚 (𝑡) = 𝜅𝑝 (𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)) − 𝜅𝑣 {
𝑑
𝜃 (𝑡)}
𝑑𝑡 𝑙
The block diagram of the PV controller:
Figure 5.3: PD Position Control
25
Senior Project / Final Report 2009
Taking the La Place transform of the transfer function:
𝑉𝑚 (𝑠) = 𝜅𝑝 (𝜃𝑑 (𝑠) − 𝜃𝑙 (𝑠)) − 𝜅𝑣 𝑠𝜃𝑙 (𝑠)
Q. From the Simulink above, find the closed-loop transfer function.
Solution:
𝐾𝜅𝑝
𝜃𝑙 (𝑠)
= 2
𝜃𝑑 (𝑠)
𝜏𝑠 + (1 + 𝐾𝜅𝑣 )𝑠 + 𝐾𝜅𝑝
The standard transfer function for a second order system is:
𝑌(𝑠)
𝜔𝑛2
= 2
𝑅(𝑠)
𝑠 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
Q. Find Kp and Kv.
Solution:
𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
𝜏𝑠 2 + 𝑠 + 𝐾𝜅𝑝 + 𝐾𝜅𝑣 𝑠
𝑠2 +
(1 + 𝐾𝜅𝑣 )𝑠 𝐾𝜅𝑝
+
𝜏
𝜏
𝜔𝑛2 =
𝐾𝜅𝑝
𝜏
2𝜁𝜔𝑛 =
1 + 𝐾𝜅𝑣
𝜏
𝜅𝑝 =
𝜔𝑛2 𝜏
𝐾
𝜅𝑣 =
−1 + 2𝜁𝜔𝑛 𝜏
𝐾
Q. Using the following expressions, calculate 𝜁 and 𝜔𝑛 .
𝜁 = − ln {
𝜔𝑛 =
26
𝑃𝑂
}
100 √
𝜋
𝑡𝑝 √1 − 𝜁 2
1
𝑃𝑂 2
ln {100} + 𝜋 2
Senior Project / Final Report 2009
𝜁 = 0.690
𝜔𝑛 = 21.7 𝑟𝑎𝑑/𝑠
Q. By using the model parameters, 𝐾 = 1.53 and 𝜏 = 0.0254, calculate Kp and Kv.
Solution:
𝜅𝑝 = 0.0254 𝑠
𝜅𝑣 = −0.157
The algorithim of the PID controller to control the position of the servo is:
𝑉𝑚 (𝑡) = 𝜅𝑝 (𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)) + 𝜅𝑖 ∫ 𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)𝑑𝑡 − 𝜅𝑣 {
𝑑
𝜃 (𝑡)}
𝑑𝑡 𝑙
Figure 5.5: PID Position Control
The La Place transform of the PID transfer function:
𝜅
𝑉𝑚 (𝑠) = {𝜅𝑝 + 𝑠𝑖} (𝜃𝑑 (𝑠) − 𝜃𝑙 (𝑠)) − 𝜅𝑣 𝑠𝜃𝑙 (𝑠)
Q. From the Simulink diagram, find the PIV closed-loop transfer function.
Solution:
𝐾(𝜅𝑝 𝑠 + 𝜅𝑖 )
𝜃𝑙 (𝑠)
= 3
𝜃𝑑 (𝑠)
𝑠 𝜏 + (1 + 𝐾𝜅𝑣 )𝑠 2 + 𝐾𝜅𝑖
27
Senior Project / Final Report 2009
5.3 Integral Gain Design:
After neglecting the velocity’s gain, we have a PI compensator:
𝑉𝑚 (𝑡) = 𝜅𝑝 (𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)) + 𝜅𝑖 ∫ 𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)𝑑𝑡
𝑡𝑖
𝑉𝑚 (𝑡) = 𝜅𝑝 𝑒𝑠𝑠 + 𝜅𝑖 ∫ 𝑒𝑠𝑠 𝑑𝑡
0
𝑡𝑖 = 1.0 𝑠
Q. Calculate the Integral Gain.
𝑉𝑚 (𝑡) = 𝜅𝑝 𝑒𝑠𝑠 + 𝜅𝑖 𝑡𝑖 𝑒𝑠𝑠
𝜅𝑖 =
−𝑉𝑚 (𝑡) + 𝜅𝑝 𝑒𝑠𝑠
𝑡𝑖 𝑒𝑠𝑠
𝜅𝑖 = 38.9
28
Senior Project / Final Report 2009
Chapter VI
SRV02 Speed Control Experiment
29
Senior Project / Final Report 2009
6.1 SRV02 Speed Model
Transfer function that represents the angular rate of the SRV02 load gear relative to the input
voltage.
With output and input variables
6.2 Specifications
SRV02 speed control time-domain and frequency-based specifications are:
𝑒𝑠𝑠 = 0
𝑃𝑂 ≤ 5%
𝑡𝑝 ≤ 0.05 𝑠
𝑃𝑀 ≥ 75 𝑑𝑒𝑔
𝜔𝑔 = 75 𝑟𝑎𝑑
30
Senior Project / Final Report 2009
6.3 Lab Procedure
Figure 6.1: Unity Feedback System
The output of the system above:
Y(s) = C(s) P(s) (R(s) – Y(s))
𝐶(𝑠)𝑃(𝑠)𝑅(𝑠)
Y(s) =
1+𝐶(𝑠)𝑃(𝑠)
The open-loop voltage to load gear position transfer function is:
𝜅
P(s) =
(𝜏 𝑠+1)𝑠
𝑌(𝑠)
𝜔𝑛2
= 2
𝑅(𝑠)
𝑠 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
𝑅(𝑠) =
𝑃𝑂 =
𝑅0
𝑠
100 ( 𝑌𝑚𝑎𝑥 − 𝑅0 )
𝑅0
𝑡𝑝 = 𝑡𝑚𝑎𝑥 − 𝑡0
𝑃𝑂 = 100𝑒
𝑡𝑝 =
{−
𝜋𝜁
}
√1−𝜁 2
𝜋
𝜔𝑛 √1 − 𝜁 2
𝑒𝑠𝑠 = 𝑟𝑠𝑠 (𝑡) − 𝑦𝑠𝑠 (𝑡)
31
Senior Project / Final Report 2009
𝐸(𝑠) = 𝑅(𝑠) − 𝑌(𝑠)
𝐸(𝑠) =
𝑅(𝑠)
1 + 𝐶(𝑠)𝑃(𝑠)
𝑅0
𝐸(𝑠) =
𝑠 {1 +
𝜅
}
(𝜏𝑠 + 1)𝑠
(𝜏𝑠 + 1)𝑠
}
𝑠→0 𝜏𝑠 2 + 𝑠 + 𝜅
𝑒𝑠𝑠 = 𝑅0 {lim
𝑒𝑠𝑠 = 0
The time –domain specifications for controlling the servo’s position are:
𝑒𝑠𝑠 = 0
𝑡𝑝 = 0.20𝑠
𝑃𝑂 = 5.0%
Q. By using the following expressions, calculate the maximum overshoot of the response (in rad)
given a step setpoint of 45°.
𝜃𝑑 (𝑡) =
𝜋
4
𝜃(𝑡𝑝 ) = 𝜃𝑑 (𝑡) {1 +
𝑃𝑂
}
100
Solution:
𝜃𝑑 (𝑡) = 0.785 𝑟𝑎𝑑
𝜃(𝑡𝑝 ) = 0.823 𝑟𝑎𝑑
The PI compensator to control the position of the servo is:
𝑉𝑚 (𝑡) = 𝜅𝑝 (𝑏𝑠𝑝 𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)) + 𝜅𝑖 ∫ 𝜃𝑑 (𝑡) − 𝜃𝑙 (𝑡)𝑑𝑡
The block diagram of the PI controller:
32
Senior Project / Final Report 2009
Figure 6.2: PI Speed Control
Taking the La Place transform of the transfer function:
𝑉𝑚 (𝑠) = 𝜅𝑝 (𝑏𝑠𝑝 Ω𝑑 (𝑠) − Ω𝑙 (𝑠)) −
𝜅𝑖
(Ω𝑑 (𝑠) − Ω𝑙 (𝑠))
𝑠
Q. From the Simulink above, find the closed-loop transfer function.
Solution:
𝐾(𝜅𝑝 𝑠 𝑏𝑠𝑝 + 𝜅𝑖 )
Ω𝑙 (𝑠)
= 2
Ω𝑑 (𝑠)
𝜏𝑠 + (1 + 𝐾𝜅𝑝 )𝑠 + 𝐾𝜅𝑖
The standard transfer function for a second order system is:
𝑌(𝑠)
𝜔𝑛2
= 2
𝑅(𝑠)
𝑠 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
Q. Find Kp and Kv.
Solution:
𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2
𝜏𝑠 2 + 𝑠 + 𝐾𝜅𝑝 𝑠 + 𝐾𝜅𝑖
𝑠2 +
33
(1 + 𝐾𝜅𝑝 )𝑠 𝐾𝜅𝑖
+
𝜏
𝜏
Senior Project / Final Report 2009
𝜔𝑛2 =
𝐾𝜅𝑖
𝜏
2𝜁𝜔𝑛 =
𝜅𝑖 =
1 + 𝐾𝜅𝑝
𝜏
𝜔𝑛2 𝜏
𝐾
𝜅𝑝 =
−1 + 2𝜁𝜔𝑛 𝜏
𝐾
Q. Using the following expressions, calculate 𝜁 and 𝜔𝑛 .
𝜁 = − ln {
𝜔𝑛 =
𝑃𝑂
}
100 √
1
𝑃𝑂 2
ln {100} + 𝜋 2
𝜋
𝑡𝑝 √1 − 𝜁 2
𝜁 = 0.690
𝜔𝑛 = 86.7 𝑟𝑎𝑑/𝑠
Q. By using the model parameters, 𝐾 = 8.82 and 𝜏 = 0.0507, calculate Kp and Ki.
Solution:
𝜅𝑝 = 0.569
𝜅𝑖 = 43.1
34
Senior Project / Final Report 2009
Chapter VII
Ball and Beam Experiment
35
Senior Project / Final Report 2009
7.1 Modeling
Figure 2: Ball & Beam open-loop block diagram.
The primary goal of modeling is to obtain a complete SRV02+BB01 Transfer Function.
The BB01 Transfer Function is:
And the SRV02 Transfer Function is:
The BB01 transfer function describes the displacement of the ball with respect to the load angle
of the servo. The SRV02 load-to-angle transfer function will be added to the system to get the
full SRV02+BB01model.the transfer function that represents the position of the SRV02 load gear
relative to the input voltage is:
With output and input variables :
Model parameters for SRV02 in high-gear configuration with no load are:
𝐾 = 1.7588, 𝜏 = 0.0285
36
Senior Project / Final Report 2009
7.2 Nonlinear equation of motion
Ball-and-beam model describes the position of the ball with respect to the angle of the beam
relative to the horizontal. The equation of motion is:
By applying Newton’s law of motion, the forces acting on ball alongside the beam equal:
Where 𝑚𝑏 is the mass of the ball.
Figure 7.1: Complete ball & beam free-body diagram.
Q. Find the force in the x direction, along the beam, that is caused by gravity (Fx,t).
Solution:
37
Senior Project / Final Report 2009
Q. Find the force that is caused by rotational inertia of the ball in the x direction, if the torque of
the ball is:
Solution:
The force caused by the rotation of the ball is:
The relationship between rotation of ball and linear displacement
The torque of the ball is:
The force acting on the ball in the x direction from its momentum becomes:
Q. Give the nonlinear equation of motion in the form of:
Solution:
We know that:
And that:
38
Senior Project / Final Report 2009
Insert translational and rotational forces
Solving for the linear acceleration of the ball, this becomes:
7.3 Adding SRV02 Dynamics
In this section the equation of motion representing the position of the ball relative to the angle of
the SRV02 load gear is found. The derived equation will have to be linearized in order for the
model to be used in control design.
Figure 7.2: Ball & beam schematic
39
Senior Project / Final Report 2009
Q. Using the schematic shown above, find the relationship between the SRV02 load gear angle
(𝜃1 ) and the beam angle (𝛼).
Solution:
Consider the beam and servo angles required to change the height of the beam by ℎ.
Taking the sine of the beam angle gives:
And taking the sine of the servo load angle will produce the following:
It is given that the height of the beam is:
As a result, the relationship between the servo and beam angle is:
Q. Find the equation of motion that represents the ball’s motion with respect to the SRV02 angle
(𝜃1 ).
Solution:
Insert the servo and beam relationship into the nonlinear equation of motion:
Assume small angles and therefore
Applying this to the nonlinear equation of motion, results in the linear equation of motion
of the BB01.
The Model gain is the coefficient of 𝜃𝑙 (𝑡) and it is expressed by:
By Simplifying the equation of motion, we get:
40
Senior Project / Final Report 2009
Ball and beam system parameters are:
Moment of inertia of solid sphere:
Moment of inertia of BB01 ball is:
Value of ball inertia has the value of:
Q. Find the model gain(𝐾𝑝𝑝 ).
Solution:
7.4 Obtaining a Transfer Function
In this section we will find the transfer function describing the servo voltage to the ball’s
displacement.
Q. Find the transfer function Pss(s) of the BB01. Assume that all I.C’s are zero.
Solution:
The Laplace transform of BB01 linear equation of motion is:
By solving for X(s), we obtain the following transfer function for BB01.
The BB01 plant transfer function is:
41
Senior Project / Final Report 2009
Q. Give the complete SRV02+BB01 process transfer function.
Solution:
Transfer function between SRV02 voltage and ball position
BB01 Plant transfer function
7.5 BB01 Control
Consider a unity feedback system.
Figure 7.3: Unity feedback system.
The output of a unity feedback system with compensator 𝐶(𝑠) and a plant model𝑃(𝑠)is.
The closed-loop unity feedback transfer function is:
A standard second-order system has the form of:
The time-domain specifications for controlling the position of the SRV02 load shaft are:
42
Senior Project / Final Report 2009
The specifications for controlling the position of the ball are:
Where 𝑐𝑡𝑐 is the ball and beem settling percentage.
The upper-bound equation of envelope of a damped sinusoid is:
The settling time percentage equation is:
The upper -bound in terms of settling time percentage equation is:
Q. Show that the equation for settling time is:
Solution:
Place formula in terms of settling time percentage and solve for exponent.
Take log
Solve for settling time
Minimum natural frequency required to meet peak time and overshoot specification is.
Second-order system peak time equation is:
43
Senior Project / Final Report 2009
Maximum percentage overshoot equation is:
Minimum natural frequency required to meet peak time and overshoot specification.
7.6 Ball and Beam Cascade Control Design
The cascade control that will be used for SRV02+BB01 system is illustrated by the block
diagram shown in figure 5. Based on the measured ball position X(s), the ball and beam
compensator, 𝐶𝑏𝑏 (𝑠), the servo load angle needed 𝜃𝑑 (𝑠) will be computed in the outer-loop to
attain the desired ball position, 𝑋(𝑑). The servo compensator 𝐶𝑠 (𝑠) calculates the motor voltage
required for the load angle to track the desired load angle.
Figure 7.4: Cascade control system used to control ball position in SRV02+BB01 plant
7.6.1 Inner-loop design: SRV02 PV Position Controller
Q. If the model parameters had the values of 𝐾 = 1.76, 𝜏 = 0.0285, calculate the following:
Minimum damping ratio.
Natural frequency.
The control gains needed to satisfy the time-domain response requirements.
Solution:
44
Senior Project / Final Report 2009
7.6.2 Outer-loop (SRV02+BB01) Stability Analysis
Before designing the cascade control, some analysis is performed on the entire system. The
inner-loop that controls the position of the SRV02 load shaft is complete and the servo dynamics
can be neglected now. Assume that the desired load angle equals the measured load angle.
The outer-loop shown in figure 6, controls the position of the ball and beam.
Figure 7.5: BB01 closed-loop system.
Q. Using figure 6, find the closed-loop transfer function for the BB01 system with a proportional
compensator of:
Solution:
BB01 controller with unity compensator
Closed-loop system of BB01 with proportional compensator
45
Senior Project / Final Report 2009
Q. Plot the root locus of the BB01 system.
Solution:
Figure 7.7: Root locus of open-loop BB01 system.
Poles of CLS
As the poles of system move further along the imaginary axis, the system becomes more
oscillatory (generally more unstable).
7.6.3 Desired Location of Poles
Recall the prototype second order system:
Let’s say that we have the following natural frequency:
46
Senior Project / Final Report 2009
And the following desired damping ratio:
Figure 7.7: Desired damping ratio
Location of poles along the real axis:
Location of poles along the imaginary axis is the damped frequency:
Angle of poles from imaginary axis from damping ratio
The damping ratio required to meet specs is.
The natural frequency needed to meet specs is.
47
Senior Project / Final Report 2009
Q. Find the closed-loop transfer function of the ball and beam when using the PV controller
shown in figure 8.
Figure 7.8: Ball and beam ideal PV controller.
Solution:
The ideal PD controller is:
The ideal PD closed-loop BB01 position control transfer function is.
The ideal PV controller:
The ideal PV closed-loop BB01 position control transfer function:
7.6.4 Finding Zero Location and Gain to Satisfy Specifications
Recall the prototype second-order system:
Characteristic equation:
48
Senior Project / Final Report 2009
Desired gain equation:
Desired zero location:
Desired gain:
Desired zero location:
Computed compensator gain
Evaluated zero location
49
Senior Project / Final Report 2009
Chapter VIII
Overview of IP02 Plant
And
Self-erecting Inverted Pendulum Theorem
50
Senior Project / Final Report 2009
8.1 Introduction
The Self-Erecting Single Inverted Pendulum (SESIP) system consists of a single rod mounted on
an IP02 linear cart. The rotation axis of this cart is perpendicular to the direction of the motion of
the cart. The pendulum rod is free to swing along the cart’s axis of motion. The control system of
the SESIP starts with the “down” position, swings up, and finally balances it upright while
maintaining or tracking a desired cart position.
8.2 IP02 Device
IP02 is a fundamental module for the linear motion experiment. It consists of a precisely solid
aluminum cart driven by a high quality DC motor equipped with a planetary gearbox. The cart
slides along stainless steel shaft using linear bearings. The cart is driven via a rack and pinion
mechanism as opposed to the wheels. The Ip02 can suspend in front of the cart to perform self
erecting and gantry experiments. The IP02 system has encoders to allow for multiple turns. The
IP02 cart position is sensed by a quadrature incremental encoder whose shaft meshes with the
track via an additional pinion. A schematic representing the IP02 input and output is shown in
figure 1.
figure 8.1: The IP02 plant input and output
51
Senior Project / Final Report 2009
8.3 Mathematical Theorem
the open loop transfer function of the IP02 system is defined as:
𝐺(𝑠) =
𝑥𝑐 (𝑠)
𝑉𝑚 (𝑠)
The resulting PV control law is:
𝑑
𝑉𝑚 (𝑡) = 𝐾𝑝𝑐 (𝑥𝑝𝑐 (𝑡) − 𝑥𝑐 (𝑡)) − 𝐾𝑣_𝑐 ( 𝑥𝑐 (𝑡))
𝑑𝑡
Figure 8.2: Angle definition
52
Senior Project / Final Report 2009
8.4 Demonstration
The self-erecting inverted pendulum can be implemented by using running the proper MATLABSimulink codes. ( Appendix)
53
Senior Project / Final Report 2009
Chapter IX
Societal Impacts
54
Senior Project / Final Report 2009
9.1 Societal Impacts
This project will benefit the instructor of, and the students enrolling in, the feedback control
course offered at California University of Pennsylvania. The students will have the opportunity
to experience the implementation of controllers in real-time. Seeing these controlled plants work,
will solidify the students’ understanding of control’s theorem. The outcome of this project is the
enhancement of the learning process offered by the university.
55
Senior Project / Final Report 2009
Chapter X
Conclusion and Recommendations
56
Senior Project / Final Report 2009
10.1 Recommendations
After the completion of the project’s core, I believe that offering a second feedback control
course at the university will give the students enough time to really enjoy and understand the
operational concept of theses plant. Downloading the required software in a network will be an
advantage because the students will be able to carry on their experiments remotely. The
university can always buy hardware extensions and produce so many more experiments.
10.2 Conclusion
Goals, objectives, and timelines were all reached as was proposed by the author earlier in the fall
of 2008. The expected outcome of this project was to get the Quanser’s plant fully operational
and document the mathematical theory that can be useful to the students. All the plants are
functioning to their full potential and this document provides an important resource to
understand the real-time concepts of these experiments. I have efficiently utilized all of my
resources in order to complete this project. One particular resource was the support engineering
department of Quanser. Finally, I would like to confirm the successful completion of all phases
of this project.
57
Senior Project / Final Report 2009
References
[1] Dorsey, J. (2002). Continuous and Discrete Control Systems. New York: McGraw Hill.
[2] Franklin, G. F., Naeini. A. E., & Powell, J.D. (2002). Feedback Control of Dynamic
Systems 4th edition. New Jersey: Prentice Hall.
[3] Nise, N. S. (1995). Control Systems Engineering. California: Benjamin/Cummings.
[4] www.quanser.com
[5] www.adeptscience.dk
[6] http://www.wikipedia.org/
[7] www.mathworks.com
[8] Quanser’s PDF and m files.
[9] www.engin.umich.edu
58
© Copyright 2026 Paperzz