AN205343 FM3 MB9B500 Series Phase Lock Loop This application note describes the phase lock loop in motor control about theory, block, function, flow, sample, parameter and so on. Contents 1 Introduction ...............................................................1 1.1 Purpose ...........................................................1 1.2 Definitions, Acronyms and Abbreviations ........1 1.3 Document Overview ........................................1 2 Purpose of PLL .........................................................2 2.1 Overview ..........................................................2 2.2 Field Oriented Control (FOC) ...........................2 2.3 Phase Lock Loop (PLL) ...................................3 3 PLL Theory ...............................................................5 1 Introduction 1.1 Purpose 4 5 6 7 8 PLL Estimate Parameter Introduce .......................... 6 4.1 Speed and angle estimator block diagram....... 6 4.2 The step of the estimate module ..................... 7 The flowchart of estimate module ............................. 8 Application ................................................................ 9 6.1 Function Description ........................................ 9 Additional Information ............................................... 9 Document History ................................................... 10 This application note describes the phase lock loop in motor control about theory, block, function, flow, sample, parameter and so on. 1.2 Definitions, Acronyms and Abbreviations FOC - Field Orient Control PLL - Phase Lock Loop 1.3 Document Overview The rest of document is organized as the following: Chapter 2 explains the purpose of PLL control. Chapter 3 explains the theory of PLL. Chapter 4 explains the introduction of the PLL estimate parameter . Chapter 5 explains the flowchart of estimate module. Chapter 6 explains the PLL application in Cypress solution. Chapter 7 explains the additional information. Chapter 8 explains the appendix. www.cypress.com Document No. 002-05343 Rev.*A 1 FM3 MB9B500 Series Phase Lock Loop 2 Purpose of PLL PLL arithmetic purpose introduces 2.1 Overview Current industry trends suggest the Permanent Magnet Synchronous Motor (PMSM) as the first preference for motor control application designers. Its strengths, such as high power density, fast dynamic response and high efficiency in comparison with other motors in its category, coupled with decreased manufacturing costs and improved magnetic properties, make the PMSM a good recommendation for large-scale product implementation. Cypress Semiconductor produces a wide range of Digital Signal Controllers (DSCs) for enabling efficient, robust and versatile control of all types of motors, along with reference designs of the necessary tool sets, resulting in a fast learning curve and a shortened development cycle for new products. 2.2 Field Oriented Control (FOC) In case of the PMSM, the rotor field speed must be equal to the stator (armature) field speed (i.e., synchronous). The loss of synchronization between the rotor and stator fields causes the motor to halt. Field Oriented Control (FOC) represents the method by which one of the fluxes (rotor, stator or air gap) is considered as a basis for creating a reference frame for one of the other fluxes with the purpose of decoupling the torque and flux-producing components of the stator current. The decoupling assures the ease of control for complex three-phase motors in the same manner as DC motors with separate excitation. This means the armature current is responsible for the torque generation, and the excitation current is responsible for the flux generation. In this application note, the rotor flux is considered as a reference frame for the stator and air gap flux. The control scheme for FOC is presented in Figure 1. This scheme was implemented and tested using the Cypress Inverter control platform, which can drive a PMSM motor using different control techniques without requiring any additional hardware. Figure 1. Sensorless FOC for PMSM Block Diagram ωr + ef - P I Iqref + - Idref + P I P I - Park- Vq Vd α,β Vβ Iq Id θesti m ω mR Vα 1 d,q A C Isα d,q α,β Pa rk I Position and speed Estimator Isβ sβ α,β a,b, c Clark e B Ib Ic Isα Vβ V α Softwar e www.cypress.com 3Phase Bridge SVPW M Document No. 002-05343 Rev.*A Hardwar e 2 FM3 MB9B500 Series Phase Lock Loop 2.3 Phase Lock Loop (PLL) The particularity of the FOC in the case of PMSM is that the stator’s d-axis current reference Idref(corresponding to the armature reaction flux on d-axis) is set to zero. The rotor’s magnets produce the rotor flux linkage, ΨPM, unlike ACIM, which needs a constant reference valueIdref, for the magnetizing current, thereby producing the rotor flux linkage. The air gap flux is equal to the sum of the rotor’s flux linkage, which is generated by the permanent magnets plus the armature reaction flux linkage generated by the stator current. For the constant torque mode in FOC, the d-axis air gap flux is solely equal to ΨPM, and the d-axis armature reaction flux is zero. On the contrary, in constant power operation, the flux generating component of the stator current, Id, is used for air gap field weakening to achieve higher speed. In sensorless control, where no position or speed sensors are needed, the challenge is to implement a robust speed estimator that is able to reject perturbations such as temperature, electromagnetic noise and so on. Sensorless control is usually required when applications are very cost sensitive, where moving parts are not allowed such as position sensors or when the motor is operated in an electrically hostile environment. However, requests for precision control, especially at low speeds, should not be considered a critical matter for the given application. The position and speed estimation is based on the mathematical model of the motor. Therefore, the closer the model is to the real hardware, the better the estimator will perform. The PMSM mathematical modelling depends on its topology, differentiating mainly two types: surface-mounted and interior permanent magnet. Each type has its own advantages and disadvantages with respect to the application needs. The proposed control scheme has been developed around a surface-mounted permanent magnet synchronous motor (Figure 2-2), which has the advantage of low torque ripple and lower price in comparison with other types of PMSMs. The air gap flux for the motor type considered is smooth so that the stator’s inductance value, Ld= Lq (non salient PMSM), and the Back Electromagnetic Force (BEMF) is sinusoidal. Figure 2. Surface Mounted PM PMSM Transversal Section Armature (Stator) Air gap Armature slots with Armature winding Rotor’s permanent magnets Rotor core Rotor shift The fact that the air gap is large (it includes the surface mounted magnets, being placed between the stator teeth and the rotor core), implies a smaller inductance for this kind of PMSM with respect to the other types of motors with the same dimension and nominal power values. These motor characteristics enable some simplification of the mathematical model used in the speed and position estimator, while at the same time enabling the efficient use of FOC.The FOC maximum torque per ampere is obtained by uninterruptedly keeping the motor’s rotor flux linkage situated at 90 degrees behind the armature generated flux linkage (see Figure 2-3). www.cypress.com Document No. 002-05343 Rev.*A 3 FM3 MB9B500 Series Phase Lock Loop Figure 3. FOC Phase Diagram (Base Speed) β jIsXs Umax RsIs Is=IIq Us E ψPM α In Figure 3 and Figure 4 jIsXs is voltage drop in the stator inductor. RsIs is voltage drop in the stator resistance. E is Back Electromotive Force. ψPM is rotor’s permanent magnets flux linkage. Us is stator terminal voltage. Considering the FOC constant power mode, the field weakening for the motor considered cannot be done effectively because of the large air gap space, which implies weak armature reaction flux disturbing the rotor’s permanent magnets flux linkage. Due to this, the maximum speed achieved cannot be more than double the base speed for the motor considered for testing. Figure 2-4 depicts the phase orientation in constant power – Field Weakening mode. Figure 4. FOC Phase Diagram (High Speed - FW) β Umax jIsXs RsIs Is E Us Iq ψPM α Id LsdI d www.cypress.com Document No. 002-05343 Rev.*A 4 FM3 MB9B500 Series Phase Lock Loop 3 PLL Theory Theory of PLL The estimator has PLL structure. Its operating principle is based on the fact that the d-component of the Back Electromotive Force (BEMF) must be equal to zero at a steady state functioning mode. The block diagram of the estimator is presented in Figure 5. Figure 5. PLL Estimator’s Block Schematic Par α,βk Esα Esβ Ed LP F Eq LP F d, q Edf Sign Eqf + θestim - 1 𝐾𝛷 Integrator ωmR Starting from the closed loop shown in Figure 5, the estimated speed (ωmR) of the rotor is integrated in order to obtain the estimated angle, as shown in Equation 1: Equation 1: 𝜃𝑒𝑠𝑡𝑖𝑚 = 𝜔 𝑚𝑅 𝑑𝑡 (1) The estimated speed, ωmR, is obtained by dividing the q-component of the BEMF value with the voltage constant, ΚΦ, as shown in Equation 2. Equation 2: 𝜔𝑚𝑅 = 1 𝐾𝛷 𝐸𝑞𝑓 − sign 𝐸𝑞𝑓 ∙ 𝐸𝑑𝑓 (2) Considering the initial estimation premise (the d-axis value of BEMF is zero at steady state) shown in Equation 2, the BEMF q-axis value,Eqf, is corrected using the d-axis BEMF value, Edf, depending on its sign. The BEMF d-q component’s values are filtered with a first order filter, after their calculation with the Park transform, as indicated in Equation 3. Equation 3: 𝐸𝑑 = 𝐸𝛼 cos 𝜃𝑒𝑠𝑡𝑖𝑚 + 𝐸𝛽 sin 𝜃𝑒𝑠𝑡𝑖𝑚 𝐸𝑞 = 𝐸𝛽 cos 𝜃𝑒𝑠𝑡𝑖𝑚 − 𝐸𝛼 sin 𝜃𝑒𝑠𝑡𝑖𝑚 (3) With the fixed stator frame, Equation 4 represents the stators circuit equations. www.cypress.com Document No. 002-05343 Rev.*A 5 FM3 MB9B500 Series Phase Lock Loop Equation 4: 𝐸𝛼 = 𝑉𝛼 − 𝑅𝑠 𝐼𝛼 − 𝐿𝑠 𝐸𝛽 = 𝑉𝛽 − 𝑅𝑠 𝐼𝛽 − 𝐿𝑠 𝑑𝐼𝛼 𝑑𝑡 𝑑𝐼 𝛽 (4) 𝑑𝑡 In Equation 4, the terms containing α – β were obtained from the three-phase system’s corresponding measurements through Clarke transform. LsandRs represent the per phase stator inductance and resistance, respectively, considering Y (star) connected stator phases. If the motor is Δ (delta) connected, the equivalent Y connection phase resistance and inductance should be calculated and used in the equations above. 4 PLL Estimate Parameter Introduce This section introduce the PLL estimate parameter Estimate module is the most important module in the software, it estimate the angle speed ωmR and position θestim of the rotor. 4.1 Speed and angle estimator block diagram Figure 6. Estimator Diagram 𝑉𝛼 Park 𝐼𝑠𝛼 𝑑 𝑑𝑡 Ls − +𝐸 𝑠𝛼 𝐸𝑑 α,β LP F 𝐸𝑑𝑓 − Rs Sig n 1 𝐾𝛷 Rs 𝐼𝑠𝛽 𝑉𝛽 𝑑 𝑑𝑡 Ls − − 𝐸𝑠𝛽 + d,q 𝐸𝑞 LP F 𝐸𝑞𝑓 + − 𝜔𝑚𝑅 Integrator 𝜃𝑒𝑠𝑡𝑖𝑚 + 𝑉𝛼 𝜃𝑒𝑠𝑡𝑖𝑚 𝑉𝛽 𝐼𝑠𝛼 𝐼𝑠𝛽 Estimato r 𝜔𝑚𝑅 Input variables for estimate block: α and β component of the current signal Isα, Isβ from Clarke transform α and β component of the stator voltage signal Vα, Vβ from SVM module Output variables by estimate block: Angle speed ωmRoutput to PI regulator for speed PI loop. Estimated position θestimoutput to park and park inverse transform. www.cypress.com Document No. 002-05343 Rev.*A 6 FM3 MB9B500 Series Phase Lock Loop 4.2 The step of the estimate module The estimator equations implemented in the application software are described as flows. step1 The BEMF voltages are calculated as shown in equation 5,6 . 𝐸𝑠𝛼 = 1.5 −𝐼𝑠𝛼 𝑅𝑠 − 𝐿𝑠 𝐸𝑠𝛽 = 1.5 −𝐼𝑠𝛽 𝑅𝑠 − 𝐿𝑠 𝑑𝐼𝑠𝛼 𝑑𝑡 𝑑𝐼 𝑠𝛽 𝑑𝑡 + 𝑉𝛼𝑛−1 (5) + 𝑉𝛽𝑛−1 (6) Where Esα is α component of the BEMF. Esβis β component of the BEMF. Vαn-1is α component of the stator voltage for previous cycle . Vβn-1is β component of the stator voltage for previous cycle. Rsis Winding Resistance. Lsis Winding Inductance. Figure 7. Motor Equal Circuit Is Vs Rs + Ls + es Motor − − Step 2 sin and cos value of the estimated rotor angle are calculated. cos(θestim) and sin(θestim) are used to express the sin and value of the estimated angle. Step 3 The calculated α-β components of the BEMF are transformed to the d-q coordinates. as shown in Equation 7,8. The transformation angle is the estimated flux angle θesti . 𝐸𝑑 = 𝐸𝑠𝛼 cos 𝜃𝑒𝑠𝑡𝑖𝑚 + 𝐸𝑠𝛽 sin 𝜃𝑒𝑠𝑡𝑖𝑚 (7) 𝐸𝑞 = 𝐸𝑠𝛽 cos 𝜃𝑒𝑠𝑡𝑖𝑚 − 𝐸𝑠𝛼 sin 𝜃𝑒𝑠𝑡𝑖𝑚 (8) Step 4 The d-q components of the BEMF Ed ,Eq should be filtered to reduce the noise. Edf,Eqfare the d-q components of the BEMF, which is filtered by LPF function. www.cypress.com Document No. 002-05343 Rev.*A 7 FM3 MB9B500 Series Phase Lock Loop Step 5 The estimated angular speed is calculated by the BEMF on the d-axis added or subtracted depending on the sign of BEMF on the q-axis. As equation shows 𝜔𝑚𝑅 = 𝐼𝑁𝑉𝐹𝐴𝑌𝑀 𝐸𝑞 −𝑠𝑖𝑔𝑛 𝐸𝑞 ∙𝐸𝑑 𝐼𝑁𝑉𝐹𝐴𝑌𝑀 = 2𝑛 (9) 1 𝑖𝑛𝑑𝑢𝑐𝑡 𝑣𝑜𝑙𝑡𝑎𝑔𝑒 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 The estimated angular speed should be limited to augment the stability and convergence of the estimator. On the other hand, if ωmR>max value of ωmR, it should be limited to max value of ωmR Step 6 Since there is the integral relationship between rotor position and angle speed. And the estimated rotor position θestim can be calculated by integrating the angle speed. 𝜃𝑒𝑠𝑡𝑖𝑚 = 5 𝜃𝑒𝑠𝑡𝑖𝑚 +𝜔 𝑚𝑅 ∙𝐷𝐸𝐿𝑇𝐴 _𝑇 2𝑛 (10) The flowchart of estimate module Figure 8. Flowchart of Estimate Module www.cypress.com Document No. 002-05343 Rev.*A 8 FM3 MB9B500 Series Phase Lock Loop 6 Application PLL application achieve in system code 6.1 Function Description The following code is the example for this module. /************************************************* Function Name: RunMotorCtrlAlgo C file name: DrvMotor_MCL.C, DrvMotor_MCL.H Input: WhichMFT Format: INT8S Function interface:void RunMotorCtrlAlgo(INT8S WhichMFT) *************************************************************/ void example_RunMotorCtrlAlgo () { WhichMFT=0; RunMotorCtrlAlgo(WhichMFT); } 7 Additional Information For more Information on MB9B500 Series Phase Lock Loop, visit the following websites: http://www.cypress.com/32bitarmcore/fm3 www.cypress.com Document No. 002-05343 Rev.*A 9 FM3 MB9B500 Series Phase Lock Loop 8 Document History Document Title: AN205343 - FM3 MB9B500 Series Phase Lock Loop Document Number: 002-05343 Revision ** ECN - Orig. of Change CBZH Submission Date Description of Change 08/27/2010 Initial release 03/24/2011 Changed the document format 06/26/2011 Redraw some picture and change the formula Format *A www.cypress.com 5264273 CBZH 06/07/2012 Changed the document format 05/10/2016 Migrated Spansion Application Note MCU-AN-510104-E-13 to Cypress format Document No. 002-05343 Rev.*A 10 FM3 MB9B500 Series Phase Lock Loop Worldwide Sales and Design Support Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find the office closest to you, visit us at Cypress Locations. PSoC® Solutions Products ® ® ARM Cortex Microcontrollers cypress.com/arm cypress.com/psoc Automotive cypress.com/automotive PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP Clocks & Buffers cypress.com/clocks Cypress Developer Community Interface cypress.com/interface Lighting & Power Control cypress.com/powerpsoc Memory cypress.com/memory PSoC cypress.com/psoc Touch Sensing cypress.com/touch USB Controllers cypress.com/usb Wireless/RF cypress.com/wireless Community | Forums |Blogs | Video |Training Technical Support cypress.com/support PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone Fax Website : 408-943-2600 : 408-943-4730 : www.cypress.com © Cypress Semiconductor Corporation, 2010-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited. TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in this document. Any information provided in this document, including any sample design information or programming code, is provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products. Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respective owners. www.cypress.com Document No. 002-05343 Rev.*A 11