See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/325936864 Vector control of PMSM using TI's launchpad F28069 and MATLAB embedded coder with incremental build approach Conference Paper · December 2017 DOI: 10.1109/ICPES.2017.8387393 CITATIONS READS 4 619 4 authors, including: Hrishikesh Mehta Aishwarya Apte Aethertec Innovative Solutions AISSMS-All India Shri Shivaji Memorial Society 19 PUBLICATIONS 81 CITATIONS 12 PUBLICATIONS 143 CITATIONS SEE PROFILE Vrunda Joshi Savitribai Phule Pune University 25 PUBLICATIONS 433 CITATIONS SEE PROFILE Some of the authors of this publication are also working on these related projects: Analysis of PMSM Motor View project Auto-navigation of Car type mobile robot View project All content following this page was uploaded by Hrishikesh Mehta on 09 November 2021. The user has requested enhancement of the downloaded file. SEE PROFILE 2017 7th International Conference on Power Systems (ICPS) College of Engineering Pune, India. Dec 21-22, 2017 Vector Control of PMSM Using TI’s Launchpad F28069 and MATLAB Embedded Coder with Incremental Build Approach Hrishikesh Mehta∗ , Aishwarya Apte† , Swapnil Pawar∗ and Vrunda Joshi∗ ∗ Department of Electrical Engineering, PVG’s College of Engineering And Technology, Pune - 411009. Email: mehta.hrishi@gmail.com † Department of Electrical Engineering, AISSMS’s College of Engineering, Pune - 411001. sufficient knowledge of the microprocessor/micro-controller being used. This may require lot of time and effort and yet may not yield fruitful results thus discouraging further research in this field. Texas Instrument’s F28069 Launchpad [?], [?] with DRV8301 inverter booster pack is explored in this paper to overcome these coding efforts. F28069 Launchpad is a high performance, low power and cost effective development board which is packaged with all features required to control PMSM. It can be programmed using Embedded Coder package in academically widely used MATLAB/Simulink software environment thus eliminating the need to write embedded C code for implementing complex algorithms. A simulation model of closed-loop vector control for PMSM is provided by MATLAB along with its Embedded Coder support package for C2000 controllers. This model can be used to directly program the F28069 Launchpad. However, it was found during the testing of this model that implementing this algorithm directly for PMSM still involved challenges like calibrating the current sensors and encoder and tuning the parameters of all three PID controllers of this complex vector control scheme. It was observed that without proper calibration and tuning of control parameters the results of this scheme are unpredictable. Novelty of the work reported in this paper lies in the approach for implementation of vector control for PMSM using MATLAB and TI’ s Launchpad using incremental build level. This approach is similar to the strategy followed while implementing embedded C code on TI’s DSP processors [?], [?], [?]. The advantage of this scheme is that the parameters can be tuned independently and its results can be validated at each step. After introduction section, the organization of the paper is as follows: Section II covers the mathematical model for PMSM and brief theory on Vector Control. Section III gives an overview of the hardware used in implementation. Details of TI’s Launchpad F28069 and BOOSTXL-DRV8301 along with the software platform is presented in this section. The simulation model using MATLAB Embedded Coder and its step-wise implementation is discussed in Chapter Section IV. Incremental build models along with its results are explained in this chapter. Section V concludes the paper with some highlights for future scope. Abstract—Vector control (field oriented control) is a widely used method to control PMSM as it improves the response of the drive by decoupling torque and flux. However, it is difficult to directly implement the closed-loop algorithm on any hardware platform due to its complexity. This paper proposes an approach to implement the vector control scheme by using the incremental build levels specially designed for TI’s Launchpad F28069. In this paper, the closed-loop Field-Oriented Control (FOC) algorithm is implemented to control a three-phase 60W Permanent Magnet Synchronous Motor (PMSM) using TI’s Launchpad F28069 and MATLAB Embedded Coder. Effectiveness of the scheme is evaluated using simulation and experimental results. Major advantage of this approach is that performance of the drive can be validated at each build level. Keywords: PMSM, TI Launchpad F28069, Vector Control, DRV 8301, MATLAB Embedded Coder I. I NTRODUCTION Permanent magnet synchronous motors (PMSM) have been the subject to interest for researchers for last few years as it has numerous advantages over traditionally used induction motor and dc motors for drive and automotive applications [?], [?], [?]. These motors are highly efficient, have high torque to weight ratio, maintenance free operation, high speed operation [?], [?], [?]. Space vector pulse width modulation (SVPWM) is most preferred method for operation of PMSM as it enables better utilization of DC voltage which is applied to the inverter drive [?], [?]. A complex vector control strategy is implemented for control of speed and torque of the motor. Vector control decouples torque and flux using robust mathematics where precise rotor position information is obtained by an encoder attached to the rotor shaft or by implementing a observer to estimate the position thus giving faster separately excited DC motor like control over the motor [?], [?]. One of the challenging aspects for implementation of vector control algorithm is its coding for any selected microcontroller or digital signal processor based platform. Also a collective effort needs be exercised for building required hardware modules for that platform. This process requires one to have highly efficient programming skills, hands-on experience in building and using electronic circuitry, in-depth theoretical background knowledge of the scheme to be implemented and 978-1-5386-1789-2/17/$31.00 ©2017 IEEE 1 II. M ATHEMATICAL M ODEL OF PMSM Mathematical model of PMSM in the two-phase rotated coordinate can be expressed as follows [?], [?], [?], [?]: The voltage equations in d − q reference frame can be expressed as: ud = Rs id + ρφd − ωr φq uq = Rs iq + ρφq − ωr φd (1) (2) where Rs is the stator winding resistance, id and iq are currents in dq-frame, ρ is a differential operator (d/dt), ωr is mechanical speed and φd and φq are dq-axis stator flux linkages. The flux-linkage equations can be expressed as: φ d = Ld id + φ f φ q = Lq iq Fig. 2. Project Workbench (3) (4) transformation, SVPWM unit and inverter and is shown in Fig. ??. The principle of operation is as follows: The desired speed signal is compared with measured speed obtained from the encoder pulses. This difference is given as input to the PI speed controller. The output of the PI speed controller is given as input to the q-axis PI current controller. Reference value given to the d-axis PI current controller is 0 to achieve maximum torque condition. The output of d-axis PI current controller and q-axis PI current controller is ud and uq . Values of uα and uβ are calculated using the inverse Park’s transformation. SVPWM module generates 6 PWM signals for the inverter based on the values of uα and uβ and thus drives the PMSM. Where, Ld and Lq are dq-axis inductances and φf is the flux linkage of the rotor permanent magnets linking the stator. The electromagnetic torque equation is expressed as: Te = pn (φd iq − φq id ) (5) and the motion equation is expressed as: Jρωr = Te − Bωr − TL (6) Where, pn is number of poles, J is rotational inertia, TL is load torque and B is viscous friction coefficient. To achieve maximum torque in a typical vector controlled speed drive for PMSM, the value of flux producing component of current i.e. id is kept 0 [?]. When id = 0, the torque equation is expressed as: T e = pn φ f i q (7) III. H ARDWARE AND S OFTWARE D ETAILS A. Hardware Configuration The experimental setup in this paper consists of the following hardware components: 1) 3-ph, 60W, 3000RPM PMSM with an incremental encoder; 2) Loading arrangement (i. e. PMDC machine as a Generator coupled to the shaft of PMSM); 3) DC Power Supply (0-30V, 3A Regulated); 4) F28069 Launchpad; 5) Booster pack DRV 8301; 6) A compatible PC with Code Composer Studio (CCS), controlSUITE and MATLAB/Simulink along with Embedded Coder support package for TI controllers installed; 7) Additional instruments like oscilloscope and digital multimeter. A photograph of entire test setup is shown in Fig. ??. 1) 60W, 3-ph PMSM coupled to a PMDC machine: In this setup, a 24V, 60W, 0.18N-m, 3000 rpm, 8-pole PMSM with a 1000ppr incremental encoder is mechanically coupled with a PMDC machine. PMDC machine acts as a generator and can be connected to a electrical load (in this case a rheostat) which will indirectly load the PMSM when it is driven. With this setup motor can be fully loaded. 2) Launchpad F28069 and DRV8301 Booster Pack: TI’s F28069 Piccolo Launchpad is an inexpensive evaluation platform with all necessary features required to control a PMSM. Fig. 1. The principle of id = 0 control To achieve vector control, each physical quantity is transformed into DC parameters using co-ordinate transform. Therefore, a PMSM can be controlled as a DC motor. In vector control, flux and torque producing components of current are decoupled, where flux is proportional to id and electromagnetic torque is proportional to iq . The whole system is composed of speed loop, current loop, speed and rotor position detection, stator three-phase current detection, coordinate 2 challenging as it involves proper tuning of three PID controllers, calibration of current sensors and their equivalent numerical conversions and encoder calibration for speed and position measurements. To check whether each section of the algorithm as well as hardware works correctly, the model is implemented in incremental steps called as build levels. Implementation starts with very minimal and basic blocks required to run the motor and finishes with all blocks of closed loop vector control scheme. Strategically, incremental build levels for F28069 Launchpad using MATLAB/Simulink are organized in following sequence: Build Level 1: Space Vector PWM Generation using F28069 Build Level 2: Running the PMSM in open loop using generated SVPWM Pulses Build Level 3: Closing the PID controller of current loop Build Level 4: Calibrating Encoder Build Level 5: Implementing the complete speed control. It has dedicated PWM pins to drive the inverter module, ADC channels for current measurement and dedicated QEP pins to be connected to an incremental encoder to sense the speed and position of the motor. The controller used on this board is TMS320F28069M. DRV 8301 booster pack contains a 24V, 10A, three-phase MOSFET-based H-bridge inverter along with shunt resistances (one in each phase) used for current measurement. This module is directly mounted on the Launchpad thus eliminating all wiring efforts. Fig. ??(a) shows a photograph of the F28069 Launchpad and Fig. ??(b) shows the DRV8301 Booster Pack. A. Build Level 1: Generating the Space Vector PWM Pulses In first build level, F28069 Launchpad is tested by generating PWM pulses using space vector modulation block. The minimal blocks required to generate the SVPWM pulses using library blocks of Embedded Coder package are shown in Fig. ??. Model is designed in per unit. The signal generated by the ramp generator is given to inverse Park transformation block as virtual θ to generate reference signals for space vector generator block to generate PWM pulses. The ramp signal is shown in Fig. ??. DRV 8301 and PMSM are not connected in this build level. Fig. 3. F28069 Launchpad and DRV8301 Booster Pack B. Software Configuration All the software packages used to implement vector control of PMSM using TI’s Launchpad are:. 1) Code Composer Studio v5.0 and above; 2) MATLAB 2014a with Embedded Coder Support Package; 3) controlSUITE v3.3 and above. 1) Code Composer Studio: Code Composer Studio (CCStudio or CCS) is an integrated development environment (IDE) to develop applications for Texas Instruments (TI) embedded processors. Code Composer Studio v5.5 is used in this paper and is integrated with MATLAB Environment. CCS helps in converting the C/C++ code developed by MATLAB to an executable .hex / .out file which is loaded into the F28069 controller directly. 2) Embedded Coder: MATLAB Embedded Coder Support Package for Texas Instruments C2000 Processors enables us to generate a real-time executable C/C++ code which can be downloaded directly to our TI development board. Basic vector control blocks are substituted with processor specific blocks in the Simulink model to generate executable code. 3) ControlSUITE v3.3: ControlSUITE for C2000 microcontrollers provides all the digital motor control (DMC) libraries which is required for Embedded Coder Package to generate code. This software package contains the libraries or C/C++ code files and its documentation along with schematics of all C2000 boards shipped by TI. Fig. 4. Incremental Build Level One: Generating the SVPWM Pulses Fig. 5. Ramp Output By executing this model, the SVPWM pulses observed on the dedicated PWM pins of the Launchpad are shown in Fig. ??. Frequency of the generated pulses is 20kHz. IV. S IMULATION USING I NCREMENTAL B UILD L EVELS AND R ESULTS B. Build Level 2: Running the PMSM in open loop using generated SVPWM Pulses In this build level, the DRV8301 module is connected to the launchpad and PMSM and is supplied with a 24V DC supply The vector control scheme is a complex algorithm. Implementing the closed loop algorithm directly is extremely 3 Fig. 9. Incremental Build Level Three: Closing the current loop Fig. 6. SVPWM Pulses Calibrated current from build level two is given as an input to Clarke transform block, output of which is given as an input to Park transform block in MATLAB. Currents id and iq are controlled to references of 0 pu and 0.25 pu respectively using the PID controllers. It was observed that the motor runs satisfactorily with proportional gain value of 0.05 and integral gain value of 0.015. The output response of speed as observed is shown in Fig. ??. A reference speed of 1500rpm is applied to the motor and it was observed that motor runs exactly at 1500rpm. Similar results were obtained for a wide speed range. As the motor runs only with current loop, it cannot be fully loaded to its capacity. Motor stops rotating if it is loaded above certain load. to run the motor. The motor is run in open loop by adjusting the ramp control module for speed and idref is kept at 0 and iqref is kept at 0.25 pu which was found sufficient to overcome motor inertia and start the motor. The block arrangement in MATLAB/Simulink for build level two is shown in Fig. ??. Fig. 7. Incremental Build Level Two: Running the PMSM in open loop using generated SVPWM Pulses As compared to build level one, ADC blocks used for current measurement are added in this level. Most important significance of this build level is to calibrate current sensing in order complete the current loop in build level three. A current calibration unit is developed according to the datasheet of the controller. The waveforms of current Ia and Ib as observed on DSO are shown in Fig. ??. A phase shift of approximately 120◦ can be observed between the two currents. Fig. 10. Speed Response reference of 1500RPM D. Build Level 4: Encoder Calibration Fig. 11. Incremental Build Level Four: Encoder Calibration In this build level encoder readings are calibrated in order to get correct speed and position information for the encoder pulses. In this paper, the 4-pole pair PMSM produces 4000 counts per mechanical or 1000 counts per electrical revolution. Simulink model for incremental build level four is shown in Fig. ??. As seen in the figure, block encoder calibration is used Fig. 8. Currents Ia and Ib C. Build Level 3: Closing the current loop In this build level, current loop is closed using PID controllers as shown in Fig. ??. 4 approach were given along with results for each level. With this approach, performance of the drive can be observed and corrected at each bulid level for successful operation of the vector control scheme. Since the work reported here uses blocks from embedded coder, it is relatively much easier to implement vector control than using embedded C programming using CCS. It is also possible to incorporate advance control methods in vector control easily using this method. to count the number of pulses and converts the value to obtain position information. An index offset is added to compensate for the difference between encoder index pulse and absolute zero rotor angle. Speed is obtained by differentiating this position information with respect to time and its conversion factor. It is further used close the speed loop thus implement the complete vector control in build level five. Encoder pulses are shown in Fig. ??. All the three types of pulses i.e. QEPI, QEPA and QEPB can be seen in the figure. R EFERENCES [1] J. R. Hendershot and T. J. E. Miller, Design of Brushless Permanent Magnet Machines. Motor Design Books LLC, Second Edition, March 2010. [2] X. Y. Xu Jiaqun and T. Renyuan, “Development of full digital control system for permanent magnet synchronous motor used in electric vehicle,” Proceedings of the Fifth International Conference on Electrical Machines and Systems, pp. 554–556, 2001. [3] C. L. Yu Zhang and X. Mou, “The control system of PMSM based on ANFIS,” Electric Drive and Automatic Control, pp. 4–5, June 2007. [4] P. Pillay and R. Krishnan, “Modeling, simulation, and analysis of permanent-magnet motor drives. I. The permanent-magnet synchronous motor drive,” IEEE Transactions on Industry Applications, vol. 25, pp. 265–273, 1989. [5] T. Sebastian, G. Slemon, and M. Rahman, “Modelling of permanent magnet synchronous motors,” IEEE Transactions on Magnetics, vol. 22, pp. 1069– 1071, 1986. [6] P. Pillay and R. Krishnan, “Modeling of permanent magnet motor drives,” IEEE Transactions on Industrial Electronics, vol. 35, pp. 537– 541, 1988. [7] B. K. Bose, Modern Power Electronics and AC Drives. Upper Saddle River, NJ07458: Prentice Hall PTR, 2002. [8] C. K and S. A, “PMSM vector control performance improvement by using pulse with modulation and anti-windup PI controller,” International Conference on Multimedia Computing and Systems, pp. 1–7, 2011. [9] R. Krishnan, Permanent Magnet Synchronous and Brushless DC Motor Drives. Boca Ranton, Florida: CRC Press, 2010. [10] A. I. Haitham Abu-Rub and J. Guzinski, High performance control of AC drives with MATLAB/Simulink models. Wiley Publications, 2012. [11] “TMS320x28xx, 28xxx Enhanced Pulse Width Modulator (ePWM) Module Reference Guide,” literature number SPRU791, Texas Instruments. [12] “TMS320x2806x Piccolo Technical Reference Manual,” literature number SPRUH18, Texas Instruments. [13] Digital Control Systems Group, “PMSM3 1,” System Document, C2000 Foundation Software, Texas Instruments. [14] N. L. D. G. Tiecheng Sun, Ce Liu and S. Xu, “Design of PMSM Vector Control System Based on TMS320F2812 DSP,” 2012 IEEE 7th International Power Electronics and Motion Control Conference - ECCE Asia, pp. 3527–3531, June - 2012. [15] A. I. T. Asri Samat, Pais Saedin and N. Adni, “The Implementation of Field Oriented Control for PMSM Drive Based on TMS320F2808 DSP Controller,” 2012 IEEE International Conference on Control System, Computing and Engineering, pp. 612–616, 23 - 25 Nov. 2012. [16] O. C. Kivanc and S. B. Ozturk, “MATLAB Function Based Approach to FOC of PMSM Drive,” 2015 IEEE European Modelling Symposium, pp. 96 – 102, Madrid, 2015. [17] R. K. Sharma and V. Sanadhya, “Vector control of a permanent magnet synchronous motor,” IEEE India Conference, pp. 81–86, 2008. [18] C. Wang, “Modern control technology of motor,” China Machine Press, pp. 104–105, 2009. Fig. 12. Encoder Pulses E. Build Level 5: Closing the speed loop This is the final level in incremental build level approach which completes the speed control loop of vector control. The calibrated encoder position is given to Park and Inverse Park transform blocks instead of a ramp signal generated by the ramp generator blocks used until this stage. Measured speed is passed through a low-pass filter and is compared with the reference speed to generate iqref using the speed PID block as shown in Fig. ??. Fig. 13. Incremental Build Level Five: Closing the speed loop In this build level, based on different tests conducted on the setup, it is observed that the motor runs at a constant speed of 2500 rpm irrespective of the set point. The main reason was the error in a library file used for configuration of QEP module of F28069 which is communicated to the technical team of Texas Instruments and is the scope for future work. V. C ONCLUSION This paper presented a vector control using incremental build levels for speed control of a 60W PMSM using TI’s F28069 launchpad and MATLAB Embedded Coder. Details of the Simulation Platform, hardware used and steps involved in implementing the vector control with the incremental build 5 View publication stats