Version 1.1 1 of 11 ECE 311 – LAB 3 MOTOR SPEED CONTROL BEFORE YOU BEGIN PREREQUISITE LABS ECE 201 and 202 Labs ECE 311 Lab 2. EXPECTED KNOWLEDGE Linear systems Transfer functions Step and impulse responses (at the level covered in ECE 222) Block diagram algebra (as covered in ECE 311) EQUIPMENT Oscilloscope Programmable Power Supply Arbitrary Function Generator MATERIALS Motor-Generator Plant, including: Electronic Control Unit (ECU) Plug-in jumpers and capacitors Motor Generator Foam Pad Rubber Band Faceplate Coupling Hose Motor Mounting Screws Faceplate Mounting Screws TIP41 Power Transistor Large heat sink with screw and nut OBJECTIVES In this lab you will gain knowledge of different types of compensation and how to implement each of these types using analog circuits. You will learn how to select components for each type of compensation and how the compensation affects the output of the system. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 2 of 11 INTRODUCTION Automatic control is a vital part of modern engineering and science. It is used in space vehicle systems, missile guidance, aircraft, robotics, and modern manufacturing processes. The system to which the controller is applied is called the plant. In this lab, you will design controllers for the DC motor plant from Lab 2. Obtain the SAME motor-generator plant from the TA as you used for Lab 2. Also obtain an Electronic Control Unit (ECU) from the TA. There are many different types of feedback controllers. In the following sections you will work with (A) four different types of linear feedback controllers, [(A1) the proportional compensated, (A2) the proportional compensated with derivative, (A3) the proportional compensated with integral, and (A4) the proportional compensated with derivative and integral], and (B) a pulsewidth modulation controller. A. LINEAR FEEDBACK CONTROL Each controller tries to make the output of the closed loop system as close as possible to the input of the system. Using techniques you developed in Lab 2, you will be measuring the performance of each of these controllers. It may be beneficial if you have a copy of Lab 2 for reference. PRELAB A Answer Questions 1 – 5. A1. PROPORTIONAL COMPENSATION The gain of a system can be adjusted by introducing proportional compensation, kp. Figure 1 shows the block diagram of such a system. kp is the proportional compensation, or gain, of the compensator. H(s) is the transfer function of the plant. Using block diagram algebra, the transfer function for such as system can be determined as follows: G s kpH s 1 kp H s x e + S kp H(s) y - Figure 1. Unity Feedback System with Proportional Compensation. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 3 of 11 Figure 2 shows the ECU schematic, and the plug-in points P1-P2 and P3-P4. The circuit consists of three op amps: a differential amplifier, an inverting amplifier and a voltage follower. The differential amplifier subtracts the input signal from the output, or feedback, signal. As you can see from Figure 2, a gain of 10 was chosen for the compensator. This value was chosen so that the plant would operate at approximately the same operation point of Lab 2, but with a lower input voltage. The lower input voltage is needed to keep the inverting op amp from saturating. The inverting amplifier is used to determine the gain, or proportion, of the compensation. The voltage follower (aka current buffer) is used to ensure the output voltage is connected to a high impedance source and is therefore not directly affected by the circuit that it is connected to. Connect sources, ECU, and the plant as shown in Figure 2. Answer Questions 6 – 12. You should have found that the output voltage closely tracks the input voltage at low frequencies. The DC gain should be approximately 1. 560 k 1 M 1.0 V 15 V 560 k + 15 V 100 k - 15 V - A1 A2 + 0.1 V -15 V -15 V 560 k + VOUT - 560 k -15 V A3 + 15 V Figure 2. Schematic for Proportional Compensation. A2. PROPORTIONAL COMPENSATION WITH DERIVATIVE Proportional compensation with derivative, PD, is a more flexible form of compensation than proportional. This type of compensator contains two parameters to adjust a fixed gain and a gain that is proportional to the derivative of the system error, e = x – y. This adds a zero to the openloop transfer function. The block diagram for a PD system is shown in Figure 3. The schematic that you will use for the PD is shown in Figure 4. As you can see, the PD can be created from the proportional compensator by adding a capacitor in parallel with the 100 k resistor. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 4 of 11 The zero added by the PD is located at 1 , where A R1C1 . A Answer Questions 13 – 18. x e + S kp(As+1) H(s) y - Figure 3. Block Diagram for PD System. 560 k C1 1 M 1.0 V 15 V 560 k 15 V 100 k - 15 V + 0.1 V R1 + -15 V -15 V 560 k + VOUT - 560 k -15 V + 15 V Figure 4. Schematic for PD. A3. PROPORTIONAL COMPENSATION WITH INTEGRAL Like PD compensation, proportional compensation with integral is a more flexible form of compensation than proportional. This type of compensator contains two parameters to adjust a fixed gain and a gain that is proportional to the integral of the system error, e = x – y. This adds a pole to the open-loop transfer function. The block diagram for a PI system is shown in Figure 5. The schematic that you will use for the PI is shown in Figure 6. The PI can be created from the proportional compensator by adding a capacitor in series with the 1 M feedback resistor of the inverting amplifier. The zero added by the PI is at s a where a 1 / R2C2 and the pole is added at s 0 . Answer Questions 19 – 24. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 5 of 11 x e + S - kp(s+a) s H(s) y Figure 5. Block Diagram for PI System. 1 M 560 k R2 1.0 V 15 V 560 k 15 V 100 k - C2 15 V + + 0.1 V -15 V -15 V 560 kK + VOUT - 560 k -15 V + 15 V Figure 6. Schematic for PI. A4.PROPORTIONAL COMPENSATION WITH INTEGRAL & DERIVATIVE Proportional compensation with integral and derivative, PID, is a combination of PD and PI compensators. Figure 7 shows the block diagram for a PID compensator; the schematic is shown in Figure 8. Answer Questions 25 – 29. x e + S - kp(As+1)(s+a) s H(s) Figure 7. Block Diagram for PID System. © 2001 Department of Electrical and Computer Engineering at Portland State University. y Version 1.1 6 of 11 1 M 560 k C1 R2 1.0 V 15 V 560 k 15 V 100 k - C2 15 V + 0.1 V R1 + -15 V -15 V 560 k + VOUT - 560 k -15 V + 15 V Figure 8. Schematic for PID. Answer Questions 30 – 31. B. PULSE WIDTH MODULATION In this lab you will also gain knowledge of how pulse width modulation can be used to overcome stiction, hysteresis, and other types of nonlinearities commonly encountered in mechanical systems. Pulse width modulation (PWM) is a common technique used for speed control. To help understand how PWM works, consider the following analogy of riding a bike. When you wish to accelerate, you start peddling at a comfortable cadence (your output is on). Once you reach your desired speed you quit peddling and coast (your output is off). When you start to slow down, you begin peddling again at nearly the same cadence (your output is on) until you reach your desired speed, and then you coast again (output off). Pulse width modulation employs a similar technique. To start the motor, the pulse width modulator gives the motor full power (a fixed maximum voltage). In this lab the maximum voltage will be 10 V and will be denoted by Vcc. This is analogous to peddling at a constant cadence. After a specified period of time, the voltage driving the motor is completely removed (i.e. it is set to 0 V). This is analogous to coasting. Periodically the voltage switches between maximum power and no power applied. PWM is typically applied at a fairly high frequency so that the switching between full power on and no power applied occurs too rapidly for the motor to actually speed up or slow down each cycle. Recall from the earlier lab that the motor has the same frequency response as a low pass filter. This means that applying a pulse width modulated signal is roughly equivalent to applying a DC voltage with the same value as the average of the pulse waveform. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 7 of 11 The duty cycle is defined as the percentage of time that the pulse is at full power. If the duty cycle is 100%, the voltage driving the motor is a constant 10 V. If the duty cycle is 0%, the voltage driving the motor is a constant 0 V. If the duty cycle is 50%, half the time the 10 V is applied and half the time 0 V is applied. This is roughly equivalent to applying a 5 V DC voltage source. Figure 9, Figure 10, and Figure 11 show some screen shots of the pulse width modulator shown in Figure 12. Figure 9. Pulse Width Modulator with 0% Duty Cycle. vT t is shown in yellow, VS is shown in blue, and vO t is shown in pink. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 8 of 11 Figure 10. Pulse Width Modulator with 100% Duty Cycle. vT t is shown in yellow, VS is shown in blue, and vO t is shown in pink. Figure 11. Pulse Width Modulator with Duty Cycle Between 0% and 100%. vT t is shown in yellow, VS is shown in blue, and vO t is shown in pink. Although there is an equivalent DC voltage for a pulse-width modulated signal, there is an advantage to using PWM rather than applying a DC voltage. Recall that in Lab 2 you found that © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 9 of 11 the motor had a certain amount of stiction. This caused the motor to stick until a sufficient DC voltage was applied to break the stiction and the motor then accelerated to a relatively fast speed. This nonlinearity prevented you from operating the motor at low speeds efficiently. The advantage of PWM is that it largely overcomes the problem of stiction. As you increase the duty cycle, the motor receives a series of 10 V pulses that are roughly similar to sharp kicks. The 10 V pulses are sufficient to start the motor turning at a lower equivalent DC voltage than an actual DC voltage source would be capable of. PRELAB B A pulse width modulator can be created using an op amp as a comparator, as illustrated in Figure 12. The output of the comparator switches between the upper and lower rails of the op amp. For this lab, you will use the function generator to produce a triangle waveform, vT t , as one of the inputs to the comparator. This waveform varies from VT to VT . The other signal will come from the power supply or your controller (denoted as Vs) and will represent the desired amount of power that should be delivered to the motor. When VS VT the duty cycle of the pulse width modulator is 0% (Figure 9). When VS VT the duty cycle is 100% (Figure 10). When VT VS VT , the duty cycle of the pulse width modulator is between 0% and 100% (Figure 11). If the op-amp lower rail is set to 0 V and the upper rail is set to Vcc, then the average equivalent DC voltage is equal to the product of the duty cycle and Vcc. Answer Questions 32 – 33. In this lab all of the op amps should be connected to a positive rail of +10 V and a negative rail of –10 V. In this PWM application, the TIP41 BJT acts as a switch. + vT(t) Vs vo(t) - Figure 12. Comparator for Pulse With Modulation. The op-amp in the circuit in Figure 12 acts as the comparator in your pulse width modulator, which consists of a triangle waveform connected to the inverting terminal of the comparator and a source (or control) voltage connected to the non-inverting terminal. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 10 of 11 TESTING THE PULSE WIDTH MODULATOR Build the pulse width modulator shown in Figure 12. Use 10 V for the rails of the op amp. Use channel 3 of the power supply as VS. Use channel 2 of the function generator to create a triangle wave with amplitude of 1.0 V, an offset of 0.75 V, and a frequency of 1 kHz. Remember to use the 50 shunt resistor. Use the oscilloscope to view the signals VS, vT t and vO t . Use a variety of values for VS and observe how it affects the pulse width modulation on the oscilloscope. You should be seeing waveforms like those in Figure 9, Figure 10 and Figure 11. Answer Question 34. FULL-SCALE CHARACTERIZATION DIRECT CONNECTION Refer back to the DC Full Scale Characterization of your plant in Lab 2. Answer Questions 35 – 36. PULSE WIDTH MODULATION Connect the motor-generator plant as shown in Figure 13. Unlike the previous exercise in Lab 2, in this case the motor is being driven by a pulse width modulated signal. For the triangle wave, use channel 2 of the function generator. Use amplitude of 1 V, an offset of 0.75 V and a frequency of 1 kHz. Remember to terminate the function generator with the 50 shunt resistor. On the generator, use the terminal next to the red dot as the reference point (ground). If you get negative values for VOUT after the generator starts rotating, switch the polarity of the leads on the motor. 10 V 10 V + -10 V VS + VOUT - vT(t) Figure 13. Schematic for Pulse Width Modulation Full-scale Characterization. © 2001 Department of Electrical and Computer Engineering at Portland State University. Version 1.1 11 of 11 Answer Questions 37 – 40. PROPORTIONAL COMPENSATION Refer back to the results of Section A1. PROPORTIONAL COMPENSATION WITH PULSE WIDTH MODULATION Connect the motor-generator plant as shown in Figure 14. 560 k 1.5 k -10 V 560 k -10 V 1 k - + + VS 10 V -10 V 10 V 560 k 10 V + 560 k 10 V vT(t) + VOUT - -10 V + 10 V Figure 14. Schematic for Proportional Compensation with Pulse Width Modulation Fullscale Characterization. Answer Questions 41 – 43. © 2001 Department of Electrical and Computer Engineering at Portland State University.