Title: Controls Lab
1Controls Lab
Objectives
1. Create and validate a first-order model of a
brushless DC motor. 2. Measure nonlinearities of
the motor to use for nonlinear model 3.
Qualitatively observe the effects of the P, I,
and D gains. 4. Use model parameters to design a
P, PD, and PID controllers for the motor.
2Controls Lab
Objectives cont.
- Test the performance of the previously developed
P, PD, and PID position controllers on a
brushless DC motor. - Adjust the PID gain to improve system
performance. - Post-laboratory work
- Compare the empirical performance of the various
controllers to each other and to the simulated
performance
3 Apparatus
- PC
- Quanser Data Acquisition
- Amplifier
- Motor and Flywheel
4Background
Motor differential equation (1) Wh
ere T is the torque on the rotor Kt is the
torque coefficient, if is the field current, vf
is the field voltage, Rf is the field
resistance, J is the moment of inertia, w is the
rotating speed and B is the friction
coefficient. Motor dynamics in the Laplace
domain (2)
5For a step voltage input, the Laplace transform
of the velocity response is (3)
Time domain velocity response (4)
To identify the motor constant Km , recognize
that the steady state speed equals the product
Vin Km. Also note that the time constant Tm can
be readily identified by finding the time
required for the velocity to reach 63.2 (1-e-1)
of the steady state speed.
6Procedure Motor Parameter Data Collection
- Open WINCON and start SIMULINK from that.
- Open Control_Template1.mdl as shown on figure
1. - 3. Specify vin (e.g. vin 0.8)
- 4. Build model.
- 5. Plot -gt New -gt Scope....
- Hit START.
- Hit STOP
- Save plots as M-files.
- Repeat...
7Figure 1. SIMULINK/Quanser System to Implement
Parameter Identification Experiment
8From Simulink Source
Parameters
Step time 0
Initial value 0
From Quanser Library
Quanser Consulting
Final value vin
Quanser Consulting MQ3 Series
Step
MQ3 DAC
(leave parameters as default)
Sample time 0
Analog Output
From Quanser Library
Quanser Consulting
Quanser Consulting MQ3 Series
MQ3 ENC
(leave parameters as default)
Encoder Input
From Simulink Sinks
Scope
From Quanser Library
Quanser Consulting MQ3 Series
Quanser Consulting
From Simulink Continuous
(leave parameters as default)
MQ3 Timer
25s
Parameters
s25
Numerator 25 0
Time-Base
Denominator 1 25
Transfer Fcn
From Simulink Math
Parameter
-K-
Gain 1/2000
From Simulink Signals Systems
(leave the rest as default)
Gain
Terminator
Figure 2. SIMULINK and Quanser System blocks
9Procedure Nonlinearity Data Collection
1. Use Control_Template_1. 2. Specify a positive
value for vin. 3. Reduce vin until motor stops
turning. (Find vin to two decimal places
e.g.0.54V) 4. Repeat, starting with negative vin
to find negative deadzone. 5. Enter values in
Table 1 below.
Table 1 Deadzone/Saturation Limits
Positive limit
Negative limit
Deadzone
Saturation
10 V
-10 V
10Procedure Parameter Identification
- 1.Open M file. (Type name of the file without the
.m extension in the command window.) - 2. Find the steady-state speed ?ss by inspection.
- 3. Calculate the motor gain Km according to the
formula - (5)
- 4. Calculate the characteristic speed of the
motor ? - (6)
- 5. By inspection of the graph, determine the time
constant Tm . - 6. Repeat the steps above to find the constants
corresponding to each step input voltage Vin. - 7. Enter values in Table 2.
11 Table 2. Experimentally Determined System
Parameters
12Procedure Model Verification
1.Create the Simulink model shown in Figure 3.
2. Use experimental 1.0 Volt parameters for Tm
and Km. 3. Run the simulation. 4. Plot the data
in the Matlab command window and overlay it with
the experimental data. (See Figure 4.)
Figure 3. SIMULINK Model Used to Verify Parameter
Identification
13?
Tm
Figure 4. Comparison of Experimental Data (solid
line) with Simulation Model (broken line) Steady
state velocity is 7.35 rev/sec for 1.0 volt
input. Characteristic speed is 4.65 rev/sec at
0.945 sec.
14Procedure Qualitative Observations
1. Use Control_Qualitative.mdl as shown on
Figure 5. 3. Specify gains (Kp,Ki,Kd) for P
controller. 4. Build model and hit START. 5. For
each controller turn the flywheel with your hand
(1) quickly, (2) slowly, and (3) turn and hold in
position. 6. What aspect is the restoring force
sensitive to? Record your observations in your
lab notebook. 7. Repeat for I and D controllers.
15Quanser Consulting
Quanser Consulting
Transfer Fcn
Figure 5. SIMULINK Model for Qualitative
Observations
16Simulink and Quanser Blocks
From Quanser Library Quanser Consulting MQ3
Series
From Quanser Library Quanser Consulting MQ3
Series
(leave parameters as default)
(leave parameters as default)
From Quanser Library Quanser Consulting MQ3
Series
(leave parameters as default)
From Simulink Continuous
From Simulink Math
Parameters
Parameters
Gain 1/2000
Numerator 25 0
Denominator 1 25
From Simulink Source
Parameters
Constant Value 0
From Simulink Math
Parameters
List of signs
List of signs
Figure 6. SIMULINK and Quanser System blocks
17Controller Gain Calculations
These gains, calculated by the Pole-Placement
Method, are to be used in the next part of the
Controls lab. NOTE CONTROLLER GAINS SHOULD BE
CALCULATED VIA MATLAB
1. P (Proportional) Controller (Mp10)
The damping ratio, ?, can be determined from the
fractional overshoot, Mp (10) from the
relationship (7)
The proportional gain (8)
2. PD (Proportional plus Derivative) Controller
(Mp10) and (tds2.5sec)
The desired natural frequency can
be determined from the following
relationship
(9)
18(10)
(11)
3. PID Controller (Mp10) and (ts2.5sec)
(12)
(13)
(14)
(15)
19Table 3 Calculated Controller GainsFor
specified Maximum Overshoot 10 and specified
Settling Time 2.5 sec
(nn1)
(nn2)
(nn3)
Note values of n1, n2, and n3 change each
semester
20Background PID Performance
Motor Transfer function (Position output)
PID controller transfer function
Feedback control block diagram
Figure 7. Control Feedback Block Diagram
21Procedure PID Controller Performance
1. Open Control_Template_2. Set constants
according to TA instructions 2. Set Kp, Ki, and
Kd to the values you calculated for each of the P
controller. 3. RTW Build 4. Plot both the shaft
position and the control signal (voltage) on the
same graph by selecting Plot -gt New -gt Scope...
from the WinCon Server toolbar and choosing
Scope1a and Scope1b. 5. Run the controller for at
least 1 complete period. 6. Save the graph with
both variables plotted as an M-file. 10. Repeat
for the PD, and PID controllers.
22Block Diagram to Initiate Position Control of
Motor
Pulse Generator
From Simulink Source (use time based)
From Simulink Source
Parameters
Parameters
Amplitude 12
Constant Value 0
Period 40
Pulse width 50
Phase Delay 0
Figure 8. SIMULINK Model used for Position
Control of DC Motor
23Simulink and Quanser Blocks
From Quanser Library Quanser Consulting MQ3
Series
From Quanser Library Quanser Consulting MQ3
Series
(leave parameters as default)
(leave parameters as default)
From Quanser Library Quanser Consulting MQ3
Series
(leave parameters as default)
From Simulink Continuous
From Simulink Math
Parameters
Parameters
Gain 1/2000
Numerator 25 0
Denominator 1 25
From Simulink Source
Parameters
Constant Value 0
From Simulink Math
Parameters
List of signs
List of signs
Figure 9. SIMULINK and Quansar Blocks Used in
Position Control
24SCORE-Change
Procedure PID Controller Performance 2
- Open M Files.
- Measure the maximum overshoot, the 2 settling
time, and the steady-state error for each graph
(where applicable) and record the information in
Table 1. See Figure 4 for an example. - Calculate the score for the performance of the
controller. - SOmax x tsettle
- Adjust the gains of the best PID controller to
improve the performance of the controller. Record
the gains and the scores for each attempt in
Table 1.
Figure 10. Example measured quantities settling
time and max overshoot.
25Non-Linear Simulink Model Verification
- Build the following Non-Linear Model to compare
to experimental results. - The Transfer Fcn2 on the right is really just
(Km / (Tms2 s)). - To Run your simulation, make sure to go to
Simulation, then Configuration Parameters, and
run Variable-Step (Ode 45 or fixed Ode5), at
around 0.1 max and 0.05 min step sizes. This
will make your simulation run much quicker. Feel
free to vary these values to make a higher
resolution plot. - Slight modification to this model will give a
linear version.
See Earlier Slide
Pulse Generator
See Earlier Slide
Figure 11 Non-Linear Model
26Controller Performance Results
Table 4. Simulation and experimental performance
results for various controllers.