0% found this document useful (0 votes)
408 views75 pages

Control Systems Manual Student

This document describes the hardware used in an analog motor control system laboratory. The system comprises two main boards: 1) the K-CSP board which contains the motor components and supporting electronics, and 2) the K-ECS board which provides computational power and controls the K-CSP board. The K-CSP board contains a DC motor, gear system, flywheel, speed and position sensors. It connects to the K-ECS board which runs the control software and sends control signals to the motor. The document explains the purpose and connection of the various components in the motor control system hardware.

Uploaded by

James
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
408 views75 pages

Control Systems Manual Student

This document describes the hardware used in an analog motor control system laboratory. The system comprises two main boards: 1) the K-CSP board which contains the motor components and supporting electronics, and 2) the K-ECS board which provides computational power and controls the K-CSP board. The K-CSP board contains a DC motor, gear system, flywheel, speed and position sensors. It connects to the K-ECS board which runs the control software and sends control signals to the motor. The document explains the purpose and connection of the various components in the motor control system hardware.

Uploaded by

James
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

ELG3155/3555 Student Lab Manual

Prof. Wail Gueaieb

Version: February 5, 2018


2
Contents

Nomenclature 7

I Preliminaries 9

I-1 Hardware 11

I-1.1 General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

I-1.2 Hardware Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

I-1.2.1 Connecting Everything Together . . . . . . . . . . . . . . . . . . . . . . . . . 13

I-1.2.2 Understanding Figure I-1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

I-1.2.3 Speed and Position Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

I-2 Software 19

I-2.1 Software Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

I-2.1.1 System’s Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

I-2.2 Using the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

I-2.2.1 Driver Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

I-2.2.2 Running the K-CSP GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

I-2.2.3 Uploading the Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

I-2.2.4 Uploading the Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . 26

I-3 General Lab Instructions 27

3
4 CONTENTS

II Analog Control Experiments 29

II-0Introduction 33

II-0.1Lab Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

II-0.1.1Experimenting with Different System Setups . . . . . . . . . . . . . . . . . . 35

II-1Plant Modeling and Identification in the Frequency Domain 37

II-1.1Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

II-1.2Modeling of a Motor System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

II-1.2.1Motor Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

II-1.2.2Motor Gear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

II-1.2.3Fly Wheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

II-1.2.4Overall System Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

II-1.3Lab Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

II-1.3.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

II-1.3.2Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

II-1.4Laboratory Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

II-2Plant Modeling in Time Domain 47

II-2.1Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

II-2.2State-Space Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

II-2.2.1Open-Loop Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

II-2.2.2Closed-Loop Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

II-2.3Lab Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

II-2.3.1Validation of Open-Loop Model . . . . . . . . . . . . . . . . . . . . . . . . . . 50

II-2.3.2Validation of Closed-Loop Model . . . . . . . . . . . . . . . . . . . . . . . . . 51

II-3System Identification Through Frequency Response Techniques 55

II-3.1Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

II-3.2Identifying a First-Order System From Its Frequency Response . . . . . . . . . . . . 55

II-3.3Lab Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
CONTENTS 5

II-3.4Laboratory Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

II-4Control of Motor Speed Error 63

II-4.1Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

II-4.2Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

II-4.3Proportional Control of Motor Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

II-4.4PI Control of Motor Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

II-4.5Lab Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

II-4.6Laboratory Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

III Appendix 69

A Analog Controller Implementation 71

A.1 Physical Realization of Active Compensators . . . . . . . . . . . . . . . . . . . . . . 71

A.2 Practical Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

A.3 Physical Realization of Passive Compensators . . . . . . . . . . . . . . . . . . . . . . 73


6 CONTENTS
Nomenclature

Greek Symbols

ωm Motor’s angular speed, page 38 rad/s

ωrm Angular speed of motor’s rotor, page 38 rad/s

Latin Symbols

bf Damping coefficient, page 39 N·m/(rad·s)

em Efficiency of motor gear, page 39 (unitless)

im Current in motor winding, page 38 A

J System’s lumped inertia, page 39 kg·m2

Kω Speed sensor’s sensitivity, page 13 V·s/rad

Kθ Position sensor’s sensitivity, page 13 V/rad

Kem Motor’s back emf constant, page 38 V·s/rad

Ktm Motor’s torque constant, page 38 N·m/A

Lm Motor winding inductance, page 37 H

RM Optional resistance added to the motor, page 38 Ω

Rm Motor winding resistance, page 37 Ω

rm Ratio of motor gear, page 38 (unitless)

Td Disturbance torque, page 39 N·m

Tf Friction torque, page 39 N·m

Tm Motor’s generated torque, page 38 N·m

Trm Torque of motor’s rotor, page 38 N·m

vem Motor’s back emf, page 37 V

vm Motor’s input voltage, page 38 V

7
8 CONTENTS
Part I

Preliminaries

9
Chapter I-1

Hardware

I-1.1 General Description

The overall motor control system comprises two main boards, as shown in Fig. I-1.1:

1. the K-CSP (Kylowave Control System Platform) is the board containing the motor compo-
nents (motor, gear, speed sensor, position sensor, shaft), and most of the other complementary
components, such as the flywheel and the supporting electronics.
2. the K-ECS (Kylowave Electronic Control System), is the “brains” of the whole system and
supports it with the necessary computational power.

Each board is composed of a number of integrated circuits which can be monitored and controlled
through several digital and analog I/O pins, as shown in Fig. I-1.2.

The K-CSP contains the mechanical structure of the motor system along with some basic circuits
to run it. It comes with 7 sets of I/O pins:

1. Digital control pins


2. DC motor pins
3. Smart load pins
4. DC generator pins
5. Analog sensors pins
6. Current sensors pins
7. Reserved pins

The pin out of each set is shown in Fig. I-1.2.

The K-ECS is a fully-fledged electronic board with the necessary power electronics to run a large
variety of systems, including the K-CSP in open- and closed-loop modes. It comes with 7 sets of
I/O pins (most of which are not needed to run the motor, as can be seen from Fig. I-1.2):

11
12 CHAPTER I-1. HARDWARE

Figure I-1.1: The K-CSP (left), and the K-ECS board (right)

1. Digital control pins


2. DCDC converter pins
3. 3-phase rectifier pins
4. 1-phase rectifier pins
5. Analog sensors pins
6. Current sensors pins
7. 3-phase inverter pins

I-1.2 Hardware Connection

Connecting both kits as shown in Fig. I-1.2 implements the control system depicted in Figs. I-1.3
and I-1.4. To save time, most of these connections are already made for you through a bundle of 3
components:

1. A digital interface board, to connect the digital connectors on the K-ECS and the K-CSP.
2. An analog interface board, to connect the analog connectors on the K-ECS and the K-CSP.
3. 4 pre-wired power connectors, to connect the power/ground signals between the K-ECS and
the K-CSP.
I-1.2. HARDWARE CONNECTION 13

I-1.2.1 Connecting Everything Together

To connect all the components together, follow the procedure below:

1. Stack the K-CSP on top of the K-ECS such that their power switches are facing you (Fig. I-
1.5(a)).
2. Connect the 4 power connectors, as shown on Fig. Do NOT turn on the power until all the
components are connected (Fig. I-1.5(b)).
3. Gently, connect the “Analog Sensors” pins of the K-ECS and the K-CSP using the analog
interface board (Fig. I-1.5(b)). Make sure the card is upright. Do NOT force it through.
Doing so may damage the pins.
4. Gently, connect the “Digital Control” pins of the K-ECS and the K-CSP using the digital
interface board (Fig. I-1.5(c)). Make sure the card is upright. Do NOT force it through.
5. Connect the K-ECS and the computer with the provided USB cable (Fig. I-1.5(b)).
6. Connect the 12 Vdc power adapter to the K-ECS (Fig. I-1.5(b)). Do NOT use the 24 Vdc
adapter. Now, you can turn on the K-ECS switch which should automatically turn on the
K-CSP as well. This step must be successful before proceeding any further. If the lights on
either boards are not on, you have to check your connections.

I-1.2.2 Understanding Figure I-1.2

• Super thick black and red lines are ground and power lines, respectively. At least 18 AWG
wires (thick wires) MUST be used for these connections (NOT the regular breadboard wires).
• Solid continuous connections carry analog signals.
• Dashed connections carry digital signals.
• The circuit in the dashed box at the bottom of the figure is what you will implement on your
breadboard as needed.

I-1.2.3 Speed and Position Sensors

The motor system is equipped with a digital encoder to measure the speed and position of the
motor (Fig. I-1.3). The position sensor is a relative position sensor as it measures the motor position
relative to its starting point. In other words, it takes the starting point as the zero position.

The sensitivities of the speed sensor, Kω , and of the position sensor, Kθ , are given in Table I-1.1.
As can be noted from the table, the speed sensor generates 5.0 V for every 9.225 rad/s. Likewise,
the position sensor generates 5.0 V for every 2π rad of rotation.

This means that if the speed sensor’s output is 1.5 V, for example, then the motor’s speed is
ωm = 1.5/Kω = 2.77 rad/s.

Likewise, if the position sensor’s output is 2 V, then the motor’s angular position is θm = 2/Kθ =
(2/5) × 2π = 0.8π rad (which is 2/5 of a turn).
14 CHAPTER I-1. HARDWARE

Description Symbol Value Unit


Speed sensor’s gain Kω 5.0/9.225 V·s/rad
Position sensor’s gain Kθ 5.0/(2π) V/rad

Table I-1.1: Sensor gains


VSUPPLY

DGND
DGND

VSUPPLY
Inv3Ph_B
Three-Phase Inverter Three-Phase
Current Sensors RESERVED Current Sensors
Pin5 pin6 Inverter pin2 DC_Mot-
Pin1 DC Motor Pin7 Pin1
Inv3Ph_A pin3
Three-Phase
Three-Phase
Inverter pin1 DC_Mot+
Inverter pin4 DC Motor
Digital_7 pin2
Digital Control
pin13 OptEnc_X
K-ECS Digital Control PotV_0
Pin9
Digital Control
Reserved Analog Connector
OptEnc_A K-MCK
Digital Control
Internal 1kΩ

Pin7 pin24
Potentiometer

pin2 pin6
Pin10

Analog Connector
Digital_6
Digital Control OptEnc_B
Analog Connector Digital Control
I-1.2. HARDWARE CONNECTION

Digital Control Pin14


pin29 pin30 pin22 pin24 Pin11

PwmInv_CH DACPWM_0
Digital Control
Pin30
PwmDCC_H DACPWM_1
Digital Control
Analog Connector Analog Connector

AnalogIO_1
AnalogIO_0
Pin29
pin9 pin10

Reference (0 to +5V)
Error Signal Channel 1 DACFlt_1
Output
Vin = 0 to +5V
Analog
Control Output DACFlt_0
Vout = 0 to +5V Controller
Vref = +2.5V Channel 0

K-MCK AGND
Analog Connector K-MCK AVDD
Pin6 Analog Connector
1K, 0.25W 1K, 0.25W Pin4
15

Figure I-1.2: Interfacing the motor kit with the K-ECS board (courtesy of Kylowave Inc.)
16 CHAPTER I-1. HARDWARE

K-ECS

Motor Motor
(-11.4V to +11.4V) Speed (rad/s) Position (rad)

Motor
Processor Controller System
(-5V to +5V)

Motor
Speed (V)
Speed (-3 rad/s to +3 rad/s)
Sensor
Motor
Position (V)

Position (-6.28 rad to +6.28 rad)


Sensor

Figure I-1.3: Overall system’s high-level block diagram


K-CSP High-Level Architecture
Disabled Controller
Internal Disabled Lead-Lag #1 Disabled Lead-Lag #2
Digital Power DC
Reference Controller Lead-Lag Lead-Lag Drive Motor
#1 #2
External Controller
Controller open-loop (2) Ke
(S t M + 1)
Feedback K L1 (S t Z1 + 1) K L2 (S t Z2 + 1)
open-loop (1) (S t P1 + 1) (S t P2 + 1)
Speed
Speed error
Position
Disabled low-pass filter Position error
Feedback
Low-pass
Note: 1) Signals in red can be visualized on the GUI waveform window Filter
I-1.2. HARDWARE CONNECTION

2) Signals in green are internal signals and can not be visualized in the waveform window
3) The position gain maps +/- 2π radians to +/- 5V (V = gain * 0.79577 Angle)
4) Print a WARNING if one of the signals crosses/hit one of the saturation limits
KF
(S + w F)

REFERENCE CONTROLLER
LEAD-LAG FEEDBACK FILTER ACTUATOR
Enable:
Enable: Enable: Enable: Power drive:
external generator none (bypass mode)
none (bypass mode) none (bypass mode) supply voltage: 12 Vdc
digital
internal generators lead-lag first-order low-pass max. voltage: 11.4 Vdc
Signal range: +/- 5 V external
Type: Type: max. current: 2A
Internal controller:
digital digital full-bridge
type: digital
FEEDBACK Ranges: Ranges: gain: 1:1
range: programmable
Enable: programmable programmable DC motor:
input range default:
enable input default: input default: max. voltage: 11.4 Vdc
output range default:
open-loop at feedback (1) output default: output default: min. voltage: 0.6 Vdc
External Controller:
open-loop at controller (2) no load current: 0.09A
type: analog or digital
Signal range: +/- 5 V max. current: 0.5 A
input range: +/- 5 V
gear ratio: 1:84
output range: +/- 15 V
bidirectional rotation
shaft speed: 7.2 KRPM
gear speed: 85.7 RPM
Signal range: +/- 5 V

Figure I-1.4: Block diagram (courtesy of Kylowave Inc.)


17
18 CHAPTER I-1. HARDWARE

(a)

(b) (c)

Figure I-1.5: Kit Setup


Chapter I-2

Software

I-2.1 Software Description

The interface with the hardware is done through a graphical user interface (K-CSP GUI) which is
the main window to show up when you launch the application (Fig. I-2.1). The following is a brief
description of the K-CSP features.

The following is a brief description of the different components of the K-CSP GUI, as labeled on
the figure.

1. Total duration time of the experiment.

2. The button to start running the experiment.

3. The button to stop the experiment.

4. Pull-down menu to select the communication port with the hardware.

5. Refresh button to rescan the open communication ports.

6. Path/name of the file where the experiment result’s raw data is to be stored. Logging data in
this file enables users to process it later (if needed) using Matlab, for example.
Note: Log your data on the C: drive for best performance. Avoid real-time data logging onto
remote or usb drives as it is a relatively time consuming process.

7. This button enables users to change the path/name of the data file.

8. Selects whether to run the motor system in an open or closed-loop mode (see Fig. I-2.4).

9. Selects the type and source of input to the system (Vr in Fig. I-1.3 and Fig. I-2.4). The user
can choose to excite the system with an external signal (from an external device such as a
signal generator) or with one of several automatically generated signals which are described
in Fig. I-2.2.
Note: In all cases, this signal must be between −5 V and 5 V.

19
20 CHAPTER I-2. SOFTWARE

2 3 5
1 4

6 7

8 11 14
15
9 12
16
13
17
10
18
19

20

Figure I-2.1: K-CSP’s graphical user interface

10. The parameters of the input signal (see Fig. I-2.2).

11. Pull-down menu to select whether to carry out a real experiment by applying the control
algorithm on the physical system, or to emulate the algorithm by applying it on a pre-defined
theoretical model.

12. Pull-down menu to select the type of controller to implement.

13. The parameters of the chosen controller type.

14. The time period at which analog signals are sampled for processing purpose.

15. The time period at which analog signals are sampled for data visualization, as for plotting
the four generated graphs for example (shown in Fig. I-2.3). This period must be a multiple
of the signal sampling period above.

16–19. These are the signals to be displayed in the graph matrix (Fig. I-2.3).
I-2.1. SOFTWARE DESCRIPTION 21

Main Fbk: This signal is always displayed as the top left graph. It can be any of the system’s
signals in the case of open-loop mode. However, in the case of closed-loop system, it has
to be chosen as the actuation error, as shown in Fig. I-2.4. In other words, in closed-loop
mode, this is always the signal passed to the input of the controller, if one is used, or to
the input of the motor, otherwise.
Aux Fbk: This signal is always displayed as the top right graph. In general, it can be any
of the system’s signals. However, in the case of closed-loop system where the type of
controller chosen is PI+PD, it is used as a second feedback signal.
Graph 3: Signal to be displayed at the bottom left graph. It is only used for display purpose,
so it can be any of the system’s signals.
Graph 4: Signal to be displayed at the bottom right graph. It is only used for display
purpose, so it can be any of the system’s signals.

The graph matrix is built on top of the KST visualization tool1 . For the full description
of how to use the menu, shortcuts, and any of its large consortium of features, readers are
encouraged to consult its official website: https://kst-plot.kde.org

20. Text box where the system’s status and activities are reported.

Fig. I-2.4 illustrates the relationship between the system’s signals and the K-CSP settings.

I-2.1.1 System’s Signals

Several of the system’s signals come in two versions:

• Raw signal, meaning the signal as is. This is usually a relatively noisy signal.

• Filtered signal, meaning the value of the signal after undergoing a filtering process to remove
noise.

For example, the raw speed is the motor speed as delivered by the speed sensor. The filtered speed
is the result of passing the raw speed through a filter to remove noise. Note that although filtered
signals are usually less noisy than the raw signals, they still carry some noise.

The following are definitions of some of the system signals:

Reference: the system’s input (Vr in Fig. I-1.3 and Fig. I-2.4).

Speed: motor’s angular speed.

Position: motor’s angular position.

Control output: the input signal to the motor (Vm in Fig. I-1.3 and Fig. I-2.4).

1
https://kst-plot.kde.org
22 CHAPTER I-2. SOFTWARE

Constant
Value
0V

Delay
Amplitude
Impulse Duration

0V

Step Time

Step Final Value


Initial Value
0V

Delay Width
Amplitude
Pulse
Initial
Period
0V

Start Time
Slope
Ramp Final Value
Initial Value
0V

Figure I-2.2: Signals that can automatically be generated in software


I-2.1. SOFTWARE DESCRIPTION 23

Figure I-2.3: K-CSP’s graph matrix


24 CHAPTER I-2. SOFTWARE

Motor
Motor
Controller System
Speed (rad/s)

[-5..5] V

Speed
Motor
Sensor
Speed (V)

Figure I-2.4: Relationship between the system signals and the K-CSP settings
I-2.2. USING THE SOFTWARE 25

I-2.2 Using the Software

The following procedures have to be done each time the computer is rebooted. Hence, they have to
be done at the beginning of each lab session. They also have to be done in the same order they are
decribed below.

I-2.2.1 Driver Installation

Before you can run the software, you have to install the proper drivers that enable the hardware
to communicate with the computer through the USB cable. For that, you need to follow the steps
below.

1. Plugin the K-ECS board to the wall power outlet using the provided 12-V DC power adapter.
Read the label to make sure that it actually provides 12V DC. Keep the switch turned OFF
for now.

2. Plugin the K-ECS to the computer through the provided USB cable. Don’t use your own!

3. Now, power ON the K-ECS using its own switch. The computer will probably try to auto-
matically search for its drivers. Wait until it is done. Do not be alarmed if it fails (this is
most likely).

4. Go to the following menu item (through Windows main menu)

• Menu > Software Development > Arduino > Install Arduino Drivers

and follow the intuitive instructions after that. Eventually, a confirmation message should
come up on the screen confirming that the drivers installation was successful.

I-2.2.2 Running the K-CSP GUI

The software is to be run only after properly connecting the K-ECS and motor boards, as explained
in Chapter I-1.

To run the K-CSP GUI on a lab computer, click on

• Menu > Software Development > Arduino > KCSP

The GUI of Fig. I-2.1 will show up on the screen.

Select the proper communication port (label 4 on Fig. I-2.1) if it was not already automatically
selected by the software. The port number may vary from computer to another, but you may
identify the right port by the label “Arduino Mega 2560”.
26 CHAPTER I-2. SOFTWARE

I-2.2.3 Uploading the Firmware

The firmware is the software running inside the K-ECS. It is sometime referred to as the sketch.
Because the K-ECS may be shared by several courses, it is recommended to upload the right firmware
each time you want to use the K-ECS. This can be accomplished as follows:

1. Make sure the K-ECS is connected to the computer through the provided USB cable, then
turn it ON.

2. Launch the K-CSP GUI.

3. Select the proper communication port (label 4 on Fig. I-2.1) if it was not already automatically
selected by the software. The port number may vary from computer to another, but you may
identify the right port by the label “Arduino Mega 2560”.

4. In the K-CSP GUI menu, go to File > Upload Sketch, and upload the provided sketch (hex
file). Make sure you get a success confirmation message at the end of this process. Otherwise,
you may have to try again.

I-2.2.4 Uploading the Configuration File

The K-CSP is so flexible that it allows to use different configurations on the same hardware. Many
parameters of the control system can be configured through configuration files.

To upload a configuration file from the menu of the K-CSP GUI, click on

• File > Open

Then select the configuration (kcsp) file you want to upload.


Chapter I-3

General Lab Instructions

The following are instructions and good common practice which students must follow in order to
avoid losing points.

1. Present all the steps of your derivations. Missing out details may affect the clarity/integrity
of your work and hence may cost you points.

2. All plots must be clear and serve their purpose. They have to have clear labels, units, and
legends (whenever applicable). They must be well explained and referred to in the text (not
just “dumped” in the document).

3. All plots in the lab reports must be generated from the experimental raw data and not from
screen shots. For instance, you may do so using Matlab, Mathematica, or other neat data
plotting software.
Note that for them to serve their purpose, they may need to be processed by the plotting
software of your choice (e.g., zoomed in/out, truncated, shifted, etc.) For example, if the
purpose of the plot is to show the time constant of the response, that information must be
visually easy to extract from the figure.

4. A participation sheet must be filled, signed by all group members, and submitted electronically
as a separate document with the submission of the lab report. It is accepted to submit a
scanned copy of the participation sheet.

5. Groups not storing their hardware kits neatly at the end of the lab or not keeping them in
good order may receive a penalty.

6. The faculty forbids having food or drinks (except water) inside its labs.

27
28 CHAPTER I-3. GENERAL LAB INSTRUCTIONS
Part II

Analog Control Experiments

29
31

Attention

It is absolutely important to read and understand


Part I before passing on to Part II.
32
Chapter II-0

Introduction

The objective of this lab is to get introduced to the hardware and software you will be working
with.

In particular, you will learn how to:

• Connect the K-MCK and the K-ECS boards.


• Setup and run the K-CSP, change the experiment parameters, graph the signals of interest,
and interpret the results.
• Use the KST data plotting tool.
Pre-lab

P-II-0.1. As explained in Chapter I-2, the K-CSP uses an open source software, (0 pts)
called KST, to plot data. To familiarize yourself with this data plotting
tool, first watch the following video tutorials from KST’s official website
https://kst-plot.kde.org/video_tutorials/:

• Kst presentation #2: General presentation of the user interface and


most important concepts
• Kst presentation #3: Range tools and live plots with streaming data
• Kst presentation #4: FFTs, equations, filters, fits, plugins

Although the above videos are the most relevant to the labs you will be
conducting, it is recommended that you watch the rest of the videos as
well.

II-0.1 Lab Procedure

L-II-0.1. Connect the K-ECS and K-MCK boards, and launch the K-CSP, as explained in Chap-
ter I-2.

33
34 CHAPTER II-0. INTRODUCTION

Turning ON the system power button must ALWAYS be the

Attention
LAST step to do.

NEVER handle electronic components that are powered.

L-II-0.2. Run the system with a step input of vr = −4 V. This can be achieved by selecting
“Constant” from the Signal Generator pull-down menu and entering −4 volts in the
unique parameter box. Then, press the Start button (you may leave the rest of the
parameters at their default values). After a few seconds, the motor will start turning
while 4 signals will be plotted by the KST in a graph matrix. You may stop the
experiment at any time by pressing the Stop button.
Demo

(0 pts) D-II-0.1. Demonstrate this step to the TA.

L-II-0.3. Identify the four displayed signals in Fig. I-1.3 (note that you are dealing with an open-
loop system in this case).
Demo

(0 pts) D-II-0.2. Demonstrate this step to the TA.

L-II-0.4. Open the data file where the experiment data is stored. Make sure you understand how
it is structured and relate data columns to the signals displayed in the graph matrix.
The file is a text file (with extension .csv), which you can view with any text editor or
spreadsheet editor.
To open the data file, you can either

• browse to the file path indicated in the Data File box and double click the file
name within a window manager, for instance; or
• use the K-CSP menu: File > View Data File

L-II-0.5. Try the different interaction types demonstrated in the KST video tutorial “Kst pre-
sentation #2: General presentation of the user interface and most important concepts”
starting at time 3:05 till the end of the video clip. In particular, use the zoom tool to
zoom out and in to certain regions of the plots to visualize them with a higher resolution.

L-II-0.6. Try displaying the data using different ranges. This is illustrated in the video tutorial
“Kst presentation #3: Range tools and live plots with streaming data” starting at time
1:20 till the end of the video clip. Note that you don’t have to do it while the data is
streaming live. You can do it after the experiment is over.

L-II-0.7. Apply a low-pass filter to the raw speed error signal. Then, apply an exponential
fit on the raw speed signal. These features are illustrated in the video tutorial “Kst
II-0.1. LAB PROCEDURE 35

presentation #4: FFTs, equations, filters, fits, plugins” starting at time 3:00 till time
5:00. You may skip this step if these features are not enabled in the lab computers!

Demo
D-II-0.3. Demonstrate this step to the TA. (0 pts)

II-0.1.1 Experimenting with Different System Setups

The purpose of this part of the lab is to test your understanding of the software/hardware system,
explained in Part I.

Configure the K-CSP to run the following experiments:

L-II-0.8. Speed control system in closed-loop mode with a PID controller and a step input of a
step time of 5 s, and an initial and final values of −3 V and −5 V, respectively. Do not
use filtered signals.
Demo

D-II-0.4. Demonstrate this step to the TA. (0 pts)

L-II-0.9. Position control system in closed-loop mode without controller, using a pulse input with
a delay of 5 s, an initial value of −3 V, a period of 20 s, a width of 50%, and an amplitude
of −2 V. Set the overall experiment time to 80 s. Do not use filtered signals.
Demo

D-II-0.5. Demonstrate this step to the TA. (0 pts)


Report

No report is required for this lab.


36 CHAPTER II-0. INTRODUCTION
Chapter II-1

Plant Modeling and Identification in the


Frequency Domain

II-1.1 Objectives

The objective of this lab is to find an open-loop model of the motor system, which will be used as
the plant in the following lab experiments.

You will learn how to:

• Model sub-components of a motor system.

• Aggregate the models of these subsystems into the transfer function of the whole system.

• Approximate the real high-order model of a typical motor system by a first-order model
estimate.

II-1.2 Modeling of a Motor System

A block diagram of the motor system is shown in Fig. II-1.1. The system is composed of a geared
brushed DC motor and a fly wheel.

II-1.2.1 Motor Circuit

The motor circuit is schematically depicted on the left side of Fig. II-1.1. It comprises the windings
around the armature (Lm ) and their resistance (Rm ). A back emf (vem ) is generated across the
winding terminals when the rotor is in motion, such that

vem = Kem ωrm

37
38CHAPTER II-1. PLANT MODELING AND IDENTIFICATION IN THE FREQUENCY DOMAIN

Motor
(optional add-on)
(optional add-on)
clamps

Gear box

Wheel

Figure II-1.1: Block diagram of the motor system (the plant)

where ωrm is the motor rotor’s angular speed and Kem is a motor-dependent back emf constant.
The back emf acts on “weakening” the effective voltage running the motor. The motor’s input, which
is also the overall system’s input in this case, is the DC voltage (vm ) applied across its terminals.
The torque (Trm ) generated by the rotor is defined by

Trm = Ktm im

where im is the current running through the motor windings and Ktm is a motor-dependent torque
constant. The motor dynamics can be altered by adding an external resistor (RM ) is series with
the motor circuit.
Pre-lab

(5 pts) P-II-1.1. In the Laplace domain, express vm in terms of ωrm (s), Trm (s), and motor
constants/parameters (including RM ).
Hint: use the equation of the motor circuit. Note that signals like im , for
example, are not constant.

II-1.2.2 Motor Gear

In general, a gear transfers mechanical energy from one side to the other. This is done by increasing
the angular speed and decreasing the torque by a factor of rm (known as the gear ratio), or vice
versa, in such a way as to (ideally) conserve their product (the mechanical power). In other words,
ideally, the motor’s generated torque (Tm ) and the motor shaft’s angular speed (ωm ) are related by

−1
ωm = ωrm Tm = −rm Trm ωm Tm = ωrm Trm
rm
The negative sign is due to the fact the gear switches the direction of rotation. In the following,
and in order to be consistent with K-CSP’s convention, we will assume that a positive rotation of
II-1.2. MODELING OF A MOTOR SYSTEM 39

the rotor is associated with a positive rotation of the motor shaft, and vice versa. Hence, the above
equations become
1
ωm = ωrm Tm = rm Trm ωm Tm = ωrm Trm
rm

In practice, however, gears are not ideal. They rather consume some of the energy they are supposed
to transfer. Hence, for a gear of efficiency em ∈ (0, 1), the above relations are more precisely
expressed as follows:
1
ωm = ωrm Tm = em rm Trm ωm Tm = em ωrm Trm
rm
Pre-lab

P-II-1.2. Deduce the expression of Vm (s) in terms of ωm (s), Tm (s), and motor (5 pts)
constants defined so far.

II-1.2.3 Fly Wheel

A fly wheel is attached after the motor gear box to add some inertia to the system. Clamps may
be added on or taken off the wheel to change the system’s inertia and so its dynamics.

II-1.2.4 Overall System Model

In the following, it will be assumed that the system is subject to only a viscous-type friction
torque Tf = −bf ωm , where bf is a positive friction coefficient (constant). Note that although
conputationally convenient, considering that viscous friction is the only friction acting on the motor
is not accurate. This friction model is often satisfactory at a relatively high motor speed but it may
lead to a poor performance when the speed is around zero.

Let J be the total inertia of the system. Then, applying Newton’s second law of motion (sum of
the torques is equal to the inertia times the acceleration), we get

dωm
Tm + Tf + Td = J (II-1.1)
dt
where Td is a lump of all other (disturbance) torques acting on the motor, which were not explicitly
modeled.

Now that we defined the transfer functions of the interconnected subsystems, we are ready to derive
the overall model of the entire system.
Pre-lab

P-II-1.3. Using (II-1.1), find the transfer function [Tm (s) + Td (s)]/ωm (s). (5 pts)
40CHAPTER II-1. PLANT MODELING AND IDENTIFICATION IN THE FREQUENCY DOMAIN

(5 pts) Pre-lab P-II-1.4. Use the findings so far to fill-in the empty blocks in the motor’s open-loop
block diagram of Fig. II-1.2. Note that the feedback shown in the figure
is inherently natural due to the electromagnetic nature of the motor. In
other words, it can never be removed, which is why the model is still
referred to as the “open-loop” model despite that feedback.

(5 pts) P-II-1.5. Assuming no external disturbances (i.e., Td = 0), compute the expression
of the system’s transfer function T1 (s) = ωm (s)/Vm (s). Express it as a
ratio of two polynomials in s. What order is the system?

(5 pts) P-II-1.6. Now, disabling the main input (i.e., Vm = 0) and enabling the disturbance
(i.e., Td 6= 0), compute the expression of the transfer function T2 (s) =
ωm (s)/Td (s). Express it as a ratio of two polynomials in s.

(5 pts) P-II-1.7. Deduce the expression of the motor’s speed ωm (s) when both inputs (Vm
and Td ) are active.
Hint: think of the superposition principle.

(5 pts) P-II-1.8. Deduce the expression(s) of the open-loop motor system’s pole(s).

(5 pts) P-II-1.9. In most cases, such a system can be approximated by a first-order system.
This is because the dominant pole (the one closer the imaginary axis of
the s-plane) is far less than 5 times in magnitude than the real parts
of the other pole(s). This stems from the fact that, in practice, the total
resistance in the armature circuit is by far much larger than its inductance.
In other words, RmL+Rm
M
≈ 0.
Assuming no external disturbances (Td = 0), find the system’s transfer
function if it is approximated by a first-order model. Writing it in the
form of K/(τ s + 1), find the expressions of the system’s DC gain (K) and
its time constant (τ ).

Motor Motor
Speed (rad/s) Position (rad)

Figure II-1.2: Open-loop block diagram of the motor system (the plant)
II-1.3. LAB PROCEDURE 41

II-1.3 Lab Procedure

II-1.3.1 Introduction

In the laboratory, you will run the motor system in an open-loop mode to experimentally compute
its DC gain K and time constant τ while approximating the open-loop system by a first-order
model;

ωm (s) K
= (II-1.2)
Vm (s) (τ s + 1)

Note that the response of such a family of systems to a step input of magnitude Vm in the time-
domain is

ωm (t) = Vm K (1 − e−t/τ ) (II-1.3)

assuming zero initial conditions.

In practice, exciting the motor from rest using a step input with a zero initial condition may not
lead to a first-order response. This is because the dynamics of the motor in the vicinity of zero
speed is dominated by (unmodeled) nonlinear terms. Therefore, to make the system act more like a
first-order system, it is better to have the motor running at an initial constant non-zero speed and
from there excite it with a step input of amplitude ∆ u, as illustrated in Fig. II-1.3.

Time

Figure II-1.3: Step response of a first-order system with non-zero initial condition

Let ∆ y denote the change in the steady-state output (motor speed in this case). The DC gain (K)
is the system’s output response as a result of a unit step input. Thus,

∆y
K= .
∆u

The time constant is the time needed for the system’s response to reach 63% of the output span
(∆ y) (see Fig. II-1.3).
42CHAPTER II-1. PLANT MODELING AND IDENTIFICATION IN THE FREQUENCY DOMAIN

II-1.3.2 Implementation

To run the experiment, follow the following procedure.

L-II-1.1. Connect the K-MCK and the K-ECS boards and launch the K-CSP, as described in
Chapter I-1.

L-II-1.2. Upload this lab’s firmware (Hex file) to the K-ECS board.

L-II-1.3. Load this lab’s configuration file (kcsp file) to the K-CSP.

L-II-1.4. Apply the settings shown in Fig. II-1.4 with the following exceptions:

a) Make sure you pick the right communication port.

Figure II-1.4: K-CSP settings

L-II-1.5. Run the experiment with the reference signal’s initial and amplitude values indicated
in Table II-1.1. For information on the Pulse signal properties, see Fig. I-2.2.
II-1.4. LABORATORY REPORT 43

Save your plots and copy the raw data (csv file) on your personal storage media, such
as a USB key, for later use. You may want to give them meaningful names so that they
do not get mixed up with the files of other experiments.
L-II-1.6. Using the raw speed data/plot, graphically compute the values of K and τ , as precisely
as possible (use the zoom tool if necessary), and write them down in the proper cells of
Table II-1.1. Avoid working on the first a few cycles of the plot. The numerical values
will be computed later.
Demo

D-II-1.1. Make sure you demo to the TA at least one of your runs before leaving (10 pts)
the lab.

Speed
Graphically Numerically
Initial Vref Amplitude ∆ VRef Initial ωm Final ωm ∆ ωm K τ K τ
(V) (V) (V) (rad/s) (rad/s) (rad/s) (s) (s)
2.0 1.0
2.0 1.5
2.0 2.0
2.0 2.5
2.0 3.0
Average:

Table II-1.1: Model identification results

II-1.4 Laboratory Report

Include the following in your laboratory report:


Report

R-II-1.1. The plots of all the experiments corresponding to Table II-1.1. Make sure (4 pts)
they are properly labeled.

R-II-1.2. A filled copy of Table II-1.1. (16 pts)


Furthermore, for each experiment, use the experimental raw data you
saved in the lab, to plot the transient response of the system. One exci-
tation cycle is enough for each experiment. Make sure to shift the x- and
y-axis scales so that the graph starts from (0, 0). The graphs must clearly
show the time constant, settling time, and the output steady-state value.
Numerically process the speed data of each transient response graph to
44CHAPTER II-1. PLANT MODELING AND IDENTIFICATION IN THE FREQUENCY DOMAIN

Report find the numerically computed values of the DC gain and the time con-
stant.
To numerically compute the DC gain with a higher precision you may
want to take the average of the output at steady state.
In Matlab, for instance, you may want to customize the following state-
ment to find the index idx corresponding to the time constant:
idx=max(find((yss-y)>=0.37*yss))
where yss is the output’s steady-state value and y is a vector of the output
samples (i.e., speed).
Do not forget to calculate the average values of K and τ in Table II-1.1.

(10 pts) R-II-1.3. Model validation: For each row of Table II-1.1, generate two figures:

a) The first figure shows the response of the “ideal” system along with
that measured experimentally. The latter is the same transient re-
sponse plot you generated above. The “ideal” system response can be
generated by applying the average of the numerically computed K
and τ to the Matlab function lsim fed with the time and input vec-
tors used to generate the first plot. For details on how to use lsim re-
fer to http://www.mathworks.com/help/control/ref/lsim.html
b) In the second figure include the error between the ideal and the
measured responses plotted in the first figure.

Analyze the validity of your model.

Include your answers to the following questions in your report.


Report

(5 pts) R-II-1.4. Does the DC gain or the time constant of a first-order system depend on
the input? Justify your answer theoretically and back it up with your
results in Table II-1.1.

(5 pts) R-II-1.5. What might be the origin of the discrepencies between the ideal and the
experimental response of the motor system?

(30 pts) R-II-1.6. Design of an LTI system:


Design an electric circuit that has the same first-order transfer function
as the motor system identified above (in its first-order approximation).
It is preferred that the circuit’s input and output be voltages (instead of
current, for example).
Determine the following circuit characteristics:

1. The values of all the circuit’s electric components (resistors, capaci-


tors, etc.)
II-1.4. LABORATORY REPORT 45

Report 2. The symbolic and numeric expressions of the circuit’s transfer func-
tion.
3. The symbolic expressions and numeric values of the circuit DC gain
and time constant.

The difference between symbolic and numeric expressions is that the sym-
bols of the electric components are substituted with their numeric values
in the latter.
Using Multisim, simulate the circuit with step functions of the amplitudes
in Table II-1.1, and include the figures in your report. A guide on how to
do that is at http://www.ni.com/tutorial/12774/en/ You may want to
search the Internet for other online tutorials on how to use Multisim, in
general, if you do not know yet.
How do you compare the response of the circuit and that of the motor to
the same inputs?
What do you think of the following statement? Explain.

Two systems with the same transfer function must have the
same behavior (input-output wise) regardless of their type (elec-
trical, mechanical, chemical, medical, economical, etc.)

Submit your Multisim file as a separate document from your report so


that the TA can run the simulations for verification. Do not submit your
work in a zip archive. It is the student’s responsibility to make sure that
the Multisim document is compatible with the Multisim version installed
in the computer labs of the Faculty of Engineering. That is where the TA
will run the simulations. No debugging will be done. If the simulation
does not work, for any reason, no points will be assigned.

When answering pre-lab or lab report questions, ALWAYS indicate the number of the
Attention

question you are answering.


46CHAPTER II-1. PLANT MODELING AND IDENTIFICATION IN THE FREQUENCY DOMAIN
Chapter II-2

Plant Modeling in Time Domain

II-2.1 Objectives

In Chapter II-1, a model of the motor system was derived in the Laplace domain. In this chapter,
the plant will be modeled in the time domain. Hence, the objective of this lab is to find an open-loop
state-space model of the motor system.

II-2.2 State-Space Representation

Control systems are often studied through their state-space representations rather than transfer
functions. Some of the main advantages of state-space representations over transfer functions are
the following:

• They can model SISO as well as MIMO systems.


• They are suitable for linear as well as nonlinear systems.
• They are capable of modeling time-independent and time-dependent systems.

II-2.2.1 Open-Loop Analysis

In this part, you will study the open-loop motor system through its state-space model
Pre-lab

P-II-2.1. Using the motor description and equations in Section II-1.2, derive a state- (20 pts)
space model of the open-loop motor system. The system’s output is the
motor speed ωm while the external inputs are the armature’s applied volt-
age vm and the disturbance torque Td . You may adopt ωm and the motor’s
armature current im as the system states. In other words, the state vector
x = [ωm im ]T , and the input u = [vm Td ]T .

47
48 CHAPTER II-2. PLANT MODELING IN TIME DOMAIN

(5 pts) Pre-lab P-II-2.2. From your state-space model compute the transfer function ωm (s)/Vm (s)
(without passing by the signal flow graph and Mason’s formula). Compare
your solution to that of Pre-lab question P-II-1.5.

(10 pts) P-II-2.3. Use your state-space model to draw a signal flow graph of the open-loop
motor system. Make sure to identify the nodes corresponding to the states
and their time-derivatives in the graph. Compare the graph to your solu-
tion of Fig. II-1.2 in Chapter II-1. Comment on the similariries between
the two?

(10 pts) P-II-2.4. Now, use the signal-flow graph to compute this transfer function
ωm (s)/Vm (s). Compare that to your solution of Pre-lab questions P-II-2.2
and P-II-1.5.

(10 pts) P-II-2.5. Repeat the previous pre-lab question to compute the transfer function
ωm (s)/Td (s). Note that in this case, you are supposed to compare with
your solution of Pre-lab question P-II-1.6.

(10 pts) P-II-2.6. Use your state-space model to compute the system’s pole(s). Compare
your result with that of Pre-lab question P-II-1.8. What can you conclude?

(5 pts) P-II-2.7. Use your state-space model to find an expression of the armature current
at steady state (when all signals reach their final values) in terms of the
motor parameters.

(10 pts) P-II-2.8. Simulate the state-space model in Matlab using the command
[y,t,x]=lsim(...)a or [y,t,x]=step(...)b and plot the curves of
the states (speed and current). Assume that there are no disturbances
acting on the system. Note that you may also want to specify an initial
condition if it is not zero. Use the following matrices in your simulation:
 
−0.8315789474 1379423.59799655
system matrix =
−385.4271817932 −2117.6470588235
 
0 1052631.57894737
input matrix =
294.1176470588 0
a
http://www.mathworks.com/help/control/ref/lsim.html
b
http://www.mathworks.com/help/control/ref/step.html

II-2.2.2 Closed-Loop Analysis

In this section, we will use an approximation of the motor’s open-loop transfer function as first-order
model,
ωm (s) Km
Gp (s) = ≡
Vm (s) τm s + 1
This is often a valid approximation of DC motor transfer functions, as shown in Chapter II-1.
II-2.2. STATE-SPACE REPRESENTATION 49

Attention The values of the DC gain and time constant will be provided by the
instructor.
Pre-lab

P-II-2.9. In Matlab, simulate the step response of the open-loop motor Gp (s), and (10 pts)
include the transient response graph. The plot must clearly show the
transient response characteristics of the system (time constant, settling
time, and output steady-state value).
In practice, do you think it is easy to change the model of the plant?
Explain.

We are now interested in changing the system behavior. One way of achieving this is by by intro-
ducing an output feedback which results in relocating the system’s pole(s).

Let e = vr − Kω ωm and the control signal (input to the motor) vm = Kp e, where Kω is the motor’s
speed sensor gain (see Table I-1.1), acting as a feedback gain, and Kp is a positive design gain.

This control scheme is depicted in Fig. II-2.1, where Hs (s) = Kω and Gc (s) = Kp .

Motor
Motor
Controller System
Speed (rad/s)

[-5..5] V

Speed
Motor
Sensor
Speed (V)

Figure II-2.1: Block diagram of a speed feedback control for the motor system
Pre-lab

P-II-2.10. Derive the state-space model of the closed-loop system. You may take the (10 pts)
motor speed as a state.

P-II-2.11. Compute the closed-loop poles. What effect does increasing the free pa- (10 pts)
rameter Kp have on the closed-loop poles, and so on the closed-loop re-
sponse?
50 CHAPTER II-2. PLANT MODELING IN TIME DOMAIN

(10 pts) Pre-lab P-II-2.12. Simulate the state-space model in Matlab for four positive values of Kp .
Include the step response figures of the simulations in your pre-lab report.
Avoid choosing too close values, and do not choose values that may sat-
urate the control signal vm . Check Fig. I-1.4 for the saturation limits.
Your plots must clearly show the transient response characteristics of the
system (time constant, settling time, and output steady-state value).

II-2.3 Lab Procedure

In the laboratory, you will validate the simulations you conducted earlier for the open- and closed-
loop system.

L-II-2.1. Connect the K-MCK and the K-ECS boards and launch the K-CSP, as described in
Chapter I-1.

L-II-2.2. Upload the appropriate firmware (Hex file) to the K-ECS board.

II-2.3.1 Validation of Open-Loop Model

You will begin by validating your plant’s open-loop response. To do so, follow the following proce-
dure.

L-II-2.3. Load this part’s configuration file (kcsp file), if any, to the K-CSP.

L-II-2.4. Apply the settings shown in Fig. II-2.2 with the following exceptions:

a) Make sure you pick the right communication port.

L-II-2.5. Run the experiment and save your plots and copy the raw data (csv file) on your personal
storage media, such as a USB key, for later use. You may want to give them meaningful
names so that they do not get mixed up with the files of other experiments.
Demo

(10 pts) D-II-2.1. Make sure you demo to the TA your run before leaving the lab.
Report

(20 pts) R-II-2.1. Include the plots of your experimental and simulation results (from pre-
lab question P-II-2.9). To plot experimental data, use the experimental
raw data you saved in the lab, to plot the transient response of the system.
II-2.3. LAB PROCEDURE 51

Figure II-2.2: K-CSP settings for open-loop system

One excitation cycle is enough. Make sure to shift the x- and y-axis scales
Report

so that the graph starts from (0, 0). All your numerical and experimen-
tal plots must clearly show the time constant, settling time, and output
steady-state value.
Compute the response characteristics (DC gain, time constant, and set-
tling time) from your simulation and experimental plots. Comment on
how close (or far) they match.

II-2.3.2 Validation of Closed-Loop Model

You will validate the closed-loop response you simulated earlier.

L-II-2.6. Load this part’s configuration file (kcsp file), if any, to the K-CSP.
52 CHAPTER II-2. PLANT MODELING IN TIME DOMAIN

L-II-2.7. Apply the settings shown in Fig. II-2.3 with the following exceptions:

a) Make sure you pick the right communication port.


b) Enter your value of Kp in front of “Kp Gain”.

Figure II-2.3: K-CSP settings for closed-loop system

L-II-2.8. Run the experiments with the the gain values Kp that you chose earlier.
Save your plots and copy the raw data (csv file) on your personal storage media, such
as a USB key, for later use. You may want to give them meaningful names so that they
do not get mixed up with the files of other experiments.
Demo

(10 pts) D-II-2.2. Make sure you demo to the TA at least one of your runs before leaving
the lab.
II-2.3. LAB PROCEDURE 53

Report R-II-2.2. Include the plots of your experimental and simulation results (from pre- (20 pts)
lab question P-II-2.12). To plot experimental data, use the experimental
raw data you saved in the lab, to plot the transient response of the system.
One excitation cycle is enough. Make sure to shift the x- and y-axis scales
so that the graph starts from (0, 0). All your numerical and experimen-
tal plots must clearly show the time constant, settling time, and output
steady-state value.
Comment on how close (or far) they match, and whether your earlier
analysis on the effect of increasing Kp is confirmed experimentally.

When answering pre-lab or lab report questions, ALWAYS indicate the number of the
Attention

question you are answering.


54 CHAPTER II-2. PLANT MODELING IN TIME DOMAIN
Chapter II-3

System Identification Through


Frequency Response Techniques

II-3.1 Objectives

In this laboratory, students will learn how to:

• Experimentally sketch the Bode plot of a system.

• Identify the system model from the Bode plot.

• Validate the system model against its time response.

II-3.2 Identifying a First-Order System From Its Frequency Re-


sponse
Pre-lab

P-II-3.1. The Bode plot of a first-order system is shown in Fig. II-3.1. Use the Bode (20 pts)
plot to find the system’s DC gain and time constant. Write the system’s
transfer function. Explain your answer in detail.

P-II-3.2. The step response of a first-order system is shown in Fig. II-3.2. Find the (20 pts)
system’s DC gain and time constant. Write the system’s transfer function.
Explain your answer in detail.

55
56CHAPTER II-3. SYSTEM IDENTIFICATION THROUGH FREQUENCY RESPONSE TECHNIQUES

60 dB

40
Magnitude (dB)

20

−20

−40 rad/s
10−1 100 101 102 103

180 ◦

165
150
135
120
105
90
75
60
45
30
15
0
Phase (deg)

−15
−30
−45
−60
−75
−90
−105
−120
−135
−150
−165
−180 rad/s
10−1 100 101 102 103

Figure II-3.1: Bode plot of a first-order system


II-3.2. IDENTIFYING A FIRST-ORDER SYSTEM FROM ITS FREQUENCY RESPONSE 57

3.5

Output
3

2.5

Input
2

1.5

0.5

0.0 t
0.0 0.5 1 1.5 2 2.5 3 3.5 4

Figure II-3.2: Step response of a first-order system


58CHAPTER II-3. SYSTEM IDENTIFICATION THROUGH FREQUENCY RESPONSE TECHNIQUES

II-3.3 Lab Procedure

In the laboratory, you will start by experimentally sketch the Bode plot of an LTI system.

L-II-3.1. Connect the K-MCK and the K-ECS boards and launch the K-CSP, as described in
Chapter I-1.

L-II-3.2. Upload the appropriate firmware (Hex file) to the K-ECS board.

L-II-3.3. Load this part’s configuration file (kcsp file), if any, to the K-CSP.

L-II-3.4. Apply the settings shown in Fig. II-3.3 with the following exceptions:

a) Make sure you pick the right communication port.

Notice the sampling periods.


You may want to adjust the experiment duration so that it is enough to get a few cycles
of the input and output signals.

L-II-3.5. Run the necessary experiments to fill out Table II-3.1.


Save your plots and copy the raw data (csv file) on your personal storage media, such
as a USB key, for later use. You may want to give them meaningful names so that they
do not get mixed up with the files of other experiments.
Demo

(10 pts) D-II-3.1. Make sure you demo to the TA at least one of your runs before leaving
the lab.

L-II-3.6. Now, you will record the system’s time response so that you can later extract its transfer
function and compare it to that obtained from the Bode plot. To do that, choose an
adequate input type which allows you to plot the step response of the system. Remember
to avoid having the motor running at low speeds at all times (to avoid static nonlinear
fiction).

L-II-3.7. Run at least 4 experiments with the same input type but different input magnitude.
Save your plots and copy the raw data (csv file) on your personal storage media, such
as a USB key, for later use. You may want to give them meaningful names so that they
do not get mixed up with the files of other experiments.
Demo

(10 pts) D-II-3.1. Make sure you demo to the TA at least one of your runs before leaving
the lab.
II-3.3. LAB PROCEDURE 59

Figure II-3.3: K-CSP settings for the frequency response experiment


60CHAPTER II-3. SYSTEM IDENTIFICATION THROUGH FREQUENCY RESPONSE TECHNIQUES

Input Input Input Output Magnitude Magnitude Output Output


Frequency Magnitude Frequency Magnitude Ratio Ratio Phase Shift Phase Shift
(Hz) (V) (rad/s) (rad/s) (rad/(s·V)) (dB) (rad) (◦ )

0.02 1.0
0.04 1.0
0.06 1.0
0.08 1.0
0.10 1.0
0.20 1.0
0.40 1.0
0.60 1.0
0.80 1.0
1.00 1.0
2.00 1.0
4.00 1.0
6.00 1.0
8.00 1.0
10.00 1.0

Table II-3.1: Frequency response results


II-3.4. LABORATORY REPORT 61

II-3.4 Laboratory Report

Include the following in your laboratory report:


Report

R-II-3.1. Include your input and output plots corresponding to each row of Table II- (10 pts)
3.1. Label them clearly.

R-II-3.2. Finish filling in Table II-3.1 and include it in your report. (20 pts)

R-II-3.3. Use the graph on page 62 to draw the system’s Bode plot. (10 pts)

R-II-3.4. From the Bode plot, find the DC gain and time constant, and write the (20 pts)
system’s transfer function. Explain your reasoning in detail.

R-II-3.5. Include your step response plots. Label them clearly. (10 pts)

R-II-3.6. Now use the step response plots to find the DC gain and time constant. (20 pts)
You would better calculate them from each plot and average them out.
Write the system’s transfer function. Explain your reasoning in detail.

R-II-3.7. Compare the transfer functions you derived from the frquency and time (10 pts)
responses. How close are they? Try to explain the source of differences,
if any.

When answering pre-lab or lab report questions, ALWAYS indicate the number of the
Attention

question you are answering.


dB
Magnitude (dB)

rad/s


Phase (deg)

rad/s

Figure II-3.4: A template for sketching Bode plots


Chapter II-4

Control of Motor Speed Error

II-4.1 Objectives

The objective of this lab is to study and control the speed of a DC motor and its actuation error
using a P and PI controllers.

II-4.2 Introduction

Figures II-4.1 and II-4.2 show the block diagrams of speed and position feedback control systems of
a DC motor. The objective of this laboratory is to study the actuation error of both systems and
its relation with the type of the system. The error signal is denoted by e in both figures.

Motor
Motor
Controller System
Speed (rad/s)

[-5..5] V

Speed
Motor
Sensor
Speed (V)

Figure II-4.1: Block diagram of a speed feedback control for the motor system

As we did previously, the motor (plant) will be modeled by its first-order approximation,

K
Gp (s) =
τs+1

where K and τ are process’ DC gain and time constant, respectively.

63
64 CHAPTER II-4. CONTROL OF MOTOR SPEED ERROR

Motor Motor
Motor
Controller System
Speed (rad/s) Position (rad)

[-5..5] V

Position
Motor
Sensor
Position (V)

Figure II-4.2: Block diagram of a position feedback control for the motor system

The speed sensor converts the motor’s rotational speed in rad/s to its corresponding voltage. The
sensor’s transfer function is approximated by a positive constant (Kω ) which is also known as the
sensor’s sensitivity. In other words,

Hs (s) = Kω .

Likewise, the position sensor converts the motor’s angular position in rad to its corresponding
voltage. The sensor’s transfer function is approximated by a positive constant (Kθ ) which is also
known as the sensor’s sensitivity. In other words,

Hp (s) = Kθ .

The values of Kω and Kθ are reported in Table I-1.1.

In this laboratory, the focus will be on controlling the motor speed and its error (see Fig. II-4.1).
Pre-lab

(2 pts) P-II-4.1. Find the value of the reference signal vr to pass as an input to the system
which is equivalent to a constant value of 7.2 rad/s.

(2 pts) P-II-4.2. Repeat the above question for a ramp input with a slope of 0.369 rad/s2 .

II-4.3 Proportional Control of Motor Speed

You will first start by studying the performance of a Proportional compensator to control the motor
speed.

Gc (s) = Kp > 0
II-4.4. PI CONTROL OF MOTOR SPEED 65

Pre-lab P-II-4.3. Find an expression of the system’s transfer function T (s). Do not substi- (4 pts)
tute the parameters with their values yet.
Deduce the system’s order and type (i.e., type 0, 1, 2, etc.)

P-II-4.4. Find the expression of the error transfer function E(s)/Vr (s), and deduce (10 pts)
the steady-state error for: (i) a step input Vr , and (ii) a ramp input Vr t.
Do not substitute the parameters with their values yet.

P-II-4.5. Find the expressions of the static position and velocity error constants, (10 pts)
Kep and Kev , respectively. Use these error constants to deduce the steady-
state error for: (i) a step input Vr , and (ii) a ramp input Vr t. Do not
substitute the parameters with their values yet.

P-II-4.6. Do you think a proportional controller is able to annihilate the system’s (4 pts)
actuation error for: (i) a step input, and (ii) a ramp input? Explain.

For the following questions, substitute the system parameters with their respective
Attention

values. The motor’s DC gain K and time constant τ will be provided by your instruc-
tor.
Pre-lab

P-II-4.7. For the input of Pre-lab Step P-II-4.1, what gain values of the controller (5 pts)
lead to a constant steady-state error equivalent to +1.6 rad/s, if possible?

P-II-4.8. For the input of Pre-lab Step P-II-4.2, what gain values of the controller (5 pts)
lead to a constant steady-state error equivalent to +1.6 rad/s2 , if possible?

II-4.4 PI Control of Motor Speed

You will now study the performance of a PI compensator to control the motor speed.

1
Gc (s) = Kp + Ki Kp , Ki > 0
s
Pre-lab

P-II-4.9. Is there an advantage of using a PI controller over its P counterpart in (4 pts)


this case? Explain the theory behind your answer.
66 CHAPTER II-4. CONTROL OF MOTOR SPEED ERROR

(38 pts) Pre-lab P-II-4.10. Repeat Pre-lab Steps P-II-4.3 to P-II-4.8 with the PI controller.

II-4.5 Lab Procedure

In the laboratory, you will validate your earlier findings.

L-II-4.1. Connect the K-MCK and the K-ECS boards and launch the K-CSP, as described in
Chapter I-1.

L-II-4.2. Upload the appropriate firmware (Hex file) to the K-ECS board.

L-II-4.3. Load this lab’s configuration file (kcsp file), if any, to the K-CSP.

L-II-4.4. Apply the appropriate settings to the K-CSP. Remember, the “Main Fbk” signal must
always correspond to the feedback error. In this case, it is the raw speed error.

L-II-4.5. Do not forget to choose PID Controller as your controller type.

L-II-4.6. Run the experiments corresponding to pre-lab questions P-II-4.7 and P-II-4.8 for the P
and PI controllers.
If you have the luxury of having a free gain in the case of the PI controller, try to
choose it conveniently to avoid signal saturations and to clear illustrate the purpose of
the experiment.
Save your plots and copy the raw data (csv file) on your personal storage media, such
as a USB key, for later use. You may want to give them meaningful names so that they
do not get mixed up with the files of other experiments.
Demo

(20 pts) D-II-4.1. Make sure you demo to the TA all 4 your experiments with your original
calculated gain values before leaving the lab.

(20 pts) D-II-4.2. In case the computed controller gains didn’t lead to the target error, fine
tune them until the error is experimentally shown to be as close as possible
to the desired one, and demo your results to the TA.
Save your plots and copy the raw data (csv file) on your personal storage
media.
II-4.6. LABORATORY REPORT 67

II-4.6 Laboratory Report


Report

R-II-4.1. Include all the figures you demonstrated to the TA in steps D-II-4.1 and D- (20 pts)
II-4.2. Make sure they are clear enough to make the TA reach the same
conclusion you did.

R-II-4.2. In which cases didn’t your computed controller gains lead to the target (5 pts)
error? Enumerate some possible reasons for that.

R-II-4.3. Is the steady-state error proportional to the magnitude of a step input (10 pts)
when a P-controller is used? Justify your answer formally (mathemati-
cally).

R-II-4.4. Do you think it is possible to completely annihilate the speed control (10 pts)
system’s error to a step input with a P-controller? Explain.

When answering pre-lab or lab report questions, ALWAYS indicate the number of the
Attention

question you are answering.


68 CHAPTER II-4. CONTROL OF MOTOR SPEED ERROR
Part III

Appendix

69
Appendix A

Analog Controller Implementation

In some of the following laboratories, students will be asked to design and implement analog con-
trollers on a breadboard which they will later integrate in the overall control system (see Fig. I-1.2).
The following is a brief description on how to do so.

A.1 Physical Realization of Active Compensators

Some types of active Compensators may be implemented using the circuit of Fig. A.1, whose transfer
function is
V0 (s) Z2 (s)
Gc (s) = =− (A.1)
Vi (s) Z1 (s)

Where Z1 and Z2 are the impedances of the circuits shown in Table A.1. The last column of the
same table provides expressions of the controller circuit transfer functions in terms of their electric
component parameters.

Z2

Z1
Vi −

Vo
+

Figure A.1: The base circuit for active compensators with inverted polarity

In order to get rid of the leading minus sign (−) in the transfer function of equation (A.1) due to
the effect of the inverting op-amp, the output signal needs to be reinverted back by concatenating a

71
72 APPENDIX A. ANALOG CONTROLLER IMPLEMENTATION

Table A.1: Component circuits of some active compensators (Table 9.10 of [1])

similar circuit to that of Fig. A.1. The resultant circuit is shown in Fig. A.2. Therefore, as long as
Z3 and Z4 are chosen such that they are equal, the transfer function of the circuit in that figure is

V0 (s) Z2 (s)
Gc (s) = = (A.2)
Vi (s) Z1 (s)
A.2. PRACTICAL CONSIDERATIONS 73

Z2 Z4

Z1
Vi − Z3

+ Vo
+

Figure A.2: The base circuit for active compensators with the proper polarity

A.2 Practical Considerations

Design stage: When designing an active compensator, students will have to base their (theoretical)
design based on Fig. A.2, equation (A.2), and Table A.1.

Common ground and power: When implementing the controller circuit on a breadboard, al-
ways use the same ground and power as the K-ECS or the motor kit boards. Refer to
Fig. I-1.2 to identify the pins where to pull the ground and power from. You may pull
Never connect any signal to your breadboard from an external source other than the K-ECS
or the motor board.

Op-amp: To avoid saturation and poor performance of some commercial op-amps, it is recom-
mended to use TLV27X from Texas Instruments. Students do not need to buy the chip
themselves as it will be provided to them in the lab. Make sure to pull all its input sig-
nals from the K-ECS or the motor kit. The chip’s datasheet may be downloaded at http:
//www.ti.com/lit/ds/symlink/tlv272.pdf

A.3 Physical Realization of Passive Compensators

Passive compensators are implemented with passive circuit components (no op-amps are needed).
Not all sorts of compensators can be implemented with passive circuits. Table A.2 shows the circuit
diagrams of some passive controllers.
74 APPENDIX A. ANALOG CONTROLLER IMPLEMENTATION

Table A.2: Circuits of some passive compensators (Table 9.11 of [1])


Bibliography

[1] Norman S. Nise. Control Systems Engineering. Wiley, 7 edition, 2015.

75

You might also like