You have no items in your shopping cart.
- Home /
- User Manual for PMSM Motor Control using DSPIC
Permanent Magnet Synchronous Motor
This design reference manual describes the design of a 3-phase permanent magnet synchronous motor (PMSM) vector control drive with quadrature encoder as a position and a speed sensor. The document briefly describes the theory of the PMSM vector control and the hardware solution used. It is focused more on the application implementation on the TMS320F2812.
- Vector control of a permanent magnet synchronous motor using the quadrature encoder as a position sensor
- Targeted at the Tower rapid prototyping system (K40 tower board, Tower 3-phase low voltage power stage)
- Vector control with a speed closed-loop
- Rotation in both directions
- Application speed ranges from 0% to 100% of nominal speed (no field weakening)
3-phase permanent magnet synchronous motor
The construction of the PM synchronous motor and its mathematical description using a space model can be found in the designer reference manual PM Sinusoidal Motor Vector Control with Quadrature Encoder
Introduction to vector control
The permanent magnet synchronous motor features (high efficiency, high torque capability, high power density and durability) are good for using the PMSM in motion control applications. The key idea for the vector control algorithm of the AC motors was to achieve an AC motor torque/speed characteristic similar to that of the separately excited DC motor. In the DC motor, the maximum torque is generated automatically by the mechanical switch called the commutator. The commutator feeds current only to that coil whose position is orthogonal to the direction of the magnetic flux generated by the stator permanent magnets or excitation coils. The PMSM has the inverse construction, the excitation is on the rotor and the motor has no commutator. It is possible to control these two components independently and to reach the required performance, thanks to the decomposition of the stator current into a magnetic field-generating part and a torque generating part. To keep the constant desired torque, the magnetic field generated by the stator coils has to follow the rotor at the same synchronous speed. Therefore, to successfully perform the vector control, the rotor shaft position must be known and is one of the key variables in the vector control algorithm. For this purpose, either the mechanical position sensors are used (encoders, resolvers and so on) or the position of the shaft is calculated (estimated) from the motor phase currents and voltage. This is then called sensorless control. Using the mechanical position, sensors bring several benefits. The position is known over the entire speed range with the same precision, there is no need to compute highly athematically intensive algorithms that estimate the rotor shaft position. So vector control with a position sensor can be implemented on less powerful microcontrollers. The performance of the MCU can also be used for other tasks. On the other hand, the cost of the mechanical sensor is a significant portion of the cost of the whole drive.
Synchronous machine and the main principle of the vector control
As mentioned, the required torque is proportional to the q-portion of the orthogonal d, q-currents system. The d-portion reflects the generation of the rotor magnetic flux. Because there are permanent magnets mounted on the PMSM rotor, this current is usually kept at a zero level, unless the field weakening is performed to accelerate the motor above the nominal speed or while performing the MTPA algorithm. In such cases, the required d-current possesses a negative value. Therefore, the control process (regulation) is focused on maintaining the desired values of the d and q currents.
Because the d, q-system is referenced to the rotor, the measured stator currents have to be transformed from the 3-phase a,b,c stationary frame into the 2-phase d, q-rotary frame before they enter the regulator block. At first, the Clarke transformation is calculated, which transforms the quantities from the 3-phase to 2-phase systems. Because the space vector is defined in the plane (2D), it is sufficient to describe it in the 2-axis (alpha, beta) coordinate system. Consequently, the result of the transformation into the 2-phase synchronous frame (Park transformation) is two DC values – the d, q-currents. It is much easier to regulate two DC variables than two variables changing in time. The following picture shows the transformation sequencing.
Vector control implementation
There is an enhancement to the vector control algorithm implemented in the application described in the designer reference manual PM Sinusoidal Motor Vector Control with Quadrature Encoder. The limitations of the PI current controllers are calculated in real time based on the available DC-bus voltage. Bellow diagram is a simplified block diagram of the vector control algorithm. The aim of this control is to regulate the motor speed at a predefined level. The speed command value is set by a high level control. The algorithm is executed in two control loops. The fast inner control loop is executed within a hundred µsec period. The slow outer control loop is executed within a period of an msec. The fast control loop executes two independent current control loops. They are the direct and quadrature-axis current (isd , isq) PI controllers. The direct-axis current is used to control the rotor magnetizing flux. The quadrature-axis current corresponds to the motor torque. The current PI controllers’ outputs are summed with the corresponding d and q axis components of the decoupling stator voltage. Thus, the desired space vector for the stator voltage is obtained and then applied to the motor. The fast control loop executes all the necessary tasks to achieve an independent control of the stator current components.
- Three-phase current reconstruction
- Forward Clarke transformation
- Forward and backward Park transformations
- Rotor magnetizing flux position evaluation
- DC-bus voltage ripple elimination
- Space vector modulation (SVM)
The slow control loop executes the speed controller, field weakening control and lower priority control tasks. The PI speed controller output sets a reference for the torque producing quadrature axis component of the stator current iq_ref and the flux producing current id_ref.
To achieve the goal of the PM synchronous motor control, the algorithm uses feedback signals. The essential feedback signals are three-phase stator current and stator voltage. For correct operation, the presented control structure requires a speed feedback on the motor shaft.
Simplified block diagram of PMSM vector control
The algorithm of the PMSM vector control is represented as a chain of functions. Outputs of one function serve as inputs to the other functions. Each body of the functions contains mathematical equations not involving the peripherals. To speed-up the development of any motor control applications, these motor control functions together with some commonly used mathematic algorithms, such as trigonometric functions, controllers, or limitations and digital filters, were placed into one set and create the Motor Control Library. The motor control libraries are available for some MCU platforms, optimized for each platform to maximize the use of available core features. The functions were tested and are well documented. Therefore, building the motor control application is much simpler for the developer.
Hardware set-up and configuration
Motor phase A
Motor phase B
Motor phase C
Encoder phase A
Encoder phase B
ADC conversion timing, currents and voltage sampling
ADC Conversion timing
PMSM Motor Control
To Self Start Control Of Permanent Magnet Synchronous Motor for various speed.
- Intelligent Power Module (IPM) unit.
- TMS320F2812 Controller.
- PMSM Motor.
- Patch chords.
- Connect the 20 pin cable from the TMS 320F 2812 DSP unit port b connecter to power module (IPM) FBGA header .
- Connect the feedback cable between motor encoder signal 9 pin cable to IPM unit back side.
- Connect the motor terminals U, V, W to the in “IPM Power Module.
- Connect the 230 volt ac supply.To give the input using auto transformer connect to P & N.
- Initialy auto transformer keep on zero position.
- Initialy protection led should be off condition.
Launching The Code Composer Studio V4image Click this icon shown on your desktop. A prompt will appear asking for a workspace location. To launch Code Composer Studio IDE for the first time, configure Code Composer Studio for a fixed workspace location.
1. Setting The Workspace Location : Double-click the image Setup CCStudio icon on desktop.
The workspace launcher dialog box appears.
Note: Be sure that workspace location is empty for a fresh project
2. Tick the use this as the default and do not ask again (Optional).
Note: Again to get the workspace launcher at startup. open ccs go to window – preference – general – startup and shutdown – tick “prompt for workspace on startup”.
3. Click ok.
4. The empty workspace editor will open.
Step 2 : Create a New Project
To create a project, follow these steps:
1. From the CCStudio File menu, choose New – CCS Project.
New CCS Project dialog box appears.
2. In the Project Name field, type the project name & click Next.
3. Tick the use default Location field, type or browse to the folder you created as workspace location. Click Next.
4. In the Project type field, Select C2000.
5. Tick Debug and Release in configuration box. Click Next.
6. Then also, click next.
7. In output Type, select the Executable.
8. In Device Variant, Choose TMS320C28XX & TMS320F2812.
9. Click Finish. Code Composer Studio creates a project file called practice.pjt. This file stores your project settings and references the various files used by your project.
10. From the CCStudio C/C++ Projects, Right click the led [Active – Debug ] New – Source File.
11. In the source file field, Type the source file name with extension. (led.c)
12. Click Finish.
13. Type the program in pmsm.c editor window then, File – Save.
Note : Paste the Needed the Files in the prooject loaction,
Step 3: Create a Target Configuration File
1. From the CCStudio C/C++ Projects, Right click the led [ Active – Debug ] New – Target Configuration File.
2. New Target Configuration dialog appears. Then Click Finish
NewTargetConfiguration.ccxml will open, This will help to communicate between hardware and softeware. While connecting the hardware to the software the target configuration file will run. If any initialize needed we can add gel file additionally in the target configuration.
3. In General setup, there are more connection available to choose. Accorcding to our board, we have to choose XDS 100 USB emulator version 1 and TMS320F2812( Target Device ).
4. Tick the TMS320F2812 & Click Save.
Step 4: Build a Project
Before Building the project we must modify project properties , add the include files and path according to our usage.
1. From the CCStudio C/C++ Projects, Right click the led [ Active – Debug ] – Properties.
2. In C/C++ Build, go to C2000 compiler
Include Options (Add dir to #include search path(--include_path,-I)) select this add icon and add the following three path by individuality.
3. IN C/C++ Build, go to c2000 linker
a. Basic option - stack size - 0x400.
b. Include library file or command file as input (--library,-I)
c. file search path (Add
4. From the CCStudio C/C++ Projects, Right click the led [ Active – Debug ] – Build Project or Rebuild Project.
Note: Once the project is successfully build you will get 0 Errors. If Errors arise check the code and project properties then rebuild the project.
Step 5: Run a project
To run a project,
1. Target – Debug Active Project.
Note: at this step, Target will connect, gel file will run, led.out will load to target then finally Keep the cursor at main() of program to start execute.
2. This is Debug workspace, at this we can debug a code using breakpoints, single stepping, watch window, memory etc..,
3. Target – Run.
Now Check the Output at Motor, Watch Hyper Terminal serial window to monitor the parameters.
To do the Increment or Decrement the duty cycle use two push button in TMS320F2812 kit.
SW9 – Increment
SW10 – Decrement
Step 6: Halt a project.
Target – Reset.
Target – Terminate all.
Again, the ccs will return to edit workspace from debug workspace.
4. Close the Code composer studio