experiment 3.pdf
TRANSCRIPT
-
7/22/2019 Experiment 3.pdf
1/8
Lab 3- Servo Position Control And Rotary
Pendulum Control
ME 413 - Microprocessors and AutomaticControl Lab
Indian Institute of Technology Gandhinagar
1 SERVO POSITION CONTROL
1.1 AIM :
To design and analyze a servo position controller to meet the design specifications,
using PD controller.
1.2 Facilities Required:
1. Setup of QUBE servo position control
2. Matlab installed with Quarc setup
1.3 Theory:
1.3.1 Servo Model:
The QUBE-Servo voltage-to-position transfer function is given by,
P(s) =m(s)
Vm(s) =
K
s(s + 1)
-
7/22/2019 Experiment 3.pdf
2/8
where K = 23.2 rad/(V-s) is the model steady-state gain, = 0.13 s is the model timeconstant, m(s) = L[ m(t)] is the motor / disc position, and Vm(s) = L[vm(t)] is the
applied motor voltage.
1.3.2 PID Control:
The proportional, integral, and derivative control can be expressed mathematically as
follows
u(t) =ke(t) + ki
t0
e() d+ kdde(t)
dt
The corresponding block diagram is given in Figure 1. The control action is thus a sum
of three terms referred to as proportional (P), integral (I) and derivative (D). The above
controller equation can also be described by the transfer function
C(s) =ks +kis
+ kds
The proportional term is based on the present error, the integral term depends on past
Figure 1: Block Diagram of PID control
errors, and the derivative term is a prediction of future errors. Advanced model-based
controllers differ from the PID controller by using a model of the process for prediction.
1.3.3 PD Position Control:
The proportional-velocity (PV) control has the following structure
u=kp(r(t)y(t))kdy(t)
wherekp is the proportional gain, kdis the derivative gain, r =d(t)is the setpoint orreference motor / load angle, y = m(t)is the measured load shaft angle, and u = Vm(t)
-
7/22/2019 Experiment 3.pdf
3/8
is the control input (i.e., in this case, the applied motor voltage).
The closed-loop transfer function of the QUBE-Servo is denoted Y (s)/R(s) = m(s)/d(s).Assume all initial conditions are zero, i.e., m(0
) = 0 and m(0) = 0, taking the
Laplace of above equation gives
U(s) =kp(R(s)Y(s))kdsY(s)
Solving for Y (s)/R(s), we obtain the closed-loop expression,
Y(s)
R(s)=
Kkp
s2 + (1 + Kkd)s + Kkp
This is a second-order transfer function. Recall the standard second-order transfer
function
Y(s)
R(s)=
2ns2 + 2 ns + 2n
1.4 EXPERIMENT:
Design the Simulink model shown in Figure 2. This implements the PD controller with
a high-pass filter of 150s/(s + 150). Set the Signal Generator block such that the servo
command (i.e., reference angle) is a square wave with an amplitude of 0.5 rad and at a
frequency of 0.4 Hz.
1.4.1 Procedure
1. Build and run the QUARC controller. The response should look similarly as shown
in Figure.3
2. Set kp = 2.5 V/rad and kd = 0. Keep the derivative gain at 0 and vary kp be-
tween 1 and 4. What does the proportional gain do when controlling servo position?
3. Set kp = 2.5 V/rad and vary the derivative gain kdbetween 0 and 0.15 V/(rad/s).
What is its effect on the position response?
4. Stop the QUARC controller.
5. Find the proportional and derivative gains required for the QUBE-Servo closed-
loop transfer function to match the standard second-order system. Your gain equationswill be a function ofn and .
6. For the response to have a peak time of 0.15 s and a percentage overshoot of 2.5%,
the natural frequency and damping ratio needed are n = 32.3 rad/s and= 0.76. Us-ing the QUBE-Servo model parameters, K and , calculate the control gains needed to
-
7/22/2019 Experiment 3.pdf
4/8
Figure 2: PD Control of QUBE-Servo
Figure 3: QUBE Servo PD control withKp=2.5 andKd= 0.05
satisfy these requirements.
7. Run the PD controller with the newly designed gains on the QUBE-Servo. At-
tach the position response as well as the motor voltage used.
8. Measure the percent overshoot and peak time of the response. Do they match the
desired percent overshoot and peak time specifications given in Step 6 without saturat-
ing the motor, i.e., going beyond 10 V?
Hint: Use the Matlab ginput command to measure points off the plot.
-
7/22/2019 Experiment 3.pdf
5/8
9. If your response did not match the above overshoot and peak time specification,
try tuning your control gains until your response does satisfy them. Attach the result-ing Matlab figure, resulting measurements, and comment on how you modified your
controller to arrive at those results.
2 Rotary Inverted Pendulum Balance Control
2.1 AIM :
To design and analyze a controller for balancing a pendulum in the upright position
using LQR controller.
2.2 Facilities Required:
1. Setup of QUBE servo inverted pendulum control
2. Matlab installed with Quarc setup
2.3 Theory:
2.3.1 Background:
A rich collection of methods for finding parameters of control strategies have been
developed. Several of them have also been packaged in tools that are relatively easy to
use. Linear Quadratic Regulator (LQR) theory is a technique that is suitable for finding
the parameters of the balancing controller. Given that the equations of motion of the
system can be described in the form
x=Ax +Bu
the LQR algorithm computes a control task,u, to minimize the criterion
J=
0x(t)TQx(t) + u(t)TRu(t)dt (1)
The matrixQ defines the penalty on the state variable and the matrix R defines the
penalty on the control actions. Thus when Q is made larger, the controller must work
harder to minimize the cost function and the resulting control gain will be larger. In
our case the state vectorx is defined
x=
T
(2)
Since there is only one control variable, R is a scalar and the control strategy used
to minimize cost functionJis given by
u=K(xrx) =kp,(r )kp, kd,kd,. (3)
This strategy is know as state-feedback control and is illustrated in Figure 4. It is
equivalent to the PD control explained in the Balance Controllab.
-
7/22/2019 Experiment 3.pdf
6/8
Figure 4: Block diagram of balance state-feedback control for rotary pendulum
2.4 Experiment
Construct a controller similarly as shown in Figure 5 that balances the pendulum on
the QUBE-Servo Rotary Pendulum system using a generated control gain K.
Figure 5: Simulink model used with QUARC run optimized balance controller
The LQR theory has been packaged in the Control Design Module. Given the
model of the system,in the form of the state-space matrices Aand B, and the weighting
matrices QandR, the LQR function computes the feedback control gain automatically.
In this experiment, the state-space model is already available. In the laboratory, the
-
7/22/2019 Experiment 3.pdf
7/8
effect of changing the Q weighting matrix while R is fixed to 1 on the cost function J
will be explored.
2.4.1 LQR Control Design
1. In Matlab, run the setup qube rotpen.m script. This loads the QUBE-Servo ro-
tary pendulum state-space model matrices A, B, C, and D. The A and B matrices
should be displayed in the Command Window:
A =
0 0 1.0000 0
0 0 0 1.0000
0 149.2751 -0.0104 0
0 261.6091 -0.0103 0
B =
0
0
49.7275
49.1493
2. Use theeig command to find the open-loop poles of the system. What do you
notice about the location of the open-loop poles? How does that affect the sys-
tem?
3. Using thelqr function with the loaded model and the weighting matrices
Q=
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
andR=1,
generate gainK. Give the value of the control gain generated.
4. Change the LQR weighting matrix to the following and generate a new gain
control gain:
Q=
5 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
andR=1.
Record the gain generated. How does changing q11 affect the generated control
gain? Based on the description of LQR in above, is this what you expected?
-
7/22/2019 Experiment 3.pdf
8/8
2.4.2 LQR-Based Balance Control
1. Run setup qube rotpen.mscript in Matlab.2. Using the Simulink model you made in the Balance Control lab, construct the
controller shown in Figure 5:
Add the necessary Sum and Gain blocks to implement the state-feedback control.
Since the control gain is a vector, make sure the gain block is configured to do
matrix type multiplication.
Add the Signal Generator block in order to generate a varying, desired arm
angle. To generate a reference state, make sure you include a Gain block of
[1 0 0 0].
3. Load the gain designed in Step 3 in LQR Control Design. Make sure it is set as
variable K in the Matlab workspace.
4. Build and run the QUARC controller.5. Once the pendulum is balanced, attach your response of the rotary arm, pendu-
lum, and controller voltage.
6. In Matlab, generate the gain usingQ=diag([5 1 1 1])performed in Step 4in LQR Control Design. The diag command specifies the diagonal elements in a square
matrix.
7. To apply the newly designed gain to the running QUARC controller, go to the
Simulink model and selectEdit Update Diagram(or press CTRL-D).
8. Examine and describe the change in the Rotary Arm (deg) and Pendulum (deg)
scopes.
9. Adjust the diagonal elements ofQ matrix to reduce how much the pendulum
angle deflects when the arm angle changes. Describe your experimental procedure to
find the necessary control gain.
10. List the resulting LQRQ matrix and control gain Kused to yield the desiredresults. Attach the responses using this new control gain and briefly outline how the
response changed.
11. Click on the Stopbutton to stop running the controller.
12. Power off the QUBE-Servo if no more experiments will be performed in this
session.