ee 4314 lab 3 handout speed control of the dc motor … lab 3 handout - pid control... · 09/30/12...

9
09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID Controller Fall 2012 IMPORTANT: This handout is common for all workbenches. 1. Lab Information a) Date, Time, Location, and Report Due Please check your lab schedule on Blackboard for your lab date, time, and workbench. The lab will be held at NH250. Your lab report is due on Wednesday at 11:59 pm two weeks after your lab session. b) Preliminary Work You are required to complete the Preliminary Work given in the next section of this handout and to read the rest of the handout before you come to the lab for the experiment. At the beginning of the lab, the TA will check your preliminary work. Get a printout of your answers and results and show it to the TA when you go to your lab session. c) Lab Report After the lab, you will work on the problems at the end of the handout on your own and are required to submit a report on that. Please check the information about the assignment in the lab report section at the end. d) Some Notes and Rules - Do not forget to sign the attendance sheet. - Login to the account created for your group and use the folders provided to save your work. - Do not change the experiment hardware setup unless instructed by the TA or by the lab procedure in the handout. - Cooperate with your group mates to increase your efficiency in performing the experiment. - Bring a USB memory device to get a copy of the experiment data at the end of the lab. - Keep clear from the moving parts of the experiment setup when it is running.

Upload: dokhanh

Post on 20-May-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 1

EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID Controller

Fall 2012

IMPORTANT: This handout is common for all workbenches.

1. Lab Information

a) Date, Time, Location, and Report Due

Please check your lab schedule on Blackboard for your lab date, time, and workbench. The lab

will be held at NH250. Your lab report is due on Wednesday at 11:59 pm two weeks after your

lab session.

b) Preliminary Work

You are required to complete the Preliminary Work given in the next section of this handout

and to read the rest of the handout before you come to the lab for the experiment. At the

beginning of the lab, the TA will check your preliminary work. Get a printout of your

answers and results and show it to the TA when you go to your lab session.

c) Lab Report

After the lab, you will work on the problems at the end of the handout on your own and are

required to submit a report on that. Please check the information about the assignment in the lab

report section at the end.

d) Some Notes and Rules

- Do not forget to sign the attendance sheet.

- Login to the account created for your group and use the folders provided to save your work.

- Do not change the experiment hardware setup unless instructed by the TA or by the lab

procedure in the handout.

- Cooperate with your group mates to increase your efficiency in performing the experiment.

- Bring a USB memory device to get a copy of the experiment data at the end of the lab.

- Keep clear from the moving parts of the experiment setup when it is running.

Page 2: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 2

2. Preliminary Work

This part of the handout provides the preliminary information that you need to understand the

experiment, conduct it, and interpret the results. Follow the steps below to complete the preliminary

work. Provide your answers and results on a paper and present it to the TA when you go to your lab

session.

This lab focuses on the tuning of a PID (Proportional-Integral-Derivative) controller to regulate

the rotational speed of the DC motor system. PID control is the predominant method in industry for

control of various plants and processes that may include motors, engines, valves, and other actuation

schemes.

The block diagram of a basic feedback control system is shown in Figure 1 where y(t) denotes the

process output, r(t) denotes the reference/setpoint which is the desired output, e(t) = r(t) − y(t) denotes

the control error and u(t) is the control signal computed by the controller based on the control error.

Figure 1 Basic feedback control structure

The controller in Figure 1 uses the error signal to determine the required control signal that drives

the process. The input-output relationship of a basic PID controller in time-domain is given as:

tedt

dKdeKteKtu D

t

IP

0

(1)

The control signal, u(t), is a linear combination of proportional (P), integral (I), and derivative (D)

terms of the error signal, e(t). These three terms are accompanied by constant gains KP, KI, and KD.

Designing a PID controller is essentially the process of determining the values of these constants,

which is also known as tuning the controller.

a) Study Example 2.5 – Transfer function of the DC motor in the textbook (Dorf & Bishop, 12th

ed., p. 70). The DC motor system that you will be working on in the lab is a permanent magnet

DC motor hence the control is through the armature voltage/current. You are interested in the

transfer function of the motor that relates the rotational speed of the rotor to the input voltage.

Given the transfer function in eq. 2.70 in the textbook that relates the input voltage and rotor

angular position:

(2)

where K and τ are motor constants, θ is the angular position of the rotor, and Vin is the input

voltage to the armature circuitry, show that the transfer function relating the rotational speed of

the rotor to the input voltage is given by

(3)

y(t) r(t) + e(t) u(t) Controller

(e.g. PID)

Plant/Process

(e.g. Motor)

_

Σ

Page 3: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 3

where ω is the angular speed of the rotor. First, show how θ and ω are related in time and

frequency domains. Then, replace θ(s) in (2) by the expression in terms of ω(s) and find H(s).

b) Given the transfer function in (3), find the response of that system for a unit step input assuming

zero initial conditions. That is,

(4)

First, represent the input in frequency domain and replace it in (3) to find ω(s). Then, find the

inverse Laplace transform of ω(s) by using partial fraction expansion method and referring to

Table 2.3 Important Laplace Transform Pairs in page 59 of the textbook. The result should give

you a time domain expression for ω(t). Sketch ω(t) for t ≥ 0 by assuming several values for t

including t = 0, τ, and ∞.

c) Create a Simulink model as shown in Figure 2 for the motor system and run it to observe the

step response on the scope. Modify the transfer function block according to the following motor

constants: K = 0.9, τ = 0.26 s. Do not forget to set the ‘step time’ of the step source to 0. Plot the

result using simout variable and compare it with your sketch of ω(t).

Figure 2 A Simulink model for the DC motor system

d) Find the transfer function C(s) of the PID controller represented by equation (1).

?sE

sUsC (5)

e) You will be using the open-loop Ziegler-Nichols PID Tuning method described in your

textbook (p. 490) for assigning initial values to the PID gains. Fill out the values in where R is

the initial slope of the step response of the system and Td is the transport delay. In the step

response the DC motor system, there is typically no transport delay. That is, the motor starts

moving immediately after the input is applied. In this case, you can take Td as 0.1×τ, where τ is

the time constant of the system (τ = 0.26 s). For finding R, use your simulation result in part (c).

Page 4: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 4

Table 1 Open-Loop Ziegler-Nichols PID Controller Gain Tuning

Controller Type KP KI KD

Proportional (P): C(s) = ? ?1

dRT

0 0

Proportional-Integral (PI): C(s) = ? ?9.0

dRT

?27.0

2

dRT 0

Proportional-Integral-Derivative (PID): C(s) = ? ?2.1

dRT

?6.02

dRT ?

6.0

R

f) Create a Simulink diagram like the one in Figure 3. Show your block diagram with your

transfer function model of the DC motor system (i.e. insert your constants for K and τ). Run the

simulation for all three types of controller (P, PI, and PID) with a step input of magnitude 2

and show all responses on the same graph.

Figure 3 Simulation model of the PID controller and DC motor system

g) Based on Table 2, tune your PID controller by changing the values of the controller gains such

that the control performance is as close as possible to:

a. Rise Time Tr: Less than the time constant of the system (i.e. Tr < τ).

b. Percent Overshoot Mp: Less than 10%.

c. Settling Time Ts: Less than 5×τ

d. Steady State Error: Less than 1% of the reference signal.

Observe the effect of the gains on the control performance. Show the response for the best

performing controller and indicate how you calculated the above performance criteria on the

graph (Refer to the back cover page of the textbook for the description of performance

measures). List the gain values you came up with.

Table 2 Effect of increasing the PID gains on control performance

Increase Rise Time % Overshoot Settling Time Steady State Error

KP Decrease Increase Small Change Decrease

KI Decrease Increase Increase Decrease

KD Small Change Decrease Decrease Small Change

h) In practice, the derivative term creates problems by amplifying noise and sharp reference signal

changes. This problem is commonly eliminated by using a low pass filter together with the

derivative term. Look into the help documentation of the PID block to see how MATLAB

implements that with the parameter N. Explain the effect of this parameter.

Page 5: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 5

3. Setting up the Experiment (by TA)

Figure 4 Picture of the DC motor system

This part will have been done by the TA before the lab begins. This section is for your

information. The experimental setup is shown in the following drawing.

Figure 5 Experimental setup for DC motor system

Each computer is equipped with an NI-1200 data acquisition board (DAQ) that allows connection

with the DC motor system. The connection is made using a terminal block to facilitate the access to the

pins corresponding to the input/output channels of the board.

a) Begin by connecting the motor control module to the power supply. The module is marked 5V,

0V, +12V, −12V. Be sure that the supplied voltage is correct. Make sure that the ground pins on

the motor module are connected together.

b) Connect the Analog Ground of the DAQ card (pin 11 on terminal block) to the common ground

of the motor module.

c) Connect the Analog Output 1 of the DAQ card (pin 12 on terminal block) to Vin on the Motor

Drive Input.

d) Connect the non-inverting Analog Input 2 of the DAQ card (pin 3 on terminal block) to Vout on

the Tacho Generator Output.

e) Connect the Enable Input of the motor ( E ) to ground.

f) Disengage the eddy current brake.

PC NI

Terminal

NI

Card

MATLAB

Simulink

DC Motor

System

Vin

Vout

H(s) =

Vout(s) / Vin(s)

= ?

AOUT

AIN

Page 6: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 6

4. Doing the Experiment

The objective of this experiment is to control the speed of the DC motor system with the PID

controller that you designed in the preliminary work. First, you will obtain the step response of the

system. You will realize that it is difficult to maintain a desired output value under changing load

conditions without a controller. Then, you will use a PID controller to regulate the speed output.

a) Browse to Lab 3 folder and double-click on the Simulink file “TestMotor.mdl”. The following

block diagram opens up. The “Vin” and “Vout” terminals of the “DC Motor System” block

show analog signals that the computer uses to interact with the real system. Vin is the control

signal sent to the motor drives while Vout is the analog signal acquired from the tacho-

generator of the motor system. If you double-click a block on the diagram, you can see and

modify its parameters. Try it with the step block. This is the input signal to the motor. Change

the step time to 0 if not already set so.

Figure 6 Simulink block diagram for the DC motor system

b) Make sure that the current MATLAB folder is the one that contains the “TestMotor.mdl” file.

Click on the ‘Incremental Build’ button shown in Figure 6 (or Tools>Real-Time

Workshop>Build Model). You will see the build process in the MATLAB command window.

Once the build is successfully completed click the “Connect to Target” button and after the

connection is realized click on the ‘Run’ button that becomes active in the Simulink diagram.

These buttons are shown in Figure 6.

c) Set the slider gain to 3 and hit ‘Run’. This will start running the Simulink code for a number of

seconds equal to the simulation time specified in the Simulink diagram. The value of the slider

gain is equivalent to the value of the input voltage as far as the step input is unit. Observe the

result on the scope window. Click on button on the scope window to auto-adjust axes.

Compare the response of the real system and your simulation in part (c) of the preliminary

work. Do they have similar characteristics? Save your result for this part.

d) Observe the step response under changing load: Find the input value that runs the motors at

a speed equivalent to 2.5 V on the output scope. Assume that this is the desired output. Run the

system with the input value you just found and after about 4 seconds engage the brake all the

way (level 2). Here, engaging the brake represents a changing load for the motor system.

Observe how the speed changes. Are you able to maintain a set output without a controller if the

load changes? Save your result for this part.

Now, let’s use a PID controller for speed regulation. Close the current Simulink diagram and open

“PIDControl.mdl”. It is shown in Figure 7. The PID controller is a discrete time block because the

Connect to

Target Button Run Button

Incremental

Build Button

Page 7: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 7

signals acquired and generated by the computer are intrinsically discrete. The variables of interest are

displayed by the scopes, namely: reference signal r, error signal e, control signal u, and the output

speed signal. Whenever instructed, save these matrices together from the workspace into your results

folder with a proper file name that indicates the experiment step you are doing. Carefully follow the

steps below in the given order. Observe your results and try to associate them with your knowledge of

feedback control systems and the PID controller.

Figure 7 Simulink block diagram of the experiment

No Load Test:

e) Disengage the brake. Test your P, PI, and PID controllers that you created in part (f) of the

preliminary work using the Ziegler-Nichols method (Table 1). Use the same reference signal

(e.g. 2) for all cases. Save the results.

f) Test your PID controller that you tuned in part (g) of the preliminary work. Check if the

performance criteria are satisfied. If not, tune it more to make it better (do not spend more than

10 minutes for this). Finally, save the best result you have got.

g) Change the simulation time to infinity (inf) and rebuilt the model. Test your PID controller

starting with a slider gain value of 2. While the system is running, keep the slider gain control

window open and change the reference value to 3, 4, and then −2. Do this by not dragging the

slide but by entering the values in the middle box and hitting enter. This way, you can make

sure that you input exact values instantaneously. Finally, stop the system and save the result.

Can the system output follow the reference signal?

Changing Load Test:

h) While the brake is disengaged, run the system at a reference of 3V and after a few seconds

engage the brake first to level 1, then to level 2, and finally back to 0 and stop. Can the system

compensate for changing load conditions? Can it maintain the output at the given reference?

Save the result.

Page 8: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 8

5. Lab Report

Submit your individual report for the following questions via EE4314 Blackboard

(https://elearn.uta.edu) in one of the following file formats: .doc, .docx, or .pdf. Your report should

include –if any– your formulations, listings of MATLAB code, pictures of Simulink block diagrams,

and resulting graphs for each problem. Make sure that you show all your work and provide all the

information needed to make it a standalone and self-sufficient submission. Have an appropriate report

format for your submission. This lab handout is a good example as to how you should format your

report. Make sure that you include the following information in your report:

Report title, your name, ID number, lab section, submission due date and time.

Answers to the problems with your

o Mathematical derivations and formulations. It is highly recommended that you use the

Equation Editor of Microsoft Word, MathType, or a similar editor to write your

equations. You can also scan handwritten equations and merge them into your report.

o Pictures of Simulink block diagrams and property windows of important blocks in the

simulation.

o Listings of MATLAB codes with inline comments and explanation in text.

o Pictures of data plots with appropriate axis labeling, titles, and clearly visible axis

values. Screen printing is not well accepted.

Comments –if any– to let us know how we can make your learning experience better in this lab.

Note that you will need to use the results presented in this lab report for the experiment in Lab 4.

Below is the assignment policy:

This assignment is due on Wednesday at 11:59 pm two weeks after your lab session.

You must upload a single file in .doc, .docx, or .pdf format via the “Lab Report Submission”

link at EE4314 Blackboard (https://elearn.uta.edu).

Late reports will get 20% deduced score from the normal score for each late day (0-24 hr)

starting right after the due date and time. For example, a paper that is worth 80 points and is 2

days late (24hr – 48hr) will get 80 – 80 × 2 × (20/100) = 48 points. A paper that is late for 5 or

more days will get 0 score.

You will have two chances of attempt to submit your report via Blackboard and only the last

submission will be considered.

Grading is out of 100 points and that includes 20% (20 points total) for the format. A nice

format refers to a clear, concise, and well organized presentation of your work.

Page 9: EE 4314 Lab 3 Handout Speed Control of the DC Motor … Lab 3 Handout - PID Control... · 09/30/12 − Page 1 EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID

09/30/12 − Page 9

Question 1 (40 pts):

Provide your answers to the preliminary work. The following rubric will apply for parts (a) to (h) of

the preliminary work:

a) 5 pts b) 5 pts c) 5 pts d) 5 pts e) 5 pts f) 5 pts g) 5 pts h) 5 pts

Question 2 (60 pts): Your results should include the following signals whenever applicable:

reference signal r, error signal e, control signal u, and the output speed signal.

a) (10 pts) Show your result for part (c) of the experiment. Explain how the time constant τ and the

gain K of the system can be found based on its step response. You may want to use your work in part

(b) of the prelab.

b) (10 pts) Show your result for part (d) of the experiment and discuss how the motor speed

changes when the brake is engaged. Try to explain why it changes.

c) (10 pts) Show your results for part (e) of the experiment and compare the performance of your P,

PI, and PID controllers based on the performance criteria given in part (g) of the preliminary work.

Clearly show how you calculate the four performance measures (rise time, percent overshoot, settling

time, and steady state error) using the experimental results.

d) (10 pts) Show your result for part (f) of the experiment. Compare it with the simulation result in

part (g) of the prelab.

e) (10 pts) Show your result for part (g) of the experiment. Can the system output follow the

reference signal? What is the steady state error for each reference value you used?

f) (10 pts) Show your result for part (h) of the experiment. Can the system compensate for changing

load conditions? Can it maintain the output at the given reference? What is the steady state error for

each level of the brake?