ENGS 26 CONTROL THEORY Lab 2: Motor Speed Control Laboratory Equipment and Software Required: Thayer School DC Motor/Tachometer board DT2801-A Data Acquisition Board and PC Oscilloscope Connectors (1 BNC-BNC, 3 BNC-Banana, 4 to 6 pairs banana-banana) + 10 V power amplifier (white box) Voltmeter Signal generator +15 V DC power supply (silver box) DT VEE software Breadboard and analog control component kit (SIGN OUT FROM INSTRUMENT ROOM – ONE KIT PER GROUP) Note: This lab will be performed over a two week period. Please complete prelab assignment (problem 5, problem set 2) before the first lab session, and do the prelab assignment found on p. 5 of this handout before the second lab session. Save the bulk of the data analysis portions of the lab for post-lab analysis, so that you can complete the experimental portion during the lab period. 1. Objective The objective of this lab is to identify the transfer function of a DC motor and to design and implement proportional and proportional integral controllers to control motor speed. 2. System modeling The DC motor is driven by a voltage through a power amplifier. An integrated tachometer provides a voltage that is proportional to shaft angular velocity. We will consider shaft angular velocity control; hence, we will not use the potentiometer supplied with the board for this experiment. Control laws to be developed will depend on open-loop motor characteristics, which can be determined based on the motor response to step input voltages. Your first objective is to develop a dynamic model of the continuous-time system. Figure 1 shows a functional block diagram of the open-loop system consisting of the power amp, motor, and tachometer. The motor together with the power amp and tachometer can be represented by Vt K = Vin Ts + 1 . (1) Vt , the output voltage of the tachometer reflects motor angular velocity, Vin is the input voltage to the motor (through the power amp, which you will set to have a gain of 1), and K, T are system parameters. Signals w and n reflect the possibility of a disturbance on the motor, and measurement noise associated with the tachometer, respectively. The block diagram describing the open loop system is shown in Figure 2. It lumps the gains associated with the motor, power amp and tachometer into K, assumes a system time constant T, and neglects measurement noise. 1 w n Vt Vin power amp DC motor Tachometer (volts) (volts) Figure 1: Functional block diagram of the laboratory apparatus W(s) + Vin (volts) + K Vt Ts + 1 (volts) Figure 2: Block diagram of the open-loop system 2.1 Acquiring data to model the open-loop system Using the signal generator, generate a square-wave signal (at approximately 0.1 Hz) between zero and 5 V. Connect the square-wave signal to the INPUT of the power amplifier. Set the power amplifier gain to 1 by looking at the output of the power amplifier on the oscilloscope (or voltmeter) and adjusting the knob on the front panel until to output voltage equals the input voltage. Turn off the power amplifier and connect the OUTPUT of the power amplifier to the motor input leads on the board, noting the correct polarity. If the tubing is attached between the motor and potentiometer shafts, carefully remove the tubing from the motor shaft. (If you damage the tubing, it can be replaced, but please don’t bend the shafts!) Tie the tubing back with a piece of wire, if necessary. Connect the output of the tachometer to A/D channel 0. Simultaneously record the input to the motor (the square wave) on channel 1. Use DT VEE to acquire input/output data. Set up and start a DT VEE program (see Figure 3), and record the tachometer response for at last one cycle. Adjust your square wave input and sampling frequency so that you can capture the entire response (transient response and steadystate voltage) adequately enough to determine motor parameters. If you have never used DT-VEE, please consult your lab instructor for assistance. Save the data recorded on AD channels 0 and 1 as text files for further processing to find the system parameters. Use I/O menu, ‘To File’ submenu, and specify a unique file name. Consult your lab instructor for assistance if you have never used the I/O functions in DT-VEE. (Data can be loaded into MATLAB, but do this after you finish your lab experiments. At the MATLAB prompt, type >>load c:\vee_user\myfile, specifying your file name (including any extension) for ‘myfile’. Data will appear in a vector whose name is the file name. Create a time vector as follows. Note the sample period used for data collection in DT-VEE, and use the MATLAB command, t=[0:points-1]*T, where points is the number of points collected and T is the sample period. The command points=length(myfile)will give you the number of points in your data array.) Repeat the open-loop step response experiment for one square wave of lower amplitude than 5 V (e.g., 2 or 3 V), and one square wave of larger amplitude than 5 V (e.g., 8 V). The maximum voltage recorded by the A/D converter is 10 V. (12 V is the maximum input voltage to the motor.) For extremely small voltages, you will experience “stiction” effects (static friction). 2 Figure 3: A sample template for data acquisition from the DC motor. 2.2 Mathematical modeling There are a number of methods for determining system parameters from the experimental response. The easiest method is to determine your time constant based on the definition of a time constant, and to determine K based on the input signal Vin and steady-state tachometer voltage. You may use an alternate approach, if desired. Determine the parameters of the open-loop system using the record of the experimental results obtained for several different step inputs Vin. Are the parameters consistent? Compare your time constant to that found from manufacturer specifications given at the end of this handout. (Again, you may save this analysis until after you finish the experiment.) 2.3 System simulation Using the open-loop transfer function obtained above, simulate the open-loop step response of the system using MATLAB and compare it with the experimental response(s). (Save this for post-lab analysis.) 3 3. Speed control of the DC motor using proportional control Please read this entire section before proceeding. Using the continuous-time transfer function identified, draw a closed-loop system block diagram showing reference input of “setpoint” voltage Vs , output Vt , and transfer functions for the motor/amp/tach and control law Gc ( s). Find the steady-state response of your system for a proportional control law, Gc ( s) = K p . (You should have done this as a prelab assignment associated with Problem Set 3. Convince yourself that the small differences in the constants T and K used in the prelab and those determined experimentally do not matter much!) Determine the control gain K p at which the voltage to the motor saturates, for a setpoint voltage Vs = 5 V. Now, implement the proportional control law using analog electronics. For the reference input signal, use the signal generator to provide a 0 to 5V square wave at approx. 0.1 Hz. Construct a summing junction to add the input signal to the tachometer signal, and construct the proportional control circuit. You can construct a summing junction and implement a proportional control gain using the differential amplifier circuit shown in Figure 4, or you may design your own circuit. In Fig. 4, V2 is the reference input provided by the signal generator ( Vs ), and V1 is the voltage across the tachometer ( Vt ). If R1 = R2, the output voltage is Vout = Vs − Vt , and the proportional control gain is K p = 1. Note that resistors must be matched, i.e., the two R1’s in the circuit must be R R identical, as should the two R2’s. If R1 <> R2, Vout = 2 (Vs − Vt ) , and K p = 2 . You will R1 R1 examine the closed-loop response for three different control gains. One way to set the gain is to build the circuit with three fixed resistors and one trim pot. Then, before closing the loop, apply a constant input voltage Vs and a zero tach voltage Vt , and turn the trim pot until the gain is equal to your desired proportional control gain. Alternatively, you can set R1 = R2 in the differential amplifier circuit, and use the power amp knob to set the gain of the power amp equal to K p . The second method is much easier, but DO NOT read values from the power amp scale under the knob to determine the gain! Instead, use a voltmeter to determine the gain. For the first value of K p , use a control gain that does not saturate the motor. For the second value, use a value such that the maximum control voltage is 12 V, and for the third value, choose a value of K p such that the maximum value of the control voltage significantly exceeds 12 V. Figure 4 Differential Amplifier Summing Junction (From Horowitz and Hill, The Art of Electronics.) 4 Construct and test the summing junction on your protoboard. Make sure the power supply and power amp are off while you are constructing the circuit, and disconnect the output of the power amp from the input to the motor. Supply +15 V and ground to your op amp from the +15 V power supply. Avoid longs lengths of wire, alligator clips and other poor wiring techniques by supplying +15 V to your board through the banana connectors. Refer to attachments for pinouts of the operational amplifier and for resistor color codes. Consult your lab instructor if you need assistance in constructing the circuit or if you have never used a protoboard. Once your circuit is working and your gain is set, close the loop as follows. WITH THE POWER AMP and +15 V SUPPLY OFF, connect the output of the circuit to the input of the power amp, and connect the tachometer to the summing junction. Connect the output of the power amp to the motor. Also, connect the output of the tachometer to AD channel 0, and connect the reference input to AD channel 1. Record the closed-loop response as follows. First, turn on the signal generator, power amplifier and 15 V power supply. Then, start the DTVEE program, choosing a total sample that captures at least one full cycle of the closed-loop response. Record the tach response and reference input, and save the data to disk. Also, you may want to monitor the input to the power amplifier and the tach response to check for saturation. (The ideal experiment would record all three signals at once, but DT-VEE may not allow this.) Next, run the closed-loop speed control system again, and put your finger on the shaft to generate a disturbance while the closed-loop system is in operation. Record the response using DT-VEE. What happens? Repeat the input and disturbance responses for each of the three proportional control gains. Check to make sure your results qualitatively match theory before disassembling your circuit. If you do not complete this portion of the lab, keep the circuit intact. In your report, show the closed-loop system block diagram, show your analysis, describe your circuit, and answer the following questions. What is the steady-state error to 5V input? What happens to the transient response and steady-state error as K p increases? Simulate the closed-loop response to a 5V input in MATLAB for the motor parameters found experimentally and values of K p used in the lab. How do experimental responses compare to simulated responses? How does the experimental system respond to a disturbance? Compare experimental results with your analysis in problem 5, problem set 3. 4. Proportional-integral Speed Control of the DC Motor (week 2) Prelab analysis: In problem 5, HW3, you should have discovered that PI control, Kp s +1 K p s + Ki Ki Gc ( s) = = Ki provides benefits in reducing steady-state error to a step input and s s reducing the disturbance response. Fix the value of K p to avoid saturation, and choose a value for Ki such that the transient and error response is “satisfactory.” For example, you should have found that the closed-loop system with a PI control law is now a second-order system. With K p fixed to avoid saturation, choose Ki to provide an adequate transient response and to reduce steadystate error “quickly.” Also, consider rejection of a constant disturbance as a specification. Use the program generated Problem Set 3 to determine an appropriate control gain Ki. You will define and explain your transient and steady-state performance criteria in your report. Lab procedure: Implement a PI control law using one of the two PI op amp circuits discussed in class. One of these circuits is provided in Figure 5. Refer to attachments to determine resistor and 5 capacitor values available in your analog control kit. Connect the output of the summing junction to the input of the PI circuit. (Remember to set the resistances in your summing junction to be equal for this part, since the overall gain will affect K p !) Connect the output of the PI circuit to the input of the power amp. Operate the closed-loop system and record the tachometer voltage and reference input as in the previous experiment. NOTE THAT IT IS EXTREMELY IMPORTANT THAT NO SIGNAL EXIST ON THE INPUT TO THE INTEGRATOR CIRCUIT PRIOR TO CLOSED-LOOP OPERATION. If a signal exists on the integrator circuit, it will integrate, and there will be a large signal on the motor at time zero, due to the integrated signal. Therefore, the order of operation is important. If you start your DT-VEE program first, then turn on the power amp and +15V supply, no signal will exist on the integrator circuit prior to data collection. Next, operate the closed-loop system again and record the response to a finger-on-shaft disturbance. Answer the following questions in your report. State your control system design specifications, and discuss how you arrived at these specs. Describe your PI control circuit, including component values chosen to implement the control law. Discuss experimental results. For example, what is the steady-state error for a 5V input? How does the experimental response for PI control compare to that simulated in MATLAB? How does the system respond to a disturbance? Did the experimental system meet specifications? If not, why not? What is the effect of saturation? ENGS 26: Part List for Analog Controller Kit (may differ slightly from actual kit) Approx. Quantity Part 6-8 2-4 741 Op amp 747 Quad op amps 5 10 10 10 6 6 6 1 Mohm resistor 100 kohm resistor 10 kohm resistor 1 kohm resistor 100 kohm trim pots 10 kohm trim pots 1 kohm trim pots 3 3 3 3 3 3 10 µf capacitor 1 µf capacitor 0.1 µf capacitor 4.7 µf capacitor 0.47 µf capacitor 0.047 µf capacitor protoboard wire (red, black, various colors) Screwdriver for adjusting trim pots wire cutters/strippers Protoboard w/ velcro 1 1 1 6 PLEASE TURN OFF INSTRUMENTS AND MAKE SURE ALL CONNECTORS ARE RETURNED TO YOUR STATION BEFORE LEAVING THE LAB. REMEMBER TO TAKE YOUR KIT WITH YOU. YOUR FELLOW STUDENTS AND LAB INSTRUCTOR WILL THANK YOU! 10K Figure 5 An analog PI control circuit. 7 8 9