EE 4314 Lab#2
Identification of the Transfer Function of a DC Motor System
Prior to the lab, it will be necessary for all students to be familiar with the following concepts and terms. The students should be prepared to present brief paragraphs and figures explaining these terms to the TA.
； Gain and Static Characteristic of a plot or plant
； Transfer Functions, Poles and Zeros
； Time Constant of a function
； Rise Time
； Settling Time
It will also be assumed that all students understand basic Matlab and Simulink functionality. You are required to
complete all Preliminary Work given in this 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.
The goal of this lab is to present a simplified method of identification in order to determine an approximate equivalent transfer function model for a DC motor system. Instead of determining the system transfer function starting from the first principles and differential equations that govern the system, we will use an experimental approach to obtain the transfer function based on the step response of the system. The experimental setup is shown in the following drawing.
VinMATLAB NI AOUT H(s) =
(s) / V(s) VSimulink Card outin
AIN = ? V outNI DC Motor PC Terminal System Fig. 1: Experimental setup for DC motor system identification
The model of the system that you will obtain in this lab will be used in the third lab to design a controller (in a feedback structure) for the control of the rotational velocity of the motor. The designed controller will be tested in the third lab on the actual motor system.
There are two different DC motor systems: ECP DC Motor Plant and Quanser SRV-02 Plant. Each team
works on one of them. For the first two parts of the following experimental procedure, please refer to the directions for the particular setup you use. Starting with Part 3, the rest of the procedure is the same for both plants.
Setting up the Experiment for ECP DC Motor Plant
1. Connecting the motor to the acquisition board in the computer (This part is done by the TA)
Every computer is equipped with a NI-1200 data acquisition board (DAQ) to allow connection with a process. The connection is made using a terminal block to facilitate the access to the pins corresponding to the input/output channels of the boards.
Hardware connections for NI-1200 card:
a. Begin by connecting the motor control module to the power supply. The module is marked 5V, 0V,
+12V, ?12V. Be sure the supplied voltage is correct.
b. Make sure that all the ground pins on the motor module are connected together.
c. Connect the Analog Ground of the DAQ card (pin 11 on terminal block) to the common ground of
the motor module.
Ed. Connect the Enable Input of the motor () to ground.
e. Connect the Analog Output of the DAQ card (pin 12 on terminal block) to Vin on the Motor Drive
f. Connect the non-inverting Analog Input of the DAQ card (pin 3 on terminal block) to Vout on the
Tacho Generator Output.
2. Setting up the matlab/simulink file
a. Click on the Simulink file "TestMotor.mdl" in the “Lab 2 – Identification of the Transfer Function of
a DC Motor” folder. The following block diagram opens up.
The names “Input” and “Output” of the Analog Input and Analog Output blocks in Simulink show what those blocks represent for the computer, not for the system. The Analog Output block sends the desired input signal to the motor drives. The Analog input reads the response of the motor from the tacho generator and sends it to the Scope to be visualized and saved.
Fig. 2: Simulink Block diagram for identification
b. 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. The following window should be seen:
Fig. 3: Step input
c. Click on the Tools menu in the Simulink diagram and, in the Real-Time Workshop submenu, select Build Model. You will see the Matlab command window pop up and the build process will be displayed. Once the build is successfully completed click the “Connect to target” button and after the connection is realized click on the arrow that appears in the simulink diagram. This will start running the Simulink code for a number of seconds equal to the simulation time specified in the simulink diagram.
Note: For real-time applications, Simulink compiles the model into a fast executable code that handles the data acquisition and processing. Anytime a change is made in the Simulink file, except changing the value of the step input to be sent to the process or changing any other simple parameter, the file must be rebuilt.
Performing the Identification Experiment
3. Experiment for determining the form of the transfer function based on the step response
a. Use the simulink file set up in Part 2 to obtain a step response of the motor system. Consider the step input size being equal to 3 (this means that 3V will be applied to the system input).
b. Open the simulink file called “simulatedMotor.mdl” to simulate the step response of a first order transfer function as shown below.
Fig. 4: Simulink block diagram for simulating the step response of a transfer function
c. Compare the shape of the step response of the motor system with the shape of the step response of the first order transfer function. If they are similar to each other then this means that you can approximate the transfer function of the motor system with a first order transfer function. Also, you can check this assumption by referring to your textbook, Example 2.13 - Modeling a DC Motor.
Then the transfer function that will model the motor system will be given as:
?，?？？；：，?? (1) ；，~~ ？?，?！，；;，(
To completely describe the behavior of the motor system we now have to find the overall gain g and the
time constant τ of the circuit.
d. Double click on the “Scope” block in the model and click on the “Parameters ” menu button of
the opening window. In the “Data History” tab, choose the settings as in Fig. 5 below. These settings will enable saving the data of the graph on the scope to the workspace within an array called “Sim_Step_Response”
(or any other name you specify). The first column of the matrix corresponds to time values while the second column to the output of the “Transfer Function” block. The array will be updated each time the simulation is
run and after setting up the scope you will need to run the simulation at least once to have the array in the workspace. Hence, run the simulation once again to have array in the workspace.
Fig. 5 Save the graph on the scope to workspace using its parameters menu
4. Finding the gain of the transfer function g
a. The motor drive is capable of handling voltages from ?5V to 5V for its full range of operation. Vary
the slider gain in Fig. 2 between ?2 and +2 in steps of 0.2V and in the intervals from +2V to + 5V and from ?2V
to ?5V in steps of 0.5V. Note the corresponding tacho-generator steady-state output on the scope. Make a table showing the input voltage that you specified (V) and the steady state output voltage (V) that you measured. inout
You can import the file called “VinVout.mat” into the workspace from the current directory and use the imported matrix as your table, the first column having Vin and the second column having the corresponding Vout values.
b. Plot using Matlab V vs. V (the values from the table you made). outin
This plot, called “static characteristic”, will give information regarding the static input-output behavior of the motor, in other words the static gain of the system. From the plot you can see that there exists a so called "dead-zone" in the center, with two linear regions on each side of the dead-zone. Note down the limits of the dead-zone.
Note: Every time you have to determine the value of a parameter that describes the static behavior of a system, we will determine the value finding the slope of a line. This gives you information about how the
system amplifies or attenuates the input signal.
Due to nonlinearities in the physical motor module some of the measured characteristics will exhibit dead-band and/or saturation. In these cases, the value we will use for the parameter is the slope (?V / ?V) of outin
the linear part of the characteristic (do not use points that belong to the dead zone or the saturation zone). You should also determine the saturation and dead-band limits in case we wish to construct a more detailed model.
Give some thought as to how you should determine the slope of the linear operating region of the motor so that the resulting linear model best represents the real motor system. Then, compute the slope of the linear region. The resulting value will be the DC gain of the motor’s model, i.e. the gain g of the transfer function in equation
. Finding the value of the time constant5;
In order to have a full first order transfer function description of the motor, the parameter we wish to find next is τ, the time constant in the equation (1).
The time constant characterizes the dynamic behavior of the system. To find it we need to look at the step response on the motor, not only at the steady state value of it (as it was done in the previous part).
You will use the same simulink file.
a. Make sure that the simulation time is set up in such a way to see on the plot the steady state of the system’s response, keeping in mind that you are interested now in the dynamical characteristics of the system such as rising time and settling time which you need to see as clearly as possible (a long constant line of steady state value is no longer interesting for this part of the experiment; however the steady state should be visible on your graph). For instance, 5 sec should be enough to see both the transient and steady state response of the system.
b. Make sure that the scope has been setup to save the speed signal data in the Matlab Workspace. By clicking on the “parameters” button in the Scope window a new window containing the scope parameters
will open up. In this window in the “Data history” tab you will select that the data be saved to workspace. Give a name for your data (e.g. “speed”) and specify array format for it.
c. Set the slider gain block to a value that is outside the dead-band region (that you determined previously).
d. Run the code. The step response of the motor for the input step will be shown on the Scope. Click on the “binoculars” button and encircle the region of interest with the mouse to have a well scaled image of the transient part of the signal.
Note: If you return to the Matlab command window and type "who" on the screen the names of the variables in the workspace will appear. You will see also the name of the variable that contains you data.
Plot the step response in Matlab. To plot the data in Matlab you only have to plot the second column (speed) of the data array versus the first column (time). Example: If your data is saved in the variable named “speed” then to plot this signal you need to write: speed(signal(:,1), speed(:,2)). You should get the
same graph as the one in the scope window.
Save the plot (as .fig) and the speed data (as .mat) in your results folder. You should give names to your files with a certain convention such as for the result of Part 5d with input value 2V: “Part-5d_In-2V”
For a first order transfer function the time constant ; is defined as the time required for the step response
to go from 0% to 63.2% of its final value. Determine this value of the time constant from the obtained data in the workspace.
f. Repeat parts 5c and 5d for two other input values, one being in the negative linear region. Note that
the control input can take any value in the ?5V and 5V but do not chose values inside the dead-zone or beyond
the saturation limits.
To determine the time constant of the system, take the average of the three time constants that you just determined. This mean value will be the time constant ; of the transfer function in (1).
Write down the transfer function model of the motor system.
6. Validation of the motor model
a. In the Simulink file presented in Fig.4 update the transfer function block parameters using the model that you determined for the actual motor. Set the slider gain to one of the three input values you picked in 5-c and run the simulation. Using the data from the scope that is saved in the workspace, plot the response of the simulation model. Then on the same graph, plot the response of the real system for the same input value.
b. Save this simulink file under a different name.
c. Repeat the simulation for several input values and compare the result with that of the real system.
If these are similar it means that the model that you just identified for the motor system is fairly good. If the two responses are not similar then you have to go back at either Part 4 or 5 and redo the experiments.
The lab report should include the answers to the following points. You are also responsible for performing everything listed in all lab procedures, in addition to what is listed here.
You can print any graphs that you want to attach to your report. In the report itself, all tables and figures should be labeled with captions and have their axis labeled and a title present. It is highly recommended that the
students use IEEE format for their reports. It is assumed that students will need to work in groups on this experiment but each individual is responsible for turning in a unique report. Proper grammar, syntax, and academic standards for the report itself apply. This includes citations and a Works Cited section where appropriate. All Matlab and Simulink code should be provided attached as Appendices to your report and should include adequate Comments. All reports should be uploaded to the class Blackboard page prior to the final due date.
Note that you will need to use the results presented in these lab reports for the experiments in lab 3.
1. a) (10 pts) Write the tables with the parameters of the motor model that you identified. The tables should include all the values you found in Parts 4 and 5.
b) (5 pts) Give some thought as to how many of the figures in each parameter are significant. As a rule, only the least significant digit you give should be substantially uncertain.
2. (10 pts) Why is the time constant ; of a first order system determined based on 63.2% of the final value of the step response? Explain mathematically where that particular value of 63.2% comes from.
3. a) (10 pts) Plot V vs. V. b) (10 pts) On the graph, show where the system is linear or nonlinear. outin
4. a) (10pts) Explain the existence of the “dead zone”. b) (5 pts) Comment on what sort of problems might arise
due to these nonlinearities if one were to design a speed controller for the motor module.
5. a) (15pts) For what interval in the control input would you expect the identified model to be accurate? b) (5 pts) If you were given that the normal operating speed of the motor corresponds to 2V at the output, how would you calculate the value of g so that the linear approximation in equation (1) best fits to the actual nonlinear response around this normal operating speed.
6. (10 pts) Why did you model the plant with a first order transfer function?
7. (5 pts) Calculate the poles and zeros of the obtained transfer function.
8. (5 pts) Is the obtained transfer function stable?