Sunteți pe pagina 1din 40

School of Electrical and Computer Engineering

Control Group

DC Motor Control Lab using xPC


Target
On Feedback Modular Servo
System MS150
Manual Book

RMIT University

School of Electrical and Computer Engineering


School of Electrical and Computer Engineering
Control Group

Control Group @04.2010


School of Electrical and Computer Engineering
Control Group

Preface

Note
Please check the Feedback website for THE HEALTH AND SAFETY AT
WORK ACT 1974, PRODUCT IMPROVEMENTS, COMPONENT
REPLACEMENT, DECLARATION CONCERNING ELECTROMAGNETIC
COMPATIBLITY and its COPYRIGHT NOTICE BEFORE starting the lab.

Declaration
The first chapter is a brief introduction of the Modular Servo System
MS150. The copyrights of the product, MS150 belong to Feedback
Company. Please contact Feedback Company or check its official
website to obtain the authorized manual book with detailed
datasheets. The xPC Target System which is a Mathworks product,
Mathworks holds the copyrights of it. The Second Chapter only
refers a part of its content which will be used in the lab system.

Copyright Notice
RMIT University reserves all the copyrights of the lab design. No part
of this publication may be reproduced, stored in a retrieval system,
or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording or otherwise, without the prior permission
of RMIT University.
School of Electrical and Computer Engineering
Control Group

Contents

Chapter1. Introduction of the Feedback MS150 Sy1stem

1. Overview of Feedback Modular Servo System

MS150…….2

2. Units Used in the DC Motor Speed Control

Lab……………….3

Chapter2. Introduction of the XPC Target System

1. Overview of XPC Target

System……………………………………….5

2. National Instruments PCI

Card………………………………………..6

3. Connection and Communication between the

Host and XPC

Target……………………………………………………

……………..….7

Chapter3. DC Motor Speed Control Lab

1. Overview of the DC Motor Speed Control

Lab……………….11

2. MS150 Setting for DC Motor Speed Control

Lab…………...12

3. xPC Target System Configuration for Motor

1
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Speed Control

Lab…………………………………………………………

………………………14

4. Lab

Activities…………………………………………………

……………….21

5. Further

Development……………………………………………

…….24

Reference………………………………………………………………

…………………………….25

Appendix………………………………………………………………

……………………………..26

2
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter1. Introduction of the Feedback

MS150 System

1.1 Overview of Feedback Modular Servo System

MS150
The Feedback Modular Servo System was designed to help students
understand the principle of open or closed-loop control theory. Also,
it is ideally suitable to be used in basic engineering training
programs.

The system consists of a magnetic base platform and several units


which can be attached onto the base with magnetic force. Each unit
has its unique functions. For example, the Reduction Gear Tacho
Unit GT150X is normally used to acquire the feedback in terms of
the motor rotating speed. As the Fig.1.1 depicted, the units have
diagrams on the surface indicating their inner connection and
functions. These MS150 units are usually connected into either a DC
system labeled as MS150, or an AC system labeled MS150A. In both
systems, speed or position control may be implemented.

Figure1.1 Overview of MS150


Other features of the system can be found on the Data Sheet of
MS150 that can be downloaded from Feedback website, from which
3
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

users of MS150 can have a more complete


understanding.

In this manual, only the DC system MS150 will be introduced. In the


DC Motor Control Lab, the following equipment in MS150 is required:
The Power Supply Unit, PS150E;
The Servo Amplifier Unit, SA150D;
The DC Motor Unit, DCM150F;
The Reduction Gear Tacho Unit, GT150X.

4
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter1. Introduction of the Feedback

MS150 System

1.2 Units Used in the DC Motor Speed Control Lab


General functions of these units can be directly read from the
surface of each unit, as the figures depicted below, where only some
important features are specifically introduced. Please refer to
Feedback official website to download more detailed data sheets.

Figure1.2 DC Motor Speed Control Lab Units

PS150E
The unit PS150E serves as the power supply of the system. Inputs
are 120v~2A(T) and 230v~1A(T), 50/60Hz. The unit supplies +24v
dc unregulated at 2A, +/-15v regulated at 0.5A, 18v ac at 1A, 9-0-9v
5
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

at 10mA. The unit is usually connected to the Servo


Amplifier Unit SA150D.

Chapter1. Introduction of the Feedback MS150

System
SA150D
This unit is used to operate either the DC motor in the lab, or an AC
motor system in MS150. There is a protection circuit built inside to
avoid overload of the motor.

DCM150F
The motor in this unit is a permanent magnet DC motor, which has
the limitation speed at 3000 radium/min. The torque is 2A for 0.1
Nm.

GT150X
The Reduction gear tacho unit installed a 30/1 reduction gear and a
tacho-generator. The speed feedback of the motor can be read
directly from the unit in terms of 2.75 volts/(1000r/min), or 5V/
(1800r/min).

6
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter2. Introduction of the XPC Target

System

2.1 Overview of XPC Target System

“xPC is the solution for prototyping, testing and deploying

real-time systems.”[4]

Fundamental Structure of the XPC Target System


The XPC Target System consists of a host PC and one or several
target PCs. In this environment, users can create Simulink models
with blocks, or state-flow charts from the MATLAB libraries on the
host PC. The models can be simulated or “built” in non-real time
mode there. Subsequently, XPC target system incorporates a Real
Time Workshop which allows the users to verify their models and
generate executable program code using the embedded C/C++
compiler. When the executable code has been generated, XPC
Target System downloads it from the host PC to the target PC
through the Ethernet or RS232 connection. Finally, the XPC Target
System runs the real-time applications on the separate target PC,
and the users can change the parameters of the models on the host
PC to prototype, test and deploy their systems in real-time.

Requirements of the XPC Target System


Hardware requirements: the system requires a PC to be the host PC,
at least one target PC which must provide available I/O connection
to the host PC (this can be Ethernet interface or RS232 interface)
and the corresponding data cable to connect them. To run the real-
time applications, including sending control signals and collecting
feedback information back, a National Instruments PCI card should
also be installed in the target PC. The PCI card should be connected
to the control targets via break out board.

Software requirements: the MATLAB software and its Simulink and


Real-Time Workshop, xPC target toolbox must be installed in the
host PC. In addition, either a Microsoft Visual C/C++ compiler, or an
Open Watcom C/C++ compiler should be prepared in the host PC in
order to generate the executable code.

7
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Features of the xPC Target System: please refer to the


Mathworks website for this information of this part.

8
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter2. Introduction of the XPC Target

System

2.2 National Instruments PCI Card


For data acquisition in the xPC Target System, a National
Instruments PCI board and its suitable break out board are required.
The PCI card is one of the most widely adopted internal buses for
PCs. In our lab, NI PCI 6024E and the break board NI CB-68LP are
employed.

To run the real-time applications, including sending control signals


and collecting feedback information, a National Instruments PCI card
should also be installed in the target PC. The PCI card should be
connected to the control targets via its matched interface card.

Please check our appendix, or go to the National Instruments


website to download the relative data sheets.

Fig2.1 PCI card and its installation

9
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter2. Introduction of the XPC Target

System

2.3 Connection and Communication between the

Host and XPC Target


Please check the requirements of the XPC Target System first before
starting the connection and communication between the host PC
and Target PC

1) Physical Connection
As depicted in Fig2.2, XPC Target users should first set up the host
PC and target PC. Remember Simulink models will be built and
simulated on the host PC, and the real- time applications can be
operated on the target PC. In Fig2.2, the laptop is used as the host
PC with a Simulink model running on it, and the PC behind it is the
target PC which is connected to the monitor. The monitor is used to
observe signals from the xPC Target System. As the figure shows,
there are two scopes on the screen corresponding to the two Target
scopes in the Simulink model; the bar on the top describes the
setting of the current system. Once it has been finished, users can
connect the target pc to the host pc using available data cable.
Ethernet cable is recommended for its stability and high data
transmitting speed. Finally, the control target, namely in this lab,
MS150 system shown as on the left hand side of the figure can be
connected to the target pc through PCI and its interface card.

Caution: Do NOT turn on any control target power before a


proper model has been downloaded to the target PC.
Otherwise, target PC may send misleading control signal to
the control target and cause damage.

10
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Fig2.2 xPC Target System connection

11
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter2. Introduction of the XPC Target

System
2) xPC Target Explorer Setting
Run the Matlab on the host PC, and type in the command “xpcexplr”
to run the xPC Target Explorer as shown below.

Fig2.3 xPC Target Explorer

Using the xPC Target Explorer, users need to complete the following
operations:
a) To start with, user should select the C/C++ compiler from
“Compilers Configuration”.

b) On the left window, under “Target PCx”, click on


“communication”. Two options for host target communication
are available to select on the right window where users can
use their own customized settings. The selection should
depend on the physical connection (TCP/IP is for Ethernet
interface, and COM is for RS232 serial interface).

c) Change to “configuration” on the left window. Users should be


able to see multiple approaches to boot the XPC Target
System, including through CD boot, floppy boot and so forth.
12
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Create an image file of the boot disk and burn it to


a CD for instance.

d) Insert the CD into the target PC, and boot its system directly
from the CD drive. The target PC will log onto the xPC Target
System.

Chapter2. Introduction of the XPC Target System


e) After completing the above three steps, do not change the
communication settings, right click on “TargetPCx” and select
“connect”. The target PC will be connected to the host PC.

3) Simulink model setting


Now users may create a fundamental Simulink I/O test model and
set up the simulation parameters.

a) Type in command “simulink” and execute to open the Simulink


Library Browser as the following figure shows.

Fig2.4 Simulink Library Browser

13
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

b) Create a simple I/O test model using the blocks


from the library. xPC Target blocks library is located at the
bottom of the entire library.

c) From the menu of the Simulink model, select “Simulation-


>Configuration Parameters”. In the configuration, it is
inevitable to set solver options as well as the Real-Time
Workshop options properly as the Fig2.5 indicated.

14
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter2. Introduction of the XPC Target

System

Fig2.5 Simulation Configuration

d) Solver: normally set start time as 0s, and set stop time long
enough for observation. In the lab environment, Fix-step type
of solver is highly recommended. Fundamental sampling time
should be faster than any of sample time setting of the blocks
in the model.

e) Real-Time Workshop: select “System Target File” as


“xPCtarget.tlc” for XPC Target System to generate C code.

f) After the above three steps have been finished, model can be
downloaded by clicking on the “built” button.

g) Turn on the power of the control target and run the real-time
application normally or externally.

15
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab

3.1 Overview of the DC Motor Speed Control Lab


The DC Motor Speed Control Lab is designed ideally for students to
get familiar with the Advanced Control Theory including system
identification and PID control. The lab will impress students by
allowing them to build and simulate a model on an xPC Target real-
time device, collect data and operate real-time parameter tuning.

In this chapter, the connection of the MS150 system and the set up
of the xPC Target System for the DC Motor Speed Control Lab will be
introduced in the first and second section. The following section
explains how to precede system identification and PID control on
this platform. The last section generalizes the possibilities for further
development for this lab environment.

Features
• Graphical model design is intuitive for students to understand
the control theory.

• The signals can be directly observed on the target PC monitor.

• Numerical data can be collected and exposed to Matlab platform


for precise analysis.

• With real-time parameter tuning on the model blocks or sub-


system masks, the effects of proportional, integral and
derivative controller can be observed directly.

• MS150 system provides an easy-to-learn control target.

• The lab can be easily extended using the potentio -meter unit of
MS150, and professional programmers can design GUI interface
for the lab with Microsoft Visual Basic Express or directly
generate from Matlab.

16
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab

3.2 MS150 Setting for DC Motor Speed Control Lab


1) Physical Connection on MS150
a) MS150 DC Motor standard connection
• Supply power to unit PS150E and connect it to unit
SA150D through the port special for Servo Amplifier;
• Connect the Servo Amplifier to the DC motor unit DCM10F;
• Connect the DC motor unit DCM150F to the reduction gear
unit GT150X by using a 2.5mm Hex Key to tight their
coupler.

b) Lab connection
Please connect the wires to the ports on each unit according
to the following figure.

Figure3.1 DC Motor Speed Control Lab Wire Connection

2) Connect to NI CB-68LP board


The NI CB-68LP board is a “Low-cost termination accessories
with 68 screw terminals for easy connection of field I/O signals to
the counter/timer devices. The connector blocks include
standoffs for use on a desktop or mounting in a custom panel.
The CB-68LP has a vertically mounted 68-pin connector.”

As it shown in Fig3.1, the following terminals are employed in the


DC Motor Speed Control Lab:
22: DAC0OUT1, digital to analog output 1;
17
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

55: AOGND, analog output ground;


67: AIGND, analog input ground;
68: ACH0, analog channel 0.

Chapter3. DC Motor Speed Control Lab


This pin assignment is specially used for NI PCI 6023E/6024E.
Please check the appendix for the entire pin assignment table of
NI PCI 6023E/6024E for further development in the future.

Fig3.2 NI CB-68LP

3) Trouble Shooting
Only the most frequently appeared problems and their possible
solutions are listed below.

• Feedback delay: if the feedback information is not


reasonable and the response is too slow, please check the
bearing of the unit GT150X. Make sure the bearing is
stably fixed to the unit.

• Motor noise: if the motor is too noisy even under low input
gain situation, please check the coupling between the unit
DCM150F and GT150X. Maybe, it was not tighten enough.
Another possible problem could be the misalignment
between the bearings of the two units.

• No feedback on xPC Target monitor: if there is not any


feedback depicted on xPC Target monitor, please first
confirm whether there is reasonable feedback shown on
the unit GT150X. If not, please check the physical
connection according to the above two sections.
18
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Otherwise, please check the pin assignment


table to see whether they match with the design of your
model blocks.

• Please Note: the channel number on the pin assignment


table is indicated by that number plus one in the Simulink
blocks.

19
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab

3.3 xPC Target System Configuration for Motor

Speed Control Lab


Before configuring the xPC Target System, it is important to ensure
the physical connections of the system correspond with the above
chapters. Another important step that has to be completed is to
burn a boot disk for xPC Target System and record its settings.

Subsequently, we can start configuring the xPC Target System


according to the following steps. Please note: the following
explanation is an example for the xPC Target System configuration.
Users should learn the example and configure their system
according to their customized settings.

1) xPC Explorer
Start Matlab and run xPC Target Explorer

Fig3.3 xPC Target Explorer

The xPC Target Explorer is the interface for the xPC Target
System users to set up the configuration for the connection
between the host PC and one or several target PCs. As the
above figure shows, the xPC Target Hierarchy can be observed
from the left hand side of the window. It shows the compilers
20
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

configuration, the current directory to the .dlm


files and all the Target PCs settings.

21
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab


Set C/C++ program compiler

Fig3.4 C/C++ program compiler for xPC Target


Users can select Watcom to use Open Watcom as a compiler
or select VisualC as a compiler. However, both of them need to
be matched with users’ current Matlab version. Please browse
the Mathworks website to check the version matching table.

Set communication between the host and target PC

Fig3.5 Communication between host and target PC

22
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab


As it shown in fig3.5, TCP/IP was selected, which means the
host PC and the target PC should be connected through a Lan
cable. Once it has been selected, all the TCP/IP options are
activated. For example, users are allowed to set the target PC
IP address. However, all the settings should correspond to the
boot disk setting (Please check Chapter2 to learn how to
create a boot disk). Another requirement is that the host pc IP
should also be set properly. Please find the current Network
Connection from Control Panel. Right click on the icon and
select properties, and then select Internet Protocols (TCP/IP).
Fill in the IP address, subnet mask and default gateway same
as the boot disk setting and change the last digit of the IP
address to a different number. Leave the DNS Server part
blank. For example, if the IP address is set as below in the
boot disk:
IP Address: 192.168.0.2; Subnet: 255.255.255.0; Gateway:
192.168.0.254.
The IP address of the host PC should be set as:
IP Address: 192.168.0.1; Subnet: 255.255.255.0; Gateway:
192.168.0.254.

The other option for the host target connection is RS232,


which stands for the communication through the serial port
“COM”. For this option, users should ensure that the settings
including the port number and the band rate match with the
physical connection. Users may check the physical connection
through device management on the host PC. If in case, the
host PC did not recognize the connection, users may have to
install a driver to the system. For example, if a laptop without
serial port will be used as a host PC, a RS232 to USB converter
cable can be used, but in this case, the driver for the
connected USB should be installed.

23
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab


2) Simulink model
Run Simulink and create a model

Fig3.6 create a Simulink model

Design an I/O test model using xPC Target blocks


Scroll down to the bottom of the library to find “xPC Target”
type and find the blocks through the following path:
xPC Target-> D/A ->National Instruments -> E-series -> PCI-
6024E DA;
xPC Target-> A/D->National Instruments -> E-series -> PCI-
6024E AD;
xPC Target-> Misc. -> Scope(xPC).
Also, find a Pulse Generator in the Source library.
Finally, connect them together as the following figure depicts.

24
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Fig3.7 I/O test model

Chapter3. DC Motor Speed Control Lab


3) Simulink Parameter Configuration
a) Solver configuration:
Start time-> 0;
Stop time-> inf;
Solver type-> Fixed Step;
Fixed step size ->0.001;
Select solver according to the expectations.

Fig3.8 Simulink Solver Configuration

The above configuration set the running time as from the very
beginning to infinite. For the DC Motor Speed Control Lab, the
solver type is expected to be fixed step. Since the lab is the
25
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

real-time speed control of the dc motor, the other


option, variable-step cannot be applied. It is impossible to
estimate the solver step in real time.

26
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab


b) Real-Time Workshop Configuration
Select system target file as “xpctarget.tlc”

Fig3.9 Real-Time Workshop Configuration

The file “xpctarget.tlc” tells the Real-Time Workshop to


generate the C program specifically for xPC Target System.
The compiler selected in xPC Target Explorer setting is a
general C program compiler. “xpctarget.tlc” is built on the
basis of the general C program compiler, and specifically
designed for xPC Target applications so that the Real-Time
Workshop on Matlab can generate executable code according
to the Simulink models that users created.

27
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab


1) Run the model
Build the model, connect to target PC and run it in real time.
Please check the following section for how to create, run and
adjust a model properly. If there is any problem, please check
the following session for trouble shooting.

2) Trouble Shooting
Only the most frequently appeared problems and their
possible solutions are listed below.

• Complier: if there is any warning about the complier, users


should first confirm the complier is installed in the valid
directory of Matlab; if there is still any problem, please browse
the Mathworks website and ensure the version of the complier
matches with that of the installed Matlab.

• “Com” communication is not available: please ensure the


driver of the serial port has been installed into the operation
system. Also, please check the device management to make
sure the setting of the port is matched.

• Cannot find xPC Target library: please install the toolbox of xPC
Target into your Matlab.

28
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab

3.4 Motor Speed Control Lab Activities


PID controller Simulink model example

Fig3.10 System Identification and PID control Simulink model

As an example, the above Simulink model employs the blocks from


xPC Target Library and realizes the function of System Identification
and PID control. The meaning for each part is explained as below.

• Reference and Gain: these two blocks are used to set the
reference point for the control target DC motor. The amplitude
of the reference can be set in the parameter settings of the
Reference block, or it can be changed directly on Gain even
during the motor is running.

• Constant input to pin 1 of the Switch 1: this is always set to be


zero to eliminate the noise from pin 1 when it is not connected
into the control loop.

• PCI-6024E National Instr. Analog Input: this block is employed


to collect feedback information from the MS150 system. Since
in this lab, pin 68 was connected. According to the pin
assignment table, it represents analog channel0. Therefore, in
the Simulink model, the channel should be set as [1]. The
29
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

channel number on I/O connector pin assignment


table is always augmented by one when presented in Matlab.

Chapter3. DC Motor Speed Control Lab


• PCI-6024E National Instr. Analog Output: this block is applied
to send control signals out to the control target. The channel
setting principle is the same with PCI-6024E National Instr.
Analog Input block.

• Switch 1&2: the switches are used to switch the operation


mode. The system is in System Identification mode if both of
switches 1 and 2 are connected to pin 1; if both of the
switches are connected to pin 2, PID control will be employed.

• Target Scope: these two blocks are found from the xPC Target
Library, and are specifically designed to show control
information on the monitor of the target PC. The data can be
shown in several ways according to the settings of the block.
For example, users can determine whether to show the data in
graphical mode, or numerical mode.

• PID Controller: the controller is actually a subsystem block.


There are three parameters that can be adjusted on this block,
kp, ki, and kd, which is corresponding to the gain of
proportional, integral and derivative control, respectively. To
discover the precise structure of the system, users can right
click on the block and select “look under mask”. The inner
structure will then appears in a separate window.

Fig3.11 PID Controller under mask


30
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

• Out 1 & 2: these two blocks are crucial to collect numerical


feedback information for precise analysis of the target system.

31
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Chapter3. DC Motor Speed Control Lab


From xPC Target Explorer, users are allowed to send their data
collected from the above blocks to Workspace on Matlab. From
the xPC Target Hierarchy, click on the model that is currently
used as the figure below shows. Tick the time and output box,
where you can change the data file name, and click on the
“Send to Matlab Workspace” button. The data received from
the two blocks will then be sent to the workspace.

Fig3.12 sending data from Simulink model to Matlab


Workspace

Fig3.13 data on Workspace collected from Simulink ports


As the above figures shown, the data are sent to the Matlab
32
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Workspace. The two columns of “yout” correspond


to the data from out1 and out2, respectively.

Chapter3. DC Motor Speed Control Lab

3.5 Further Expansion Proposal


Position Control: Feedback Servo System MS150 provides the
potentio-meter unit OP150K and other units to collect positional
feedback. Please check Feedback MS150 system manual book to
find out the proper connection for DC Motor Position Control. In the
xPC Target System design, please check the pin assignment table to
find a proper channel for position feedback.

State-space Control: as long as the system has been identified in


the way as section 3.4 described, State-space control can be
employed in the system. The appendix at the end of the manual
recommends the block diagram for State-space control.

AC Motor Control: the xPC Target System can also be deployed on


AC motors. The system configuration part would be similar.
However, it is necessary to design a suitable control model in
Simulink for AC motors.

GUI Interface: a GUI interface for the Simulink models can be


designed. The users who are good at Microsoft Visual Basic Express
can use this program to design the GUI interface. The core for this
way is to utilize xPC Target API and xPC Target API COM. Another
approach is to complete the interface design in the Matlab
environment and directly generate the GUI from Matlab. Please refer
to Mathworks website for the concrete method.

Remote Control Lab: with a local router, the xPC target and its host
and be connected to internet, which allows users could control it
from distance. A specific IP is required for the system in this case.

33
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Reference

[1] Feedback Instruments Ltd, “Modular Servo Instructional Servo


System, MS150” [Online] Available:
http://www.fbk.com/files/MS150/Full%20MS150.pdf

[2] National Instruments, “Low-Cost E Series Multifunction DAQ –


12 or 16-Bit, 200 kS/s, 16 Analog Inputs” (for NI PCI E-series)
[Online] Available:
http://www.ni.com/pdf/products/us/4daqsc202-204_ETC_212-
213.pdf

[3] National Instruments, “Counter/Timer Accessories and


Cables” (for NI CB-68LP) [Online] Available:
http://www.ni.com/pdf/products/us/4daqsc390-392.pdf

[4] Mathworks Inc. “xPC Target Documents”


http://www.mathworks.com/access/helpdesk/help/toolbox/xpc/
?BB=1

[5] Wikipedia the free encyclopedia, “PID controller”


http://en.wikipedia.org/wiki/PID_controller

34
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Appendix

1. System Identification, PID Control and State-

space Control diagrams

2. GUI Interface

3. NI CB-68LP data sheet

4. 68-Pin E Series Connector Pin Assignments

35
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Appendix

1. PID Control and State-space Control diagrams


1) System Identification

2) PID Control Design

3) State-space Control Design

36
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.
School of Electrical and Computer Engineering
Control Group

Appendix

2. GUI Interface

37
RMIT University
School of Electrical and Computer Engineering
Prof. Liuping Wang, Dr. N.V. Truong, Dae Yoo, Xuan Liu, Rex Lee.

S-ar putea să vă placă și