0% found this document useful (0 votes)
19 views30 pages

Module 18

This document discusses using the F2833x digital signal processor for digital motor control. It begins with an introduction on how motor control has progressed from analog to digital. The F2833x is well-suited for digital motor control as it contains analog-to-digital converters, pulse width modulation units, and a quadrature encoder interface. The chapter then covers basics of different motor types, principles of motor control, power switches for 3-phase control, field oriented control schematics, and Texas Instrument's digital motor control library and solutions. It provides an example of implementing field oriented control of a permanent magnet synchronous motor using different software build levels.

Uploaded by

Adesh Jagtap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views30 pages

Module 18

This document discusses using the F2833x digital signal processor for digital motor control. It begins with an introduction on how motor control has progressed from analog to digital. The F2833x is well-suited for digital motor control as it contains analog-to-digital converters, pulse width modulation units, and a quadrature encoder interface. The chapter then covers basics of different motor types, principles of motor control, power switches for 3-phase control, field oriented control schematics, and Texas Instrument's digital motor control library and solutions. It provides an example of implementing field oriented control of a permanent magnet synchronous motor using different software build levels.

Uploaded by

Adesh Jagtap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

F2833x Digital Motor Control

Introduction
In this module, we will look into an application that is not usually considered to be the
domain of Digital Signal Processors: real-time control of electrical motors. In the old days,
the control of speed and torque of electrical motors was performed using purely analog
technology. Since the appearance of microprocessors, more and more control units have been
designed digitally, using the advantages of digital systems. This improves the degree of
efficiency and allows the implementation of more advanced control schemes, thanks to
increased real-time computing power. It is a natural progression to use the internal hardware
computing units of a DSP to transfer the calculation from a standard microprocessor to a
DSP. This way, we can implement more advanced algorithms in a given time period.

However, to use a digital controller for motor control, the system needs a little more than
computing power. The output signals of the digital controller to the power electronic are
usually generated as pulse width modulated signals (PWM). It would be most cost-effective
if the controller could be equipped with an internal PWM-unit. To control the operation of
the motor we need to do some measurements for currents and voltages – analogue to digital
converters (ADC) will be helpful as well. A typical unit to perform a position/speed
measurement is an optical encoder; quite often, we build in a Quadrature Encoder (QEP).
Recalling all parts of the F2833x we discussed in this Teaching - CD, you can imagine that
the F2833 is an ideal device for Digital Motor Control (DMC).
The chapter will not go into the fine details of electrical motors and drives. Instead, it will
give you a sense of what needs to be done to use the F2833x to control the motor of a
vacuum cleaner or the motor of an electrical vehicle. To fully understand these principles, it
requires many more classes at university. If you are on a course of electrical engineering that
focuses on drives and power engineering, you might be familiar with most of the technical
terms. If not, see this chapter as a challenge for you to open up another application field for a
Digital Signal Controller.
Chapter 18 is based on a Texas Instruments Presentation “TIs C2000 Real-Time MCU for
Digital Motor Control“(August 2009). Depending on the laboratory equipment at your
university, you might be offered the chance to attend a laboratory session to build a working
solution for such a motor control.

F28333x - Digital Motor Control 18 - 1


Module Topics

Module Topics
F2833x Digital Motor Control ........................................................................................................ 18-1
Introduction ................................................................................................................................... 18-1
Module Topics ............................................................................................................................... 18-2
Basics of Electrical Motors ........................................................................................................... 18-3
Motor Categories ...................................................................................................................... 18-3
Asynchronuous Motor .............................................................................................................. 18-4
Synchronuous Motors: BLDC and PMSM ............................................................................... 18-5
Motor Control Principles .............................................................................................................. 18-6
Trapezoidal Control .................................................................................................................. 18-6
Scalar Control (“V/f”) ............................................................................................................... 18-6
Field Oriented Control (FOC) ................................................................................................... 18-7
FOC Coordinate Transform (Clarke / Park).............................................................................. 18-9
FOC Measurement of Motor Position and Speed ..................................................................... 18-9
Advantages of Vector Control ................................................................................................ 18-10
FOC Step By Step ................................................................................................................... 18-10
3-Phase Power Switches ............................................................................................................. 18-11
Sine PWM VSI Control .......................................................................................................... 18-12
Space Vector PWM VSI Control ............................................................................................ 18-13
FOC Control Schematics ............................................................................................................ 18-14
Field Oriented ACI control ..................................................................................................... 18-14
Field Oriented Brushless DC control ...................................................................................... 18-15
Field Oriented PMSM control................................................................................................. 18-16
F2833x Features for Motor Control ........................................................................................... 18-17
Software .................................................................................................................................. 18-17
IQ – Math Functions ............................................................................................................... 18-18
Real-time Debug (RTDX)....................................................................................................... 18-19
Texas Instruments Digital Motor Control Library ...................................................................... 18-20
Software Modules ................................................................................................................... 18-20
The Application Framework ................................................................................................... 18-21
Texas Instruments DMC Solutions ......................................................................................... 18-22
Example: PMSM Framework ...................................................................................................... 18-23
Build Level 1 .......................................................................................................................... 18-23
Build Level 2 .......................................................................................................................... 18-24
Build Level 3 .......................................................................................................................... 18-25
Build Level 4 .......................................................................................................................... 18-25
Build Level 5 .......................................................................................................................... 18-26
Build Level 6 .......................................................................................................................... 18-26
Power Factor Correction (PFC) .............................................................................................. 18-27
C2000 Motor Control Hardware ................................................................................................ 18-28
Summary...................................................................................................................................... 18-30
Motor Control Development Kit.................................................................................................. 18-30

18 - 2 F28333x - Digital Motor Control


Basics of Electrical Motors

Basics of Electrical Motors


Motor Categories
In order to classify the different electrical motors families, we can distinguish motors driven
by direct current (DC) and motors driven by an alternating current (AC). DC motors are the
most popular ones: both stators and rotors carry an excitation created by coils or windings in
which DC current circulates. In order to ensure the motor rotation by commutating the
windings, brushes are permanently in contact with the rotor.

Common Motors & C2000 Applicability


Motor Type Torque Curve Applications Strengths Weaknesses

Universal T Power Tools, Cheap, Simple Low reliability


Vacuums, Control Poor torque and
Fans limited control
Low
S
DC Brushed T Power Tools, Cheap, Simple Low reliability, EMI,
Battery Control Noisy, Feedback
S
Operated required
Stepper Printers, Constant Control complexity
T torque, Precise can vary; Speed
Automation
position control,
High speed
control or High
Load
Control
S

AC – Asynch White Goods, Low cost, Poor at low speeds,


Complexity
T
Pumps, Fans Efficient at fixed Feedback (f,i) and (generally)
AC Induction
speeds, complex control for
S high efficiency
AC – Synch Automation, Efficient, Demanding control
Traction, reliable, smooth for highest
BLDC T
Precision, operation; efficiency; High
PMSM Growth
White Goods Combustible Historically
IPM S environments; expensive but
High torque prices dropping
Reluctance Traction, White Low cost, highly Complex control to
High
T
Goods reliable eliminate noise and
SR (still not widely torque ripple
S used)

Under the classification of AC motors, we have synchronous motors and asynchronous


motors; both motor types are induction machines.
Asynchronous machines require a sinusoidal voltage distribution on the stator phases in
order to induce current on the rotor, which is not fed by any currents nor carries any
magnetic excitation.
Synchronous motors are usually called “Brushless DC Motors” (BLDC) but can also be
called “Permanent Magnet Synchronous Motors” (PMSM) depending on their construction
and the way they are being controlled. In this type of motor, we have one sinusoidal or
trapezoidal excitation on the stator and one constant flux source on the rotor (usually a
magnet).

F28333x - Digital Motor Control 18 - 3


Basics of Electrical Motors

Asynchronuous Motor

Asynchronous Motor: ACI


1.50
Phase currents
1.00
ia ib ic
Rotor rotation
ia A` Ω 0.50

Rotor flux 0.00


1 24 47 70 93 116 139 162 185 208 231 254 277 300 323 346

Ω R = s.Ω
-0.50

C B -1.00

Im -1.50

Stator flux ~
ΩS ω I
c Current Phasors ωt
~
C 120o I
a
B` ` Re
A Aluminum bar
~
I
b
Theory of Operation:
– Rotor placed in a moving magnetic field (flux) will have current induced – which produces another magnetic field
– The interaction of these two magnetic fields produces the rotational torque
• Stator flux is variably controlled by feeding current
• Rotor flux is induced by the stator flux
• Rotor and Stator rotate at different speeds = Asynchronous
• Angle between rotor and stator flux can be regulated to determine torque
• Rotor position is never known

18 - 4 F28333x - Digital Motor Control


Basics of Electrical Motors

Synchronuous Motors: BLDC and PMSM

Synchronous Motors: BLDC & PMSM


A` Rotor field
φ ω 120. f
C Rotor speed (rad/s) : Ω = gives (r.pm)
N p p
f : AC supply frequency (Hz)
B p : motor poles
N

S
C` Stator field
S
B`
A BLDC Back EMF
PMSM Back EMF

Theory of Operation:
– Fixed rotor flux (magnetic field) and a produced stator flux
– The interaction between the two fields produces a torque which will cause the motor to rotate
• Stator flux is variably controlled by feeding current
• Rotor flux is constant by permanent magnets or current fed coils
• Rotor rotation is at same frequency as supplied excitation = Synchronous
• Angle between rotor and stator flux can be regulated to determine torque
• Rotor position can be measured or estimated

Which Synchronous? BLDC vs. PMSM


Continuous States = More Complex
Back EMF of BLDC Motor
Back EMF of PMSM
ea
ωt
ea eb ec
eb
ωt
ωt
ec
ωt

1 2 3 4 5 6 1 CONTINUOUS
• BLDC Motors • PMSM Motors
– Easier to control (6 Trapezoidal states) – More complex control (continuous 3Ph Sine Wave)
– Torque ripple at commutations – No torque ripple at commutation
– Better for lower speed – Higher max achievable speed
– Noisy – Low noise
– Doesn’t work with distributed winding – Work with low-cost distributed winding
– Not as efficient, lower Torque – Higher efficiency, higher Torque
– Lower cost – Higher cost

F28333x - Digital Motor Control 18 - 5


Motor Control Principles

Motor Control Principles


Trapezoidal Control

Trapezoidal Control (BLDC only) - Simple


ea Trapezoidal Step by Step
ωt
1. Sample the System
eb – Position: Hall sensors (3 Square wave
outputs correspond to rotor position)
– 3 Ph Voltages (sensorless)
ωt – Current through a shunt (optional)
ec 2. Calculate
ωt – Speed = Frequency of positions
3. Estimations (Sensorless)
– Voltage Back EMF easily gives position
1 2 3 4 5 6 1 of rotor
4. Regulate the Loop
Trapezoidal Control – Simple proportional PID speed control
+ Fed with direct current – Optional Current/Voltage Monitor
+ Stator Flux commutation only each 60º (1-6) 5. Stimulate the System
+ Two phases ON at the same time – Simple PWM trapezoidal patterns (1-6)
– Torque ripple at commutations
– Communication at high speed difficult
– Noisy
– Doesn’t work with distributed winding

Scalar Control (“V/f”)

V/f Control (ACI or PMSM) – Simple


Model:
MAXIMUM
TORQUE VOLTAGE Rs Ls Rr/s Lr

V Φm Lm R(s)
NOMINAL
TORQUE I m = (Vm / 2π f L m )
TORQUE Φ m = (Vm / 2π f)
Vo
At low speed: Rs is no longer
negligible: Vm < V
LOW SPEED NOM SPEED SPEED A large portion of energy is now
wasted.

+ Simple Proportional Control: Three sine waves feeding the motor


+ Position information not required (optional) Torque oscillation
generates uncontrolled
– Poor dynamic performance current overshoot:
TORQUE
– Torque delivery not optimized for all speeds
TIME

18 - 6 F28333x - Digital Motor Control


Motor Control Principles

The V/Hz regulation scheme is the simplest one that can be applied to an asynchronous mo-
tor. The goal is to work in an area where the rotor flux is constant (Volts proportional to
speed).
In practical solutions, the speed sensor is optional as the control is tuned to follow a prede-
fined “speed-profile versus load table”, assuming the load characteristics are known in ad-
vance.
Obviously, this type of control bases itself on the steady electrical characteristics of the ma-
chine and assumes that we are able to work with a constant flux in the complete speed range
the application targets. This is why this type of control does not deliver a good dynamic per-
formance and a good transient response time; the V/Hz profile is fixed and does not take into
account conditions other than those seen in a steady state. The second point is the problem at
startup of AC induction motors, which cannot deliver high torques at zero speed; in this case,
the system cannot maintain a fixed position. In practice for low speed, we need to increase
the delivered voltage to the stator compared to the theoretical V/Hz law.

Field Oriented Control (FOC)


Instead of using a pure sine wave shaped modulation of the PWM stage, in recent years the
space vector theory has demonstrated some improvements for both the output crest voltage
and the harmonic copper loss. The maximum output voltage based on the space vector theory
is 1.155 times larger than the conventional sinusoidal modulation. This makes it possible to
feed the motor with a higher voltage than the simpler sub-oscillation modulation method.
This modulator enables higher torque at high speeds, and a higher efficiency. Torque
distortion is also reduced.
The space vector PWM technique implemented into the existing TI DMC library reduces the
number of transistor commutations. It therefore improves EMI behavior.

F28333x - Digital Motor Control 18 - 7


Motor Control Principles

FOC Control (ACI or PMSM) – Complex


A`
q=90°
C F Maintain
N
the ‘load
B
angle’ at
90°
C`
S F
B`
A Torque = Cross Product of Fields
Maximized when Sin q = 1 = 90 Degrees
Field Orientation
+ Reduced torque ripple
+ Better dynamic response
Measure & Control
+ Good performance at lower speeds Torque, Flux
Angle, Speed
- Need to measure angle between rotor and stator
- Requires independent control of flux and torque in real-time

A typical characteristic of FOC - PWM command strategy is that the envelope of the
generated signal is carrying the first and the third harmonics. We can interpret this as a
consequence of the special PWM sequence applied to the power inverters. Literature also
mentions the third harmonic injection to boost out the performance we get out of the DC bus
capacitor. This third-harmonic exists in the phase to neutral voltage but disappears in the
phase-to-phase voltage.

18 - 8 F28333x - Digital Motor Control


Motor Control Principles

FOC Coordinate Transform (Clarke / Park)

FOC: Torque & Flux Deduced from Currents


a 3PH α Clarke Q Park
MATH MATH
MEASURE
CURRENTS
Currents TRANSFORM Transformation TRANSFORM Transformation

Is ωstator
Is Is D
Iq
π/2 Id
2π/3 Torque Component Flux Component
2π/3
β
b
c 2π/3
Ια t
Torque Component
IQ
ic ia ib t

t Flux Component
Ιβ t ID
t

Two phase orthogonal Rotating


Three phase reference frame reference frame
reference frame

FOC Measurement of Motor Position and Speed

FOC: Angle & Speed are Measured or Estimated

ACI
– Measured
• Tachometer: Square wave output proportional to speed
– Estimations
• Angle estimated from Integral of Sinusoidal Back EMF Voltage with closed
loop voltage compensation
• Speed estimated from Estimated Flux, measured current, and motor model

PMSM
– Measured
• Encoder: 2 Square waves give position, speed calculated by change over time
• Resolver: SIN + COS waves give position, speed calculated by change over
time
– Estimations
• Angle estimated from Integral of Sinusoidal Back EMF Voltage with Sliding
Mode Observer technique
• Speed calculated from change in angle over time

F28333x - Digital Motor Control 18 - 9


Motor Control Principles

Advantages of Vector Control

Why FOC? Performance Comparison


FOC

FOC
• System responds faster to changes in set point or load change
• Minimum speed at full load is now essentially zero
• Starting torque is increased
• Very little torque ripple
• Reduces Cost
• Optimally size motor for the task at hand
• Current controlled, so the inverter can be optimized

FOC Step By Step

FOC: Step By Step


Measure & Control
1. Sample the System
Torque, Flux
– Current
– Voltage (Sensorless) Angle, Speed
– Speed (ACI Sensored)
– Speed & Position/Angle (PMSM Sensored)
2. Transform sampled data and calculate useful quantities
– Measure Currents  Use Clarke/Parke Transform  Torque & Flux
– ACI Sensored
• Measure Speed + Torque & Flux Components  Angle
– ACI Sensorless
• Measure Voltage + Stator Current (Clarke)  Angle Estimation
• Angle Estimation + Stator Current (Clarke)  Speed Estimation
– PMSM Sensored
• Measured Speed and Measured Angle
– PMSM Sensorless
• Measured Voltage + Stator Current (Clarke)  Angle Estimation
• Angle Estimation  Speed Estimation
3. Regulate the Loop
– PID techniques are most common; Controls to a reference value
– Regulate speed, position/angle, current, flux and maximize torque
4. Stimulate the System
– Inverse transforms of Park and Clarke
– PWM Pattern generation to drive the voltage/current source

18 - 10 F28333x - Digital Motor Control


3-Phase Power Switches

3-Phase Power Switches


As we saw in the previous basic diagrams, we need to apply three 120° phase shifted excita-
tion signals to the power circuitry of the motor. As you have seen in Chapter 7 (“PWM”), a
PWM signal can be used to modulate sinusoidal signals. With three independent switching
pattern streams and six power switches, we can deliver the necessary phase voltages to gen-
erate the required torque imposed by the load. The goal is to build the correct conduction
sequences in the IGBTs to deliver sinusoidal currents to the motor to transform it to a me-
chanical rotation.
This is traditionally achieved by comparing a three-phase sinusoidal waveform with a trian-
gular carrier. In the digital world, on the DSP processor, we compute a sinusoidal command
and apply it to the PWM units that generate the appropriate PWM outputs usually connected
to gate drivers of the IGBTs from the inverter.
Basically we are “chopping” a DC voltage, carried by the DC bus capacitor, in order to build
the appropriate voltage shapes for the stator phases, with the goal of having a good efficiency
during this energy conversion process. This is a power electronics concern: we need to mi-
nimize the noise introduced by these conducting sequences and source of harmonics.

Controlling the 3PH Voltage Source Inverter (VSI)

Upper & lower


devices can not
be turned on
simultaneously
(dead band)
PWM signal is
applied between
gate and source
+

DC bus
capacitor − Three phase
outputs which
go to the motor
terminals

Power
Switching
Devices

F28333x - Digital Motor Control 18 - 11


3-Phase Power Switches

Sine PWM VSI Control

Traditional (Old) Sine PWM VSI Control

 Inputs
 Triangular Switching Frequency (5-25 kHz typically)
 Sine wave = Carrier Trying to match (V or I Reference, 0-1000 Hz typically)
 Image not to scale; Typically 100s of triangle periods in each Sine wave
 Output
 When they cross, you switch the PWM

18 - 12 F28333x - Digital Motor Control


3-Phase Power Switches

Space Vector PWM VSI Control

Space Vector PWM VSI Control


Theory: A special switching sequence of the upper three power devices of a
VSI results in 3 pseudo-sinusoidal currents in the stator phases.
Calculate the appropriate duty cycle – every period - needed to
generate a given stator reference voltage.
q

V120 (010) V60 (011)V0 (100)


S2
Van*
S3

θ S1
V180 (110) 0 (111) 0 (000)
0 d
S4 S6

Zero Vectors (000) & (111)


S5

V240 (100) V270 (101)

For review of the calculations,


please see detailed theory in
SVGEN documentation from DMC
Library (SPRC080 or SPRC125).

SVPWM Benefits vs Traditional Sine PWM

• 15% boost in torque


• 30% less switching losses (higher efficiency)
• 30% reduced EMI due to fewer transistor commutations
• Reduced harmonic copper losses
• Capacitor reduction
– The use of smaller DC link capacitor will introduce DC bus ripple
– Controllers with processing overhead can digitally compensate for the
ripple on the DC bus, allowing for a greater ripple limit
– This smaller capacitor size can reduce system cost

F28333x - Digital Motor Control 18 - 13


FOC Control Schematics

FOC Control Schematics


Field Oriented ACI control
The overall system for implementation of the 3-phase ACI control unit is shown in the next
slide. The ACI motor is driven by the conventional voltage-source inverter. The F2833x is
generating six pulse width modulation (PWM) signals by means of space vector PWM
technique for six power- switching devices in the inverter. In a “sensored” measurement
mode, a tachometer or resolver is used to feedback speed and position. By contrast, in a
“sensorless” measurement mode, two input currents of the PMSM (ia and ib) are measured
from the inverter and they are sent to the F2833x via two analog-to-digital converters
(ADCs).

ACI System for FOC


MCU
+ DC Bus
Tx PWM1
Timers PWM2
Serial coms
and PWM PWM3
R (UART) PWM4
Compare
x PWM5
Units
PWM6
PWM1 PWM3 PWM5 AC Induction
SIMO
Motor
Capture CAP/QEP
SOMI SPI
CLK Serial coms Unit
STE

ADCIN0 PWM2 PWM4 PWM6


ADCIN1 CAP/QEP
ADC

Shunt Tacho
resistor Or
Resolver

ADCIN2
ADCIN3 Signal
Conditioning

Sensor is removed with sensorless FOC

18 - 14 F28333x - Digital Motor Control


FOC Control Schematics

Field Oriented Brushless DC control

BLDC System – Sensored, Trapezoidal


Back EMF of BLDC

ea

eb
MCU
+ DC Bus ec
Tx PWM1
Serial Timers PWM2
and PWM PWM3
Rx (UART) PWM4
Compare PWM5
Units PWM6
PWM1 PWM3 PWM5 Three-phase
SIMO SPI BLDC machine
Capture CAP1
SOMI (Synch CAP2
CLK Unit CAP3
Serial)
STE
CAP1
PWM2 PWM4 PWM6 CAP2
ADC ADCIN0 CAP3

DC Shunt
0 / 120 / 240 deg
position
information
(e.g., Hall
Signal sensors )
Conditioning

BLDC System – Sensorless, Trapezoidal


Back EMF of BLDC

ea
MCU
DC Bus eb
+
Tx PWM1 ec
Serial coms Timers PWM2
and PWM PWM3
Rx (UART) PWM4
Compare PWM5
Units PWM6
PWM1 PWM3 PWM5 Three-phase
SIMO BLDC machine
SOMI SPI Capture
CLK Serial coms Unit
STE
ADCIN1
ADC
ADCIN2 PWM2 PWM4 PWM6 No
ADCIN3

ADCIN0
sensors !
DC Shunt
ADCIN1 Phase
Signal ADCIN2
ADCIN3 Voltage
Conditioning Meas

F28333x - Digital Motor Control 18 - 15


FOC Control Schematics

Field Oriented PMSM control

PMSM System – FOC/Vector


Back EMF of PMSM
MCU 1.50

DC Bus 1.00 ea eb ec
+ 0.50

Tx PWM1 0.00
1 24 47 70 93 116 139 162 185 208 231 254 277 300 323 346
ωt
Timers PWM2 -0.50
Serial coms
and PWM PWM3 -1.00

Rx (UART) PWM4 -1.50


Compare
PWM5
Units
PWM6
PWM1 PWM3 PWM5
SIMO QEP1
SOMI SPI Capture
QEP2
CLK Serial coms Unit
CAP3
STE
QEP1
ADCIN0 PWM2 PWM4 PWM6 QEP2
ADC ADCIN1 CAP3 (index)
Encoder
Shunt Optional
resistor

Signal
Conditioning

Sensor is removed with sensorless FOC

18 - 16 F28333x - Digital Motor Control


F2833x Features for Motor Control

F2833x Features for Motor Control


Software

Software for Real-Time Controllers

Header Files Foundation Libraries CCS Debug Tools


– Init routines and functions – Math primitives – Real-time Debug
– Named bit fields – Signal Processing – Graphical Analysis
– Peripheral Examples – Floating-point – DSP/BIOS RTOS and
– Control Law Accelerator scheduler
CCS v4 Sample Projects and – Flash API – Plug-ins and add-ons
Workspaces – IQMath
– Eclipse-based code editor and 3rd Party Tools
debugger
Device Evaluation
–Tool kit demonstration
Application
Application Libraries Debug and
– Modeling and Simulation
– Digital Motor Control – Debug tools
workspaces show how to set Development
– Digital Power
Productization
– Emulators
up watch windows and graphs
for real-time analysis
– General Purpose GUI ready System Examples
for customization – Robust Modular Frameworks
– Multiple Digital Power
Demonstration GUIs Conversion Types
– Peripheral Explorer – Multiple Motor Types
– Renewable Energy Kit – Power Line Communication
– Digital Power Kits
3rd Party Resources
– Diagram-based code
generation
– Software libraries

10/28/2009 28

C2000 Software for DMC Concept

Methodology
- Highest precision & most numerically accurate
- Modular libraries (C source) for easiest re-use and customization
- Removal of fixed point scaling and saturation burden
- Easiest to tune for your custom motor
- Documentation: DMC theory, software, BOM, schematics

Customers can self serve and achieve high productivity!

Achieved by
- IQMath
- Application Frameworks: DMC Library & Incremental Build
- Partner Tools for simulation, GUI programming, and auto code gen

F28333x - Digital Motor Control 18 - 17


F2833x Features for Motor Control

IQ – Math Functions

IQMath
• Library and Compiler Intrinsic
– Move your decimal point to where you need it
– Write in floating point, compiler does all the work

• Start-up, tuning, and debug effort are reduced


– Change numerical range on the fly, global or local
– Tune for best resolution and dynamic range
– Remove quantization effects
– Scaling and saturation are a thing of the past
– Better integration with simulation and code gen tools
– Single source set to move between fixed and floating point
processors
– Easy re-use and re-tuning for new systems

IQmath: Choose your decimal


Range or Resolution?
Based On The Required Dynamic Range Or Resolution
31 0
S I I I I I I I I I I I I I I I I . Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q (Q15)
GLOBAL_Q Max Val Min Val Resolution
28 7.999 999 996 -8.000 000 000 0.000 000 004
24 127.999 999 94 -128.000 000 00 0.000 000 06
20 2047.999 999 -2048.000 000 0.000 001

The user selects a “Global Q” value for the entire application:


#define GLOBAL_Q 24 // set in “IQmathLib.h” file
_iq Y, M, X, B;
Y = _IQmpy(M,X) + B; // all values are in I8Q24
The user can also explicitly specify the IQ value to use:
_iq20 Y, M, X, B;
Y = _IQ20mpy(M,X) + B; // all values are in I12Q20

18 - 18 F28333x - Digital Motor Control


F2833x Features for Motor Control

Probably one of the most important advantages of programming in IQMaths is the ability to
switch from a fixed-point environment to the floating-point processor world. When the
programmer uses a conditional compilation technique, based on “#if – else – end if”
directives, the same C code can be used for fixed-point and floating-point translation.

IQMath: One source set from Simulation to Production

Simulation
Or IQMath
Algorithm

Y = _IQmpy(M, X) + B;
Configure Math Type In IQmath Header File
#if MATH_TYPE == IQ_MATH #if MATH_TYPE == FLOAT_MATH
Automatically Converts To:

Y = (float)M * (float)X + (float)B;


Fix-Point Math Code Floating-Point Math Code

Compiler Intrinsic Compile & Run


Run On On any Floating-Point
F28x Fixed-Point Device

Gives Up And Down Code Mobility

Real-time Debug (RTDX)


Real-time Debug (RTDX)
Control systems must be debugged while running!
 Halt in non-critical code for debug while time-critical interrupts
Real-time

continue to be serviced
Debug

 Access memory and registers without stopping the processor


 Implemented in silicon, not by a software debug monitor
 No CPU cycles required

 RTDX always available, real-time debug on customer returns

Halt and single step non-time critical code Time-critical interrupts


are still serviced.

Main() function() Interrupt void ISR_1()


{ { {
…… …… ………
} } }

F28333x - Digital Motor Control 18 - 19


Texas Instruments Digital Motor Control Library

Texas Instruments Digital Motor Control Library


Software Modules

Texas Instruments Digital Motor Control (DMC) Library is available free of charge and
can be downloaded from the Texas Instruments website. It consists of a number of useful
functions for motor control applications. Among those functions, there are pure motor con-
trol modules (Park and Clark transforms, Space Vector PWM etc) as well as traditional
control modules (PID controller, ramp generator etc) and peripherals drivers (for PWM,
ADC and others).
Based on this DMC library, Texas Instruments has developed a number of application
notes for different types of electrical motors. All applications examples are specially de-
signed for the C2000 platform and come with a working example of the corresponding
software, background information and documentation.
One branch of this library is dedicated to the F2833x and takes advantage of the 32-bit IQ-
Math data format.
The following slide shows the software modules available for the C2000 family:

DMC Library
Blocks are Modular C functions
- Variables as Inputs, Variables as Outputs
- Library of Source Code
- Most are IQ based, tune to your stability needs!
Multi-page
Documentation
& Theory of
Operation for
each module

Other Libraries Available


- FFT (32-bit Complex & Real)
- Filters (FIR, IIR)
- QMath (Trig, SQRT, INV, LOG, DIV)
- IQMath Virtual Floating Point
(Conversion, Arithmetic, Trig, Math)
- Signal Generation (Sine, Ramp, Trapezoidal)
- Digital Power

18 - 20 F28333x - Digital Motor Control


Texas Instruments Digital Motor Control Library

The Application Framework


All Digital Motor Control Library solutions are based on are based on a framework system,
shown in the following slide. Although the modules are written in optimized IQMath code,
all of them can be accessed using a C language interface.

Application Frameworks

Connect the Blocks Complete Solutions from TI


- Tie output variables to input variables in C code - 20+ Motor Type and Control Technique Specific Solutions
- Yellow = Transforms - DC, BLDC, ACI, PMSM, SR, Stepper
- Pink = Control - Sensored or Sensorless, V/Hz or Vector/FOC
- Green = Peripheral - Download Includes
ex: Instead of user configuring all ePWM registers, the - CCStudio IDE Workspace and Project
FC_PWM_DRV module uses variable inputs from - Source Code
SVGEN_DQ to create the proper PWM register - Documentation
settings for proper duty cycle and pattern generation - System Overview
- Control Theory of Operation
- Software Flow Diagram
- Hardware Configuration
- Step by Step Instructions
- Screen Captures
- Verification & Debug Techniques
- Incremental Build Methodology
- Step by Step System Verification

Connect Blocks In C:
// Connect SVGEN Block: This module abstracts all the PWM
svgen_dq1.Ualpha = ipark1.Alpha; registers. Does all the work for you –
svgen_dq1.Ubeta = ipark1.Beta; every period – based on the changing
// Execute SVGEN Block:
duty cycle calculations from SVGEN
svgen_dq1.calc(&svgen_dq1); and your system frequency. You don’t
even need to write to the peripheral
registers!

What the user has to do is simply to select the correct blocks, to define the variables for input
and output lines of the corresponding blocks and to connect these “lines” by passing
variables. All modules are supplied with a dedicated documentation file.
For example, the file “pid_reg3.pdf” explains the interface and the background of the PID-
controller:

All functions are coded for 32-bit variables in IQ-Math-format. The functions are used as
instances of a predefined object class, based on a structure definition in a header file.

F28333x - Digital Motor Control 18 - 21


Texas Instruments Digital Motor Control Library

Texas Instruments DMC Solutions


Texas Instruments offers a set of more than 20 complete solutions for different types of
motors, switching and control techniques, all based on this application framework.

Application Frameworks, Hardware,


and Application Notes
C2000
MOTOR TYPE CONTROL FEEDBACK SOLUTION
STEPPER Microstepping Sensorless SPRAAU7
DC Speed & Position Sensored SPRC177, SPRC214
V/F Sensored SPRC130, SPRC194
ACI FOC Sensored SPRC077, SPRC207
FOC Sensorless SPRC078, SPRC195, SPRC922
BLDC Trapezoidal Sensored SPRC175, SPRC213
Trapezoidal Sensorless SPRC176, SPRC196
V/F Sensored SPRC129, SPRC210
FOC - Resolver Sensored SPRC178, SPRC211
PMSM FOC Sensored SPRC179, SPRC212
FOC Sensorless SPRC128, SPRC197, SPRC922,
TMDS1MTRPFCKIT, TMDS2MTRPFCKIT

SWITCHED Two Quadrant Sensorless SPRA600


RELUCTANCE
OTHER DMC Library: SPRC080, SPRC215
Designing High Performance DMC: SPRT528

These solutions follow a simple principle for testing the software, accessing the power drives
and closing the control loop: an incremental build methodology. The basic idea is to define a
macro and to use a conditional compilation (called: “Build Level”) to include more and more
modules into the final machine code. Such a technique is very helpful when the user tests a
motor drive system for the very first time.
The following slides explain this sequential method with the example of a PMSM Field
Oriented Control System.

18 - 22 F28333x - Digital Motor Control


Example: PMSM Framework

Example: PMSM Framework


Build Level 1
Build Level 1 is used to verify the target independent modules, such as PWM frequency,
duty cycles and updates of the PWM unit. The motors are disconnected at this level. Two
software modules “RAMP_GEN” and “RAMP_CNTL” are used to stimulate the PWM
system via the inverse PARK module and the Space Vector Generator module.

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

An oscilloscope is used to monitor the shape of the PWM signals and the pulses series
generated by the SVGEN module.

F28333x - Digital Motor Control 18 - 23


Example: PMSM Framework

Build Level 2

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

Connect IQmath Blocks In C: Watch/Modify Variables In Real-Time:


// Connect Park Block:
PARK.theta_p = RAMP_GEN.mp_out;
PARK.d = CLARKE.d;
PARK.q = CLARKE.q;
// Execute Park Block:
_IQparkPU(&PARK);
// Result in PARK.D and PARK.Q

18 - 24 F28333x - Digital Motor Control


Example: PMSM Framework

Build Level 3

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

Build Level 4

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

F28333x - Digital Motor Control 18 - 25


Example: PMSM Framework

Build Level 5

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

Build Level 6

Incremental Build Methodology


Dual Sensorless FOC PMSM Example

18 - 26 F28333x - Digital Motor Control


Example: PMSM Framework

Power Factor Correction (PFC)

MIPS leftover…integrate digital PFC!

We achieve PFC by controlling the


duty cycle such that the rectified
input current is made to follow the
rectified input voltage while
providing load and line regulation .

Why add Power Factor Correction?

Why: In an AC-Rectifier, the 3-phase inverter stage and the motor act
as a non-linear load and will draw harmonic currents from the line.
These harmonics result in losses and such currents can distort the
line voltage.
Some countries and regulatory bodies limit the distortion to the line
a product can inject (see IEC 61000-3-2).
How: Generate an intermediate DC Bus from an AC source while
drawing a sine wave input current that is exactly in phase with the
line voltage
A PFC stage has become an integral part of most power supply
designs…usually done with a standalone PFC chip…why not have
the MCU control this digitally!

F28333x - Digital Motor Control 18 - 27


C2000 Motor Control Hardware

C2000 Motor Control Hardware


To start an exploration for motor control, based on C2000 controllers, Texas Instruments
offers a set of low cost tools:

controlSTICK: Low Cost Evaluation


$39 Kit includes
• Simple USB memory stick form
factor evaluation tool
•Piccolo F28027
•Onboard USB JTAG emulation
•Header pins provides access to
most Piccolo pins
•11 example projects explain most
Piccolo peripherals
•Jumpers and patch cords to easily
connect pins together
•USB extension cable
•Code Composer Studio V3.3 with
32KB code size limit
•Complete hardware documentation
•Gerbers, schematics, etc

controlCARD: Modular, Robust, Standard


controlCARD
• Low cost, small form factor
• Standard DIMM interface
– Includes analog I/O, digital I/O, and
JTAG signals available at DIMM Pin compatible across
interface
• Robust design
the C2000 family!
– Noise filter at ADC input pins
– Ground plane
– Isolated UART communication
– Supply pin decoupling
• All life support circuitry
– Clock, Power Supply, LDO, etc
• Multiple versions available
– Piccolo F28027
– Piccolo F28035
– Delfino F28335
– Delfino C28436
– F2808
– F28044
– $49-69

18 - 28 F28333x - Digital Motor Control


C2000 Motor Control Hardware

A set of base boards allows the user to go deeper into different application areas, such as
Digital Power Supply or Digital Motor Control.

controlKIT: controlCARD + base board


Device Evaluation Application Development
Experimenter’s Kit - Flash Digital Power
TMDXDOCK28027 Experimenter’s Kit
TMDXDOCK28035 TMDSDCDC2KIT
TMDSDOCK2808 $229
TMDSDOCK28335
$79-$159 Digital Power
Developer’s Kit
TMDSDCDC8KIT
Experimenter’s Kit - RAM $325
TMDXDOCK28343
TMDXDOCK28346-168
$189
AC/DC Developer’s Kit
TMDSACDCKIT
$695
Peripheral Explorer
TMDSPREX28335
$179 Resonant DC/DC
Developer’s Kit
TMDSRESDCKIT
$229
controlKITs Include
• controlCARD + Base Board Renewable Energy
• CCStudio IDE v3.3 32KB code size limit
Developer’s Kit
• Example Software with lab document
TMDSENRGYKIT
• Power Supply and Cables
$349
Developer’s Package Sensorless FOC DMC +
• Schematics (source and .PDF files) PFC Developer’s Kit
• Bill of materials (BOM) TMDS1MTRPFCKIT 1 Motor
• Gerber files to freely use or modify TMDS2MTRPFCKIT 2 Motor
• Pin-out table showing all key signals $369/$399
• DIMM100 pin/socket mechanical details

For Digital Motor Control the following package includes all you need to experiment with
PMSM motors.

Sensorless FOC and PFC Developer’s Kit

$399 Motor Control


and PFC Kit Includes
 Piccolo F28035 controlCARD
 Sensorless Sinusoidal SVPWM based
Field Oriented Control
 Single or Dual Axis Operation
 Integrated Digital Power Factor
Correction
 Hardware Features
 100W 2 phase interleaved power
factor correction stage
 2 x 60 W motor driver stages
based on TI DRV8402 motor
driver chips
 On board isolated XDS100
JTAG emulation
 Software Lab Projects
No external
 Standalone PFC emulator required!
 Dual Axis TMDS2MTRPFCKIT(2 motors)
 Single Axis + PFC TMDS1MTRPFCKIT(1 motor)
11/1/2009
 Dual Axis + PFC (coming soon)

F28333x - Digital Motor Control 18 - 29


Summary

Summary

Benefits of C2000 for Motor Control


AC
Input
Bridge DC link Power
Motor Load
• High energy efficiency via advanced
Rectifier Converter
Control
• Variable speed Real-time control
MOSFET
I and V Sense Driver I Sense • Better dynamic and transient control

Isolation Products • Overall System performance


optimization
Resolver • High Level of Integration
Power High
Accuracy Driver
• Provides Control and Supervision
Supply
ADC’s
LDO C28xTM MCU and Buffer Optical
Controller DAC’s encoder
PFC
SVS
PWM
Level-
Shifter • Quicker Return on Investment
Hall effect
• Portfolio of compatible devices from
lowest cost to highest performance
• Long term SW and tools compatibility
• System Cost Optimization
Network 4-20mA ADC DAC
interface interface Data line Interface Interface
• Low System Cost
• Integrated OSC, Watchdogs
4-20mA loop CAN
Ethernet
RS232
+/- 10V +/- 10V • Analog Comparators
RS485
• Fault Detection
• Limited life support
• No external GPIO filters needed

Motor Control Development Kit


The Digital Motor Control Kit “TMDS2MTRPFCKIT” is an ideal target to experiment with
control loops for electrical motors.
This kit comes with a set of documentation, including all the software that is needed to build
software projects as described in this Chapter. You can also download this software from the
Texas Instruments website (www.ti.com):

• Search for literature number “sprc922.zip” to obtain the board specific software
• Search for literature number “sprc675.zip” to get the software baseline for this kit
• Search for literature number “SPRUGQ1” to get the Quick Start Guide for the
board.

18 - 30 F28333x - Digital Motor Control

You might also like