AVR495: AC Induction Motor Control Using the Constant V/f Principle and a Space-vector PWM Algorithm Features • Cost-effective and energy efficient 3-phase induction motor drive • Interrupt driven • Low memory and computing requirements 8-bit Microcontrollers Application Note 1. Introduction In a previous application note [AVR494], the implementation on an AT90PWM3 of an induction motor speed control loop using the constant Volts per Hertz principle and a natural pulse-width modulation (PWM) technique was described. A more sophisticated approach using a space vector PWM instead of the natural PWM technique is known to provide lower energy consumption and improved transient responses. The aim of this application note is to show that this approach, though more computationally intensive, can also be implemented on an AT90PWM3. 2. AT90PWM3 Key Features The control algorithms have been implemented on the AT90PWM3, a low-cost lowpower single-chip microcontroller, achieving up to 16 MIPS and suitable for the control of DC-DC buck-boost converters, permanent magnet synchronous machines, threephase induction motors and brushless DC motors. This device integrates: • 8-bit AVR advanced RISC architecture microcontroller (core similar to the ATmega 88) • 8K Bytes of In-System-Programmable Flash memory • 512 Bytes of static RAM to store variables and lookup tables dedicated to the • • • • • • application program 512 bytes of EEPROM to store configuration data and look-up tables one 8-bit timer and one 16-bit timer 6 PWM channels optimized for Half-Bridge Power Control an 11-channel 10-bit ADC and a 10-bit DAC 3 on-chip comparators a programmable watchdog timer with an internal oscillator 7546A–AVR–12/05 3. Theory of Operation 3.1 Principle of the Space-Vector Modulation Figure 3-1. Typical structure of an inverter-fed induction motor. Figure 3-1.shows the typical structure of a three-phase induction motor connected to a VSI (Voltage Source Inverter). Since the motor is considered as a balanced load with an unconnected Van = Va −Vn = (Vab −Vca) / 3 , Vbn =Vb −Vn = (Vbc −Vab) / 3 a n d n e u t r a l , V n = 〈 V a + V b + V c〉 ⁄ 3 , Vcn = Vc −Vn = (Vca −Vbc ) / 3 . Since the upper power switches can only be On or Off, and since the lower ones are supposed to always be in the opposed state (the dead-times of the inverter legs are neglected), there are only eight possible switching states, as shown on Figure 3-2. Six of them lead to non-zero phase voltages, and two interchangeable states lead to zero phase voltages. When mapped in a 2D-frame fixed to the stator using a Concordia transformation [1,2], the six non-zero phase voltages form the vertices of a hexagon. (See Figure 3-3.) ⎡Vα ⎤ ⎢ V ⎥ ⎣ β⎦ Figure 3-2. 2 = ⎡1 ⎢ ⎢⎣0 ⎡Van ⎤ ⎤⎢ ⎥ ⎥ ⎢Vbn ⎥ 3 / 2⎥ ⎦ ⎢V ⎥ ⎣ cn ⎦ − 1/ 2 − 1/ 2 3/2 − Possible switching configurations of a 3-phase inverter Application Note 7546A–AVR–12/05 Application Note As shown on Figure 3-3., the angle between two successive non-zero voltages is always 60 degrees. j (k π −1) 3 In complex form, these non-zero phase voltages can be written as V = E e , with k = 1..6 and V0 = V7 = 0 V. Table 3-1. shows the line-to-line and line-to-neutral voltages in each of the 8 possible configurations of the inverter. k Figure 3-3. Representation of the eight possible switching configurations in the Concordia reference frame Table 3-1. Switching configurations and output voltages of a 3-phase inverter Sa+ 0 0 0 0 1 Sb+ 0 0 1 1 0 Sc+ 0 1 0 1 0 Si Vab S0 0 S1 0 S2 -E S3 -E S4 E Vbc 0 -E E 0 0 Vca 0 E 0 E -E Van 0 -E/3 -E/3 -2E/3 +2E/3 Vbn 0 -E/3 +2E/3 -E/3 -E/3 Vcn 0 +2E/3 -E/3 -E/3 -E/3 Vα Vβ 0 0 -E/2 –E 3 ⁄ 2 -E/2 E 3⁄2 -E 0 E 0 –E 3 ⁄ 2 1 0 1 S5 E -E 0 E/3 -2E/3 E/3 E/2 1 1 0 S6 0 E -E E/3 E/3 -2E/3 E/2 E 3⁄2 0 0 1 1 1 S7 0 0 0 0 0 0 Vi V0 V5 V3 V4 V1 V6 V2 V7 3 7546A–AVR–12/05 Table 3-2. Expressions of the duty cycles in each sector In the Concordia frame, any stator voltage Vs = Vα + j Vβ = Vsm cos(θ ) + j Vsm sin(θ ) located inside this hexagon belongs to one of the six sectors, and can be expressed as a linear combination of the two non-zero phase voltages which delimit this sector: Vs = dk Vk + dk+1 Vk +1 . Equating dk Vk + dk+1 Vk +1 to Vsm cos(θ ) + j Vsm sin(θ ) in each sector leads to the expressions of the duty cycles shown in Table 3-2. Since the inverter cannot instantaneously generate Vs , the spacevector PWM principle consists in producing a Ts -periodic voltage whose average value equals Vs ,by generating Vk during Tk = d k Ts and Vk +1 during Tk +1 = d k +1Ts . Since d k + d k +1 ≤ 1 , these voltages must be completed over the switching period Ts by V0 and/or V7 . Several solutions are possible [3,4], and the one which minimizes the total harmonic distorsion of the stator current 1 − d k − d k +1 Ts . V0 is equally 2 applied at the beginning and at the end of the switching period, whereas V7 is applied at the middle. As an illustration, the upper side of Figure 3-4. shows the waveforms obtained in sector 1. T = T7 = consists in applying V0 and V7 during the same duration 0 4 Application Note 7546A–AVR–12/05 Application Note 3.2 Efficient Implementation of the SV-PWM Table 3-2. seems to show that the duty cycles have different expressions in each sector. A thorough study of these expressions show that since sin( x ) = sin(π − x ) , all these duty cycles can be written in a unified way as d k = θ ′ = θ − (k − 1) π 3 V sm sin(θ ′′) E 3 2 and d k +1 = V sm π −θ ′ sin(θ ′) , with θ ′′ = 3 E 3 2 and . Since these expressions no longer depend on the sector number, they can be π denoted as d a and db . Since θ ′ is always between 0 and 3 , computing d a and db requires a sine table for angles inside this interval only. This greatly reduces the amount of memory required to store this sine table. The AT90PWM3 provides the 3 power stage controllers (PSC) to generate the switching waveforms computed from the Space Vector algorythms. The counters will count from zero to a value corresponding to one half of the switching period (as shown on the lower side of Fig. 4), and then count down to zero. The values that must be stored in the three compare registers are given in Table 3-3. Figure 3-4. Inverter switch waveforms and corresponding compare register values 5 7546A–AVR–12/05 Table 3-3. 3.3 Compare Register Values vs Sector Number Sector Determination Algorithm To determine the sector which a given stator voltage Vs belongs to, some algorithms have been proposed in the literature which generally require many arithmetic operations and are based on the coordinates of Vs in the Concordia plane or in the a-b-c phase space. When this voltage is deduced from a V/f control principle, its modulus Vsm is computed by the V/f law recalled in the previous application note, and its phase θ is deduced from ω s by a discrete-time integrator. To implement this sector determination algorithm efficiently, we manage θ ′ and k instead of θ in a dedicated integrator shown on Fig. 6. The sector number k is the output of a modulo six counter activated each time θ ′ exceeds Figure 3-5. 6 π π , and θ ′ is confined to lie between 0 and (see Fig. 7). 3 3 Sector determination algorithm Application Note 7546A–AVR–12/05 Application Note Figure 3-6. Sector determination The resulting dataflow diagram, shown on Fig. 8, can be used to build a speed control loop (Figure 3-8.), in which the difference between the desired speed and the measured speed feeds a PI controller that determines the stator voltage frequency. To decrease the complexity of the controller, the input of the V/f law and of the space vector PWM algorithm is the absolute value of the stator voltage frequency. If the output of the PI controller is a negative number, two of the switching variables driving the power transistors of the inverter are interchanged. Figure 3-7. Space Vector PWM data flow diagram 7 7546A–AVR–12/05 Figure 3-8. Block diagram of the complete control system. 4. Hardware Description (ATAVRMC200) This application is available on the ATAVRMC200 evaluation board. This board provides a way to start and experiment asynchronous motor control. ATAVRMC200 main features: • AT90PWM3 microcontroller • 110-230VAC motor drive • Intelligent Power Module (230V / 400W board sized) • ISP & Emulator interface • RS232 interface • Isolated I/O for sensors • 0-10V input for command or sensor 5. Software Description All algorithms have been written in the C language using IAR's embedded workbench and AVR Studio as development tools. For the space vector PWM algorithm, a table of the rounded 2πk ) for values of 127 sin( k between 0 and 80 is used. The length of this table (81 bytes) is a 480 better trade-off between the size of the available internal memory and the quantification of the rotor shaft speed. For bi-directional speed control, the values stored in two of the comparators are interchanged when the output of the PI regulator is a negative number (see Figure 3-8.). 5.1 Project Description The software is available in the attached project on the Atmel web Site. The project to use is Project_Vector. The Project_Natural corresponds to the AVR494 Application Note. 8 Application Note 7546A–AVR–12/05 Application Note Table 5-1. List of Files used in the “Project_Vector”.IAR project. File 5.2 Description main_space_vector_PWM.c main upper level of the application space_vector_PWM2.c sector and theta determination controlVF.c Compute a constant V/F ratio mc_control.c regulation loop (PI) read_acquisitionADC.c return the ADC result init.c CPU initialization (IO ports, timers) psc_initialisation2.c PSC initialization adc.c ADC functions dac.c DAC functions Experimentation Figure 5-1. shows the speed response and the stator voltages obtained with the microcontroller for speed reference steps between +700 and -700 rpm. These experimental results were obtained with a 750 W induction machine. This figure shows that the desired speed is reached after a 1.2 s long transient, and that when the stator frequency ω s obtained at the output of the PI regulator nears zero, the stator voltage magnitude is equal to the boost voltage. These figures also confirm that transient obtained with a a space vector PWM is smoother but also longer. Figure 5-1. Measured speed (in rpm) and line-to-neutral stator voltage (in Volts) obtained with the microcontroller during speed reference steps speed [rpm] (a) 500 0 −500 −1 0 1 2 3 4 5 6 7 8 4 5 6 7 8 stator voltage [V] (b) 50 0 −50 −1 0 1 2 3 stator voltage [V] (c) 50 0 −50 3 3.02 3.04 3.06 3.08 3.1 time [s] 3.12 3.14 3.16 3.18 3.2 6. Resources Code Size : 2 584 bytes RAM Size : 217 bytes 9 7546A–AVR–12/05 CPU Load : 33% @ 8MHz 7. References 1. Atmel AVR494, AC Induction Motor Control Using the constant V/f Principle and a Natural PWM Algorithm. 2. W. Leonhard, “Control of electrical drives”, 2nd Ed, Springer, 1996. 3. F.A. Toliyat, S.G. Campbell, “DSP-based electromechanical motion control”, CRC Press, 2004. 4. Y.Y. Tzou, H.J. Hsu, “FPGA realisation of space-vector PWM control IC for three-phase PWM inverters”, IEEE Transactions on Power Electronics, Vol 12, No 6, pp 953-963, 1997. 5. K. Zhou, D. Wang, “Relation between space-vector modulation and three-phase carrier-based PWM”, IEEE Transactions on Industrial Electronics, Vol. 49, No. 1, pp 186-196, February 2002. 10 Application Note 7546A–AVR–12/05 Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Regional Headquarters Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Atmel Operations Memory 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 RF/Automotive Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 Microcontrollers 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60 ASIC/ASSP/Smart Cards 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80 Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743 Literature Requests www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically providedotherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’sAtmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. © Atmel Corporation 2005. All rights reserved. Atmel ® , logo and combinations thereof, are registered trademarks, and Everywhere You Are® are the trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. Printed on recycled paper. 7546A–AVR–12/05