Exp 1 - Part A

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Control Systems Lab

Experiment 1
EEE/ECE/INSTR F245

Name of the student :


ID No. :
BATCH & TIME :

Prepared by
Department of EEE

BITS Pilani, Hyderabad Campus

Date: January 2018

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

Figure 1.1: Quanser QUBE-Servo ................................................................................................................................................ 6


Figure 1.2: Interaction between QUBE-Servo components .......................................................................................................... 7
Figure 1.3: System schematic ........................................................................................................................................................ 8
Figure 1.4: QUBE-Servo Components .......................................................................................................................................... 9
Figure 1.5: Applications of D.C Motor ....................................................................................................................................... 10
Figure 1.6: US Digital incremental rotary optical shaft encoder ................................................................................................. 10
Figure 1.7: Optical incremental encoder signals ......................................................................................................................... 11
Figure 1.8: 5-pin DIN encoder pin-out ........................................................................................................................................ 11
Figure 1.9: QUBE-Servo with different modules ........................................................................................................................ 13
Figure 1.10: VI used with RCP to drive motor and read angle on QUBE-Servo .......................................................................... 14
Figure 1.11: Create a Simulation Loop in the block diagram ........................................................................................................ 15
Figure 1.12: Simulation Loop Parameters Dialog ......................................................................................................................... 16
Figure 1.13: HIL Read Configuration ........................................................................................................................................... 18

LIST OF TABLES

TABLE 1.1. QUBE-SERVO COMPONENTS .................................................................... 8


TABLE 1.2. QUBE-Servo System Parameters .................................................................. 12

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.

1. What is LabVIEW? Have you used it before? If yes what for?

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?

a) Control Design and simulation

b) Silver

c) Quanser Rapid control Prototyping toolkit

4. Explore how these blocks can be obtained

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.

1.2.1 BACKGROUND OF QUANSER QUBE-SERVO HRDWARE:


The Quanser QUBE-Servo, pictured in Figure 1.1, is a compact rotary servo system that can be used to
perform a variety of classic servo control and inverted pendulum based experiments. The QUBE-Servo
comes with the USB Interface. The QUBE-Servo USB Interface has its own built-in power amplifier
and data acquisition device. For USB interface version, the system is driven using a direct-drive 18V
brushed DC motor housed in a solid aluminium frame. Two add-on modules are supplied with the
system: an inertial disc and a rotary pendulum. The modules can be easily attached or interchanged
using magnets mounted on the QUBE-Servo module connector. Single-ended rotary encoders are used
to measure the angular position of the DC motor and pendulum.
Main QUBE-Servo features:
• Compact and complete rotary servo system
• 15V direct-drive brushed DC motor
• Encoders mounted on DC motor and pendulum
• Built-in PWM amplifier
• Built-in USB data acquisition (DAQ) device
• Inertial disc module
• Rotary pendulum module
• USB storage

Figure 1.1: Quanser QUBE-Servo

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.

1.2.2 SYSTEM HARDWARE


a) System Schematic
QUBE-Servo has a brushed dc motor that is connected to a PWM amplifier. There QUBE-Servo
models with the QUBE-Servo USB Interface provides a built-in data acquisition device and an
integrated amplifier. The interaction between the different system components on the QUBE-Servo is
illustrated in Figure 1.2. On the data acquisition (DAQ) device block, the motor and pendulum encoders
are connected to the Encoder Input (EI) channels #0 and #1. The Analog Output (AO) channel is
connected to the power amplifier command, which then drives the DC motor. The DAQ is interfaced to
the PC via USB link in the QUBE-Servo USB Interface.

Figure 1.2: Interaction between QUBE-Servo components.

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)

TABLE 1.1. QUBE-SERVO COMPONENTS

7
Figure 1.4: QUBE-Servo Components

1.2.3 SOFTWARE REQUIREMENTS:


Install LabVIEW™ with the following modules:
1. LabVIEW™
2. NI LabVIEW™ Control Design and Simulation Toolkit
3. Quanser Rapid Control Prototyping Toolkit

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.

Caution: Exposed moving parts.

a) Application of DC motors:
1. Robotics,
2. Hybrid vehicles,
3. Printers / Scanners,
4. Manufacturing,
5. DVD players,
6. Digital Cameras,
7. Traction, etc…

Figure 1.5: Applications of D.C Motor

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.

Figure 1.6: US Digital incremental rotary optical shaft encoder


The encoder has a coded disk that is marked with a radial pattern. As the disk rotates (with the shaft),
the light from an LED shines through the pattern and is picked up by a photo sensor. This effectively
generates the A and B Signals shown in Figure 1.7. An index pulse is triggered once for every full rotation
of the disk, which can be used for calibration or homing a system.

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.

Figure 1.8: 5-pin DIN encoder pin-out

1.2.6 SYSTEM PARAMETERS:

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.

1.2.7 SYSTEM SETUP:


To setup the QUBE-Servo system, you need the following components:
1. QUBE-Servo (USB version shown in Figure 1.1)
2. Inertial disc module (shown in Figure 1.1)
3. Rotary Pendulum (ROTPEN) module (shown in Figure 1.1)
4. 15V, 2.0 A power supply
5. Power cable
6. USB 2.0 A/B cable

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.

Figure 1.9: QUBE-Servo with different modules

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.

(a) Front Panel

(b) Block Diagram

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:

1. Load the LabVIEW™ software.


Create a new, blank Virtual Instrument (VI).
2. Go to the block diagram and create a Simulation loop, as depicted in Figure 1.11. It is found in the
Control Design & Simulation | Simulation palette & select Control & Simulation loop.
3. Double-click on the Simulation loop input node (or right-click on the border and select Configure
Simulation Parameters) to access the Simulation Parameters box shown in Figure 1.12.
4. As shown in Figure 1.12, in the Simulation Parameters tab set the following:
• Final time (s): Inf
• ODE Solver: Runge-Kutta 1 (Euler)
• Step Size (s): 0.002
This configures the simulation to run until it is stopped by the user at a sampling rate of 500 Hz. When
performing control, any of the fixed solvers can be used but Runge-Kutta 1 is typically the default.

Figure 1.11: Create a Simulation Loop in the block diagram

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).

6. Click on the OK button to apply the changes.

Figure 1.12: Simulation Loop Parameters Dialog

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.

3. Double-click on HIL Read to the encoder channel.

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.

5. Go to the front panel. You should see the numeric indicator.


`
6. Run the VI.

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

1.3.3 Driving the DC Motor:


1. Add the HIL Write block from the Quanser Rapid Control Prototyping palette / HIL / Immediate I/O.
This block is used to output a signal from analog output channel #0 on the data acquisition device. This
is connected to the on-board PWM amplifier which drives the dc motor.

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?

8. Click on the Stop button to stop the VI.


9. Power OFF the QUBE-Servo.

# End of first Lab session:


Outcome: Getting acquainted with QUBE Servo and integration with LabVIEW.

18

You might also like