From MATLAB® and Simulink® to Real Time with TI DSPs Sensored Field Oriented Control of a Permanent Magnet Synchronous Motor (PMSM) Content developed in partnership with Tel-Aviv University © 2007 Texas Instruments Inc, 0-1 Learning objectives • Review of Electromagnetic laws • Rotating magnetic fields • Structure of synchronous motors • Features of synchronous motors • BLDC and PMSM synchronous motor types • BLDC and PMSM control overview • Electro-mechanical parameters for a synchronous motor © 2007 Texas Instruments Inc, Slide 2 Field generated by a current I I Field B = k*n*I • A conductor carrying a current produces a magnetic field around it. I • A conductor that is wound into a coil produces a magnetic field along the axis of the coil. • The flux produced is proportional to the current through the coil and the number of turns in the coil. © 2007 Texas Instruments Inc, Slide 3 The Current in a Coil F1 d B1 I F2 B2 © 2007 Texas Instruments Inc, • A coil carrying a current, placed in a magnetic field experiences a force that will cause it to rotate. • This force is given as the vector cross product of the flux produced by the coil and the flux that is impressed by the external magnetic field. F1 F2 B1 x B2 T B1 B2 d Slide 4 Back EMF generation Magnet flux N S (rad / s ) a B e A Magnet rotating in front of winding “a” create an inductive voltage between A and B, e = VA-VB called Bemf (Back electromotive force) Magnetic flux seen by the winding is given by: 2 cos t Bemf is then equal to: d e ( t ) 2 sin( t ) E sin( t ) dt E 2 © 2007 Texas Instruments Inc, Slide 5 Pole pairs 2 pole pairs 1 pole pair N N SN e e(t ) E sin( t ) with S N N S e(t ) E sin( t ) with 2 For a motor with p poles pairs we have e p is the electrical frequency (rad/s) is the mechanical frequency (rad/s) or simply the speed of the machine. © 2007 Texas Instruments Inc, Slide 6 Three phases winding ia I s .e jt 2 j t 3 ib I S .e 4 jt 3 i I .e c S c ic N S ib b ia a ea E.e jpt 2 jpt 3 eb E.e 4 jpt 3 e E.e c For most three phase machines, the winding is stationery, and magnetic field is rotating Three phase machines have three stator windings, separated 120° apart physically Three phase stator windings produce three magnetic fields, which are spaced 120°in time © 2007 Texas Instruments Inc, Slide 7 Application to Three Phases Machine Operation Fundamentals Three stationary pulsating magnetic fields ia The Fc C three phase winding produces three magnetic fields, which are spaced 120° apart physically. When excited with three sine waves that are a 120° apart in phase, there are three pulsating magnetic fields. A` B Fa Fb B` C ` A Phase currents 1.50 ia 1.00 ib The resultant of the three magnetic fields is a rotating magnetic field. ic 0.50 0.00 1 24 47 70 93 116 139 162 185 208 231 254 277 300 323 346 -0.50 t -1.00 -1.50 © 2007 Texas Instruments Inc, Slide 8 Synchronous operation Three Three phase phaseAC AC current current Phase Phase11 Coil Coil11 Phase Phase22 Coil Coil22 Phase3 Phase3 Phase3 Phase3 Coil Coil Coil 3333 Coil © 2007 Texas Instruments Inc, Slide 9 Theory of operation: Rotor field A` C N N B S B` C ` S Stator field Rotor is carrying a constant magnetic field created either by permanent magnets or current fed coils The interaction between the rotating stator flux, and the rotor flux produces a torque which will cause the motor to rotate. A The rotation of the rotor in this case will be at the same exact frequency as the applied excitation to the rotor. This is synchronous operation. Rotor speed (rad/s) : gives p f : AC supply frequency (Hz) 60. f (r.pm) p Example: a 2 poles pair synchronous motor will run at 1500 r.pm for a 50Hz AC supply frequency p : motor poles pair per phase © 2007 Texas Instruments Inc, Slide 10 Electromechanical Parameters V i Es uL estator v I uL Simplified equivalent electrical scheme of a winding of a three phases synchronous motor Note: stator resistance neglected Tem 3VI cos © 2007 Texas Instruments Inc, Tem : electromec hanical torque ( N .m) V : phase voltage (V ) I : phase current ( I ) : motor rotation speed (rad / s) Slide 11 Synchronous Motor Rotor Construction non-salient rotor pole (p=1) © 2007 Texas Instruments Inc, non-salient rotor pole (p=2) salient rotor pole (p=2) Slide 12 Synchronous machine classification: BLDC and PMSM C F N A ` B B ` S F A C ` • Both (typically) have permanent-magnet rotor and a wound stator • BLDC (Brushless DC) motor is a permanentmagnet brushless motor with trapezoidal back EMF • PMSM (Permanent-magnet synchronous motor) is a permanent-magnet brushless motor with sinusoidal back EMF Back EMF of BLDC Motor 00 Phase A 300 600 900 1500 2100 2700 3300 300 900 1200 1800 2400 3000 3600 600 ia Back EMF of PMSM Ea e 1.50 ea eb ec 1.00 Hall A 0.50 Phase B e ib t 0.00 1 Hall B 24 47 70 93 116 139 162 185 208 231 254 277 300 323 346 -0.50 Phase C ic Hall C © 2007 Texas Instruments Inc, e -1.00 -1.50 Slide 13 BLDC vs. PMSM BLDC PMSM • Synchronous machine • Synchronous machine • Fed with direct currents • Fed with sinusoidal currents • Trapezoidal BEMF • Sinusoidal BEMF • Stator Flux position commutation each 60 degrees • Continuous stator flux position variation • Only two phases ON at the same time • Possible to have three phases ON at the same time • Torque ripple at commutations • No torque ripple at commutations © 2007 Texas Instruments Inc, Slide 14 Conclusion • Synchronous motors use magnetic interaction to convert electrical energy to mechanical. • Rotor must be synchronized with the rotating stator magnetic field in order to produce torque • Pole pair numbers and excitation frequency determine the mechanical rotation speed • Synchronous motors are classified in two categories: BLDC and PMSM • Each type require an appropriate control © 2007 Texas Instruments Inc, Slide 15 PMSM Control • Synchronous Motors such as PM motors and SynRMs are getting more popular because of their high power density and high efficiency • PM Assisted SynRM uses advantages of both PM and Reluctance motor • The vector control strategy is far more complicated than control of a DC motor requiring use of multiple control loops © 2007 Texas Instruments Inc, Slide 16 Control System Block-Diagram ref Inv. Park Transformation + - PI e* iqs e* ids + e* + PI - PI v qs e* v ds - Vdc s* v qs dqse dqss S V PWM s* v ds 3-phase Inverter r e iqs e ids s dq se dqss iqs s dqs s i ds abc Park Clarke Transformation Transformation PMASynRM Mechanical Speed and position of rotor © 2007 Texas Instruments Inc, Slide 17 Using the DMC Library Speed setpoint ref fb PID _IQ id_ref =0 Uout FC_PWM DRV ref fb PID _IQ Ipark_D PARKI theta Ipark_d Vq SV_GEN DQ _IQ Ta mfunc_c1 PWM1B Tb mfunc_c2 PWM2A Tc mfunc_c3 PWM2B mfunc_p PWM3A Q0 / HW 3-Phase Inverter _IQ ref fb Uout PWM1A PID _IQ Uout Ipark_Q Ipark_q Vd PWM3B park_D PARK _IQ park_d clark_d theta CLARK _IQ clark_a Ia_out clark_b Ib_out ILEG2 DRV LEG_A LEG_B _IQ park_Q park_q clark_q clark_c Q15 Q15 Q13 Q13 speed_frq SPEED FRQ shft_angle theta_elec theta_mech QEP THETA DRV Ia_gain Ib_gain Ia_offset Ib_offset QEP QEP_A PMSM QEP_A Motor _IQ speed_rpm direction dir_QEP _IQ QEP_index index_sync_flg © 2007 Texas Instruments Inc, Slide 18 The Equivalent Simulink® Model PI iqs vqs * PI ids* PI * vds * vas Ta * Space Tb Inv. Vector Park vbs* Gen. T c PWM Driver Voltage Source Inverter qlr ids iqs wr SMOSPD speed estimation PWM1 PWM2 PWM3 PWM4 PWM5 PWM6 ias Park qlr qm dir ibs Clarke ias Ileg2_ Bus ibs Driver QEP_A Ramp QEP Gen. driver ADCIN1 ADCIN2 ADCIN3 Encoder PMSM QEP_B QEP_inc TMS320F28x controller © 2007 Texas Instruments Inc, Slide 19 Hardware Setup I/O Power Supply 5V P6 Parallel Port Encoder Permanent Magnet Synchronous Motor analog eZdsp 2812 DMC 550 P7 P3 P4 P5 Motor phases Power Supply 24 Volts 4 Amps + - Encoder signal 2 Power inputs: •5V PSU for the DSP board only (software debug) •0 - 24V PSU for the power stage © 2007 Texas Instruments Inc, Slide 23 Synchronous Reluctance Motor Two pole singly salient SynRM © 2007 Texas Instruments Inc, Two pole doubly salient Switched RM Slide 24 Background d-q axes voltage and flux equations: d ds Llsids Lmd ids Ldsids vd rs ids ds r qs vq rs iqs dt dqs dt r ds Torque equation: qs Llsiqs Lmqiqs m Lqsiqs m rs I s Vds ~ Vs 3P dsiqs qsids Te 22 Te 3P ( Lds Lqs ) I dsI qs 22 I ds I s cos jX qs I qs I qs jX ds I ds I ds q-axis Vqs ~ Is d-axis I qs I s sin © 2007 Texas Instruments Inc, Slide 25 Output Torque in MASynRM di vds rs ids Lds ds r ( Lqsiqs m ) dt vqs rs iqs Lqs © 2007 Texas Instruments Inc, diqs dt Te 3 P mids ( Lds Lqs ) idsiqs 2 2 r Ldsids Slide 26 The PMS Motor Model © 2007 Texas Instruments Inc, Slide 27 Model-Based Design of a PMSM • Build Level 1 – Space vector generation • Build Level 2 - Currents/DC-bus voltage measurement verification • Build Level 3 - Tuning of dq-axis current closed loops • Build Level 4 – Encoder verification • Build Level 5 – Speed closed loop © 2007 Texas Instruments Inc, Slide 28 Space vector generation - Simulation © 2007 Texas Instruments Inc, Slide 29 Space vector generation – Real Time key modules under test Vq_testing Vd_testingvds * Ta Inv. Park vbs* Space Tb Vector Gen. Tc vas * PWM1 PWM2 PWM3 PWM Driver Ramp control PWM5 PWM6 Voltage Source Inverter rmp_out speed_ref PWM4 Ramp Gen. PMSM TMS320F28x controller © 2007 Texas Instruments Inc, Slide 30 Currents/DC-bus voltage measurement verification - Simulation © 2007 Texas Instruments Inc, Slide 31 Currents/DC-bus voltage measurement verification – Real Time PWM1 * Ta Inv. Vq_testingvds* Park vbs* Space Tb Vector Gen. Tc Vq_testing vas PWM2 PWM3 PWM Driver PWM4 PWM5 PWM6 Voltage Source Inverter e ids iqs Speed_ref ias Park ia ibs Clarke ib ADCIN1 Ileg2_ Bus Driver ADCIN2 ADCIN3 Encoder Ramp control Ramp Gen. rmp_out PMSM TMS320F28x controller © 2007 Texas Instruments Inc, Slide 32 Tuning of dq-axis current closed loops - Simulation © 2007 Texas Instruments Inc, Slide 33 Tuning of dq-axis current closed loops – Real Time key module under test vqs* Iq_ref PI Id_ref ids * PI vds* vas PWM1 Ta * Space Tb Inv. Vector Park vbs* Gen. Tc PWM Driver PWM2 PWM3 PWM4 PWM5 PWM6 Voltage Source Inverter rmp_out ids iqs Speed_ref ias Park ibs ia Clarke ib ADCIN1 Ileg2_ Bus Driver ADCIN2 ADCIN3 Encoder Ramp control Ramp Gen. PMSM TMS320F28x controller © 2007 Texas Instruments Inc, Slide 34 Encoder verification - Simulation © 2007 Texas Instruments Inc, Slide 35 Encoder verification – Real Time vqs Iq_ref PI vds Id_ref vas * * PI Ta * Space Tb Inv. Vector Park vbs* Gen. Tc PWM Driver PWM1 PWM2 PWM3 PWM4 PWM5 PWM6 Voltage Source Inverter rmp_out ids iqs Speed_ref Ramp control Ramp Gen. Park ias ia ibs Clarke ib ADCIN1 Ileg2_ Bus Driver Theta_ele c Ramp QEP m dir Gen. driver ADCIN2 ADCIN3 Encoder QEP_A PMSM QEP_B QEP_inc TMS320F28x controller © 2007 Texas Instruments Inc, Slide 36 Speed closed loop - Simulation © 2007 Texas Instruments Inc, Slide 37 Speed closed loop – Real Time iqs * vqs PI PI ids * vds * vas * PI Ta * Space Tb Inv. Vector Park vbs* Gen. Tc PWM Driver PWM1 PWM2 PWM3 PWM4 PWM5 PWM6 Voltage Source Inverter r ias ids iqs r SMOSPD speed estimation Park ias ibs Clarke ibs r QEP m Ramp dir Gen. driver ADCIN1 Ileg2_ Bus Driver ADCIN2 ADCIN3 Encoder QEP_A PMSM QEP_B QEP_inc TMS320F28x controller © 2007 Texas Instruments Inc, Slide 38