You are on page 1of 39

STUDENT WORKBOOK

QNET 2.0 DC Motor Board for NI ELVIS


Developed by Quanser
Curriculum designed by:
Peter Martin, M.A.Sc., Quanser
Matthias Krug, Ph.D., Quanser
Jacob Apkarian, Ph.D., Quanser

Curriculum
complies with*

INFO@NI.COM INFO@QUANSER.COM

*ABET Inc. is the recognized accreditor for college and university programs in applied science, computing, engineering, and technology.
Modeling

This Workbook and the VIs provided are designed for the second generation black Quanser QNET
2.0 DC Motor Board for NI ELVIS II(+) . Second generation VIs can be identified by the small black
symbol in the upper right corner of the VI. These VIs will not work for blue first generation boards.

Topics Covered
• First order transfer functions.
• Obtaining the QNET DC Motor model using the bump test method.

• Model validation

Prerequisits
• The QNET DC Motor has been setup and tested. See the QNET DC Motor Quick Start Guide for details.
• You have access to the QNET DC Motor User Manual.

• You are familiar with the basics of LabVIEW™.

QNET DC MOTOR Workbook - Student v 2.0


1 Background
1.1 Bump Test
The bump test is a simple test based on the step response of a stable system. A step input is given to the system
and its response is recorded. As an example, consider a system given by the following transfer function:

Y (s) K
= (1.1)
U (s) τs + 1

The step response shown in Figure 1.1 is generated using this transfer function with K = 5 rad/V.s and τ = 0.05 s.

Figure 1.1: Input and output signal used in the bump test method

The step input begins at time t0 . The input signal has a minimum value of umin and a maximum value of umax . The
resulting output signal is initially at y0 . Once the step is applied, the output tries to follow it and eventually settles at
its steady-state value yss . From the output and input signals, the steady-state gain K is

∆y
K= , (1.2)
∆u

where ∆y = yss − y0 and ∆u = umax − umin . In order to find the model time constant τ we can first calculate where
the output is supposed to be at the time constant from:

y(t1 ) = 0.632yss + y0 . (1.3)

Then, we can read the time t1 that corresponds to y(t1 ) from the response data in Figure Figure 1.1. From the figure
we can see that the time t1 is equal to:

QNET DC MOTOR Workbook - Student 2


t1 = t0 + τ. (1.4)

From this, the model time constant can be found as

τ = t1 − t0 . (1.5)

1.2 Model Validation


When the modeling is complete it can be validated by running the model and the actual process in open-loop. That
is, the open-loop voltage is fed to both the model and the actual device such that both the simulated and measured
response can be viewed on the same scope. The model can then be adjusted to fit the measured motor speed by
fine-tuning the modeling parameters.

See Wikipedia for more information on electric motor, mathematical model, transfer function, and LTI system theory.

1.3 Modeling Virtual Instrument


Applying a voltage to the QNET DC Motor and examining its angular rate is investigated in the laboratory. The model
simulation is run in parallel with the actual system to allow for model tuning and validation. The LabVIEW™ virtual
instrument for modeling is shown in Figure 1.2. Figure 1.3 shows the graphs-view of the VI, which is used to take
measurements.

Figure 1.2: LabVIEW™ VI for modeling QNET DC Motor

QNET DC MOTOR Workbook - Student v 2.0


Figure 1.3: QNET DC Motor Modeling VI: sample response in Measurement Graphs

QNET DC MOTOR Workbook - Student 4


2 In-Lab Exercise
2.1 Bump Test
1. Ensure the QNET DC Motor Modeling.vi is open. Make sure the correct Device is chosen.
2. Run the VI. The DC motor should begin spinning and the scopes on the VI should appear similar to those
shown in Figure 1.2.
3. In the Signal Generator section set

• Amplitude (V) = 2.0


• Frequency (Hz) = 0.40
• Offset (V) = 3.0
4. Once you have collected a step response, click on the Stop button to stop running the VI.

5. Attach the responses in the Speed (rad/s) and Voltage (V) graphs.

6. Select the Measurement Graphs tab to view the measured response as depicted in Figure 1.3.
7. Use the responses in the Speed (rad/s) and Voltage (V) graphs to compute the steady-state gain of the DC
motor. See the Background section of this laboratory for details on how to find the steady-state gain from a
step response. You can use the Cursor Palette to measure data. See the QNET DC Motor User Manual or
the LabVIEW™ help for more information.
8. Based on the bump test method, find the time constant. See the Background section for details on how to find
the time constant of the step response.

2.2 Model Validation


1. Open the QNET DC Motor Modeling.vi. Make sure the correct Device is chosen.

2. Run the VI. You should hear the DC motor begin running and the scopes on the VI should appear similar to
those shown in Figure 1.2.

3. In the Signal Generator section set:


• Amplitude (V) = 2.0
• Frequency (Hz) = 0.40
• Offset (V) = 3.0

4. In the Model Parameters section of the VI, enter the bump test model parameters K and τ that were found in
Bump Test Laboratory. The blue simulation should match the red measured motor speed more closely.

5. Attach the Speed (rad/s) and Voltage (V) chart responses from the Scopes tab.
6. How well does your model represent the actual system? If they do not match, name one possible source for
this discrepancy.
7. Tune the steady-state gain K and time constant τ in the Model Parameters section so the simulation matches
the actual system better and write down their values.

QNET DC MOTOR Workbook - Student v 2.0


© 2014 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
info@quanser.com
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. Quanser Inc. grants the following rights: a) The right to reproduce
the work, to incorporate the work into one or more collections, and to reproduce the work as incorporated in the collections, b) to create and
reproduce adaptations provided reasonable steps are taken to clearly identify the changes that were made to the original work, c) to distribute
and publically perform the work including as incorporated in collections, and d) to distribute and publicly perform adaptations. The above rights
may be exercised in all media and formats whether now known or hereafter devised. These rights are granted subject to and limited by the
following restrictions: a) You may not exercise any of the rights granted to You in above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation, and b) You must keep intact all copyright notices for the Work and provide the
name Quanser Inc. for attribution. These restrictions may not be waved without express prior written permission of Quanser Inc.

QNET DC MOTOR Workbook - Student 6


Qualitative PI Speed Control

This Workbook and the VIs provided are designed for the second generation black Quanser QNET
2.0 DC Motor Board for NI ELVIS II(+) . Second generation VIs can be identified by the small black
symbol in the upper right corner of the VI. These VIs will not work for blue first generation boards.

Topics Covered
• QNET DC Motor speed control.
• Proportional-integral (PI) compensator design.

Prerequisits
• The QNET DC Motor has been setup and tested. See the QNET DC Motor Quick Start Guide for details.

• You have access to the QNET DC Motor User Manual.


• You are familiar with the basics of LabVIEW™.

QNET DC MOTOR Workbook - Student v 2.0


1 Background
The speed of the QNET DC Motor is controlled using a proportional-integral control system. The block diagram of
the closed-loop system is shown in Figure 1.1.

Figure 1.1: QNET DC Motor PI closed-loop block diagram

The transfer function representing the DC motor speed-voltage relation with steady-state gain K and time constant
τ is
Y (s) K
= (1.1)
U (s) τs + 1
and will be used to design the PI controller. The input-output relation in the time-domain for a PI controller with
set-point weighting is

ki (r − y)
u = kp (bsp r − y) + , (1.2)
s

where kp is the proportional gain, ki is the integral gain, and bsp is the set-point weight. The closed loop transfer
function from the speed reference r to the angular motor speed output ωm is

K (kp bsp s + ki )
Gω,r (s) = . (1.3)
τ s2 + (Kkp + 1)s + Kki

1.1 Speed Control Virtual Instrument


The LabVIEW™ virtual instrument for speed control laboratory experiment is shown in Figure 1.2.

QNET DC MOTOR Workbook - Student 2


Figure 1.2: Virtual instrument for QNET DC Motor speed control

QNET DC MOTOR Workbook - Student v 2.0


2 In-Lab Exercise
1. Ensure the QNET DC Motor Speed Control.vi is open. Make sure the correct Device is chosen.
2. Run the VI. The DC motor should begin rotating and the scopes should look similar to Figure 1.2.

3. In the Signal Generator section set:


• Amplitude (rad/s) = 25.0
• Frequency (Hz) = 0.40
• Offset (V) = 100.0
• Signal = 'Square'

4. In the Control Parameters section set:


• kp (V.s/rad) = 0.050
• ki (V/rad) = 1.00
• bsp = 0.00

5. Examine the behaviour of the measured speed, shown in red, with respect to the reference speed, shown in
blue, in the Speed (rad/s) scope. Explain what is happening.

6. Increment and decrement kp by steps of 0.005 V.s/rad.


7. Look at the changes in the measured signal with respect to the reference signal. Explain the performance
difference of changing kp .

8. Set kp to 0 V.s/rad and ki to 0 V/rad. The motor should stop spinning.


9. Increment the integral gain, ki, by steps of 0.05 V/rad. Vary the integral gain between 0.05 V/rad and 1.00 V/rad.

10. Examine the response of the measured speed in the Speed (rad/s) scope and compare the result when ki is
set low to when it is set high.

11. Stop the VI by clicking on the Stop button.

QNET DC MOTOR Workbook - Student 4


© 2014 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
info@quanser.com
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. Quanser Inc. grants the following rights: a) The right to reproduce
the work, to incorporate the work into one or more collections, and to reproduce the work as incorporated in the collections, b) to create and
reproduce adaptations provided reasonable steps are taken to clearly identify the changes that were made to the original work, c) to distribute
and publically perform the work including as incorporated in collections, and d) to distribute and publicly perform adaptations. The above rights
may be exercised in all media and formats whether now known or hereafter devised. These rights are granted subject to and limited by the
following restrictions: a) You may not exercise any of the rights granted to You in above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation, and b) You must keep intact all copyright notices for the Work and provide the
name Quanser Inc. for attribution. These restrictions may not be waved without express prior written permission of Quanser Inc.

QNET DC MOTOR Workbook - Student v 2.0


PI Speed Control According to
Specifications

This Workbook and the VIs provided are designed for the second generation black Quanser QNET
2.0 DC Motor Board for NI ELVIS II(+) . Second generation VIs can be identified by the small black
symbol in the upper right corner of the VI. These VIs will not work for blue first generation boards.

Topics Covered
• QNET DC Motor speed control.

• Proportional-integral (PI) compensator design.

• Designing control according to specifications.

Prerequisits
• QNET DC Motor Qualitative PI Speed Control laboratory experiment.

QNET DC MOTOR Workbook - Student v 2.0


1 Background
The speed of the DC motor is controlled using a proportional-integral control system. The block diagram of the
closed-loop system is shown in Figure 1.1.

Figure 1.1: QNET DC Motor PI closed-loop block diagram

The transfer function representing the DC motor speed-voltage relation with steady-state gain K and time constant
τ is
Y (s) K
= (1.1)
U (s) τs + 1
and will be used to design the PI controller. The input-output relation in the time-domain for a PI controller with
set-point weighting is

ki (r − y)
u = kp (bsp r − y) + , (1.2)
s

where kp is the proportional gain, ki is the integral gain, and bsp is the set-point weight. The closed loop transfer
function from the speed reference r to the angular motor speed output ωm is

K (kp bsp s + ki )
Gω,r (s) = . (1.3)
τ s2 + (Kkp + 1)s + Kki

The standard desired closed loop characteristic polynomial is

s2 + 2ζω0 + ω02 , (1.4)

where ω0 is the undamped closed loop frequency and ζ is the damping ratio. The denominator of the transfer
function in Equation 1.3 is the characteristic equation of the system and matches the desired characteristic equation
in Equation 1.4 with the following gains:

−1 + 2ζω0 τ
kp = (1.5)
K
and
ω02 τ
ki = . (1.6)
K

Large values of ω0 give large values of controller gain. The damping ratio, ζ, and the set-point weight parameter,
bsp , can be used to adjust the speed and overshoot of the response to reference values.

There is no tachometer sensor present on the QNET DC Motor system that measures the speed. Instead the QNET
DC Motor board has circuitry that computes the derivative of the encoder signal, i.e. a digital tachometer.

QNET DC MOTOR Workbook - Student 2


1.1 Peak Time and Overshoot
The standard second-order transfer function has the form

Y (s) ωn2
= 2 , (1.7)
R(s) s + 2ζωn s + ωn2

where ωn is the natural undamped frequency and ζ is the damping ratio. The properties of its response depend
on the values of the ωn and ζ parameters. Consider when a second-order system, as shown in Equation 1.7, is
subjected to a step input given by

R0
R(s) = (1.8)
s

with a step amplitude of R0 = 1.5. The system response to this input is shown in Figure 1.2, where the red trace is
the response (output) y(t) and the blue trace is the step input r(t).

Figure 1.2: Standard second-order step response.

The maximum value of the response is denoted by the variable ymax and it occurs at a time tmax . For a response
similar to Figure 1.2, the percent overshoot is found using

100 (ymax − R0 )
PO = . (1.9)
R0

In a second-order system, the amount of overshoot depends solely on the damping ratio parameter and it can be
calculated using the equation ( )
− √ πζ
1−ζ 2
P O = 100e . (1.10)

QNET DC MOTOR Workbook - Student v 2.0


From the initial step time t0 , the time it takes for the response to reach its maximum value is

tp = tmax − t0 . (1.11)

This is called the peak time of the system and it depends on both the damping ratio and natural frequency of the
system. It can be derived analytically as
π
tp = √ . (1.12)
ωn 1 − ζ 2

Generally speaking, the damping ratio affects the shape of the response while the natural frequency affects the
speed of the response.

1.2 Speed Control Virtual Instrument


In the following laboratory, you will tracking a square wave with various PI gains as well as investigate the effects of
set-point weights. The virtual instrument for speed control is shown in Figure 1.3.

Figure 1.3: Virtual instrument for QNET DC Motor speed control

QNET DC MOTOR Workbook - Student 4


2 In-Lab Exercise
2.1 PI Control According to Specifications
1. Calculate the expected peak time tp and percent overshoot PO given the following design specifications:
• ζ = 0.75,
• ω0 = 16.0 rad/s.

Optional: You can also design a VI that simulates the QNET DC Motor first-order model with a PI control and
have it calculate the peak time and overshoot.

2. Calculate the proportional and integral control gains kp and ki , respectively, according to the design
specifications for the model parameters K = 26.0 rad/(V.s) and τ = 0.145 s.

3. Ensure the QNET DC Motor Speed Control.vi is open. Make sure the correct Device is chosen.
4. Run the VI. The DC motor should begin spinning and the scopes should look similar to Figure 1.3.

5. In Signal Generator set:


• Amplitude (rad/s) = 25.0 rad/s
• Frequency (Hz) = 0.40 Hz
• Offset (rad/s) = 100.0
• Signal ='Square'

6. In the Control Parameters section, enter the PI control gains found in Step 2 and make sure bsp = 0.
7. Stop the VI when you collected two sample cycles by clicking on the Stop button.

8. Capture the measured speed response. Make sure you include both the Speed (rad/s) and the control signal
Voltage (V) scopes.

9. Measure the peak time and percentage overshoot of the observed response. Are the specifications satisfied?
If they are not, adjust the proportional gain kp and integral gain ki to meet the specifications and capture your
system response plots. What gains did you use?

10. What effect does increasing the specification ζ have on the measured speed response? How about on the
control gains?
Hint: Start by examining Equation 1.10.

11. What effect does increasing the specification w0 have on the measured speed response and the generated
control gains?
Hint: Start by examining Equation 1.12.

12. Stop the VI by clicking on the Stop button.

2.2 Set-Point Weight


1. Ensure the QNET DC Motor Speed Control.vi is open. Make sure the correct Device is chosen.

2. Run the VI. The DC motor should begin rotating.


3. In the Signal Generator section set:

• Amplitude (rad/s) = 25.0

QNET DC MOTOR Workbook - Student v 2.0


• Frequency (Hz) = 0.40
• Offset (rad/s) = 100.0
• Signal = 'Square'

4. In the Control Parameters section set:


• kp (V.s/rad) = 0.10
• ki (V/rad) = 1.50
• bsp = 0.00

5. Increment the set-point weight parameter bsp in steps of 0.05. Vary the parameter between 0 and 1.
6. Examine the effect that raising bsp has on the shape of the measured speed signal in the Speed (rad/s) scope.
Explain what the set-point weight parameter is doing.

7. Stop the VI by clicking on the Stop button.

QNET DC MOTOR Workbook - Student 6


© 2014 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
info@quanser.com
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. Quanser Inc. grants the following rights: a) The right to reproduce
the work, to incorporate the work into one or more collections, and to reproduce the work as incorporated in the collections, b) to create and
reproduce adaptations provided reasonable steps are taken to clearly identify the changes that were made to the original work, c) to distribute
and publically perform the work including as incorporated in collections, and d) to distribute and publicly perform adaptations. The above rights
may be exercised in all media and formats whether now known or hereafter devised. These rights are granted subject to and limited by the
following restrictions: a) You may not exercise any of the rights granted to You in above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation, and b) You must keep intact all copyright notices for the Work and provide the
name Quanser Inc. for attribution. These restrictions may not be waved without express prior written permission of Quanser Inc.

QNET DC MOTOR Workbook - Student v 2.0


Qualitative PD Position Control

This Workbook and the VIs provided are designed for the second generation black Quanser QNET
2.0 DC Motor Board for NI ELVIS II(+) . Second generation VIs can be identified by the small black
symbol in the upper right corner of the VI. These VIs will not work for blue first generation boards.

Topics Covered
• QNET DC Motor position control.
• Proportional-derivative (PD) compensator.

Prerequisits
• The QNET DC Motor has been setup and tested. See the QNET DC Motor Quick Start Guide for details.

• You have access to the QNET DC Motor User Manual.


• You are familiar with the basics of LabVIEW™.

QNET DC MOTOR Workbook - Student v 2.0


1 Background
The control of the motor position is a natural way to introduce the benefits of derivative action. This laboratory
experiment focuses on qualitative proportional-derivative position control, and a controller similar to Figure 1.1 will
be used.

Figure 1.1: QNET DC Motor PI closed-loop block diagram

The two-degree of freedom PID transfer function inside the PID block in Figure 1.1 is
∫ t
u = kp (bsp r(t) − y(t)) + ki (r(τ ) − y(τ ))dτ + kd (bsd ṙ(t) − ẏ(t)) , (1.1)
0

where kp is the position proportional control gain, kd is the derivative control gain, ki is the integral control gain, bsp
is the set-point weight on the reference position r(t), and bsd is the set-point weight on the velocity reference of r(t).

The dotted box labeled Motor in Figure 1.1 is the motor model in terms of the back-emf motor constant km , the
electrical motor armature resistance Rm , and the equivalent moment of inertia of the motor pivot Jeq . The direct
disturbance applied to the inertial wheel is represented by the disturbance torque variable Td and the simulated
disturbance voltage is denoted by the variable Vsd .

1.1 PD Control Design


The behaviour of the controlling the motor position is first analyzed using a PD control. By setting ki = 0 in the PID
control equation Equation 1.1 and taking its Laplace transform, the PD transfer function is

u = kp (r − y) + kd s(bsd r − y). (1.2)

Combining the position process model


Θm (s) K
= (1.3)
Vm (s) s(τ s + 1)
with the PD control Equation 1.2 gives the closed-loop transfer function of the motor position system

K (kp + bsd kd s)
Gθ,r (s) = . (1.4)
τ s2 + (1 + Kkd )s + Kkp

1.2 Position Control Virtual Instrument


The LabVIEW™ virtual instrument for the position control experiment is shown in Figure 1.2.

QNET DC MOTOR Workbook - Student 2


Figure 1.2: Virtual instrument for QNET DC Motor position control

See Wikipedia for more information on motion control, control theory and PID.

QNET DC MOTOR Workbook - Student v 2.0


2 In-Lab Exercise
1. Open the QNET DC Motor Position Control.vi. Make sure the correct Device is chosen.

2. Run the VI. The QNET DC Motor should be rotating back and forth and the scopes should be similar to
Figure 1.2.

3. In the Signal Generator section set:


• Amplitude (rad) = 0.50
• Frequency (Hz) = 0.40
• Offset (rad) = 0.00

4. In the Control Parameters section set:

• kp (V/rad) = 0.50
• ki (V/rad.s) = 0.00
• kd (V.s/rad) = 0.00
5. Change the proportional gain kp by steps of 0.25 V/rad starting at kp = 0.5 V/rad.

6. Examine the behaviour of the measured position (red line) with respect to the reference position (blue line) in
the Position (rad) scope. Explain what is happening.

7. Set kp to 1.5 V/rad. Describe the steady-state error to a step input of the system with only proportional gain.
8. Increment the derivative gain kd by steps of 0.01 V.s/rad.

9. Look at the changes in the measured position with respect to the desired position. Explain what is happening.
10. Stop the VI by clicking on the Stop button.

QNET DC MOTOR Workbook - Student 4


© 2014 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
info@quanser.com
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. Quanser Inc. grants the following rights: a) The right to reproduce
the work, to incorporate the work into one or more collections, and to reproduce the work as incorporated in the collections, b) to create and
reproduce adaptations provided reasonable steps are taken to clearly identify the changes that were made to the original work, c) to distribute
and publically perform the work including as incorporated in collections, and d) to distribute and publicly perform adaptations. The above rights
may be exercised in all media and formats whether now known or hereafter devised. These rights are granted subject to and limited by the
following restrictions: a) You may not exercise any of the rights granted to You in above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation, and b) You must keep intact all copyright notices for the Work and provide the
name Quanser Inc. for attribution. These restrictions may not be waved without express prior written permission of Quanser Inc.

QNET DC MOTOR Workbook - Student v 2.0


PD Position Control According to
Specifications

This Workbook and the VIs provided are designed for the second generation black Quanser QNET
2.0 DC Motor Board for NI ELVIS II(+) . Second generation VIs can be identified by the small black
symbol in the upper right corner of the VI. These VIs will not work for blue first generation boards.

Topics Covered
• QNET DC Motor position control.

• Proportional-derivative (PD) compensator.

• Designing control according to specifications.

Prerequisits
• QNET DC Motor Qualitative PD Position Control laboratory experiment.
• Modeling and Qualitative PI Speed Control

QNET DC MOTOR Workbook - Student v 2.0


1 Background
Control of motor position is a natural way to introduce the benefits of derivative action. In this experiment a
proportional-integral-derivative controller is designed according to specifications. The closed-loop PID control block
diagram is shown in Figure 1.1.

Figure 1.1: DC Motor PID closed-loop block diagram

The two-degree of freedom PID transfer function inside the PID block in Figure 1.1 is
∫ t
u = kp (bsp r(t) − y(t)) + ki (r(τ ) − y(τ ))dτ + kd (bsd ṙ(t) − ẏ(t)) , (1.1)
0

where kp is the position proportional control gain, kd is the derivative control gain, ki is the integral control gain, bsp
is the set-point weight on the reference position r(t), and bsd is the set-point weight on the velocity reference of r(t).

The dotted box labeled Motor in Figure 1.1 is the motor model in terms of the back-emf motor constant km , the
electrical motor armature resistance Rm , and the equivalent moment of inertia of the motor pivot Jeq . The direct
disturbance applied to the inertial wheel is represented by the disturbance torque variable Td and the simulated
disturbance voltage is denoted by the variable Vsd .

1.1 PD Control Design


The behavior of the controlling the motor position is first analyzed using a PD control. By setting ki = 0 in the PID
control equation Equation 1.1 and taking its Laplace transform, the PD transfer transfer function is

u = kp (r − y) + kd s(bsd r − y). (1.2)

Combining the position process model


Θm (s) K
= (1.3)
Vm (s) s(τ s + 1)
with the PD control Equation 1.2 gives the closed-loop transfer function of the motor position system

K (kp + bsd kd s)
Gθ,r (s) = . (1.4)
τ s2 + (1 + Kkd )s + Kkp

Similarly to PI speed control, the standard characteristic equation s2 + 2sζωn + ωn2 can be achieved by setting the
proportional gain to
ω2 τ
kp = 0 , (1.5)
K
and the derivative gain to
−1 + 2ζω0 τ
kd = . (1.6)
K

QNET DC MOTOR Workbook - Student 2


1.2 Peak Time and Overshoot
The standard second-order transfer function has the form

Y (s) ωn2
= 2 , (1.7)
R(s) s + 2ζωn s + ωn2

where ωn is the natural undamped frequency and ζ is the damping ratio. The properties of its response depend
on the values of the ωn and ζ parameters. Consider when a second-order system, as shown in Equation 1.7, is
subjected to a step input given by

R0
R(s) = (1.8)
s

with a step amplitude of R0 = 1.5. The system response to this input is shown in Figure 1.2, where the red trace is
the response (output) y(t) and the blue trace is the step input r(t).

Figure 1.2: Standard second-order step response.

The maximum value of the response is denoted by the variable ymax and it occurs at a time tmax . For a response
similar to Figure 1.2, the percent overshoot is found using

100 (ymax − R0 )
PO = . (1.9)
R0

In a second-order system, the amount of overshoot depends solely on the damping ratio parameter and it can be
calculated using the equation ( )
− √ πζ
1−ζ 2
P O = 100e . (1.10)

QNET DC MOTOR Workbook - Student v 2.0


From the initial step time t0 , the time it takes for the response to reach its maximum value is

tp = tmax − t0 . (1.11)

This is called the peak time of the system and it depends on both the damping ratio and natural frequency of the
system. It can be derived analytically as
π
tp = √ . (1.12)
ωn 1 − ζ 2

Generally speaking, the damping ratio affects the shape of the response while the natural frequency affects the
speed of the response.

1.3 Position Control Virtual Instrument


Tracking a reference position square wave using PID control is first examined in this laboratory. Then, disturbance
effects using PD and PID are studied through direct manual interaction or a simulated using a control switch in the
VI. The LabVIEW™ virtual instrument for position control is shown in Figure 1.3.

Figure 1.3: Virtual instrument for DC motor position control

See Wikipedia for more information on motion control, control theory and PID.

QNET DC MOTOR Workbook - Student 4


2 In-Lab Exercise
1. Calculate the expected peak time tp and percentage overshoot P O given
• ζ = 0.60,
• ω0 = 25.0 rad/s.

Optional: You can also design a VI that simulates the DC motor first-order model with a PD control and have
it calculate the peak time and overshoot.

2. Assuming the model steady-state gain is K = 26 V/rad and time constant is τ = 0.145 s, calculate the
proportional and derivative control gains kp and kd , respectively, to meet the specifications above.

3. Open the QNET DC Motor Position Control.vi. Make sure the correct Device is chosen.

4. Run the VI. You should see the DC motor rotating back and forth.
5. In the Signal Generator section set:

• Amplitude (rad) = 0.50


• Frequency (Hz) = 0.40
• Offset (rad) = 0.00
6. In the Control Parameters section, set the PD gains to the values found in Step 2. The PD controller is
implemented with bsd = 0.
7. Capture the position response found in the Position (rad) scope and control signal used in the Voltage (V)
scope.
8. Measure the peak time and percentage overshoot of the measured position response. Are the specifications
satisfied?
9. What effect does changing the specification zeta have on the measured position response and the generated
control gains?
10. What effect does changing the specification ω0 have on the measured position response and the generated
control gains?
11. Stop the VI by clicking on the Stop button.

QNET DC MOTOR Workbook - Student v 2.0


© 2014 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
info@quanser.com
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. Quanser Inc. grants the following rights: a) The right to reproduce
the work, to incorporate the work into one or more collections, and to reproduce the work as incorporated in the collections, b) to create and
reproduce adaptations provided reasonable steps are taken to clearly identify the changes that were made to the original work, c) to distribute
and publically perform the work including as incorporated in collections, and d) to distribute and publicly perform adaptations. The above rights
may be exercised in all media and formats whether now known or hereafter devised. These rights are granted subject to and limited by the
following restrictions: a) You may not exercise any of the rights granted to You in above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation, and b) You must keep intact all copyright notices for the Work and provide the
name Quanser Inc. for attribution. These restrictions may not be waved without express prior written permission of Quanser Inc.

QNET DC MOTOR Workbook - Student 6


Tracking and Disturbance Rejection

This Workbook and the VIs provided are designed for the second generation black Quanser QNET
2.0 DC Motor Board for NI ELVIS II(+) . Second generation VIs can be identified by the small black
symbol in the upper right corner of the VI. These VIs will not work for blue first generation boards.

Topics Covered
• Speed control: Tracking of triangular references signals.
• Position Control: Disturbance Rejection.

• Proportion-integral-derivative (PID) control.

Prerequisits
• QNET DC Motor PI Speed Control According to Specifications laboratory experiment.
• QNET DC Motor PD Position Control According to Specifications laboratory experiment.

QNET DC MOTOR Workbook - Student v 2.0


1 Background
1.1 Tracking of Triangular Signals
The speed of the DC motor is controlled using a proportional-integral control system. The block diagram of the
closed-loop system is shown in Figure 1.1.

Figure 1.1: DC Motor PI closed-loop block diagram

The transfer function representing the DC motor speed-voltage relation with steady-state gain K and time constant
τ is
Y (s) K
= (1.1)
U (s) τs + 1
and will be used to design the PI controller. The input-output relation in the time-domain for a PI controller with
set-point weighting is

ki (r − y)
u = kp (bsp r − y) + , (1.2)
s

where kp is the proportional gain, ki is the integral gain, and bsp is the set-point weight. The closed loop transfer
function from the speed reference r to the angular motor speed output ωm is

K (kp bsp s + ki )
Gω,r (s) = . (1.3)
τ s2 + (Kkp + 1)s + Kki

The standard desired closed loop characteristic polynomial is

s2 + 2ζω0 + ω02 , (1.4)

where ω0 is the undamped closed loop frequency and ζ is the damping ratio. The characteristic equation in
Equation 1.3, i.e. the denominator of the transfer function, can match the desired characteristic equation in
Equation 1.4 with the following gains:

−1 + 2ζω0 τ
kp = (1.5)
K
and
ω02 τ
ki = . (1.6)
K

Large values of ω0 give large values of controller gain. The damping ratio, ζ, and the set-point weight parameter,
bsp , can be used to adjust the speed and overshoot of the response to reference values.

There is no tachometer sensor present on the QNET DC Motor system that measures the speed. Instead the
amplifier board has circuitry that computes the derivative of the encoder signal, i.e. a digital tachometer.

QNET DC MOTOR Workbook - Student 2


1.1.1 Speed Control Virtual Instrument
Tracking a square wave with various PD gains are discussed in the laboratory as well as the effects of set-point
weighting and integrator windup. The steady-state errors due to triangular references are also assessed. The
virtual instrument for speed control is shown in Figure 1.2.

Figure 1.2: Virtual instrument for DC motor speed control

1.2 Response to Load Disturbances


The block diagram shown in Figure 1.3 represents the load disturbance to position response for a PID controller with
transfer function
1
P ID(s) = kp + kd s + ki (1.7)
s

and zero reference input.

The closed-loop disturbance to position transfer function is


τs
Gθ,T (s) = . (1.8)
Jeq (τ s3 + (1 + Kkd )s2 + Kkp s + Kki )

Given a step disturbance with an amplitude of Td0


Td0
Td (s) = , (1.9)
s

QNET DC MOTOR Workbook - Student v 2.0


Figure 1.3: PID closed-loop block diagram to a load disturbance input

the steady-state error (i.e. the resulting angle) of the closed-loop system can be obtained with the final value theorem
as ( )
Td0
θss = lim s Gθ,T (s) = lim (Td0 Gθ,T (s)) . (1.10)
s→0 s s→0

The steady-state angle of the PD control, that is when ki = 0 in Equation 1.8, is


τ Td0
θss_P D = , (1.11)
Jeq Kkp

and the steady-state angle with integral action is

θss_P ID = 0. (1.12)

Thus when the system is subjected to a disturbance, a constant steady-state error is observed when using the
PD control system. However, the disturbance is rejected when integral control is used and the steady-state angle
eventually goes to zero.

PID control design involves using the standard characteristic equation for a third-order system

(s2 + 2ζω0 + ω02 )(s + p0 ) = s3 + (2ζω0 + p0 )s2 + (ω02 + 2ζω0 p0 )s + ω02 p0 , (1.13)

where ω0 is the natural frequency, ζ is the damping ratio, and p0 is a zero. The characteristic equation of the closed-
loop PID transfer function, i.e. the denominator of the transfer function Equation 1.8, is
Kkd + 1 2 Kkp Kki
s3 + s + s+ . (1.14)
τ τ τ

The PID characteristic equation Equation 1.14 matches Equation 1.13 using the proportional gain
ω0 τ (ω0 + 2ζp0 )
kp = , (1.15)
K
the derivative gain
−1 + 2ζω0 τ + p0 τ
kd = , (1.16)
K
and the integral gain
ω02 p0 τ
ki = . (1.17)
K

By varying the zero location p0 , the time required by the closed-loop response to recover from a disturbance is
changed.

QNET DC MOTOR Workbook - Student 4


1.2.1 Position Control Virtual Instrument
Tracking a reference position square wave using PID control is first examined in this laboratory. Then, disturbance
effects using PD and PID are studied through direct manual interaction or a simulated using a control switch in the
VI. The LabVIEW™ virtual instrument for position control is shown in Figure 1.4.

Figure 1.4: Virtual instrument for DC motor position control

See Wikipedia for more information on motion control, control theory and PID.

QNET DC MOTOR Workbook - Student v 2.0


2 In-Lab Exercise
2.1 Tracking Triangular Signals
1. Open the QNET DC Motor Speed Control.vi. Make sure the correct Device is chosen.
2. Run the VI. The motor should begin rotating.

3. In Signal Generator set:


• Amplitude (rad/s) = 50.0
• Frequency (Hz) = 0.40
• Offset (rad/s) = 100.0
• Signal = 'Sawtooth'

4. In the Control Parameters section set:


• kp (V.s/rad) = 0.20
• ki (V/rad) = 0.00
• bsp = 1.00

5. Compare the measured speed and the reference speed. Explain why there is a tracking error.
6. Increase ki and examine the response. Vary ki between 0.1 V/rad and 1.0 V/rad.

7. What effect does increasing ki have on the tracking ability of the measured signal? Explain using the observed
behaviour in the scope.

8. Stop the VI by clicking on the Stop button.

2.2 Response to Load Disturbances


1. Consider the closed-loop system from Figure 1.3. Show the block diagram representing the system if there is
no reference signal and the disturbance is a the simulated disturbance voltage Vsd .

Figure 2.1: PID closed-loop block diagram to a simulated disturbance.

2. Find the closed-loop transfer function describing the position of the motor with respect to the simulated
disturbance voltage: Gθ,Vsd (s) = Θ(s)/Vsd (s).

3. Find the steady-state motor angle due to a simulated disturbance step of Vsd with magnitude Vsd0 for a PID
and a PD (i.e. ki = 0) controller.

QNET DC MOTOR Workbook - Student 6


4. A step of Vsd = Vsd0 /s with Vsd0 = 3 V is added to the motor voltage to simulate a disturbance torque.
Evaluate the steady-state angle of the motor when a PD controller is used with the gains kp = 2 V/rad
and kd = 0.1 V.s/rad. Then, calculate the steady-state angle when using a PID controller with the gains
kp = 2 V/rad, kd = 0.1 V.s/rad, and ki = 2 V/rad/s.
Optional: You can also design a VI that simulates the DC motor first-order model with a PID control and a
step disturbance and examine the steady-state angle obtained from the response.

5. Open the QNET DC Motor Position Control.vi. Make sure the correct Device is chosen.
6. Run the VI. The motor should begin rotating.

7. In the Signal Generator section set:


• Amplitude (rad) = 0
• Frequency (Hz) = 0.40
• Offset (rad) = 0
8. In the Control Parameters section set:

• kp (V/rad) = 2.0
• ki (V/rad.s) = 0.0
• kd (V.s/rad) = 0.1
9. Apply the disturbance by clicking on the Disturbance toggle switch situated below the Signal Generator.

10. Examine the effect of the disturbance on the measured position. Attach a response of the motor position when
the disturbance is applied, record the obtained steady-state angle, and compare it to the value estimated in
Step 4.
11. Turn OFF the Disturbance switch.

12. In the Control Parameters section set:


• kp (V/rad) = 2.0
• ki (V/(rad.s) = 2.0
• kd (V.s/rad) = 0.1

13. Apply the disturbance by clicking on the Disturbance toggle switch.


14. Examine the effect of the disturbance on the measured position. Explain the difference of the disturbance
response with the integral action added and compare to the result you obtained in Step 4.
15. Stop the VI by clicking on the Stop button.

QNET DC MOTOR Workbook - Student v 2.0


© 2014 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
info@quanser.com
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. Quanser Inc. grants the following rights: a) The right to reproduce
the work, to incorporate the work into one or more collections, and to reproduce the work as incorporated in the collections, b) to create and
reproduce adaptations provided reasonable steps are taken to clearly identify the changes that were made to the original work, c) to distribute
and publically perform the work including as incorporated in collections, and d) to distribute and publicly perform adaptations. The above rights
may be exercised in all media and formats whether now known or hereafter devised. These rights are granted subject to and limited by the
following restrictions: a) You may not exercise any of the rights granted to You in above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation, and b) You must keep intact all copyright notices for the Work and provide the
name Quanser Inc. for attribution. These restrictions may not be waved without express prior written permission of Quanser Inc.

QNET DC MOTOR Workbook - Student 8


QNET boards to teach introductory control topics using NI ELVIS

QNET 2.0 DC Motor QNET 2.0 HVAC Board QNET Mechatronic QNET Mechatronic
Control Board teaches temperature (process) control Actuators Board Sensors Board
teaches fundamentals of teaches functions of actuators teaches functions of sensors
DC motor control

QNET 2.0 Rotary QNET 2.0 VTOL Board QNET Physics and QNET Myoelectric Board
Pendulum Board teaches basic flight dynamics Dynamics Board teaches control using principles
teaches classic pendulum control and control teaches fundamental concepts in of electromyography (EMG)
physics and engineering dynamics

Quanser QNET add-on boards for the NI ELVIS platform teach introductory control topics in undergraduate labs cost-effectively.
All QNETs are offered with comprehensive, ABET*-aligned courseware that have been developed to enhance the student
learning experience.

To request a demonstration or quote, please email info@ni.com.


*ABET Inc., is the recognized accreditor for college and university programs in applied science, computing, engineering, and technology, providing leadership and quality assurance in
higher education for over 75 years.
©2015 Quanser Inc. All rights reserved. LabVIEW™ is a trademark of National Instruments.

You might also like