AN205342 FM3 MB9B500 Series Space Vector Pulse Width Modulation This application note describes SVPWM function theory, block, function, flow, sample, parameter in ARM Inverter Platform. Contents 1 2 Introduction .................................................................. 1 1.1 Purpose .............................................................. 1 SVPWM Theory ........................................................... 1 2.1 Overview ............................................................. 1 2.2 Theory ................................................................. 2 2.3 SVPWM Actualize ............................................... 5 1 Introduction 1.1 Purpose 2.4 SVPWM Arithmetic in CM-3 ................................ 6 2.5 Starting Flash Memory Automatic Algorithm ..... 10 3 Additional Information ................................................ 10 Document History............................................................ 11 This application note describes SVPWM function theory, block, function, flow, sample, parameter in ARM Inverter Platform. 2 SVPWM Theory Theory of SVPWM 2.1 Overview In motor theory, motor speed defines by the formula: (1) Where f means Power frequency, p means pole pairs Through the formula ,speed regulate need change the power frequency or the motor pole pairs, and change power frequency easier than change motor pole pairs, so, at present, the great mass of motor speed regulate use frequency convert. How to change power frequency? Currently, use the type of: AC-DC-AC. It means, converting 3-phase power AC into DC, then, inverter the DC into 3-phase AC and change frequency. First, define the 3-phase power AC interphase voltage is: (2) Take this 3-phase AC voltage into stationary system (α-β): (The formulae deduce please reference the [AN] coordinate transform Clarke Transform formulae (12)) (3) Take this into voltage space vector: (4) www.cypress.com Document No. 002-05342 Rev. *A 1 FM3 MB9B500 Series Space Vector Pulse Width Modulation In sine power: (5) This equation is circularity in plural plane. So, in motor theory, invariableness voltage (U) and frequency, stator voltage space vector in plural plane move along with circularity, and space vector move a cycle in a power frequency cycle. Figure 1. Voltage Space Vector Figure 1, the line voltage space vector will move other circularity, it’s radius more than phase voltage circularity and they have 30° phase angle. , In stator 3-phase voltage space vector will move along with a circularity (start)into another circularity(stabile). The SVPWM use to regulate power frequency and draw a nice circularity through DC–AC part. 2.2 Theory SVPWM: Space Vector Pulse Width Modulation. Purpose: SVPWM can directly transform the stator voltage vectors from the two-phase α,β-coordinate system into pulse-width modulation (PWM) signals (duty cycle values). proverbial motor formulae is : (6) is stator voltage vector, is stator flux vector, is stator current vector. When is a standard sine wave, that is the same size and direction continuous change, the trajectory is an ideal circle. So, (7) When R1 *i1<<U1: (8) flux trajectory depends on voltage vector. So we can design the circuit of DC to 3-phase AC www.cypress.com Document No. 002-05342 Rev.*A 2 FM3 MB9B500 Series Space Vector Pulse Width Modulation Figure 2. Circuit of DC to 3-Phase AC As shown in Figure 2, in the circuit diagram, have 6 power switch a,b,c, [ ], they control the switch ON/OFF, and they mutex, , plot out they into 2 groups, S[ a,b,c] , it’s means each voltage vector is coded by the three-digit number and have eight possible switching states (vectors) are feasible. for example: =[1,0,0] the point [a], [b’], [c’] swith ON, and [a’], [b], [c]swith OFF. In motor theory, take into the formula, The same, can calculate other switching states, below in Table 1. Table 1. Three-phase Voltage among Different Vector Sa Sa Sa Vector UaN UbN UcN Ua Ub Uc 0 0 0 U0 0 0 0 0 0 0 1 0 0 U4 Udc 0 0 2Udc/3 - Udc/3 - Udc/3 1 1 0 U6 Udc Udc 0 Udc/3 Udc/3 - 2Udc/3 0 1 0 U2 0 Udc 0 - Udc/3 2Udc/3 - Udc/3 0 1 1 U3 0 Udc Udc - 2Udc/3 Udc/3 Udc/3 0 0 1 U1 0 0 Udc - Udc/3 - Udc/3 2Udc/3 1 0 1 U5 Udc 0 Udc Udc/3 - 2Udc/3 Udc/3 1 1 1 U7 0 0 0 0 0 0 Form formula (3) and (4), the voltage space vector formula: (9) Where www.cypress.com Document No. 002-05342 Rev.*A 3 FM3 MB9B500 Series Space Vector Pulse Width Modulation Take Table 1 vector: (10) All of non-zero vectors have the same amplitude example, f=50Hz, the vector change time: , and between border two vectors angle is , for . Graphical representation of all combinations is the hexagon shown in Figure 3. There are six non-zero vectors, U0, U60, U120, U180, U240, U300, and two zero vectors, O000 and O111, defined in α, β coordinates. Figure 3. Voltage Space Vector In Figure 3, the red line plot out the hexagon into six sectors, every between border two vectors angle is 60°, the border two vectors and zero vector could compose random voltage vector. (11) Or (12) This formula means, in sector the voltage vector rotating course could plot out many small part , it’s have the same effect. So, in the interest of bring 3-phase sine AC voltage, use the voltage vector compose, begin from U4(100),every time increase a little increment, every increment could compose from between border two vectors and zero vector. Then the enactment voltage vector equivalent with the rotating voltage vector, and that all is SVPWM. The Figure 4 show the SVPWM transform course, a f = 50Hz single phase voltage transform into DC voltage, then transform into a f=100Hz 3-phase voltage. www.cypress.com Document No. 002-05342 Rev.*A 4 FM3 MB9B500 Series Space Vector Pulse Width Modulation Figure 4. Transform Course with SVPWM DC AC f=50Hz 2.3 AC f=100Hz SVPWM Actualize 3-phase AC voltage rotating speed : , rotating a cycle need time T=1/f, if carrier wave frequence is , the frequence ratio , it’s means voltage rotating plane plot out R unit increment , so the voltage vector increment angle is For example, need compose a voltage vector , it’s station at I at sector first increment, then will use two non-zero vector(U4,U6) and two zero vector(U0,U7), shown the Figure 4. Figure 5. Decomposing Process of Voltage Space Vector In stationary system 2-phase (α-β), the with U4 angle is θ, then (13) Because: , the vector hold time is (14) Where m is SVPWM regulate ratio: Then zero vector hold time: For reduce the switch waste, every time only change one phase switch state, and the best sequence is below the Table 2. www.cypress.com Document No. 002-05342 Rev.*A 5 FM3 MB9B500 Series Space Vector Pulse Width Modulation Table 2. Best Switch Sequence with least waste Uref switch sequence I sector (0 ≤θ≤60 ) 0-4-6-7-7-6-4-0 II sector (60 ≤θ≤120 ) 0-2-6-7-7-6-2-0 III sector (120 ≤θ≤180 ) 0-2-3-7-7-3-2-0 IV sector (180 ≤θ≤240 ) 0-1-3-7-7-3-1-0 V sector (240 ≤θ≤300 ) 0-1-5-7-7-5-1-0 VI sector (300 ≤θ≤360 ) 0-4-5-7-7-5-4-0 Then use the Table 2, after voltage rotating a cycle, will have R R unit compose vector, and in I sector have 3-phase voltage wave shown in Figure 5. Figure 6. Voltage Ware In one Sector 2.4 SVPWM Arithmetic in CM-3 In ARM Inverter platform SVPWM compose sina wave need have 4 steps: 2.4.1 1. Make sure the 2. To calculate X, Y, Z which are used to determine open time of 2 adjacent basic vector. 3. To determine each conduction time for 2 adjacent basic vector. 4. To determine To write OCCP register value to CH1,CH3,CH5 which used to create SVPWM waveform Make sure the Fuction Application belong to which sector. belong to which sector Function: To calculate sector no. of SVPWM voltage vector. Function Name: CalcSectorNo C file name: SVPWM.C, SVPWM.H Function interface: INT8U CalcSectorNo(_stDataInFixAxis *pstDataInFixAxis //fixed 2-axis system) typedef struct { Q15_VAL32 alpha_Q15;// Q15_VAL32 beta_Q15;// }_stDataInFixAxis www.cypress.com Document No. 002-05342 Rev.*A 6 FM3 MB9B500 Series Space Vector Pulse Width Modulation Table 3. Input and Output of the Function ClacSectorNo Item Name Description Format alpha phase- alpha of fixed 2- phase Q15_VAL32 beta phase- beta of fixed 2- phase Q15_VAL32 SectorNo Sector no. of SVPWM voltage vector Q15_VAL32 Inputs Outputs The following code is the example for this module. void { example_ CalcSectorNo () CurrentInFixAxis. alpha_Q15= INa;//Input alpha CurrentInFixAxis. beta_Q15= INb;//Input beta CalcSectorNo (&pstDataInFixAxis); OUTa= SectorNo; } 2.4.2 D e t e r m i n e o p e n t i m e o f 2 a d j a c e n t b a s i c ve c t o r Fuction Application Function:To calculate X,Y,Z which are used to determine open time of 2 adjacent basic vector. Function Name: CalcDutyTime C file name: SVPWM.C, SVPWM.H void CalcDutyTime(_stDataInFixAxis *pstDataInFixAxis, _stXYZ *pstXYZ, INT8U WhichMFT, INT8U WhichFRTCh) typedef struct { Q15_VAL32 alpha_Q15; Q15_VAL32 beta_Q15; }_stDataInFixAxis; Table 4. Inputstruct and Output of the Function ClacDutyTime typedef { Item Name Description Format INT32S X; INT32S Y; alpha phase- alpha of fixed 2- phase Q15_VAL32 INT32S Z; beta phase- beta of fixed 2- phase Q15_VAL32 }_stXYZ; Inputs Outputs www.cypress.com WhichMFT Which MFT, valid value is MFT0, MFT1 INT8U WhichFRTCh Which FRT channel to configure INT8U X X is conduction time INT32S Y Y is conduction time INT32S Z Z is conduction time INT32S Document No. 002-05342 Rev.*A 7 FM3 MB9B500 Series Space Vector Pulse Width Modulation The following code is example for this module. Function: To calculate X,Y,Z which are used to determine open time of 2 adjacent basic vector. void example_ CalcDutyTime () { pstDataInFixAxis. alpha_Q15= INa;//Input alpha pstDataInFixAxis. beta_Q15= INb;//Input beta WhichMFT=0; WhichFRTCh=0; CalcDutyTime (&pstDataInFixAxis,& pstXYZ, WhichMFT, WhichFRTCh); OUTa= pstXYZ->X; OUTb= pstXYZ->Y; OUTc= pstXYZ->Z; } typedef struct { INT32S X; INT32S Y; INT32S Z; }_stXYZ; 2.4.3 Calculate conduction time Function Application Function: To determine each conduction time for 2 adjacent basic vector. Function Name: CalcTon C file name: SVPWM.C, SVPWM.H void CalcTon(INT8U SectorNo, _stXYZ *pstXYZ, _stOnTimingOfUVW *pstOnTimingOfUVW, INT8U WhichMFT, INT8U WhichFRTCh) typedef struct { INT32S X; INT32S Y; INT32S Z; }_stXYZ; typedef struct { INT32S TU; INT32S TV; INT32S TW; }_stOnTimingOfUVW; www.cypress.com Document No. 002-05342 Rev.*A 8 FM3 MB9B500 Series Space Vector Pulse Width Modulation Table 5. Input and Output of the Function ClacTon Item Name Description Format X X is conduction time INT32S Y Y is conduction time INT32S Z Z is conduction time INT32S SectorNo Sector no. of SVPWM voltage vector INT8U WhichMFT Which MFT, valid value is MFT0, MFT1 INT8U WhichFRTCh Which FRT channel to configure INT8U TU Conduction time of A phase connecting to DC power supply INT32S TV Conduction time of B phase connecting to DC power supply INT32S TW Conduction time of C phase connecting to DC power supply INT32S Inputs Outputs The following code is example for this module. void { example_ CalcTon () pstXYZ .X= INa; pstXYZ .Y = INb; pstXYZ .Z=INc; SectorNo=1; WhichMFT=0; WhichFRTCh=0; CalcTon (SectorNo ,& pstXYZ,& pstOnTimingOfUVW, WhichMFT, WhichFRTCh); OUTa= pstOnTimingOfUVW ->TU; OUTb= pstOnTimingOfUVW ->TV; OUTc= pstOnTimingOfUVW ->TW; } 2.4.4 C r e a t e S V P W M w a ve f o r m Fuction Application Function: To determine To write OCCP register value to CH1,CH3,CH5 which used to create SVPWM waveform Function Name: WriteCmpValToReg C file name: SVPWM.C, SVPWM.H void WriteCmpValToReg(INT8U WhichMFT, _stOnTimingOfUVW *pstOnTimingOfUVW) typedef struct { INT32S TU; INT32S TV; INT32S TW; }_stOnTimingOfUVW; www.cypress.com Document No. 002-05342 Rev.*A 9 FM3 MB9B500 Series Space Vector Pulse Width Modulation Table 6. Input and Output of the Function WriteCmpValToReg Item Name Description Format TU Conduction time of A, phase connecting to DC power supply INT32S TV Conduction time of B, phase connecting to DC power supply INT32S TW Conduction time of C phase connecting to DC power supply INT32S WhichMFT Which MFT, valid value is MFT0, MFT1 INT8U Inputs The following code is example for this module. void { example_ WriteCmpValToReg () pstOnTimingOfUVW .TU=INa; pstOnTimingOfUVW .TV=INb; pstOnTimingOfUVW .TW=INc; WhichMFT=0; WriteCmpValToReg (WhichMFT,& pstOnTimingOfUVW); } 2.5 Starting Flash Memory Automatic Algorithm There are three types of commands that invoke the flash memory automatic algorithm: read/reset, write (program) and chip-erase. Figure 7 lists commands used in programming/erasing flash memory. Figure 7. Command Sequence 3 Additional Information For more Information on Cypress semiconductor products, visit the following website: www.cypress.com/32bitarmcore/fm3 www.cypress.com Document No. 002-05342 Rev.*A 10 FM3 MB9B500 Series Space Vector Pulse Width Modulation Document History Document Title: AN205342 - FM3 MB9B500 Series Space Vector Pulse Width Modulation Document Number: 002-05342 Revision ECN Orig. of Change ** — CCTA *A 5260574 CCTA www.cypress.com Submission Date Description of Change 03/24/2011 Initial release. 06/06/2012 Change the document format. 05/09/2016 Migrated Spansion Application note from MCU-AN-510103-E-11 to Cypress format. Document No. 002-05342 Rev.*A 11 FM3 MB9B500 Series Space Vector Pulse Width Modulation 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 PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP Automotive cypress.com/automotive Cypress Developer Community Clocks & Buffers cypress.com/clocks 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 Forums | Projects | Videos | Blogs | Training | Components Technical Support cypress.com/support PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corporation. 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, 2011-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-05342 Rev.*A 12