EE 4314 Lab#2

Identification of the Transfer Function of a DC Motor System

Preliminary Work:
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.

·  Dead-zone

·  Gain and Static Characteristic of a plot or plant

·  Transfer Functions, Poles and Zeros

·  Time Constant of a function

·  Rise Time

·  Settling Time

·  Stability

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.

Experiment:

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.

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.

d.  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 Input.

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:

Hs=Vout(s)Vin(s)=gτs+1 / (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

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 (Vin) and the steady state output voltage (Vout) that you measured. 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 Vout vs. Vin (the values from the table you made).

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 (∆Vout / ∆Vin) of 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 (1).

5. Finding the value of the time constantt

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 t 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 t 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.

Lab Report:

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.