04 Golnaraghi App D D-1-D-64

You might also like

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

APPENDIX D

Control Lab

Most undergraduate control courses have labs dealing with time response and control of
dc motors—namely, speed response, speed control, position response, and position con-
trol. In many cases, because of the high cost of control lab equipment, student exposure
to test equipment is limited, and as a result, many students do not gain a practical insight
into the subject. In this appendix, recognizing these limitations, we introduce the con-
cept of Control Lab, which includes two classes of experiments: SIMLab (model-based
simulation) and LEGOLab (physical experiments). These experiments are intended to
supplement, or replace, the experimental exposure of the students in a traditional under-
graduate control course.
In this appendix, we have created a
series of inexpensive control experiments
Learning Outcomes for the LEGO® MINDSTORMS® NXT dc
After successful completion of this appendix, you will be able to motor that will allow students to do their
1. Simulate speed and position time response of dc motors and simple work within the MATLAB® and Simulink®
control systems using MATLAB and Simulink. environment—even at home. This cost-
2. Learn how to identify the parameters of a system—based on system effective approach may allow educational
time response. institutions to equip their labs with a num-
3. Gain a practical sense of real-life control problems, through the use of ber of LEGO test beds and maximize stu-
LEGO MINDSTORMS, MATLAB, and Simulink tools.
dent access to the equipment at a fraction
of the cost of currently available control-
systems experiments. Alternatively, as a supplemental learning tool, students can take the
equipment home after leaving a security deposit and learn at their own pace. This con-
cept has proven to be extremely successful at Simon Fraser University—Farid Golnaraghi’s
home university in Vancouver, Canada.
The labs include experiments on speed and position control of dc motors, followed
by a controller design project involving control of a simple robotic system conducting a
pick-and-place operation and position control of an elevator system. Two other projects
also appear in Chaps. 1 and 9. The specific goals in this appendix are
•  To provide an in-depth, practical discussion of the dc motor speed response, speed
control, and position control concepts.
•  To provide examples on how to identify the parameters of a physical system,
experimentally.
•  To give a better feel for controller design through realistic examples.
Before starting the labs, you must have completed the relevant background preparation
in Chaps. 6 and 7.

D-1

04_Golnaraghi_App_D_D-1-D-64.indd 1 07/02/17 5:27 PM


D-2   Appendix D.  Control Lab

D-1  PROJECT 1: INTRODUCTION TO LEGO MINDSTORMS NXT MOTOR—


CHARACTERIZATION AND CONTROL
This section provides a simple, yet practical, project for you to better appreciate the
theoretical concepts that have been discussed so far. The primary objective of this project
is to provide you with a series of experiments for measuring a dc motor’s electrical and
mechanical characteristics, and ultimately, to create a mathematical model for the motor.
The goal of this project is, further, to build a one-degree-of-freedom robot using the LEGO
MINDSTORMS NXT motor, shown in Fig. D-1, and to develop both speed and position
control systems for the robot using MATLAB and Simulink. LEGO MINDSTORMS and
MATLAB and Simulink will allow you to study control systems without the need for highly
equipped and expensive laboratories. Most importantly, you can learn the subject while
having fun! If you do not have access to LEGO MINDSTORMS, you can still follow the
example provided to gain practical experience on the subject.
Required components include an NXT brick, an NXT motor, and several LEGO pieces
found in the basic LEGO MINDSTORMS kit, which are used to construct a one
degree-of-freedom arm. Also required is an installed copy of MATLAB and
Instructions on assembling and
programming the robot are avail-
Simulink 2012 or newer, which is used to provide communication between the
able at www.mhprofessional.com/ host computer and the NXT device via a USB and Bluetooth connection. All the
golnaraghi. necessary components are illustrated in Fig. D-1. The arm is to pick up a payload
and drop it into the cup, which is located at a specified angle while data is sam-
pled in Simulink. Programming is done on the host computer using Simulink
and is uploaded on to the NXT brick via USB interface. The brick then provides both power
and control to the arm via the NXT cables. Additionally, there is an optical encoder located
behind the motor which measures the rotational position of the output shaft with 1° resolu-
tion. The host computer samples encoder data from the NXT brick via a Bluetooth
connection. In order for the host computer to recognize the NXT brick, the host computer
must be paired with the NXT brick when setting up the Bluetooth connection.

USB Interface

NXT Brick

NXT Cables

NXT Motors

Host Computer

One degree-of-freedom arm


Gripper
Playload (wheel)

Figure D-1  One degree-of-freedom arm with required components.

04_Golnaraghi_App_D_D-1-D-64.indd 2 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-3

Output Shaft
Gear-train

DC Motor

Figure D-2  NXT motor internals.

In order to develop position and speed control in the system shown above, it is neces-
sary to first characterize and model the motor.1

D-1-1  NXT Motor


The NXT motor used in this project is a 9-V dc motor specific to the LEGO MINDSTORMS
NXT set. As shown in Fig. D-2, the motor contains a gear train from the motor to output
shaft to provide greater torque. The idealized schematic of this motor was earlier shown in
Fig. 6-32.
The overall gear ratio calculation from motor to output shaft is shown in
The first objective of this project is Table D-1. Because the encoder measures the rotational position of the output shaft,
to help you better understand how and not that of the motor shaft, the gear ratio and its model may be absorbed into
to measure a dc motor’s electrical
the motor model—see Chap. 6 for details. As a result, from this point forward, any
and mechanical characteristics and
ultimately create a model for the
reference to the motor implicitly refers to the motor-gear-train system. Further,
motor. all parameters obtained will be for the motor-gear-train combination.
In order to fully model the motor, both the electrical and mechanical char-
acteristics of the motor are obtained experimentally. As mentioned earlier, an
The gear ratio and its model may installed copy of MATLAB and Simulink 2012 or newer are required to carry
be absorbed into the motor model. out the experiments. MATLAB and Simulink 2012 contains a new library that
has been developed to interface with LEGO hardware.

TABLE D-1  NXT Motor to Output Shaft Gear Reductions


Shaft No. Gear Tooth Ratio Gear Reduction
1 10:30:40 1:4
2  9:27 1:3
3 10:20 1:2
4 10:13:20 1:2
Overall gear reduction 1:48

1
It is important to note that the measured values provided here will vary from motor to motor; and for better accu-
racy, you are advised to conduct your own experiments to determine your system’s parameter values.

04_Golnaraghi_App_D_D-1-D-64.indd 3 07/02/17 5:27 PM


D-4   Appendix D.  Control Lab

D-1-2 Interfacing
Interfacing between the NXT motor and the host computer is of importance because
the user should be able to both control the motor as well as sample positional data from
the motor encoder or any other sensors connected to the NXT brick. Interfacing will be
performed using MATLAB and Simulink via a Bluetooth and USB connection. A Bluetooth
connection is required to sample data from the NXT motor in real time, whereas a USB
connection is required to upload Simulink models onto the NXT Brick.
Introduction to Simulink2
Simulink is an environment used for multidomain simulation where the user is able to
create models for dynamic and embedded systems. It includes a customizable set of graphi-
cal block libraries, which the user can drag and drop to design and simulate a variety of
time-varying systems. In this appendix, we are particularly interested in utilizing Simulink
to simulate the model of the NXT motor and implementing speed and position control
systems. We also use Simulink to run the NXT motor experiments.
To start the Simulink software, enter “simulink” in the MATLAB command window
or alternatively, click on the Simulink icon on the MATLAB toolbar. This will take you
to the Simulink Library Browser menu. This menu displays all of the block libraries that
are installed on your computer, similar to what is shown in Fig. D-3. These blocks can be
dragged and dropped into a Simulink model to design your very own system. To create an

Figure D-3  Simulink Library Browser menu.

2
 or a more in-depth introduction to Simulink, please refer to www.mathworks.com; for example, http://www
F
.mathworks.com/videos/simulink/getting-started-with-simulink.html, http://www.mathworks.com/help/simulink/
examples/index.html.

04_Golnaraghi_App_D_D-1-D-64.indd 4 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-5

Figure D-4  Empty Simulink model.

empty model, select File → New → Model from the Library Browser menu. An example of
an empty Simulink model is shown in Fig. D-4.
To add blocks to the model, return to the Library Browser and drag and drop them into
the model window. Some of the commonly used blocks along with their func-
tions are shown in Table D-2. Utilizing the blocks shown in Table D-2, one is
The Simulink model is essentially able to create a Simulink model for a dc motor—a position control example is
the same as a block diagram of a illustrated in Fig. D-5 (more examples appear later in the section). This model
control system. Note: The motor
can be used to simulate the behavior of a specific motor for known motor
model includes, implicitly, the
parameters. Every block can be customized by double clicking on them and setting
gear-train model as well.

TABLE D-2  Commonly Used Simulink Blocks


Multiplies the input by a constant
1 Gain

Limits the range of the input signal


Saturation

Generates a step function


Step

Integrates the input signal


1 Integrator
s

1 Models a linear system by transfer function


Transfer Fcn
s +1

04_Golnaraghi_App_D_D-1-D-64.indd 5 07/02/17 5:27 PM


D-6   Appendix D.  Control Lab

1 1 1
1 1 +– K– ++ 1
L.s+R J.s+b s
In Out
Input Amplifier Electrical Current Motor Gain Mechanical Integrator
Voltage Gain Saturation
Saturation Disturbance
2

Kb

Motor feedback

Figure D-5  Open-loop dc motor Simulink model.

the desired parameters. Note that the two saturation blocks were purposely added to simu-
late real-life scenarios. You may elect not to include them in your simulations.
In addition to creating simulations, Simulink is also able to interface with hard-
ware in real time. In particular, it is able to interface with the NXT brick via the LEGO
MINDSTORMS NXT Simulink library.
LEGO NXT Simulink Library
The LEGO NXT Simulink library has been specifically developed to interface with the NXT
brick through MATLAB and Simulink. Again, you will require MATLAB and Simulink
2012 or newer to install the library. Information can be found online that will help
Instructional video available. you with the interfacing details.3
To begin installation, enter “targetinstaller” into the MATLAB command win-
dow, and select to install from the internet when prompted. Select the LEGO NXT
library for installation and follow further on-screen instructions to finish installing the
add-on. After the library has been successfully installed, the new library will appear in
the Simulink Library Browser menu. The library blocks are shown in Fig. D-6. In par-
ticular, we are most interested in the motor and encoder blocks shown in Table D-3.

Library: Target for Use with LEGO MINDSTORMS NXT Hardware

LEGO X
Acceleration LEGO LEGO
Y Battery Button
Port 1 Z Sensor

LEGO R LEGO LEGO


G Color Sensor Encoder Gyro Sensor
Port 1 B Port A Port 1

LEGO LEGO LEGO

LCD Light Sensor Motor


Line 1 Port 1 Port A

LEGO
Data Receive via Blu- LEGO
Send via Bluet- LEGO

Sound Sensor
Mailbox 1
Size etooth(R) Con... Mailbox 1 ooth(R) Conne.. Port 1

LEGO LEGO LEGO


Freq

Vol
Speaker Timer Touch Sensor
Port 1

LEGO
Ultrasonic
Port 1 Sensor

Figure D-6  LEGO MINDSTORMS Simulink library.

3
See introductory video, Interfacing with LEGO MINDSTORMS NXT Using MATLAB and Simulink, Part 1,
at http://www.youtube.com/watch?v=jdjeubqgmjo&feature=youtu.be; also see http://www.mathworks.com/prod-
ucts/simulink/simulink-targets/videos/introduction-to-simulink-support-for-target-hardware.html.

04_Golnaraghi_App_D_D-1-D-64.indd 6 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-7

TABLE D-3  Commonly Used LEGO NXT Simulink Blocks


LEGO Outputs cumulative rotation of an NXT motor in degrees. This
value does not wrap around after reaching 360°.

Port A
Encoder

LEGO Controls the speed of the motor based on the value (−100 − 100)
of the block input port.
Port A
Motor

The Simulink library in Fig. D-6 will be used throughout this section to determine the
mechanical and electrical characteristics of the NXT motor.

D-1-3  Electrical Characteristics4


The electrical characteristics required to model the motor are its armature resistance and
armature inductance. The following sections will provide you with tests that can be done on
the motor to measure its electrical characteristics.
Armature Resistance
In order to measure the armature resistance we had to cut the NXT cable and perform
measurements using a multimeter. Obviously this step will damage the cable, and you may
wish to do this on a demo unit or with your instructor’s permission—or simply rely on the
resulting values obtained in this section. It is important to highlight that every unit is
slightly different due to manufacturing imperfections. So in the very end you will have to
fine tune the motor parameters using the speed and position time responses—as
we have done in the end of this section. If you elect to move forward with cutting
Note: All parameters obtained
the cable, you will notice there are six different colored wires as shown in
are for the motor-gear-train
combination. Fig. D-7. Only the red, white, and black wire will be required for testing, so you
may either solder or splice the remaining three wires back together.
To begin, we must measure the armature current. Connect the multimeter
in series with the white wire (motor power 1) as illustrated in Fig. D-8. The multimeter is
now ready to measure the armature current when the motor is powered.

Encoder Signal 2 - Blue wire


Encoder Signal 1 - Yellow wire
+ 4.5 v - Green wire
Ground - Red wire
Motor Power 2 - Black wire
Motor Power 1 - White wire

Figure D-7  NXT cable wire diagram.

4
It is important to note that the measured values provided here may vary from motor to motor, and you are best to
conduct your own experiments to determine your system’s parameter values.

04_Golnaraghi_App_D_D-1-D-64.indd 7 07/02/17 5:27 PM


D-8   Appendix D.  Control Lab

Ground
Ω Motor Power 2
V A
Motor Power 1
V A
OFF

Figure D-8  Measuring current from NXT.

LEGO
10
Port A
Constant Figure D-9  Open-loop motor
Motor input Simulink model.

To power the motor, connect one end of the cable to the NXT brick and the other end
to the motor and apply a small voltage to the motor using Simulink. The Simulink model
shown in Fig. D-9 will power the motor connected to Port A to 10 percent; however, you
may edit the constant block to supply the power of your choice. Upload the model to the
NXT brick and execute the program.5 Also, ensure there is no external load connected to
the motor during the test.
While the motor is running, stall the motor by completely stopping rotation with either
your hand or with a LEGO piece. You will notice the current will drastically increase when
the motor is stalled. Record the stall current, Istall, that is reported by the multimeter and
repeat for various trials. Avoid stalling the motor for more than a few seconds, otherwise
the motor coils will burn out.
After measuring the stall current, the armature voltage must also be measured. Con-
nect the multimeter in parallel with the white wire as shown in Fig. D-10. Again, apply a
small voltage to the motor using Simulink and stall the motor. Record the supplied voltage
in the white wire reported by the multimeter and repeat for various trials.
Next, we must measure the voltage supplied in the black wire (motor power 2). This
time, connect the multimeter in parallel with the black wire as illustrated in Fig. D-11.
Again, apply a small voltage to the motor using Simulink and stall the motor. Record the
supplied voltage in the white wire reported by the multimeter and repeat for various trials.

5
See LEGO MINDSTORMS NXT library documentation for program-uploading instructions. Or see the intro-
ductory video at www.mhprofessional.com/golnaraghi; also see
http://www.mathworks.com/products/simulink/simulink-targets/videos/introduction-to-simulink-support-for-
target-hardware.html.

04_Golnaraghi_App_D_D-1-D-64.indd 8 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-9

Motor Power 2

Ground
Ω
V A
Motor Power 1
V A
OFF

Figure D-10  Measuring voltage from NXT power 1.

Motor Power 1

Ground
Ω
V A
Motor Power 2
V A
OFF

Figure D-11  Measuring voltage from NXT power 2.

Note that direct measurements of voltage differences between motor power 1 and motor
power 2 may also be performed.
After recording the required voltages and currents calculate the armature voltage using

va = vwhite − vblack (D-1)


2
where vwhite and vblack are the power 1 and power 2 voltages measured earlier, respectively.
Next calculate the experimental armature resistance using
va
Ra = (D-2)
I stall
where va is the voltage measured when the motor is stalled.
Experimental data for the NXT motor for various input power values are shown in
Table D-4. Applying Eq. (D-2), the average experimental armature resistance of the NXT
motor was found to be Ra = 2.27 Ω.

04_Golnaraghi_App_D_D-1-D-64.indd 9 07/02/17 5:27 PM


D-10   Appendix D.  Control Lab

TABLE D-4  Armature Resistance Measurement Experimental Data


vwhite − vblack [motor power 1 va (at stall
voltage (white wire) − motor armature Istall (stall Ra (armature
Motor Power (%) power 2 voltage (black wire), V] voltage, V) current, A) resistance, Ω)
10 0.49 0.24 0.106 2.3
20 0.88 0.44 0.198 2.23
30 1.22 0.61 0.262 2.33
−10 −0.49 −0.24 −0.108 2.26
−20 −0.95 −0.47 −0.211 2.24
−30 −1.23 −0.62 −0.269 2.28

Armature Inductance
There are a number of ways to measure the motor inductance. One way commonly prac-
ticed in most undergraduate control labs is to connect a known resistor R (select a value
close to Ra) in series with the motor, stall the motor as in the previous section, provide the
system a constant input voltage, turn off the input and measure the electric time constant
La /(R + Ra). Knowing the time constant and resistance values, you can calculate La. We took
the easy way out by using a multimeter that is able to measure inductance. Simply connect
the multimeter to the motor terminals, and set the multimeter to measure inductance, as
shown in Fig. D-12. The experimentally measured armature inductance was found to be
La = 4.7 mH.

Figure D-12  Motor direct inductance measurement with a multimeter.

04_Golnaraghi_App_D_D-1-D-64.indd 10 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-11

D-1-4  Mechanical Characteristics6


The mechanical characteristics required to model the motor are the torque constant, the
back-emf constant, viscous-friction coefficient (recall from Chap. 2 that for sim-
Note: All parameters obtained plicity we assume all friction is modeled as viscous damping), armature and
will be for the motor-gear-train load moments of inertia, and system mechanical time constant. The following
combination. sections will provide you with tests that you can use to measure the NXT motor
mechanical characteristics.
Motor Torque Constant
From Chap. 6, the motor torque constant Ki is obtained from

Tm = K iia (D-3)

where Tm is the motor torque and ia is the armature current. Determining the torque
constant experimentally requires you to measure both the current supplied to the motor
and the torque that it provides.
Start by attaching a shaft and spool to the end of the motor as illustrated in Fig. D-13.
Next, wrap some thread or fishing line around the spool so that it acts as a pulley. Finally,
attach a weight with known mass to the end of the thread; this will act as the external torque
that the motor has to overcome in order to rotate. The torque can be calculated using

T = Tm − TW = K iia − rspool W (D-4)

6
It is important to note that the measured values provided here may vary from motor to motor, and you are best to
conduct your own experiments to determine your system’s parameter values.

NXT motor

Spool

Thread fishing wire

Variable mass
Figure D-13  Torque constant test setup.

04_Golnaraghi_App_D_D-1-D-64.indd 11 07/02/17 5:27 PM


D-12   Appendix D.  Control Lab

where rspool is the radius of the spool and W is the weight corresponding to mass M. The
motor will stall when T = 0. The corresponding Tm and ia are motor stall torque and current,
respectively.
In this experiment, the motor rotation results in the mass M to move up or down. You
will be required to measure the current supplied to the motor for a variable mass—recall the
earlier instructions on how to measure the motor current form Sec. D-1-3. Start by apply-
ing an input the motor using Simulink and let the mass rise to the top. While the motor is
pulling the mass upwards, measure the current supplied to the motor using a multimeter.
Repeat this process for various masses and plot the experimental torque Tm from Eq. (D-3)
against the measured current. It should be noted that Ki is independent of the input voltage
value. Table D-5 shows some of the measurements for our experiment. Note that for TW = 0
Nm, ia = 0.041 A, which is the current in the motor to overcome the internal motor fric-
tion. This value can later be used to calculate the motor damping parameter. Also note that
for mass M = 0.874 kg the motor stalls and the corresponding stall torque is Tstall = TW =
0.116 Nm. The experimental motor torque curve for our NXT motor is shown in Fig. D-14,
where the experimental motor torque curve is extrapolated from the data points using the
linear regression tool in MATLAB. The NXT experimentally measured motor constant is
the inverse of the slope (3.95A/N·m) or Ki = 0.252 N·m/A.
Back-emf Constant
From Chap. 6, the back-emf constant is obtained from

eb = K bω m (D-5)

where eb is the back-emf or motor voltage and wm is the motor angular speed. To measure the
motor back-emf constant, you will be required to test the motor’s open-loop speed response
using Simulink as well as measuring the supplied voltage using a multimeter. Begin by creat-
ing the Simulink model shown in Fig. D-15 to apply an open-loop step input to the motor.

TABLE D-5  Motor Torque Constant Measurement Experiment (rspool = 0.013575 m)


TW = rspool W (torque
M (mass attached of motor to overcome ia (motor
Trial to string, kg) W (weight, N) mass, N·m) current, A)
1 0 0 0 0.041
2 0.067 0.6566 0.008913 0.085
3 0.119 1.1662 0.015831 0.113
4 0.173 1.6954 0.023015 0.137
5 0.234 2.2932 0.03113 0.161
6 0.293 2.8714 0.038979 0.187
7 0.353 3.4594 0.046961 0.224
8 0.413 4.0474 0.054943 0.245
9 0.471 4.6158 0.062659 0.283
10 0.532 5.2136 0.070775 0.322
11 0.643 6.3014 0.085542 0.387
12 0.702 6.8796 0.093391 0.435
13 0.874 8.5654 0.116275 0.465 (stall)

04_Golnaraghi_App_D_D-1-D-64.indd 12 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-13

0.7

0.6

0.5

Motor Current (A)


0.4

0.3 Slope 3.95 A/Nm

0.2

0.1

0
0 0.02 0.04 0.06 0.08 0.1 0.12
Torque (Nm)

Figure D-14  Experiment motor torque Tw versus current curve for NXT motor to calculate Ki.

This program will serve as the basis for measuring the open-loop step response of the motor.
In this model, the “Transport Delay” block, delays the step input by a specified time. The step
input must be delayed because Simulink cannot sample encoder data from time t = 0 s,
but rather starts sampling between 0 to 1 s. To overcome this problem, the step input is
delayed by 1 s. Make sure to set the “Time Delay” parameter to 1 in the Transport Delay
block parameters as illustrated in Fig. D-16. Keep in mind that doing this will require you to
take all measurements starting from time t = 1 second rather than time t = 0 s. Additionally,
the “Motor” block is used to apply a voltage to the motor, whereas the “Encoder” block is
used to sample positional encoder data from the motor encoder. Also, set the “Save format”
in the “To Workspace” block to “Structure With Time” as illustrated in Fig. D-17. By doing
this, all sampled encoder data will be accompanied with a timestamp. Finally, the step input
to the motor can be edited by changing the “Final Value” parameter in the step input block
as shown in Fig. D-18. In this example, the motor is powered to 50 percent.
Before executing the model, ensure there is no external load connected to the NXT
motor. Also, prepare the multimeter to measure voltage as described in the head “Armature
Resistance” measurement in Sec. D-1-3. Change the simulation time to the desired runtime
and run the model.

LEGO

Port A
Step Transport
Delay Motor

LEGO
Output
Port A
To Workspace
Encoder Figure D-15  Open-loop step input.

04_Golnaraghi_App_D_D-1-D-64.indd 13 07/02/17 5:27 PM


D-14   Appendix D.  Control Lab

Figure D-16  Transport delay block parameters.

While the motor is running you will be required to measure the supplied armature
voltage for various step inputs. After execution is completed, positional encoder data will be
stored into the “output” variable. To differentiate the positional data and plot the open-loop
speed response, execute the following code in MATLAB:

pos = double(output.signals.values);%convert position data from int to


double
vel = diff(pos)./diff(output.time); %differentiate position
size_vel = size(vel);
for i = 1:size_vel(1)
vel_shifted(i+1) = vel(i); %shift velocity matrix
vel_shifted(1) = 0; %initial velocity = 0
end

vel_shifted = vel_shifted*pi/180.0; %convert deg to rad


plot(output.time, vel_shifted);

04_Golnaraghi_App_D_D-1-D-64.indd 14 07/02/17 5:27 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-15

Figure D-17  To workspace block parameters.

A sample open-loop step response for a 2.0-V step input is shown in Fig. D-19. You
will observe that there is noise visible in the output. The noise is a result of differentiation of
the low resolution position signal from the encoder to find speed, and it may also be attrib-
uted to the gear backlash. As a result, you need to record the average steady-state speed for
various step inputs and record the steady-state speed and armature voltage for each trial.
Finally, plot the experimental armature voltage against the measured steady-state average
speeds. A sample plot is shown in Fig. D-20 where the experimental data points are shown
as well as an extrapolated trend line found using the linear regression tool in MATLAB. The
slope of this line is the back-emf constant of the motor. The back-emf constant of the NXT
motor was experimentally measured to be Kb = 0.249 V/ rad/s.
It should be noted that, in an ideal case, the back-emf constant and motor torque constant
are numerically equal in the SI units. However, because these values have been experimentally

04_Golnaraghi_App_D_D-1-D-64.indd 15 07/02/17 5:28 PM


D-16   Appendix D.  Control Lab

Figure D-18  Step input block parameters.

measured, their corresponding experimentally measured values are close, but not equal. To
equate the two constants, we can find the average value that exists between them so that
both Kb and Ki are numerically equal. The average value between Kb = 0.249 V/rad/s and
Ki = 0.252 N·m/A is 0.25; therefore this average value will be used for both Kb and Ki.
Viscous-Friction Coefficient
The viscous-friction coefficient describes the amount of friction that exists in the system. In
reality, the friction may not be viscous. However, as discussed in Chaps. 2 and 6, this is an
assumption that we make to arrive at an approximate linear model for the
Note: All parameters obtained motor-gear-train combination—again any reference to motor implicitly refers
will be for the motor-gear-train to the motor-gear-train combination. Important note: Because of various non-
combination. linear affects such as friction and gear backlash, it is not expected that this
parameter can be estimated accurately.
Using small inductance assumption, i.e. La ≈ 0, we can arrive at the effective damping
due the electrical and mechanical components. From Sec. 6-3-6, the speed response of the
motor in Fig. D-13 (assuming negligible spool inertia) is

dω (t )  KK  e (t )K i
Jm +  Bm + i b  ω (t ) = a − Tw (D-6)
dt  Ra  Ra

04_Golnaraghi_App_D_D-1-D-64.indd 16 07/02/17 5:28 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-17

7
Average steady-state speed = 7.636 rad/sec

5
Speed (rad/sec)
63.2% of steady-state speed = 4.826 rad/sec
4

0
0 1 2 3 4 5 6 7 8 9 10
Time (sec)

Figure D-19  Open-loop speed response for 2.0 V input (50 percent power).

4
Voltage (V)

2
Slope = 0.249 V/rad/sec

0
0 2 4 6 8 10 12 14 16 18 20
Steady-State Speed (rad/sec)

Figure D-20  Voltage versus steady-state speed.

04_Golnaraghi_App_D_D-1-D-64.indd 17 07/02/17 5:28 PM


D-18   Appendix D.  Control Lab

where Bm is the viscous-friction coefficient, Ra is the motor armature resistance, Ki is the


motor torque constant and Kb is the back-emf constant. Using the no load case (TW = 0),
the steady-state angular speed of the motor shaft for a 2.0-V step input is in agreement with
Example 7-4-1, Eq. (7-15). Hence,

2Ki
ω fv = limω (t ) =
t →∞ K i K b + Ra Bm (D-7)
As a result, we can calculate Bm experimentally, at steady state, using

 2K  1 
Bm =  i − K i K b   
 ω fv   Ra  (D-8)
 2(0.25)  1 
= − (0.25)2   =1.31 × 10−3 N ⋅ m/s
 7.636   2.27 

To measure the viscous-friction coefficient, apply a step input—in this case 2 volts—to
the motor, using the procedure outlined earlier in back-emf constant measurement section,
and observe the open-loop speed response, as shown in Fig. D-19. Record the steady-state
speed—in this case 7.636 rad/s—and substitute the values in Eq. (D-8), as shown.
Alternatively, using the mechanical equation of the motor, and replacing the motor
torque with armature current using Eq. (D-3), we have

dω (t )
Jm + Bmω (t ) = K iia − TW (D-9)
dt

Hence, the viscous-friction coefficient at steady-state angular speed can also be meas-
ured using
Ki T
Bm = ia − W (D-10)
ω fv ω fv

Using the no load case (TW = 0), from Table D-5 the no load armature current ia = 0.041
A, and we can calculate Bm experimentally to be
Ki (0.41)(.25)
Bm = ia = = 0.001342 N ⋅ m/s (D-11)
ω fv 7.636

The no load value of current is what the motor needs to overcome internal friction.
You can also obtain the viscous-friction coefficient for different load torque values
using Eq. (D-11) and Table D-5, provided that you have the corresponding steady-state
angular speed for each TW. Constructing the motor speed-torque curve, as in Fig. D-21,
will help you with this task. You can experimentally obtain this curve using the same proce-
dure as in Ki calculation that was discussed earlier in this section. In Fig. D-21, the relation
between angular speed and torque is

ω fv = −63.63Tm + ω fv (noload )
= −63.63K iia + 7.636 (D-12)

From Table D-5 and Eqs. (D-10) and (D-12), the average value of viscous-friction
coefficient Bm = 1.36 × 10-3 N ⋅ m/s.

04_Golnaraghi_App_D_D-1-D-64.indd 18 07/02/17 5:28 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-19

8
No Load Speed
7

Motor Angular Speed (Rad/s)


6

3 Slope = 63.63 Rad/s/Nm


Stall Torque
2

0
0 0.02 0.04 0.06 0.08 0.1 0.12
Moto Torque (Nm)

Figure D-21  Motor speed-torque curve.

Caution: the value of Bm varies with the power provided to the motor. In our case we
have calculated the viscous damping coefficient at power equal to 50 percent. Upon appli-
cation of different percentage of power to the motor, we can find a relationship between
viscous-friction coefficient and percentage of motor power. As shown in Fig. D-22 the
viscous-friction coefficient value decreases as the motor power increases. In this project,
therefore, the lower value of viscous-friction coefficient of the NXT motor with no load was
adopted—i.e., Bm = 1.31 × 10-3 N ⋅ m/s.
The experiment was repeated with the arm attached to the motor and the equivalent
motor-payload viscous-friction coefficient was experimentally measured using Eqs. (D-8)
and (D-11) to be B = Bm + Barm/payload = 2.7 × 10−3 N ⋅ m/s. The higher value of B in this
case amounts to the higher initial torque required to overcome the higher internal fric-
tion associated with moving the arm/payload system. Please note that this measurement
required the robot arm to rotate with the payload attached for about 10 s. In most practical

0.007

0.006
Viscous Damping Bm (N/s)

0.005

0.004

0.003

0.002

0.001

0
0 0.2 0.4 0.6 0.8 1
Power provided to the motor (1 = 100%)

Figure D-22  Measured damping coefficient as the power supplied to the motor varies from 10 to
100 percent.

04_Golnaraghi_App_D_D-1-D-64.indd 19 07/02/17 5:28 PM


D-20   Appendix D.  Control Lab

applications, this approach, while simple, may not be feasible. The alternative approach may
be to use the position control response to obtain or fine tune the value of B.
In the end, it is recommended that the no load motor is operated at 40 percent or higher
motor powers. For the setup with the robot arm and payload, a minimum of 60 percent
motor power is recommended.
Mechanical Time Constant
As discussed earlier in this appendix, the mechanical time constant tm is defined as the
time required for the motor speed to reach 63 percent (more accurately 63.2 percent)
of its final value for a step input. To measure the time constant, you will be required to
use the open-loop speed response experiment described earlier in back-emf calculations.
First, ensure there is no external load connected to the motor. Next, apply a step input to
the motor using the model shown in Fig. D-19 and plot the resulting response. Find the
average steady-state speed and calculate 63.2 percent of the steady-state speed as shown
in Fig. D-19.
In this trial, the average steady-state speed is measured to be 7.636 rad/s while
63.2 percent of the steady-state speed (to measure the time constant) is calculated to be
4.826 rad/s. The mechanical time constant for the NXT motor with no load was experi-
mentally measured to be τm = 0.081 s. The experiment was repeated with the robotic arm
and the time constant was experimentally measured to be τm = 0.10 s—obviously the slower
response is due to a higher inertia added through the payload.
Moment of Inertia
The combination armature-load moment of inertia Jm can be experimentally calculated
using

 KK 
J m = τ m  Bm + i b  (D-13)
 Ra 

where this equation relates the overall motor-gear-train moment of inertia to the other
parameters found in the previous sections. Applying Eq. (D-13) and substituting the
parameters found in previous sections, the moment of inertia of the motor-gear-train is
experimentally calculated to be Jm = Jmotor + Jgear = 2.33 × 10−3 kg·m2.
As a final check, for the no load motor with speed response shown in Fig. D-19, after
reaching the final speed value, turn off the input and record how the speed decays with time
to reach zero, as shown in Fig. D-23. The system equation with power off is

dω (t )
Jm + Bmω (t ) = Tm (D-14)
dt

where, the time constant of the system in this case is τ = J m Bm. Based on our estimated
values of Jm and Bm the system time constant is τ =1.78 s, which is very close to the measure
value of τ =1.68 s, shown in Fig. D-23.
As a result, we have a very high confidence on the accuracy of our estimated param-
eters of the system.
Similarly, the moment of inertia of the motor with the arm attached and the payload is
experimentally calculated to be Jtotal = Jm + Jgear + Jarm/payload = 3.02 × 10−3 kg·m2. Note the total
inertia was obtained using Eq. (D-13) with τm = 0.10 and B = Bm + Barm/payload = 2.7 × 10−3.
Alternatively, you can calculate the arm/payload inertia by first identifying the com-
bined mass center using techniques such as parallel axis theorem that you have learned in
your second year dynamics course (or through using a CAD software). Then, by measuring

04_Golnaraghi_App_D_D-1-D-64.indd 20 07/02/17 5:28 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-21

10
Average Max Speed
8

Angular Speed (rad/sec)


6

4
Time constant 37% of
2 Average Max = 1.68 seconds

–2
0 5 10 15 20
Time (seconds)

Figure D-23  Time constant measurement with the motor input off after reaching steady-state response.

2
the mass of the arm/payload, you can estimate J arm/payload = M arm/payload rcm . This approach
assumes the arm/payload system as a point mass M at a distance rcm away from the axis of
rotation. You may, however, find this a bit time consuming. It all depends on how much
time you plan to spend on finding an approximate model. In practice, good enough is good
enough!

D-1-5  Speed Response and Model Verification


Now that the motor parameters have been measured, the mathematical model of the speed
response system can be developed and fine-tuned by comparing the simulated response
to the response of the actual motor. The speed response Simulink model used to simulate
the motor is shown in Fig. D-24. Using the parameter values in Table D-6 and a step input
of amplitude 2.0 V starting at time equal to 1 s, the speed response, shown in Fig. D-25,
closely matches that of the actual system that was earlier shown in Fig. D-19. Note the
disturbance block is set to zero input in this case. Be sure to enter the system param-
eters in the MATLAB Command Window before running your Simulink simulation. Your
parameter names (i.e., L, R, J, b, Ki, and Kb) must be exactly the same as those used in the

Input
To Workspace1
1 1
+– Ki +– Output
L.s+R J.s+b
Step Electrical Motor Gain Mechanical To Workspace

Step Disturbance
(N.m) Scope
Kb

Motor Feedback

Figure D-24  Speed response Simulink model for a dc motor simulation.

04_Golnaraghi_App_D_D-1-D-64.indd 21 07/02/17 5:28 PM


D-22   Appendix D.  Control Lab

TABLE D-6  NXT No-Load Motor Experimental Parameters


Armature resistance Ra = 2.27 Ω
Armature inductance La = 0.0047 H
Motor torque constant Ki = 0.25 N · m/A
Back-emf constant Kb = 0.25 V/rad/s
Viscous-friction coefficient Bm = 0.00131 N · m/s
Mechanical time constant τm = 0.081 s
Combined armature motor and gear-train moment of inertia Jm = 0.00233 kg·m2

7
Steady-state speed = 7.639 rad/sec

6
Angular Speed (rad/s)

4 Time Constant = 0.081 sec


63.2% of steady-state speed = 4.827 rad/sec
3

0
0 1 2 3 4 5
Time (seconds)

Figure D-25  Speed response of modeled system for 2.0 V input.

Simulink model. After running your Simulink simulation, use the following MATLAB
commands to plot the response:
plot(output.time,output.signals.values)
hold on;
plot(input.time,output.signals.values)

In order to further verify the model with the arm attached, it is recommended that you
look at the position control response, discussed next.

D-1-6  Using Position Response to Verify and Fine-Tune System Parameters


Now that the motor parameters have been measured, they can be fine-tuned by comparing
the simulated position response to the position response of the actual motor. The position
control Simulink model used to simulate the motor is shown in Fig. D-26. In this model,
you could also include the input voltage and the current saturation blocks, as shown earlier
in Fig. D-5. If you elect to do so, the input voltage saturation block ensures the voltage to

04_Golnaraghi_App_D_D-1-D-64.indd 22 07/02/17 5:28 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-23

Input
To Workspace1

1 1 1 Output
–K– +– KP +– Ki ++ s –K– Output
L.s+R J.s+B
Step Deg to Rad Gain Electrical Motor Gain Mechanical Integrator Rad to Deg To Workspace
Input

Step Disturbance
(N.m) Scope
Kb

Motor Feedback

DC Motor Position Control Simulink Block Diagram


Double-click on the DC motor block to modify
the motor parameters

Figure D-26  Closed-loop position control Simulink model for a dc motor simulation.

stay within the voltage range (~±4.5 V) of the motor measured in Sec. D-1-3. The current
saturation block role will be to limit the current to stay within the current range of the
motor (~±1 A). See the next section for the corresponding screenshots and block descrip-
tions. All other motor parameters, in the model in Fig. D-26, have been derived in the pre-
vious sections, and are shown in Table D-5. Comparing this model to the standard position
control block diagram of a dc motor, shown in Fig. 7-19, you can see the Simulink model
is very similar. Note, in this case, the sensor gain of Ks = 1, has been used—this implies the
sensor has been calibrated so that 1 rad at the output is 1 V.
In the case of position control, the Gain block “KP” controller values correspond to
proportional controller KP. To select the controller gain, simply double-click the Gain block
“KP” and enter the designated values, or as done here, assign a parameter “KP” to the block
and enter its value in the MATLAB Command Window before running your simulation.
The position control Simulink model used for the actual NXT motor is shown in
Fig. D-27. In this model, the NXT motor takes inputs from −100 to 100 percent, which cor-
respond to the percent of maximum voltage. The “Volt to Volt%” block converts voltage to
voltage% by multiplying the input voltage by a factor of 100%/4.5 V. The “Saturation” block
ensures that the maximum 100 percent power input to the motor is not exceeded. Again, to
be consistent, in your simulation model in Fig. D-26, you could include the input voltage

LEGO
+– –K– –K– PID
Step Input Transport Deg to Rad Volt to PID Saturation Port A
Delay Volt% Controller Motor
Encoder
LEGO

Port A

Output

To Workspace

Figure D-27  Closed-loop position control Simulink model for NXT motor.

04_Golnaraghi_App_D_D-1-D-64.indd 23 07/02/17 5:28 PM


D-24   Appendix D.  Control Lab

200
KP = 2.5
KP = 5

150

Position (deg)
KP = 1.5
100

50

0
0 0.5 1 1.5 2 2.5 3
Time (seconds)

Figure D-28  Simulated no-load closed-loop position response results for multiple KP gains.

and the current saturation blocks, as shown earlier in Fig. D-5. However, our observation
was that without them, the motor current and applied voltage values remains within these
thresholds.
See the next section for the corresponding screenshots and block descriptions. In both
Figs. D-26 and D-27, the parameters of the PID controller can be customized to tune the
position response.
No-Load Position Response
Using the model shown in Fig. D-26, the closed-loop position response of the motor with
no load is simulated for a step input of 160° or 5.585 rads. The results are shown below in
Fig. D-28 for multiple KP gains in the PID block.
Next, the closed-loop position response of the NXT motor is found using the Simulink
model shown in Fig. D-27. The results are shown in Fig. D-29 for multiple KP gains in the
PID block.
Both the model response and actual motor response performance specifications are
measured and tabulated in Table D-7. By analyzing the results in Table D-7, the system
model matches the behavior of the actual motor, and no further fine tuning is necessary.

200
KP = 2.5
KP = 5

150
Position (deg)

KP = 1.5
100

50

0
0 0.5 1 1.5 2 2.5 3
Time (seconds)

Figure D-29  NXT motor no-load closed-loop position response results for multiple KP gains.

04_Golnaraghi_App_D_D-1-D-64.indd 24 07/02/17 5:28 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-25

TABLE D-7  No-Load Closed-Loop Position Response Performance Specifications Comparison


Percent Settling Time Rise
KP Overshoot (5%) (s) Time (s)
Simulated position response Gain = 1.5 0.8 0.37 0.25
Gain = 2.5 12.5 0.50 0.10
Gain = 5 18.9 0.48 0.09

NXT motor position response Gain = 1.5 0 0.37 0.28


Gain = 2.5 12.5 0.51 0.21
Gain = 5 18 0.61 0.17

Robotic Arm Position Response


Next, the closed-loop position response of the NXT motor with the robotic arm and payload
is found using the Simulink model shown in Fig. D-27. The results are shown in Fig. D-30
for multiple KP gains. Note that, because of the backlash in the gearbox, the final value is
not always 160°.
The measured parameter values when the robotic arm is attached to the motor are
shown in Table D-8. Notice that the total inertia and viscous damping coefficient are higher
than the no load case in Table D-5. Using the model shown in Fig. D-26, the closed-loop
position response of the motor with the robotic arm and payload is simulated for KP = 3.
Note that the voltage is saturated to half its maximum value (~±2.25 V) to slow down the
robotic arm in all the following tests. The simulation result is compared to the correspond-
ing experimental response, as shown in Fig. D-31.
Comparing the two responses in Fig. D-31, it is clear that the arm/payload model
requires some fine tuning. In order to improve model accuracy, the system overshoot, rise
time and settling time must all decrease. To achieve this task, let us examine the mathemati-
cal model of the system. Note that the parameter identification discussed in this section
assumes a second-order model for the position response because the motor electric-time

200
KP = 3
KP = 5
150
Position (deg)

KP = 2
100

50

0
0 0.5 1 1.5 2 2.5 3
Time (seconds)

Figure D-30  Robotic arm with payload closed-loop position response results for multiple KP gains.

04_Golnaraghi_App_D_D-1-D-64.indd 25 07/02/17 5:28 PM


D-26   Appendix D.  Control Lab

TABLE D-8  Robotic Arm and Payload Experimental Parameters


Armature resistance Ra = 2.27 Ω
Armature inductance La = 0.0047 H
Motor torque constant Ki = 0.25 N · m/A
Back-EMF constant Kb = 0.25 V/rad/s
Equivalent viscous-friction coefficient B = 0.0027 N · m/s
Mechanical time constant τm = 0.1 s
Total moment of inertia Jtotal = 0.00302 kg·m2

200

Experiment
150
Position (deg)

Simulation
100

50

0
0 0.5 1 1.5 2 2.5 3
Time (seconds)

Figure D-31  Comparison of simulated and experimental robotic arm with payload closed-loop
position response for KP = 3.

constant τ e = La /Ra = 0.002 s is very small. Hence, similar to Example 7-5-1, the simplified
closed-loop transfer function is
K P Ki K s
Θarm/payload (s ) Ra J total ω n2
= = 2 (D-15)
K P K i K s (s + 2ζω n s + ω n )
2
Θin (s ) 2  Ra B + K i K b 
s + s+
 Ra J total  Ra J total

where Ks is the sensor gain, calibrated to Ks = 1. Since Eq. (D-15) is a second-order system,
we have
R B + Ki Kb
2ζω n = a
Ra J total (D-16)
K P Ki
ωn = (D-17)
Ra J total

Combining Eqs. (D-16) and (D-17), we get

Ra B + K i K b
ζ= (D-18)
2 K P K i Ra J total

04_Golnaraghi_App_D_D-1-D-64.indd 26 07/02/17 5:28 PM


D-1  Project 1: Introduction to LEGO MINDSTORMS NXT Motor—Characterization and Control    D-27

The system poles are


2
Ra B + K i K b  R B + Ki Kb  K K
s1,2 = − ±  a  − P i (D-19)
2 Ra J total  2 Ra J total  Ra J total

Considering Eqs. (D-17) through (D-19), and using the parameter values in Table D-8 and
KP = 3, we have

ω n =10.45 rad/s (D-20)


ζ = 0.478 (D-21)
s1,2 = −5 ± j 9.18 (D-22)

Further, upon examining Fig. 7-18, which describes the effects of moving a second-
order system poles (in the s-plane) on its time response performance, moving the two poles
in Eq. (D-23) horizontally to the left should increase z while reducing system overshoot,
rise time and settling time. To do so the first term in Eq. (D-23) should increase while the
second term should be held a constant. Having these two conditions met simultaneously
may be a tedious task. So without bothering with rigorous mathematical expressions, we
resort to trial and error and reduce the value of Jtotal while checking the overall response.
Alternatively, you can vary B or both Jtotal and B, simultaneously. Variation of Jtotal seems to
be the best choice for fine tuning, as our confidence levels for Jtotal was not high, see discus-
sions in Sec. D-1-4.
The best response for KP = 3 may be achieved for Jtotal = 0.00273 kg·m2, as shown in
Fig. D-32. For this parameter choice from Eqs. (D-17) to (D-19), we have

ω n =11.0 rad/s (D-23)

ζ = 0.503 (D-24)
s1,2 = −5.54 ± j 9.03
(D-25)
where the poles in Eq. (D-25), in comparison to Eq. (D-22) have moved to the left while
both z and wn have increased. From Eq. (7-42), the PO is expected to decrease. Also from

200 KP = 3
180 KP = 5
160
140
Position (deg)

120 KP = 2
100
80
60
40
20
0
0 0.5 1 1.5 2 2.5 3
Time (seconds)

Figure D-32  Simulated robotic arm with payload closed-loop position response results for multiple
KP gains.

04_Golnaraghi_App_D_D-1-D-64.indd 27 07/02/17 5:28 PM


D-28   Appendix D.  Control Lab

Eqs. (7-46) and (7-50), the rise time and settling times are also expected to decrease. For the
second-order model using performance specification formulas, we get

1−ζ 2
percent maximum overshoot =100e − πζ / =16 (D-26)
π
t max = = 0.33 s (D-27)
ωn 1−ζ 2

1 − 0.4167ζ + 2.917ζ 2
tr = = 0.14 s (D-28)
ωn
3.2
5 percent settling time: t s ≅ = 0.58 s (D-29)
ζω n

The performance specifications of the system, shown in Table D-9, for KP = 3 are
in line with these expectations. The minor discrepancies between the calculated values,
Eqs. (D-27) and (D-28), and the simulation measurements (using the “Data Cursor” in
MATLAB figure) in Table D-9 are obviously attributed to the differences between the
second- and third-order models—the Simulink simulation results do not omit the electric
time constant. Note also since our system is nonlinear in reality, we should not expect the
simulation response to closely match that of the experiment for other controller gain values.
From Table D-9, we see this is in fact the case.
Do not forget that the PO for the experimental system is measured from the response
final value, using Eq. (7-41). For example for KP = 2, the NXT motor (with arm and payload)
response final and peak values are at 164° and 167°, respectively. So

 167 − 164 
PO =100  =1.8 (D-30)
 164 

At this point you may wish to further fine tune system parameters, or decide that the
model is good enough. For all practical purposes, the parameter values shown in Table D-10
appear reasonable, and we should stop the fine tuning process.
In the end, now that we have a good enough model of the system, we can design dif-
ferent type of controllers for this system. In Chap. 8, we will provide labs that allow you to

TABLE D-9  Robotic Arm Closed-Loop Position Response Performance Specification Comparison
Percent
KP Overshoot Settling Time (5%) (s) Rise Time (s)
Simulated position response Gain = 2 8 0.61 0.22
Gain = 3 13 0.55 0.19
Gain = 5 19.4 0.68 0.18

Robotic arm position Gain = 2 1.8 0.33 0.23


response
Gain = 3 12.5 0.53 0.18
Gain = 5 17.1 0.48 0.18

04_Golnaraghi_App_D_D-1-D-64.indd 28 07/02/17 5:28 PM


D-2  Project 2: Elevator Position Control    D-29

TABLE D-10  Fine-Tuned Robotic Arm and Payload Experimental Parameters


Armature resistance Ra = 2.27 Ω
Armature inductance La = 0.0047 H
Motor torque constant Ki = 0.25 N·m/A
Back-emf constant Kb = 0.25 V/rad/s
Equivalent viscous-friction coefficient B = 0.0027 N·m/s
Mechanical time constant τm = 0.09 s
Total moment of inertia Jtotal = 0.00273 kg·m2

further compare the real-life motor characteristics with simulation using MATLAB and
Simulink software. We also revisit the NXT motor in Chap. 11, where we study more com-
plex controller design techniques.

D-2  PROJECT 2: ELEVATOR POSITION CONTROL


Consider the elevator system in Fig. D-33 composed of the same dc motor that was used
in the previous section. The dc motor is fixed on the top of the elevator frame. A spool is
attached to the end of the motor. A thread or fishing line is wrapped around the spool to
pull the elevator car. Two touch sensors, which are on the side of the elevator frame, are
used to control the elevator car movement. By pushing the upper sensor the elevator will

NXT Motor

Spool NXT Cable

Elevator Frame

Thread
Simulink Control Model

Elevator Car
NXT Brick

Up Touch
Sensor

Down Touch
USB Interface Cable Sensor

Host Computer

Figure D-33  NXT motor elevator system.

04_Golnaraghi_App_D_D-1-D-64.indd 29 07/02/17 5:28 PM


D-30   Appendix D.  Control Lab

(a) (b)

(c) (d)

Figure D-34  (a) The top view of the elevator model. (b) The elevator car. (c) The front view of the
elevator model. (d) The side view of the elevator model.

move up by one floor, and to move down, the lower sensor is used. There are seven floors in
the elevator model—floor 0 to 6, each 5 cm high. The elevator car should stop when the yel-
low measuring pole reaches the yellow labels, as shown in Fig. D-34b. A laptop computer is
used to program the system using Simulink. The programs can be uploaded on to the NXT
brick via USB interface—see NXT brick description in the previous section. Figure D-34
provides different views of the system.
A complete set of instructions for this section can be found at www.mhprofessional
.com/golnaraghi.7
Objective. The elevator must move up 5 cm once the upper touch sensor is pushed, and
down by 5 cm once the lower touch sensor is pushed.

7
For an instructional video, also visit http://www.youtube.com/watch?v=7A4CskIYTZg.

04_Golnaraghi_App_D_D-1-D-64.indd 30 07/02/17 5:28 PM


D-2  Project 2: Elevator Position Control    D-31

Design criteria. The initial elevator car position is zero—the ground floor. The elevator
car is then to move to various floors and come back. The elevator car may not overshoot the
desired position by more than 5 percent. The steady-state error should be less than 1 mm.
The 5 percent settling time should be less than 1 s.

D-2-1  The Elevator Model


From Chap. 6, the system model may be arranged in input-output form such that ea(t) is the
input voltage and q (t) is the output

La dT (t ) K K K dθ (t )
+ T (t ) = i ea (t ) − i b
Ra dt Ra Ra dt (D-31)

d 2θ (t ) 1 1 B dθ (t )
= T (t ) − TL (t ) −
dt 2 J total J total J total dt (D-32)

where, B = Bm + Bload is the equivalent motor-payload viscous-friction coefficient, and the


total inertia is

2
J total = Mrspool + J m (D-33)

In the elevator model in Eq. (D-32), gravity applies a constant disturbance torque TL,
which can be calculated using

TL = Wrspool = (0.124)(9.81)(0.01375) = 0.017 Nm (D-34)

where, spool radius rspool is 1.375 cm, gravitational acceleration is 9.81 m/s2 and the mass of
the elevator car is 124 g. Note that this model is identical to the far simpler system earlier
shown in Fig. D-33.
Practical Observation
Obviously the elevator system in Fig. D-34 has a greater level of complexity, which our
idealized mathematical model in Eqs. (D-31) and (D-32) do not consider. For example
since the elevator car and the frame are in contact, friction is a parameter that is expected
to play a significant role in the elevator system behavior in comparison to the motor-mass
system in Fig. D-13. But we need to start from somewhere, and keeping our model as sim-
ple as possible is a good starting point.
Using Eq. (D-33) the total inertia of the system can be calculated as

J total = (0.124)(0.01375)2 + 0.00233 = 0.0024 Nm (D-35)

D-2-2  Mechanical and Electrical Characteristics


Estimation of the viscous-friction coefficient in this system may be tedious and time
consuming due to the complexity of the system. As a result, we elected to use a simple
approach to approximate B using the motor-mass system in Fig. D-13. In order to find this
parameter, we use the equation in Fig. D-14 to find the motor current ia that corresponds
to the load torque of 0.017 N·m—that is ia = 3.832 * 0.017 + 0.046174 = 0.1113 A. Then we
use Eq. (D-12) to find the corresponding motor steady-state speed, or wfv = 5.8655 rad/s.

04_Golnaraghi_App_D_D-1-D-64.indd 31 07/02/17 5:28 PM


D-32   Appendix D.  Control Lab

TABLE D-11  The Elevator and NXT Motor System Estimated Parameters
Armature resistance Ra = 2.27 Ω
Armature inductance La = 0.0047 H
Motor torque constant Ki = 0.25 N · m/A
Back-emf constant Kb = 0.25 V/rad/s
Equivalent viscous-friction coefficient B = 0.002 N · m/s
Mechanical time constant τm = 0.08 s
Combined motor and gear-train moment of inertia Jtotal = 0.0024 kg·m2
Torque from gravity of elevator car TW = −0.017 N · m

Finally, using Eq. (D-10), we find B = 0.0018 N·m/s. Obviously the damping in the elevator
system is going to be higher (or much higher!) than the system in Fig. D-13. To account for
this, we arbitrarily increased our estimated value to B = 0.002 N·m/s.
We now use the position response of the system to fine tune this parameter. Table D-11
summarizes the values we will be using in our simulations.

D-2-3  Position Control


In order to fine tune the system parameters (particularly the damping coefficient B), we first
investigate the position control response of the system without utilizing the touch sensors.
The Simulink block diagram for controlling the elevator car position is shown in
Fig. D-35. A PID block controller was constructed as shown in Fig. D-36. To see the con-
tent in Fig. D-36, you can right click on the PID block and select the Look Under Mask
option. Alternatively, you can construct a controller similar to that in Fig. D-26. To select
the desired PID controller gain simply double-click the PID box and enter the designated
values, as shown in Fig. D-36. In the following tests, both the integral and derivative
values of the PID controller will be zero, while the proportional gain is varied. Later on,
in Chap. 11, we discuss the full PID controller design in more detail. Note from the figure
that we have not utilized the second PID port, and to avoid a warning message, we have
connected it to a scope.
In Fig. D-35 we are using two step input blocks. The first input provides a 5-cm input
for 2 s and the second one gives a negative 5-cm input (see the input comparator) after 2 s
for 2-s duration, see Fig. D-37. The conversion block after the inputs, uses the spool radius
of 1.375 cm to convert the input from centimeters to radians. The output conversion block
converts the results back to centimeters, see Fig. D-38. Hence, the input and output will
have the same units in centimeters (refer to Example 7-5-1 for more discussions). The dis-
turbance block provides a constant TL = −0.017 N·m torque corresponding to gravity.
In this model, based on our experimental observations we have also included the input
voltage and the current saturation blocks since, in this case, the NXT motor applied voltage
and current reach the saturation thresholds. As in the experimental system, the input volt-
age saturation block ensures the voltage to stay within the voltage range (~±4.5 V) of the
motor measured in Sec. D-1-3. The current saturation block role will be to limit the current
to stay within the current range of the motor (~±1 A). Figure D-39 provides a screenshot
of these two blocks.
Using the Simulink model in Fig. D-35, the response of the system was obtained for
three proportional gain values of KP = 2, 3, and 5. All other system parameters are known

04_Golnaraghi_App_D_D-1-D-64.indd 32 07/02/17 5:28 PM


04_Golnaraghi_App_D_D-1-D-64.indd 33
Input

To Workspace1

1 1 1
+ –K– + PID + Ki + –K– Output
– – – L.s+R + J.s+b s

Step Up Hight to Rad PID Controller Input Current Motor Gain Integrator Rad to Height To Workspace
Electrical Mechanical
Voltage Saturation
Saturation

Step
Disturbance DC Motor Position Control
(N.m) Simulink Block Diagram
Step Down
Double-click on the
Kb DC motor block to modify
the motor parameters.
Motor feedback

Scope1

Figure D-35  Closed-loop position control Simulink model for the elevator system.

D-33

07/02/17 5:28 PM
D-34   Appendix D.  Control Lab

P
Proportional
I +
1 s + 1
+
In_1 Out_1
Integral Sum

D du/dt
D Derivative

P
Kp out
I 2
Ki out Parameters
D
(a) Kd out (b)

Figure D-36  (a) The PID controller diagram obtained from “Look Under Mask” in the PID block in
Fig. D-35. (b) Parameter values of the PID block in Fig. D-35.

Figure D-37  Step up and step down block parameters.

Figure D-38  Height to radian and radian to height block parameters.

04_Golnaraghi_App_D_D-1-D-64.indd 34 07/02/17 5:28 PM


D-2  Project 2: Elevator Position Control    D-35

Figure D-39  Saturation block parameters.

from Table D-11. Be sure to enter the system parameters in the MATLAB Command
Window before running your Simulink simulation. The entered parameters must have
exact names as those used in the Simulink model (i.e., L, R, J, b, Ki, Kb, and KP).
Run the total simulation for 4 s, and plot the results by using the following commands
in the MATLAB Command Window:

plot(output.time,output.signals.values)
hold on
plot(output.time,input.signals.values)

We can now check the validity of these results by comparing the simulated position
response to the position response of the actual motor. The system time response is shown in
Fig. D-40, and the time response performance specifications are documented in Table D-12.
The performance values shown were measured using the “Data Cursor” under the “Tool”
menu in the MATLAB figure environment.
The position control Simulink model used for the actual NXT motor is shown in
Fig. D-41. In this model, the NXT motor takes inputs from −100 to 100 percent, which

6
KP = 5
5
KP = 3
4
KP = 2
Height (cm)

–1
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (seconds)

Figure D-40  Simulated elevator model closed-loop position response results for multiple KP gains.

04_Golnaraghi_App_D_D-1-D-64.indd 35 07/02/17 5:28 PM


D-36   Appendix D.  Control Lab

TABLE D-12  Simulated Elevator Closed-Loop Position Response Performance Specifications for Different KP Values
Elevator Car Position Percent Settling Time Steady-State
Response Overshoot (5%) (s) Rise Time (s) Error (cm)
Move upward KP = 2  5.9 0.37 0.25 0.1
KP = 3  9.5 0.52 0.23 0.07
KP = 5 13.8 0.51 0.22 0.04

LEGO
+– +– –K– –K– PID(s)
Step Up Height to Volt to PID Saturation Port A
Rad Volt% Controller Motor

LEGO
–K–
Step Port A
Deg to Height
Down

Output

To Workspace

Figure D-41  One-step closed-loop position control Simulink model for NXT motor.

correspond to the percent of maximum input voltage. The “Volt to Volt%” block converts
voltage to voltage% by multiplying the input voltage by a factor of 100%/4.5 V, as shown in
Fig. D-42. The “Saturation” block ensures that the maximum 100 percent power input to
the motor is not exceeded.
In Fig. D-41, we apply a step input of 5 cm starting at 2 s and a second step input
of −5 cm starting at 4 s (both inputs have 2 s duration), to arrive at the system time
response. The response of the system was obtained for three proportional gain values of

Figure D-42  Voltage to voltage percentage block parameters.

04_Golnaraghi_App_D_D-1-D-64.indd 36 07/02/17 5:28 PM


D-2  Project 2: Elevator Position Control    D-37

6
KP = 5
5 KP = 3

4 KP = 2

Height (cm)
3

–1
1 2 3 4 5 6
Time (seconds)

Figure D-43  NXT motor closed-loop position response for different KP.

TABLE D-13  NXT Motor Closed-Loop Position Response Data for Different KP
Elevator Car Position Percent Settling Time Steady-State
Response Overshoot (5%) (s) Rise Time (s) Error (cm)
Move upward KP = 2 0 0.39 0.24 0.15
KP = 3 5.8 0.31 0.22 −0.015
KP = 5 11.7 0.47 0.21 0.08

KP = 2, 3, and 5. The system time response is shown in Fig. D-43, and the time response
performance specifications are documented in Table D-13. The performance values
shown were measured using the “Data Cursor” under the “Tool” menu in the MATLAB
figure environment.
Comparing the values in Tables D-12 and D-13, it is interesting to see that our simu-
lation model parameters are not too far off, and our model does a relatively good job in
predicting the response of the actual system. We will therefore stop the fine tuning process
at this stage. To further increase your model accuracy, you may wish to increase the value
of B to reduce the overshoot values of the simulation system.

D-2-4  PI Controller Design


Comparing the results in Table D-13, for the NXT motor, to our desired design criteria, we
can see that for KP = 2, the percent overshoot is below PO = 5. However, the steady-state
error is above the desired value of 1 mm. To eliminate the steady-state error, we can use a
PI controller (see Example 7-7-2). The simple approach is to start with small values for the
integral gain KI until reaching the desired response. Later on, in Chap. 11, we provide a
thorough instruction on PI controller design.
The NXT motor position response with a PI controller is shown in Fig. D-44. From
Table D-14, for KI = 0.3 the steady-state error is smallest. However, the steady-state error
is still above 1 mm after the elevator car moves back down. This may be attributed to the
gearbox backlash.

04_Golnaraghi_App_D_D-1-D-64.indd 37 07/02/17 5:28 PM


D-38   Appendix D.  Control Lab

6
KP = 2, KI = 0.1
5 KP = 2, KI = 0.2
KP = 2, KI = 0.3
4

Height (cm)
3

1
X: 5.67
0 Y: –0.2399

–1
1 2 3 4 5 6
Time (seconds)

Figure D-44  NXT motor closed-loop position response for KP = 2 with different KI values.

TABLE D-14  NXT Motor Closed-Loop Position Response Performance Specifications for KP = 2 with Different
KI Values
Elevator Car Position Percent Settling Time Rise Steady-State
Response Overshoot (5%) (s) Time (s) Error (cm)
Move upward KI = 0.1 0 0.35 0.25 0.01
KP = 2 KI = 0.2 0 0.36 0.25 0.03
KI = 0.3 0.5 0.37 0.25 0.08
Move downward KI = 0.1 0.47 0.58 0.25 0.24
KP = 2 KI = 0.2 0.46 0.58 0.24 0.24
KI = 0.3 0.46 0.59 0.24 0.24

D-2-5  Alternative Controller Design


From Table D-13, the steady-state error is very small for KP = 5. However, the system
exhibits a high overshoot. We have two choices in this case to reduce the overshoot while
maintaining the system final value. First approach may be to use a PD controller (see
Example 7-7-1). As you learned, this type of controller can reduce the overshoot, but does
not affect the system type and steady-state properties of the system. Alternatively, recalling
the discussions surrounding Fig. D-30 in the previous example, for the NXT motor the
value of Bm increases with the reduction of power supplied to the motor.
As shown in Fig. D-45, lowering the input power adds to the damping in the system,
reducing the overshoot. As shown in Table D-15, the elevator system meets the design cri-
teria when the input power is at 40 percent of maximum.

D-2-6  Touch Sensor System


Now that a working control system has been established (KP = 5 at 40 percent input power),
we can use the touch sensor control system and determine if indeed by pressing the touch
sensors buttons, the elevator car reaches the desired floors within the design specs. The
touch sensor model is shown in Fig. D-46. As shown in Fig. D-47, the up touch sensor is
connected to Port 1, and the down touch sensor is connected to Port 2. Set the sample time

04_Golnaraghi_App_D_D-1-D-64.indd 38 07/02/17 5:28 PM


D-2  Project 2: Elevator Position Control    D-39

6
5
4

Height (cm)
3
2
1
0 KP = 5, 40% power
KP = 5, 60% power
–1 KP = 5, 80% power
–2
1 2 3 4 5 6
Time (seconds)

Figure D-45  NXT motor closed-loop position response for KP = 5 with different power.

TABLE D-15  NXT Motor Closed-Loop Position Response Performance Specifications for KP = 5 with Different Power
Elevator Car Position Percentage Percent Settling Time Rise Steady-State
Response Power (%) Overshoot (5%) (s) Time (s) Error (cm)

Move upward KP = 5 40 0.5 0.72 0.55 −0.01


60 5.3 0.6 0.36 0.06
80 7.8 0.53 0.28 0.06
Move downward KP = 5 40 3.8 0.6 0.46 0.07
60 7.2 0.58 0.31 0.05
80 10.2 0.51 0.24 0.02

LEGO LEGO
K Ts
+ + –K– –K– PID(s)
z-1 – –
Port 1 Discrete-Time Height Height Volt to PID Controller Saturation
Port A
Touch Sensor Up Up Integrator Saturation to Red Volt% Motor
Encoder
Deg to Height
LEGO LEGO
K Ts
–K–
z-1
Port 2 Discrete-Time Port A
Touch Sensor Down Down Integrator
Output

To Workspace1

Figure D-46  Touch sensor closed-loop position control Simulink model for NXT motor elevator
system.

Figure D-47  Up touch and down touch sensor block parameters.

04_Golnaraghi_App_D_D-1-D-64.indd 39 07/02/17 5:28 PM


D-40   Appendix D.  Control Lab

Figure D-48  Height saturation block parameter.

in both cases to 0.01 s. As shown in Fig. D-48, we used a height saturation block, set to 0 to
30 cm, for safety reasons.
A discrete time integrator has also been added to both up and down touch sensors—
this is outside the scope of this appendix, but necessary for proper system operation. The
sample time for this block is set to 0.5 s, and the gain value is 10, as shown in Fig. D-49. As
a result, to move up or down you must press the respective buttons for less than 0.5 s. If you
push the up or down touch sensors longer than 0.5 s, the elevator will move 10 cm at a time,
which is two floors.
The other blocks have been discussed earlier in this section.
Finally, Fig. D-50 shows position response of the elevator model, for KP = 5 with 40 percent
power, using touch sensor to move up and down.

D-3  DESCRIPTION OF ACSYS SIMLAB AND LEGOLAB SOFTWARE


As shown in Fig. D-51, SIMLab and LEGOLab8 are series of MATLAB and Simulink files
within the Automatic Control Systems (ACSYS) applet that makes up an educational tool
for students learning about dc motors and control systems. ACSYS is developed
Instructional video available. using the graphical user interface functionality of MATLAB so that you can
work with Simulink and interface with LEGO experiments with minimal effort.
In both the SIMLab and the LEGOLab, there are five experiments. In the first
two experiments, feedback speed control and position control are explored. Open-
loop step response of the motor appears in the third experiment. In the fourth
experiment, the frequency response of the open-loop system can be examined
by applying a sinusoidal input. A controller design project is the last experiment.

8
See instructional video on SIMLab and LEGOLab, Interfacing with LEGO MINDSTORMS NXT Using MATLAB
and Simulink, Part 2, at http://www.youtube.com/watch?v=yiiWGh9XSgY.

04_Golnaraghi_App_D_D-1-D-64.indd 40 07/02/17 5:28 PM


D-3  Description of ACSYS SIMLab and LEGOLab Software    D-41

Figure D-49  Discrete-time integrator block parameter.

35

30

25

20
Height (cm)

15

10

–5
0 5 10 15 20 25 30 35
Time (seconds)

Figure D-50  NXT motor elevator system closed-loop position response for KP = 5 with 40 percent
power.

04_Golnaraghi_App_D_D-1-D-64.indd 41 07/02/17 5:28 PM


D-42   Appendix D.  Control Lab

Figure D-51  The automatic control


systems (ACSYS) applet.

To launch the ACSYS9 applet, navigate to the appropriate directory in the MATLAB
command window, and type Acsys at the command prompt. The SIMLab or LEGOLab
experiment windows can be called from the ACSYS applet by clicking on the appropriate
button.
When SIMLab or LEGOLab is opened, the experiment control window will be
displayed. The Experiment menu can be used to switch between different control experi-
ments, as in Fig. D-52. The grey control panel on the left contains the control buttons for
the experiment. Every experiment has a button to enter model parameters, a field to enter
simulation time, and additional experiment-specific plot controls.
Once the model parameters have been entered and the simulation executed, the
plots or animations that the experiment supports appear in the display panel on the right.
Figure D-53 shows a typical experiment control window in SIMLab.
SIMLab allows you to display the motor transfer functions in various formats and
to access other custom tools from the SIMLab Tools dropdown menu. For step-by-step
instructions on using the experiment window, click on the Help Me button in the menu
bar. The standard Microsoft Windows calculator and a unit conversion tool can be accessed
from the top menu.
The model parameters must be set first in any experiment. By selecting the Enter Model
Parameters button, a Simulink (.mdl) window containing the model for the experiment will
be launched. The model, shown in Fig. D-54, contains a simple closed-loop system using
PID speed control, with a reference step input and multiple outputs.

Refer to App. G for an in-depth description of ACSYS 2013.


9

04_Golnaraghi_App_D_D-1-D-64.indd 42 07/02/17 5:28 PM


D-3  Description of ACSYS SIMLab and LEGOLab Software    D-43

Figure D-52  The Experiment menu for SIMLab or LEGOLab.

All the simulation parameters for the Simulink model are pre-set. Selecting Simulation
from the Simulink menu and next choosing Configuration Parameters allows access to
these settings, shown in Fig. D-55. The Start Time and Stop Time settings in the Solver
options are most important as far as SIMLab and LEGOLab examples are concerned,
and they can be manipulated in Configuration Parameters, or on the left panel in the

Figure D-53  Typical SIMLab experiment control window.

04_Golnaraghi_App_D_D-1-D-64.indd 43 07/02/17 5:28 PM


D-44   Appendix D.  Control Lab

Figure D-54  SIMLab speed control Simulink model.

Figure D-55  Configuration parameters: solver properties.

04_Golnaraghi_App_D_D-1-D-64.indd 44 07/02/17 5:29 PM


D-3  Description of ACSYS SIMLab and LEGOLab Software    D-45

SIMLab/LEGOLab interface. They allow you to modify the simulation running time.
Other options in Configuration Parameters should not be modified, as they may cause
errors in the SIMLab and LEGOLab software.
When the Simulink model is opened, double-click on the appropriate model block
to modify model parameters such as the PID values. For SIMLab, double-clicking on the
motor block brings up a window containing a list of adjustable motor parameters (see
Fig. D-56). All motor parameters, such as the resistance, back-emf constant, load inertia,
and damping coefficient, may be modified. By default, the parameters are set to the NXT
dc motor parameters, but may be changed to model a different motor. Right-clicking on a
SIMLab motor block and selecting Look under Mask makes the dc motor model available.
However, the LEGOLab motor blocks are completely opaque to the user since they use
an actual dc motors. One other feature that SIMLab has, which LEGOLab does not, is a
torque-disturbance input into the motor. This can be used to investigate the stall torque
and the effect of an integral controller on disturbance or steady-state error elimination (see
Sec. 7-7, Fig. D-2, or Chap. 11 for more details).
To run the simulation in SIMLab, close the Simulink model and click the button labeled
Run Simulation. The Print to Figure button allows the current response plot to be sent to a
separate MATLAB figure. To read values from the figure, click on the Data Cursor button
above the MATLAB figure, and then on the appropriate curve. For a finer reading, you can
right-click on the figure and change the Selection Style to “Mouse Position.” This figure can
also be saved as a .fig or image file for future reference and analysis. Again, in the LEGOLab,
you cannot change the system parameters, but PID controller box values are available for
modification. To run the simulation in LEGOLab, follow the instructions shown in the
Simulink model file.
Some of the experiments have additional features, such as animation and calculation
tools. These are discussed in the following sections. Selecting Close Experiment in the con-
trol window exits the current experiment.

Figure D-56  Adjustable parameters for the SIMLab motor blocks.

04_Golnaraghi_App_D_D-1-D-64.indd 45 07/02/17 5:29 PM


D-46   Appendix D.  Control Lab

D-4  SIMULATION AND LEGO EXPERIMENTS


It is desired to design and test a controller offline by evaluating the system performance
in the safety of the simulation environment. The simulation model can be based on avail-
able system parameters, or they may be identified experimentally. Because most of the
system parameters are available (see motor specifications in Sec. D-1-1), it will be useful
to build a model using these values and to simulate the dynamic response for a step input.
The response of the actual system (in this case, the LEGO system) to the same test input
will then verify the validity of the model. Should the actual response to the test input be
significantly different from the predicted response, certain model parameter values would
have to be revised or the model structure refined to reflect more closely the observed
system behavior. Once satisfactory model performance has been achieved, various control
schemes can be implemented.
In this appendix, SIMLab represents the simulation model with adjustable parameters,
and LEGOLab represents the actual system. Once the model of the LEGOLab system is
identified and confirmed, the controller that was originally designed using SIMLab should
be tested on the LEGOLab model.

D-4-1  Open-Loop Speed


Using the parameter values in Table D-5 for the model of the motor in Fig. D-2, simulate
the open-loop speed response to a step voltage. Startup SIMLab, select 3: Open-Loop Speed
from the Experiment menu, and perform the following tests:
1. Apply step inputs of +1 V, +3 V, and −2 V. Note that the steady-state speed is
indicated by Eq. (7-15)10 (use the built in motor parameters from Fig. D-56 or
Table D-5).
2. Study the effect of viscous friction on the steady-state motor speed. First set Bm = 0
(b = 0) in the Simulink motor parameter window. Then gradually increase its value
and check the speed response.
3. For original parameter values in Table D-5, determine the viscous friction required
at output shaft to reduce the motor speed by 50 percent from the speed it would
rotate as if there were no viscous friction.
4. Introduce an appropriate step-disturbance input TL and study its effect on the
system in Step 1.
5. Assuming that you do not know the motor inertia for the system in Step 1, can you
use the speed-response plot to estimate its value (see Sec. D-1-4)? If so, confirm
the values of motor and load inertia. How about the viscous-damping coefficient?
6. Can you use the time response to find other system parameters?
In this experiment, we use the open-loop model represented in SIMLab Experiment 3:
Open-Loop Speed. The Simulink system model is shown in Fig. D-57, representing a simple
open-loop model with a motor speed output.
In a realistic scenario, the motor is connected to an amplifier that can output a voltage
only in a certain range. Outside of this range, the voltage saturates. The current within the

AK i − t /τ
ω m (t ) =
10
(1 − e m ) (7-15)
K i K b + Ra Bm

04_Golnaraghi_App_D_D-1-D-64.indd 46 07/02/17 5:29 PM


D-4  Simulation and LEGO Experiments    D-47

Figure D-57  SIMLab open-loop speed response of dc motor experiment.

motor may also be saturated. To create these effects in software, right-click the dc motor
block and select Look under Mask to obtain the motor model shown in Fig. D-58. Double-
click both the voltage and current blocks and adjust their values (default values of ±4.5 V
and ±1 A have already been set). If you do not wish to include saturation, you can set the
limits very large (or delete these blocks altogether). Run the above experiments again and
compare the results.
Assuming a small electric-time constant, we may model the dc motor as a first-order
system. As a result, the motor inertia and the viscous-damping friction could be calculated
with measurements of the mechanical-time constant using different input magnitudes. For
a 3-V step input, the open-loop speed response is shown in Fig. D-59. After measuring the
mechanical-time constant of the system τm, you can find the inertia Jm, assuming all other
parameters are known. Recall that for a first-order system, the time constant is the time to
reach 63.2 percent of the final value for a step input—verify using Eq. (7-15).11 In Fig. D-59,
the steady-state velocity and the time constant τm can be found from the time-response plot
by using the cursor.

AK i − t /τ
11
ω m (t ) = (1 − e m ) (7-15)
K i K b + Ra Bm

1 1
1 1 +– K– ++ 1
J.s+R J.s+b
In Out
Input Amplifier Electrical Current Motor Gain Mechanical
Voltage Gain Saturation
Saturation 2
Disturbance

Kb

Motor feedback

Figure D-58  DC motor model including voltage and current saturation.

04_Golnaraghi_App_D_D-1-D-64.indd 47 07/02/17 5:29 PM


D-48   Appendix D.  Control Lab

Figure D-59  Speed response of the open-loop system (SIMLab) for input voltage of 3 V.

In SIMLab, the disturbance torque default value is set to zero. To change an input value,
simply change its final value.
Now that you have gained insight into the motor speed response, it is time to apply your
knowledge to test the LEGO experiment. Here you have no access to the system parameter
values. Use the LEGOLab to test the following:
7. Apply step inputs of +1 V, +3 V, and −2 V. How different are the results from Step 1?
8. From the transient and steady-state responses, identify the system model as closely
as possible.
In this experiment, we use the open-loop model represented in LEGOLab Experiment
3: Open-Loop Speed. The Simulink system model is shown in Fig. D-60, representing a
simple open-loop model with a motor speed output.
Recall that the motor and amplifier have built-in nonlinear effects due to noise, friction,
and saturation. So in Step 8, your model may vary for different input values. You will also
notice the step input begins at 1 s rather than 0 s. This is due to data sampling limitations
on the NXT motor, therefore take all measurements from time = 1 s rather than time = 0 s.
In addition, distorted values may be obtained if the input to the motor is excessive and
saturates. Caution must be taken to ensure that the motor input is low enough such that this
does not happen. Use the mechanical time constant and final value of the response in this
case to confirm the system parameters defined in Table D-5. These parameters are needed
to conduct the speed- and position-control tasks.
Figure D-61 shows the LEGOLab motor speed response to a 3-V step input. The friction
effect is observed when the motor starts. Noise at steady state may also be observed, which
is due to a low sampling rate and encoder measurement limitations. When measuring the
steady-state speed, take the average speed observed in noisy areas. Note that for higher
input magnitudes, the response will saturate at the motor’s maximum speed.

04_Golnaraghi_App_D_D-1-D-64.indd 48 07/02/17 5:29 PM


D-4  Simulation and LEGO Experiments    D-49

Figure D-60  LEGOLab open-loop speed response of dc motor experiment.

Figure D-61  Speed response of the open-loop system (LEGOLab).

04_Golnaraghi_App_D_D-1-D-64.indd 49 07/02/17 5:29 PM


D-50   Appendix D.  Control Lab

D-4-2  Open-Loop Sine Input


The objective of using open-loop sine input is to investigate the frequency response of the
motor using both SIMLab and LEGOLab.
9. For both SIMLab and LEGOLab, apply a sine wave with a frequency of 1 rad/s
and amplitude of 2 V to the input, and record both the motor velocity and sine
wave input signals. Repeat this experiment for frequencies of 0.5, 1.0, 2.0, 5.0, and
10.0 rad/s (keeping the sine wave amplitude at 2 V).
10. Change the input magnitude to 10 V and repeat Step 9.
Open-Loop Experiment 412: Open-Loop Sine Input from the SIMLab or LEGOLab
Experiment menu. The input and disturbance blocks and the motor parameters are adjust-
able in the SIMLab model. For the LEGOLab version, the amplitude should be low to avoid
amplifier or armature current saturation. The SIMLab model is shown in Fig. D-62 and
LEGOLab model in Fig. D-63.
Double-click on the Sine Wave block to modify the properties of the input wave.
Amplitude of 2 V is a low enough value to avoid saturation in this example. In the SIMLab
version, the saturation values are adjustable to allow you practice with their effect. The
SIMLab response for sine input with frequency of 1 rad/s and amplitude of 2 V is shown in
Fig. D-64. The corresponding LEGOLab output is shown in Fig. D-65.
By varying the frequency of the sinusoidal input and recording the amplitude of the
steady-state output, you can conduct an experimental frequency response measurement
for the system at hand. The frequency response analysis is covered in Chap. 10.
For a sine input of magnitude 10 V, the system exhibits saturation as shown in
Figs. D-66 and D-67. Saturation occurs because the input of 10 V exceeds the maximum
motor voltage (4.5 V) and thus the motor is not able to exceed its maximum speed beyond
a 4.5-V input.

12
You can use this tool to conduct an experimental frequency response study of the system—this concept is dis-
cussed in Chap. 10.

Figure D-62  Experiment 4: SIMLab Simulink model.

04_Golnaraghi_App_D_D-1-D-64.indd 50 07/02/17 5:29 PM


D-4  Simulation and LEGO Experiments    D-51

Figure D-63  Experiment 4: LEGOLab Simulink model.

The frequency of the sine wave will dictate the gain and phase of the response curve.
There is a Gain and Phase Calculator in the Experiment 4 control window. To measure the
magnitude and phase of the steady-state response, enter a frequency of 1 rad/s in the edit
block. Entering the input frequency and clicking on Calculate displays the gain and phase of
the system. Using the Gain and Phase Calculator, you can record the gain and phase of the
response. Repeat with other input frequencies, and discuss any trends.

Figure D-64  SIMLab time response and gain and phase calculation for input = 2 sin(t).

04_Golnaraghi_App_D_D-1-D-64.indd 51 07/02/17 5:29 PM


D-52   Appendix D.  Control Lab

Figure D-65  LEGOLab time response and gain and phase calculation for input = 2 sin(t).

Figure D-66  SIMLab time response and gain and phase calculation for input = 10 sin(t).

04_Golnaraghi_App_D_D-1-D-64.indd 52 07/02/17 5:29 PM


D-4  Simulation and LEGO Experiments    D-53

Figure D-67  LEGOLab time response and gain and phase calculation for input = 10 sin(t).

D-4-3  Speed Control


Having simulated the open-loop motor characteristics in previous sections, we can now
extend the model to include velocity feedback from the motor and use a proportional con-
troller. The block diagram that you should be modeling is shown in Fig. 7-26. For propor-
tional gains of 0.1, 0.5, and 1, perform the following tests using SIMLab:
11. Apply step inputs of 12, −10, and 15 rad/s.
12. Repeat Step 11 and connect additional gear head with a gear ratio of 1:24 (requires
modification of J in the Simulink motor parameters using the gear ratio, see Chap. 6).
13. Remove the gear in previous step and use the original parameter values in
Fig. D-56, observe the effect of the closed-loop control for indicated controller
gain values. By how much does the final speed change?
14. Repeat Step 5 in Sec. D-5-1 and compare the results.
Open Experiment 1: Speed Control from the SIMLab menu window. A screen similar
to Fig. D-52 will be displayed. Next, select the Enter Model Parameters button to get the sys-
tem Simulink model, as shown in Fig. D-68. This figure is a simple PID speed-control model.
Double-clicking on the PID block displays the editable PID values. The values of the step-input
and the disturbance-torque blocks may also be adjusted. The disturbance-torque default value
is set to zero. To change an input value, simply change the number in the final value field.
Increasing the proportional gain in the PID block will decrease the rise time. For an
unsaturated model, the SIMLab version of this experiment could exhibit extremely fast rise
times at very high proportional gains because the dc motor can utilize unlimited voltage and
current levels. To create this effect in software, right-click the dc motor block, and select Look
under Mask to obtain the motor model similar to Fig. D-58. Double-click both the voltage
and current blocks and adjust their values to very large (or delete their blocks). Recall from
Sec. D-5-1 that the default saturation limits are ±4.5 V and ±1 A, respectively. Figure D-69
displays the SIMLab speed response for −10 rad/s input with proportional gain = 0.5.

04_Golnaraghi_App_D_D-1-D-64.indd 53 07/02/17 5:29 PM


D-54   Appendix D.  Control Lab

Figure D-68  SIMLab Experiment 1: Simulink model.

Figure D-69  SIMLab speed-control response for −10 rad/s input and proportional gain = 0.5.

04_Golnaraghi_App_D_D-1-D-64.indd 54 07/02/17 5:29 PM


D-4  Simulation and LEGO Experiments    D-55

For a given input to change the proportional gain values, enter the following sets of PID
values and print all three plots.
P = 0.1 I = 0 D = 0
P = 0.5 I = 0 D = 0
P = 1 I = 0 D = 0

Next, for the LEGOLab, test the following:


15. Apply step inputs of 12, −10, and 15 rad/s. How different are the results from the
SIMLab?
You may again confirm the system parameters obtained in Sec. D-5-1. The LEGOLab
speed control Simulink model is shown in Fig. D-70. Its response for −10 rad/s input and
proportional gain = 0.5 is shown in Fig. D-71.

D-4-4  Position Control


Next, investigate the closed-loop position response; choose Experiment 2: Position Control
from the Experiment menu. For proportional gains of 1.5, 2, and 5 (requires modification
of PID block parameters), perform the following tests using SIMLab:
16. For the motor in Fig. D-2, apply a 160° step input. How large is the error when the
system reaches steady state?
17. Apply a step disturbance torque (−0.1) and repeat Step 16.
18. Using the disturbance torque in Step 17, examine the effect of integral control by
modifying the Simulink PID block. Choose several different integral gain values,
and compare the time response for a constant proportional gain.
19. How does an increase in motor inertia Jm affect the system with a PI controller?
Compare the transient and steady-state responses.
20. Examine the effect of voltage and current saturation blocks (requires modification
of the saturation blocks in the motor model).

Figure D-70  LEGOLab Experiment 1: Simulink model.

04_Golnaraghi_App_D_D-1-D-64.indd 55 07/02/17 5:29 PM


D-56   Appendix D.  Control Lab

Figure D-71  LEGOLab speed-control response for −10 rad/s input and proportional gain = 0.5.

21. Design a PI controller that will give a 30 percent overshoot and a rise time of
0.1 s. What is the maximum step input amplitude that will meet these calculated
requirements (i.e., not cause the amplifier to saturate), given the default current
and voltage saturation limits of ±1 A and ±4.5 V, respectively.
22. In all previous cases, comment on the validity of Eq. (7-53).13
Open Experiment 2: Position Control from the SIMLab Experiment menu. A screen
similar to Fig. D-52 will be displayed. Next, select Enter Model Parameters to get the system
Simulink model, as shown in Fig. D-72. This model represents a simple PID position-
control system. Double-clicking on the PID block allows you to edit the PID gain values.
The values of the step-input and the disturbance-torque blocks are also adjustable. The
disturbance-torque default value is set to zero. To change an input value, double-click on
the relevant block and change the number in the final value field. Figure D-73 the SIMLab
position response for a 160° and proportional gain of 1.5.
The position time response is also animated when the simulation is run. This is a useful
tool that gives the user a physical sense of how a real motor turns. The time, input-angle,
and output-angle values are displayed on the animation field, as shown in Fig. D-73.
The nonlinearities due to voltage and current limits cause the time response to saturate
at a high enough proportional gain. The maximum speed and acceleration of the dc motor
are dictated by the voltage and current saturation limits.
23. For proportional gains of 1.5, 2, and 5 (requires modification of PID block
parameters), repeat Step 16 using LEGOLab.

KK i K s
13 Θm ( s ) Ra J ω n2
(7-53)
= = 2
Θin (s )  R B + Ki Kb  KK i K s ( s + 2ζω ns + ω n )
2
s2 +  a m s +
 RJ a  RJa

04_Golnaraghi_App_D_D-1-D-64.indd 56 07/02/17 5:29 PM


D-4  Simulation and LEGO Experiments    D-57

Figure D-72  SIMLab Experiment 2: position control Simulink model.

24. Repeat Step 20 using LEGOLab


25. Does your PI controller design in Step 23 work for the LEGOLab?
The LEGOLab Simulink model for position control is shown in Fig. D-74. In addition,
the LEGOLab position response for a 160° step input and proportional gain of 1.5 is given
in Fig. D-75.

Figure D-73  SIMLab position response for 160° and proportional gain of 1.5.

04_Golnaraghi_App_D_D-1-D-64.indd 57 07/02/17 5:29 PM


D-58   Appendix D.  Control Lab

Figure D-74  LEGOLab Experiment 2: position control Simulink model.

D-5  DESIGN PROJECT: ROBOTIC ARM


Description of the project. Consider the test system in Fig. D-1. The system is composed of
the dc motor used throughout this appendix. We connect a rigid beam to the motor shaft to
create a simple robotic system conducting a pick-and-place operation. A gripper is attached
to the end of the arm and is able to grip onto a payload and drop it into a cup at a specified
angular position. The system interfaces with the host computer using a USB connection,
while the host computer logs encoder data using a Bluetooth connection.
Objective. The objective is to drop the payload into a hole or cup as fast as possible.

Figure D-75  LEGOLab position response for 160° and proportional gain of 1.5.

04_Golnaraghi_App_D_D-1-D-64.indd 58 07/02/17 5:29 PM


D-5  Design Project: Robotic Arm    D-59

Design criteria. The arm is required to move in only one direction from the initial
position. The hole location may be anywhere within an angular range of −90° to +90° from
the initial position. The arm may not overshoot the desired position by more than 5°. A
tolerance of ±3 percent is acceptable (settling time). These criteria may easily be altered to
create a new scenario.
The objective may be met by looking at the settling time as a key design criterion.
However, you may make the design challenge more interesting by introducing other design
constraints such as the percent overshoot and rise time. In SIMLab, you can also introduce
a disturbance torque to alter the final value properties of the system. The LEGOLab system
contains nonlinear effects that make the controller design more challenging. You may try
to confirm the system model parameters first, from earlier experiments. It is highly recom-
mended that you do the design project only after fully appreciating the earlier experiments
in this appendix and after understanding Chap. 7. Have fun!
This experiment is similar to the position-control experiment in some respects. The idea
of this experiment is to get an object held by a robotic arm by an electromagnet from posi-
tion 0° to a specified angular position with a specified overshoot and minimum overall time.
Select Experiment 5: Control System Design from the SIMLab Experiment menu. A
screen similar to Fig. D-52 will be displayed. Next, select Enter Model Parameters to get
the system Simulink model, as shown in Fig. D-76. As in Sec. D-5-1, this figure represents
a simple PID position-control model with the same functionalities. Double click on the
DC Motor block to edit the model parameters. By default, they are set to the robotic arm
parameters as shown in Fig. D-76.
The added feature in this model is the gripper control. By double-clicking the
Gripper Control block, a parameter window pops up, as in Fig. D-77, which allows the
user to adjust the drop-off payload location and the time delay (in seconds) to detach
after reaching the target. This feature is particularly useful if the response overshoots and
passes through the target more than once. So, in Fig. D-78, the “Drop position angle” is the
angle where the gripper detaches dropping the payload. “Start to wait for drop position at

Figure D-76  Robotic arm model


parameters.

04_Golnaraghi_App_D_D-1-D-64.indd 59 07/02/17 5:29 PM


D-60   Appendix D.  Control Lab

Figure D-77  SIMLab Experiment 5: Simulink model.

time” refers to the time where the position trigger starts to wait for the position specified
by “Drop position angle.”
An important note to remember is that in the LEGOLab the gripper will never drop
the object exactly where it is specified due to error in the motor encoder. A SIMLab time
response of the system for proportional gain of 3 is shown in Fig. D-79.
The model response is also animated. This feature makes the simulation more realistic.
In SIMLab, it is possible to change the dimensions of the experiment setup. Choose Modify

Figure D-78  Parameter window for the electromagnet control.

04_Golnaraghi_App_D_D-1-D-64.indd 60 07/02/17 5:29 PM


D-5  Design Project: Robotic Arm    D-61

Load Drop Setup from the SIMLab Tools menu to adjust the height of the drop and the
length of the arm, and change your controller design accordingly.
Create the test bed shown in Fig. D-1 and try the experiment in LEGOLab and com-
pare the results with SIMLab. Upon opening the experiment in LEGOLab, the Simulink
model in Fig. D-80 will appear. Just like with SIMLab, the drop angle and drop position
time can be edited by double clicking on the Arm/Gripper Control block. A LEGOLab time
response of the system for proportional gain of 3 is shown in Fig. D-81.

Figure D-79  Position response for Experiment 5 in SIMLab.

Figure D-80  LEGOLab Experiment 5: Simulink model.

04_Golnaraghi_App_D_D-1-D-64.indd 61 07/02/17 5:29 PM


D-62   Appendix D.  Control Lab

Figure D-81  Position response for Experiment 5 in LEGOLab.

D-6 SUMMARY
In this appendix, we described the SIMLab and LEGOLab tools to improve your
understanding of control and to provide a better practical appreciation of the subject. We
discussed that, in a realistic system including an actuator (e.g., a dc motor) and mechanical
(gears) and electrical components (amplifiers), issues such as saturation of the amplifier,
friction in the motor, or backlash in gears will seriously affect the controller design. This
appendix focused on problems involving dc motors including modeling, system identifica-
tion, and controller design. We presented experiments on speed and position control of dc
motors, followed by a controller design projects. In these design projects, aside from the
speed and position control topics, other controllers such as PID may also be utilized. You
may wish to visit Chap. 11 to become more acquainted with these topics.

REFERENCE
Golnaraghi, F., “MSE 312 Mechatronics Design II—Course Project,” Simon Fraser University, School of
Mechatronic Systems Engineering, British Columbia, Canada, Lab Manual, 2012.

PROBLEMS
D-1.  Create a model of the motor shown in Fig. D-25. Use the following parameter values:
Jm = 0.0004 kg·m2; B = 0.001 N · m/rad/s, Ra = 2 Ω, La = 0.008 H, Km = 0.1 N·m/A, and Kb = 0.1 V/rad/s.
Assume that the load torque TL is zero. Apply a 5-V step input to the motor, and record the motor
speed and the current drawn by the motor (requires modification of SIMLab blocks by making
current the output) for 10 s following the step input.
(a)  What is the steady-state speed?
(b)  How long does it take the motor to reach 63 percent of its steady-state speed?

04_Golnaraghi_App_D_D-1-D-64.indd 62 07/02/17 5:29 PM


Problems    D-63

(c)  How long does it take the motor to reach 75 percent of its steady-state speed?
(d)  What is the maximum current drawn by the motor?
D-2.  Set the viscous friction B to zero in Prob. D-1. Apply a 5-V step input to the motor, and record
the motor speed and current for 10 s following the step input. What is the steady-state speed?
(a)  How long does it take the motor to reach 63 percent of its steady-state speed?
(b)  How long does it take the motor to reach 75 percent of its steady-state speed?
(c)  What is the maximum current drawn by the motor?
(d)  What is the steady-state speed when the applied voltage is 10 V?
D-3.  Set the armature inductance La to zero in Prob. D-2. Apply a 5-V step input to the motor, and
record the motor speed and current drawn by the motor for 10 s following the step input.
(a)  What is the steady-state speed?
(b)  How long does it take the motor to reach 63 percent of its steady-state speed?
(c)  How long does it take the motor to reach 75 percent of its steady-state speed?
(d)  What is the maximum current drawn by the motor?
(e) If Jm is increased by a factor of 2, how long does it take the motor to reach 63 percent of its steady-
state speed following a 5-V step voltage input?
(f) If Jm is increased by a factor of 2, how long does it take the motor to reach 75 percent of its steady-
state speed following a 5-V step voltage input?
D-4.  Repeat Probs. D-1 through D-3, and assume the load torque TL = −0.1 N·m (don’t forget the
minus sign) starting after 0.5 s (requires change of the disturbance block parameters in SIMLab).
(a)  How does the steady-state speed change once TL is added?
(b)  How long does it take the motor to reach 63 percent of its new steady-state speed?
(c)  How long does it take the motor to reach 75 percent of its new steady-state speed?
(d)  What is the maximum current drawn by the motor?
(e) Increase TL and further discuss its effect on the speed response.
D-5.  Repeat Probs. D-1 through D-3, and assume the load torque TL = −0.2 N·m (don’t forget the
minus sign) starting after 1 s (requires change of the disturbance block parameters in SIMLab).
(a)  How does the steady-state speed change once TL is added?
(b)  How long does it take the motor to reach 63 percent of its new steady-state speed?
(c)  How long does it take the motor to reach 75 percent of its new steady-state speed?
(d)  What is the maximum current drawn by the motor?
(e) Increase TL and further discuss its effect on the speed response.
D-6.  For the system in Fig. D-1, use the parameters for Prob. D-1 (but set La = 0) and an amplifier
gain of 2 to drive the motor (ignore the amplifier voltage and current limitations for the time being).
What is the steady-state speed when the amplifier input voltage is 5 V?
D-7.  Modify the model in Prob. D-6 by adding a proportional controller with a gain of Kp = 0.1, apply
a 10-rad/s step input, and record the motor speed and current for 2 s following the step input.
(a)  What is the steady-state speed?
(b)  How long does it take the motor to reach 63 percent of its steady-state speed?
(c)  How long does it take the motor to reach 75 percent of its steady-state speed?
(d)  What is the maximum current drawn by the motor?
D-8. Change Kp to 1.0 in Prob. D-7, apply a 10-rad/s step input, and record the motor speed and cur-
rent for 2 s following the step input.
(a)  What is the steady-state speed?
(b)  How long does it take for the motor to reach 63 percent of its steady-state speed?
(c)  How long does it take for the motor to reach 75 percent of its steady-state speed?
(d)  What is the maximum current drawn by the motor?
(e)  How does increasing Kp affect the response (with and without saturation effect in the SIMLab model)?

04_Golnaraghi_App_D_D-1-D-64.indd 63 07/02/17 5:29 PM


D-64   Appendix D.  Control Lab

D-9.  Repeat Prob. D-7, and assume the load torque TL = −0.1 N·m starting after 0.5 s (requires change
of the disturbance block parameters in SIMLab).
(a)  How does the steady-state speed change once TL is added?
(b)  How long does it take the motor to reach 63 percent of its new steady-state speed?
(c)  How long does it take the motor to reach 75 percent of its new steady-state speed?
D-10.  Repeat Prob. D-7, and assume the load torque TL = −0.2 N·m starting after 1 s (requires change
of the disturbance block parameters in SIMLab).
(a)  How does the steady-state speed change once TL is added?
(b) How long does it take the motor to reach 63 percent of its new steady-state speed?
(c) How long does it take the motor to reach 75 percent of its new steady-state speed?
D-11.  Insert a velocity sensor transfer function Ks in the feedback loop, where Ks = 0.2 V/rad/s (requires
adjustment of the SIMLab model). Apply a 2-rad/s step input, and record the motor speed and current
for 0.5 s following the step input. Find the value of Kp that gives the same result as in Prob. D-7.
D-12. For the system in Fig. D-3, select Kp = 1.0, apply a 1-rad step input, and record the motor
position for 1 s. Use the same motor parameters as in Prob. D-1.
(a)  What is the steady-state position?
(b)  What is the maximum rotation?
(c)  At what time after the step does the maximum occur?
D-13.  Change Kp to 2.0 in Prob. D-12, apply a 1-rad step input, and record the motor position for 1 s.
(a)  At what time after the step does the maximum occur?
(b)  What is the maximum rotation?
D-14.  Using the SIMLab, investigate the closed-loop position response using a proportional control-
ler. For a position-control case, use proportional controller gains of 0.1, 0.2, 0.5, 1, and 2; record the
step response for a 1-rad change at the output shaft; and estimate what you consider to be the best
value for the proportional gain. Use the same motor parameters as in Prob. D-1.
D-15.  Using the SIMLab, investigate the closed-loop position response using a PD controller. Modify
the controller used in Prob. D-14 by adding derivative action to the proportional controller. Using the
best value you obtained for Kp, try various values for KD, and record the step response in each case.
D-16.  Repeat Prob. D-15 and assume a disturbance torque TD = −0.1 N·m in addition to the step
input of 1 rad (requires change of the disturbance block parameters in SIMLab).
D-17.  Repeat Prob. D-15 and assume a disturbance torque TD = −0.2 N·m in addition to the step
input of 1 rad (requires change of the disturbance block parameters in SIMLab).
D-18.  Use the SIMLab and parameter values of Prob. D-1 to design a PID controller that eliminates
the effect of the disturbance torque, with a percent overshoot of 4.3.
D-19.  Use the SIMLab and parameter values of Prob. D-1 to design a PID controller that eliminates
the effect of the disturbance torque, with a percent overshoot of 2.8.

04_Golnaraghi_App_D_D-1-D-64.indd 64 07/02/17 5:29 PM

You might also like