Exp 1 - Part A
Exp 1 - Part A
Experiment 1
EEE/ECE/INSTR F245
Prepared by
Department of EEE
1
Purpose of the document
This document is intended to be used by the students for enhancing their learning while performing the
experiments. The learning is aided with set of questions on each of the experiments and the student is
expected to answer these questions in the process of experimentation.
It is expected that the student acquires information from References, prior to the experimentation. It is
advised that the student need not constrain oneself to the set questions given in this document and can
generate one’s own set of additional questions to enhance the learning process and this will be highly
appreciated
References:
1. QUBE user manual.
2. Control System Text books.
3. LabVIEW Software
Note
This document will serve as Control system Lab manual, observation and
record book. The soft - copy of the document has to be brought by each student
to the Lab. The observations will be noted down in the Lab session. Further
answers and results to the questions should be incorporated and submitted as
suggested by your faculty. The complete soft copy of the record should be
uploaded by each student in CMS for verification by the faculty.
2
Contents
1. INTRODUCTION OF CONTROL SYSTEM LABORATORY................................................................ 4
1.1 LabVIEW FAMILIARIZATION ................................................................................................................................... 4
1.2 INTRODUCTION OF QUBE-SERVO INTEGRATION ............................................................................................... 6
1.2.1 BACKGROUND OF QUANSER QUBE-SERVO HRDWARE ............................................................................... 6
1.2.2 SYSTEM HARDWARE ............................................................................................................................................ 7
a) System Schematic ......................................................................................................................................... 7
b) Hardware Components .................................................................................................................................. 8
1.2.3 SOFTWARE REQUIREMENTS: ............................................................................................................................. 9
1.2.4 DC MOTOR ............................................................................................................................................................. 10
a) Application of DC motors ........................................................................................................................................ 10
1.2.5 ENCODERS:............................................................................................................................................................ 10
1.2.6 SYSTEM PARAMETERS: ...................................................................................................................................... 11
1.2.7 SYSTEM SETUP ..................................................................................................................................................... 12
1.3 OPEN LOOP CONTROL SYSTEM............................................................................................................................. 14
1.3.1 IN LAB EXERCISE: ............................................................................................................................................... 14
1.3.2 Configuring a LabVIEW VI for the QUBE-Servo ................................................................................................... 15
1.3.3 Reading .................................................................................................................................................................... 17
1.3.4 Driving the DC Motor .............................................................................................................................................. 18
LIST OF FIGURES
LIST OF TABLES
3
1. INTRODUCTION OF CONTROL SYSTEM LABORATORY
1.1 LabVIEW FAMILIARIZATION
Aim: To learn about LabVIEW and familiarize oneself with its usage and applicability to Control systems.
2. Use the help function and find out what are different functions available.
3. Explore about these toolboxes available in LabVIEW and discuss for what are these utilized?
b) Silver
a) gain block
b) indicator block
c) HIL initialize VI
4
1.2 INTRODUCTION OF QUBE-SERVO INTEGRATION
Aim: To get familiarized with the Quanser QUBE-Servo hardware and use Quanser Rapid Control
Prototyping Toolkit software to interact with LabVIEW.
Prerequisites:
Before starting this experiment make sure:
• The QUBE-Servo has been setup and tested.
• Inertial disc load is on the QUBE-Servo.
• You are familiar with the basics of LabVIEW.
5
Caution: This equipment is designed to be used for educational and research purposes and is not
intended for use by the general public. The user is responsible to ensure that the equipment will be used
by technically qualified personnel only.
The schematic given in Figure 1.3 illustrates the main QUBE-Servo components and how they
interact with a data acquisition (DAQ) device.
6
Figure 1.3: System schematic
b) Hardware Components
The main QUBE-Servo components - for the USB interface - are listed in Table 1.1. The
components on the QUBE-Servo USB Interface are labelled in Figure 1.4(a,b,c,d)
7
Figure 1.4: QUBE-Servo Components
The Quanser Rapid Control Prototyping (RCP) Toolkit is an add-on for the NI LabVIEW™ graphical
development environment. This powerful control design tool spans the spectrum of design from simulation
to control implementation. It significantly simplifies access to Quanser control experiments by taking care
of all standard low level software and hardware configurations. The resulting VIs are clear and closely
match the standard block diagram system representation of control courses. This helps bridge the gap
between theory and practical implementation, and enables students to focus more on the control topics
taught in courses. The Quanser RCP Toolkit allows LabVIEW to be used to interface with Quanser
products
8
1.2.4 DC MOTOR
The QUBE-Servo includes a direct-drive 15V brushed DC motor housed in a solid aluminium frame.
The motor specifications are given in Table 1.2. The QUBE incorporates an Allied Motion CL40 Series
Coreless DC Motor model 16705.
Caution: Input _10 V, 2 A peak, 0.5 A continuous.
a) Application of DC motors:
1. Robotics,
2. Hybrid vehicles,
3. Printers / Scanners,
4. Manufacturing,
5. DVD players,
6. Digital Cameras,
7. Traction, etc…
1.2.5 ENCODERS:
Similar to rotary potentiometers, encoders can also be used to measure angular position. There are
many types of encoders but one of the most common is the rotary incremental optical encoder, shown in
Figure 6. Unlike potentiometers, encoders are relative. The angle they measure depends on the last position
and when it was last powered. It should be noted, however, that absolute encoders are available.
9
Figure 1.7: Optical incremental encoder signals
The A and B signals that are generated as the shaft rotates are used in a decoder algorithm to generate
a count. The resolution of the encoder depends on the coding of the disk and the decoder. For example, an
encoder with 512 lines on the disk can generate a total of 512 counts for every rotation of the encoder shaft.
However, in a quadrature decoder the number of counts quadruples; therefore the encoder would generate
2048 counts per revolution. The encoders used to measure the angular position of the DC motor and
pendulum on the QUBE-Servo is a single ended optical shaft encoder. It outputs 2048 counts per revolution
in quadrature mode (512 lines per revolution).
The encoders used to measure the angular position of the DC motor and pendulum on the QUBE is
the US Digital E8P-512-118 single-ended optical shaft encoder.
Table 1.2 lists and characterizes the main parameters associated with the QUBE-Servo.
10
TABLE 1.2. QUBE-SERVO SYSTEM PARAMETERS
Caution: If the equipment is used in a manner not specified by the manufacturer, the
protection provided by the equipment may be impaired.
11
QUBE-Servo USB Interface Hardware Setup:
To setup the QUBE-Servo USB Interface follow these steps:
1. Connect USB 2.0 cable from back cover of QUBE-Servo to an enabled USB 2.0 port on your desktop
PC.
2. The QUBE-Servo USB Interface driver should install automatically. If not, then you may not have
installed.
3. Connect the Power connector on the QUBE-Servo to the power supply. Ensure the power supply is
connected to a wall outlet using the appropriate power cable.
4. Attach the inertial disc or ROTPEN module to the motor hub using the magnets. The QUBE-Servo is
shown with the inertial disc and ROTPEN modules setup in Figure 1.9.
5. ROTPEN Users: If you are using the pendulum attachment, connect the encoder cable from the
pendulum module encoder to the Encoder 1 connector on the top panel of the QUBE-Servo (connector
shown in Fig. 1.4 b). The QUBE-Servo with the attached pendulum and connected cable is pictured in
Figure 1.9 b.
12
1.3 OPEN LOOP CONTROL SYSTEM
IN LAB EXERCISE:
In this lab, we will make a LabVIEW™ Virtual Instrument (VI) using Quanser Rapid Control Prototyping
Toolkit blocks to drive to the dc motor and the measure its corresponding angle - similarly as shown in
Figure 1.10.
Figure 1.10: VI used with RCP to drive motor and read angle on QUBE-Servo
13
1.3.1 Configuring a LabVIEW VI for the QUBE-Servo:
Follow these steps build a LabVIEW VI that will interface to the QUBE-Servo using Quanser Rapid
Control Prototyping Toolkit:
14
5. As shown in Figure 1.12 , in the Timing Parameters tab set the following:
• Select Synchronize Loop to Timing Source
• Timing Source: 1 kHz Clock
• Select Auto Period
This synchronizes the simulation to the PC clock. Otherwise, the simulation would run as fast as possible
(Which is fine when doing pure simulation, but not when interfacing to hardware).
7. Add the HIL Initialize VI from the Quanser Rapid Control Prototyping Toolkit palette.(Right click anywhere in
the block diagram panel)
8. Double-click on the HIL Initialize block.
9. In the Board type field, select qube_servo_usb under Quanser Devices.
External DAQ Users: If you are using an external data acquisition device, then select the board that is
installed in your PC. For example, if you are using a Quanser Q8-USB board to connect to the QUBE-
Servo then select q8_usb.
10. Run the VI by clicking on the white arrow in the top-left corner. Write the observation in Results
and Observation Section.
11. If you successfully ran the VI without any errors, then you can stop the code by clicking on the Abort
button in the tool bar.
15
1.3.2 Reading
Follow these steps to read the encoder:
1. Add the HIL Read VI from the Quanser Rapid Control Prototyping palette / HIL / Immediate I/O.
2. Connect the ‘board out’ terminal from HIL Initialize to the ‘board in’ terminal on HIL
Read, similarly as shown in Figure 1.10.
As shown in Figure 1.13., set the Polymorphic Instance to Encoder (Scalar) in order to read
from Encoder channel #0.
4. Connect the HIL Read ‘encoder counts’ terminal to a ‘Gain’ block and set the value to 1 and
Numeric indicator block similar as shown in Figure 1.10 (without the HIL Write Analog
block).
•You can find the Gain block in the Control Design & Simulation | Simulation | Signal Arithmetic
palette.
• The indicator can be added by right-clicking on the Gain output and going to Create | Indicator.
7. Rotate the disc manually for one full rotation. The numeric indicator shows the number of counts
measured by the encoder. Write the observation (counts per revolution) in Results and Observation
Section.
8. (a) What happens to the encoder reading every time the VI is started?
b) Stop the VI, move around the disc, and re-start VI. What do you notice about the encoder
reading when the VI is re-started?
9. Having measured the number of counts the encoder outputs for a full rotation. Briefly explain your
procedure to determine this and validate that this matches with the specifications of the QUBE-
Servo System (See Table-1.2)
10. Ultimately we want to display the disc angle in degrees, not counts. Set the Gain block to a value (See
Table 1.2) that converts counts to degrees. This is called the sensor gain. Find out the value of sensor
gain in deg/count, run the VI and confirm that the numeric indicator shows the angle of the disc
correctly.
16
Figure 1.13: HIL Read Configuration
2. Wire the ‘board out’ terminal from HIL Read to the ‘board in’ terminal on HIL Write.
3. Add a Numeric Control by right-clicking on analog voltage terminal on HIL Write and going go Create |
Control. Connect the Control and HIL Write Analog blocks together, as shown in Figure 1.10
4. Instead of using the Abort button on the VI tool bar, its better practice to add your own stop function. To
add your own stop as shown in Figure 1.10 do the following:
(a) Add the Halt Simulation block from the Control Design & Simulation / Simulation / Utilities palette.
(b) To add a Stop button, go the front panel of the VI and look through the Silver / Boolean palette (or
Modern / Boolean).
(c) In the block diagram, connect the Stop button and Halt Simulation VI as shown in Figure 1.10.
5. Run the VI.
6. Set the Control block (Analog Voltage) to 0.5. This applies 0.5 V to the dc motor in the QUBE-Servo.
Confirm that we are obtaining a positive measurement when a positive signal is applied. This convention
is important,
17
especially in control systems when the design assumes the measurement goes up positively when a positive
input is applied. Finally, in what direction does the disc rotate (i.e., clockwise or counter-clockwise)
when a positive input is applied?
7) Increase the voltage from 0.5 to ±5 V, (Don’t increase beyond these limits). What happens to the rotation
of the disc?
18