dsp-based control of variable
TRANSCRIPT
37DSP-based Control of Variable
Speed Drives
Hamid A. Toliyat, Ph.D.Electrical and Computer
Engineering Department, TexasA&M University, 3128 Tamus,216g Zachry Engineering Center,College Station, Texas, USA
Mehdi Abolhassani, Ph.D.Black & Decker (US) Inc., 701 E
Joppa Rd., TW100, Towson,Maryland, USA
Peyman Niazi, Ph.D.Maxtor Co., 333 South St.,
Shrewsbury, Massachusetts, USA
Lei Hao, Ph.D.Wavecrest Laboratories, 1613 Star
Batt Drive, Rochester Hills,Michigam, USA
37.1 Introduction ........................................................................................ 103137.2 Variable Speed Control of AC Machines ................................................... 103237.3 General Structure of a Three-phase AC Motor Controller ............................ 1032
37.3.1 Pulse Width Modulation Generation • 37.3.2 Analog-to-Digital Conversion Requirements• 37.3.3 Position Sensing and Encoder Interface Units • 37.3.4 The PI regulator
37.4 DSP-based Control of Permanent Magnet Brushless DC Machines ................ 103737.4.1 Mathematical Model of the BLDC Motor • 37.4.2 Torque Generation • 37.4.3 BLDCMotor Control Topology • 37.4.4 DSP Controller Requirements • 37.4.5 Implementation ofthe BLDC Motor Control Algorithm Using LF2407
37.5 DSP-based Control of Permanent Magnet Synchronous Machines ................. 104137.5.1 Mathematical Model of PMSM • 37.5.2 Mathematical Model of PMSM in RotorReference Frame • 37.5.3 PMSM Control Topology • 37.5.4 DSP Controller Requirements• 37.5.5 Implementation of the PMSM Algorithm Using the LF2407
37.6 DSP-based Vector Control of Induction Motors ......................................... 104637.6.1 Induction Motor Field-oriented Control • 37.6.2 DSP Controller Requirements• 37.6.3 Implementation of Field-oriented Speed Control of Induction Motor
37.1 Introduction
High-performance motor drives are characterized by the needfor smooth rotation down to stall, full control of torque atstall, and fast accelerations and decelerations. In the past,variable speed drives employed predominantly dc motorsbecause of their excellent controllability. However, modernhigh-performance motor drive systems are usually based onthree-phase ac motors, such as the ac induction motor (ACIM)or the permanent magnet synchronous motor (PMSM). Thesemachines have supplanted the dc motor as the machine ofchoice for variety of applications because of their simple robustconstruction, low inertia, high power density, high torquedensity, and good performance at high speeds of rotation.
The vector-control techniques established for controllingthese ac motors; and most modern high-performance drivesnow implement digital closed-loop current control. In suchsystems, the achievable closed-loop bandwidths are directlyrelated to the rate at which the computationally intensivevector-control algorithms and associated vector rotations canbe implemented in real time. Because of this computational
burden, many high-performance drives now use digital signalprocessors (DSPs) to implement the embedded motor- andvector-control schemes. The DSPs are special microprocessorsused where real-time manipulation of large amounts of digitaldata is required in order to implement complicated controlalgorithms. The inherent computational power of the DSPpermits very fast cycle times and closed-loop current controlbandwidths to be achieved.
The complete current control scheme for these machinesalso requires a high-precision pulse-width modulation (PWM)voltage-generation scheme and high-resolution analog-to-digital (A/D) conversion (ADC) for measurement of themotor currents. In order to maintain a smooth control oftorque to zero speed, rotor position feedback is essential formodern vector controllers. Therefore, many systems includerotor-position transducers, such as resolvers and incrementalencoders.
The Texas Instruments TMS320LF2407 DSP Controller(referred to as the LF2407 in this chapter) is a programmabledigital controller with a C2xx DSP central processing unit(CPU) as the core processor. The LF2407 contains the DSP
Copyright © 2007, 2001, Elsevier Inc.
All rights reserved.
1031
1032 H. A. Toliyat et al.
core processor and useful peripherals integrated onto a sin-gle piece of silicon. The LF2407 combines the powerful CPUwith on-chip memory and peripherals. With the DSP coreand control-oriented peripherals integrated into a single chip,users can design very compact and cost-effective digital controlsystems.
The LF2407 DSP controller offers 40 million instructionsper second (MIPS) performance. This high processing speedof the C2xx CPU allows users to compute parameters in realtime rather than look up approximations from tables storedin memory. This fast performance is well suited for process-ing control parameters in applications such as notch filters orsensorless motor control algorithms where a large amount ofcalculations must be computed quickly.
While the “brain” of the LF2407 DSP is the C2xx core,the LF2407 contains several control-orientated peripheralsonboard (see Fig. 37.1). The peripherals on the LF2407 makevirtually any digital control requirement possible. Their appli-cations range from analog to digital conversion to pulse widthmodulation (PWM) generation. Communication peripheralsmake possible the communication with external peripher-als, personal computers, or other DSP processors. Below isa graphical listing of the different peripherals onboard theLF2407 depicted in Fig. 37.1.
We describe here the fundamental principles behind theimplementation of high-performance controllers for three-phase ac motors – combining an integrated DSP controller,LF2407, flexible PWM generation, high-resolution A/D con-version, and an embedded encoder interface.
37.2 Variable Speed Control of ACMachines
Efficient variable speed control of three-phase ac machinesrequires the generation of a balanced three-phase set of vari-able voltages with variable frequency. The variable-frequencysupply is typically produced by conversion from dc usingpower-semiconductor devices (typically MOSFETs or IGBTs)as solid-state switches. A commonly used converter configu-ration is shown in Fig. 37.2a. It is a two-stage circuit, in whichthe fixed-frequency 50 or 60 Hz ac supply is first rectified toprovide the dc link voltage, Vd , stored in the dc link capacitor.This voltage is then supplied to an inverter circuit that gener-ates the variable-frequency ac power for the motor. The powerswitches in the inverter circuit permit the motor terminals tobe connected to either Vd or ground.
This mode of operation gives high efficiency because, ideally,the switch has zero loss in both the open and closed positions.By rapid sequential opening and closing of the six switches(Fig. 37.2a), a three-phase ac voltage with an average sinusoidalwaveform can be synthesized at the output terminals. Theactual output voltage waveform is a pulse-width modulated
(PWM) high-frequency waveform, as shown in Fig. 37.2b. Inpractical inverter circuits using solid-state switches, high-speedswitching of about 20 kHz is possible. Therefore sophisticatedPWM waveforms with fundamental frequencies, nominallyin the range of 0–250 Hz can be generated. The inductivereactance of the motor increases with frequency. Thus, higher-order harmonic currents are very small and near-sinusoidalcurrents flow in the stator windings. The fundamental voltageand output frequency of the inverter, as indicated in Fig. 37.2b,are adjusted by changing the PWM waveform using an appro-priate controller. When controlling the fundamental outputvoltage, the PWM process inevitably modifies the harmoniccontent of the output voltage waveform. A proper choice ofmodulation strategy can minimize these harmonic voltagesand in result, harmonic losses in the motor.
37.3 General Structure of a Three-phaseAC Motor Controller
Accurate control of any motor-drive process may ultimatelybe reduced to the problem of accurate control of both thetorque and speed of the motor. In general, motor speed iscontrolled directly by measuring the motor’s speed or posi-tion using appropriate transducers, and torque is controlledindirectly by suitable control of the motor-phase currents.Figure 37.3 shows a block diagram of a typical synchronousframe current controller for a three-phase motor. The figurealso shows the proportioning of tasks between software codemodules and the dedicated motor-control peripherals of amotor controller such as the LF2407. The controller consists oftwo proportional-plus-integral-plus-differential (PID) currentregulators that are used to control the motor current vec-tor in a reference frame that rotates synchronously with themeasured rotor position.
Sometimes it may be desirable to implement a decouplingbetween voltage and speed that removes the speed dependen-cies and associated axes cross coupling from the control loop.The reference voltage components are then synthesized on theinverter using a suitable PWM strategy, such as space vectormodulation (SVM). It is also possible to incorporate somecompensation schemes to overcome the distorting effects ofthe inverter switching dead time, finite inverter device on-state voltages, and dc-link voltage ripple. The two componentsof the stator current vector are known as the direct-axis andquadrature-axis components. The direct-axis current controlsthe motor flux and is usually controlled to be zero withpermanent magnet machines. The motor torque may thenbe controlled directly by regulation of the quadrature-axiscomponent. Fast, accurate torque control is essential for high-performance drives in order to ensure rapid acceleration anddeceleration – and smooth rotation down to zero speed underall load conditions.
37 DSP-based Control of Variable Speed Drives 1033
XTAL1/CLKIN
XTAL2
PLLVCCA
PLLF2
PLLF
VSSA
VREFHI
ADCIN08-ADCIN15VCCA
ADCIN00-ADCIN07
SCIRXD/IOPA1
SPISIMO/IOPC2
XINT2/ADCSOC/IOPD0
SCITXD/IOPA0
VREFLO
Port A(0-7) IOPA[0:7]
SPICLK/IOPC4
SPISTE/IOPC5
SPISOMI/IOPC3
Port E(0-7) IOPE[0:7]
Port F(0-6) IOPF[0:6]
Port C(0-7) IOPC[0:7]
Port D(0)IOPD[0]
Port B(0-7) IOPB[0:7]
TDO
TDI
CANRX/IOPC7
TRST
CANTX/IOPC6
EMU1
PDPINTB
TCK
EMU0
TMS
CAP5/QEP4/IOPF0
CAP4/QEP3/IOPE7
PWM7/IOPE1
PWM8/IOPE2
CAP6/IOPF1
PWM10/IOPE4
PWM9/IOPE3
PWM11/IOPE5
PWM12/IOPE6
T4PWM/T4CMP/IOPF3
T3PWM/T3CMP/IOPF2
TDIRB/IOPF4
TCLKINB/IOPF5
DARAM (B0)256 Words
DARAM (B1)256 Words
DARAM (B2)32 Words
C2xxDSPcore
PLL clock
10-Bit ADC(with twin
autosequencer)
RS
CLKOUT/IOPE0
XINT1/IOPA2
BIO/IOPC1
MP/MC
W/R / IOPC0
TMS2
A0-A15
D0-D15
TP1TP2
BOOT EN/XF
READY
STRB
R/W
RD
PS, DS, IS
VIS OE
ENA 144
WE
CAP3/IOPA5
PWM1/IOPA6
CAP1/QEP1/IOPA3
CAP2/QEP2/IOPA4
PDPINTA
PWM5/IOPB2
PWM6/IOPB3
PWM3/IOPB0
PWM4/IOPB1
PWM2/IOPA7
T2PWM/T2CMP/IOPB5
T1PWM/T1CMP/IOPB4
TCLKINA/IOPB7
TDIRA/IOPB6
VDD(3.3V)
VSS
VCCP(5V)
SARAM (2K Words)
Flash/ROM(32K Words
:4K/12K/12K/4K)
External memory interface
SCI
SPI
WD
Digital I/O(shared with other pins)
CAN
JTAG port
Indicates optional modules in the 240x family. The memory size and peripheral selectionof these modules change for different 240xA devices
Event manager B- 3 Capture Inputs- 6 Compare/PWM Outputs- 2 GP Timers/PWM
Event manager A- 3 Capture Inputs- 6 Compare/PWM Outputs- 2 GP Timers/PWM
FIGURE 37.1 Graphical overview of DSP core and peripherals on the LF2407. (Courtesy of Texas Instruments)
The actual direct and quadrature current components areobtained by first measuring the motor phase currents withsuitable current-sensing transducers and converting them todigital, using an on-chip ADC system. It is usually sufficientto simultaneously sample just two of the motor line cur-rents: since the sum of the three currents is zero, the thirdcurrent can, when necessary, be deduced from simultane-ous measurements of the other two currents The controller
software makes use of mathematical vector transformations,known as Park Transformations that ensure that the three-phase set of currents applied to the motor is synchronizedto the actual rotation of the motor shaft, under all oper-ating conditions. This synchronism ensures that the motoralways produces the optimal torque per ampere – i.e. operatesat optimal efficiency. The vector rotations require real-timecalculation of the sine and cosine of the measured rotor
1034 H. A. Toliyat et al.
(b)
(a)
FUNDAMENTALMOTORPHASE
VOLTAGE
RECTIFIER INVERTER
THREE-PHASE
60HzMAINS
DESIRED FREQUENCY
DESIREDAMPLITUDE
B
N
AM
C
VAB
VD
VAN
VBN
FIGURE 37.2 (a) Typical configuration of power converter used to drive three-phase ac motors and (b) typical PWM waveforms in the generationof a variable-voltage, variable-frequency supply for the motor.
VOLTAGEDECOUPLING
PARK SVM
NON-IDEALITY
CORRECTION
ADCSYSTEM
ENCODERFEEDBACKSIGNALS
ENCODERINTERFACE
UNIT
FWMGENERATION
UNIT
MOTORCURRENTFEEDBACK
PWMOUTPUTS
MOTOR CONTROLPERIPHERALS
DSP SOFTWARE
PID
PID
PARK
3−>2TRANSFORM
ROTORPOSITION
ddt
I*DS
I*QS+
+−
−
e−j e
e−j e
e
FIGURE 37.3 Configuration of typical control system for three-phase ac motor.
37 DSP-based Control of Variable Speed Drives 1035
angle, plus a number of multiply-and-accumulate operations.The overall control-loop bandwidth depends on the speedof implementation of the closed-loop control calculations –and the resulting computation of new duty-cycle values. Theinherent fast computational capability of the 40-MIPS, 16-bitfixed-point DSP core makes it the ideal computational enginefor these embedded motor-control applications.
37.3.1 Pulse Width Modulation Generation
In typical ac motor-controller design, both hardware and soft-ware considerations are involved in the process of generatingthe PWM signals that are ultimately used to turn on or offthe power devices in the three-phase inverter. In typical digi-tal control environments, the controller generates a regularlytimed interrupt at the PWM switching frequency (nominally10–20 kHz). In the interrupt service routine, the controllersoftware computes new duty-cycle values for the PWM signalsused to drive each of the three legs of the inverter. The com-puted duty cycles depend on both the measured state of themotor (torque and speed) and the desired operating state. Theduty cycles are adjusted on a cycle-by-cycle basis in order tomake the actual operating state of the motor follow the desiredtrajectory.
Once the desired duty cycle values have been computed bythe processor, a dedicated hardware PWM generator is neededto ensure that the PWM signals are produced over the nextPWM and controller cycle. The PWM generation unit typicallyconsists of an appropriate number of timers and comparatorsthat are capable of producing very accurately timed signals.Typically, 10-to-12 bit performance in the generation of thePWM timing waveforms is desirable.
Figure 37.4 shows a typical PWM waveform for a single leginverter. In general, there is a small delay required betweenturning off one power device like A-phase lower device andturning on the complementary power device A-phase upperdevice. This dead-time is required to ensure the device beingturned off has sufficient time to regain its blocking capabilitybefore the other device is turned on. Otherwise a short circuitof the dc voltage could result.
CONTROL PERIOD CONTROL PERIOD CONTROL PERIOD
20015010050
CONTROLLERINTERRUPTS
DUTY CYCLE, D1 DUTY CYCLE, D2 DUTY CYCLE, D3
AH
AL
N N + 1 N + 2TIME
µs
FIGURE 37.4 Typical PWM waveforms for a single inverter leg.
In LF2407, the compare units have been used to generate thePWM signals. The PWM output signal is high when the outputof current PI regulation matches the value of T1CNT and isset to low when the timer underflow occurs. The switch-statesare controlled by the ACTR register. In order to minimize theswitching losses, the lower switches are always kept on andthe upper switches are chopped on/off to regulate the phasecurrent.
37.3.2 Analog-to-Digital ConversionRequirements
For control of high-performance motor drives, fast, high-accuracy, simultaneous-sampling A/D conversion of the mea-sured current values is required. The drives have a ratedoperation range – a certain power level that they can sus-tain continuously, with an acceptable temperature rise in themotor and power converter. They also have a peak rating – theability to handle a current far in excess of the rated current forshort periods of time. This allows a large torque to be appliedtransiently, to accelerate or decelerate the drive very quickly,and then to revert to the continuous range for normal oper-ation. This also means that in the normal operating mode ofthe drive, only a small percentage of the total input range isbeing used.
At the other end of the scale, in order to achieve the smoothand accurate rotations desired in these machines, it is wise tocompensate for small offsets and non-linearities such as coresaturation and parameter detuning. In any current-sensor elec-tronics, the analog signal processing is often subject to gainand offset errors. Gain mismatches, for example, can existbetween the current-measuring systems for different wind-ings. These effects combine to produce undesirable oscillationsin the torque. To meet both of these conflicting resolutionrequirements, modern motor-drives use 10-bit A/D convert-ers, depending on the cost/performance trade-off required bythe application.
The bandwidth of the system is essentially limited by theamount of time it takes to input information and then per-form the calculations. The A/D converters that take many
1036 H. A. Toliyat et al.
microseconds to convert can produce intolerable delays inthe system. A delay in a closed-loop system will degrade theachievable bandwidth of the system, and bandwidth is one ofthe most important figures of merit in these high-performancedrives. Therefore, fast analog-to-digital conversion is a neces-sity for these applications.
A third important characteristic of the A/D converter usedin these applications is timing. In addition to high resolu-tion and fast conversion, simultaneous sampling is needed. Inany three-phase motor, it is necessary to measure the currentsin the three windings of the motor at exactly the same timein order to get an instantaneous “snapshot” of the torque inthe machine. Any time skew (time delay between the mea-surements of the different currents) is an error factor that isartificially inserted by the means of measurement. Such a non-ideality translates directly into a ripple of the torque – a veryundesirable characteristic.
The analog-to-digital converter (ADC) on the LF2407 allowsthe DSP to sample analog or “real-world” voltage signals. Theoutput of the ADC is an integer number which represents thevoltage level sampled. The integer number may be used forcalculations in an algorithm. The resolution of the ADC is10 bits, meaning that the ADC will generate a 10-bit numberfor every conversion it performs. However, the ADC stores theconversion results in registers that are 16-bit wide. The 10 mostsignificant bits are the ADC result, while the least significantbits (LSBs) are filled with “0”s. There are a total of 16 inputchannels to the single input ADC. The control logic of the ADCconsists of auto-sequencers, which control the sampling of the16 input channels to the ADC. The auto-sequencers not onlycontrol which channels (input channels) will be sampled bythe ADC, but also the order of the channels that the ADC per-forms conversions on. The two 8-conversion auto-sequencerscan operate independently or cascade together as a “virtual”16-conversion ADC.
37.3.3 Position Sensing and Encoder InterfaceUnits
Usually the motor position is measured through the use of anencoder mounted on the rotor shaft. The incremental encoderproduces a pair of quadrature outputs (A and B), each with alarge number of pulses per revolution of the motor shaft. Fora typical encoder with 1024 lines, both signals produce 1024pulses per revolution. Using a dedicated quadrature counter,it is possible to count both the rising and falling edges of boththe A and B signals so that one revolution of the rotor shaftmay be divided into 4096 different values. In other words,a 1024 line encoder allows the measurement of rotor posi-tion to 12-bit resolution. The direction of rotation may alsobe inferred from the relative phasing of quadrature signalsA and B.
Figure 37.5 shows the structure of an optical encoder. It con-sists of a light source, a radially slotted disk, and photoelectric
AB
LightSensors
(a)
(b)
w
FIGURE 37.5 The structure of an encoder.
sensors. The disk rotates with the rotor. The two photosensorsdetect the light passing through the slots in the disk. Whenthe light is hidden, a logic “0” is generated by the sensors.When the light passes through the slots of the disk, a logic“1” is produced. These logic signals are shown in Fig. 37.5. Bycounting the number of pulses, the motor speed can be calcu-lated. The direction of rotation can be determined by detectingthe leading signal between signals A and B.
This is all very well, but there is an increasing class of cost-sensitive motor drive applications with lower performancedemands that can afford neither the cost nor the space require-ments of the rotor position transducer. In these cases, the samemotor-control algorithms can be implemented with estimatedrather than measured rotor position.
The DSP core is quite capable of computing rotor posi-tion using sophisticated rotor-position estimation algorithms,such as extended Kalman estimators that extract estimates ofthe rotor position from measurements of the motor voltagesand currents. These estimators rely on the real-time compu-tation of a sufficiently accurate model of the motor in theDSP. In general, these sensorless algorithms can be made towork as well as the sensored algorithms at medium to high-speeds of rotation. But as the speed of the motor decreases,the extraction of reliable speed-dependent information fromvoltage and current measurements becomes more difficult.In general, sensorless motor control is applicable princi-pally to applications such as compressors, fans and pumps,where continuous operation at zero or low speeds is notrequired.
37.3.4 The PI regulator
An electrical drive based on the field-orientated control (FOC)needs two constants as control parameters: the torque com-ponent reference ie∗
qs and the flux component reference ie∗ds .
The classical PI regulator is well suited to regulate the torqueand flux feedback to the desired values. This is because it isable to reach constant references by correctly setting both theproportional term (Kp) and the integral term (Ki), which are,respectively, responsible for the error sensibility and for thesteady-state error. The numerical expression of the PI regulator
37 DSP-based Control of Variable Speed Drives 1037
Kp
Ki
1/Z
Uref
Ufbk
ek
xi
YkΣ
Σ
Σ
FIGURE 37.6 Classical PI regulator structure in discrete domain.
Kp
Ki
1/Z
Uref
Ufbk
ek
xi
Yk Y1k
Kc
–
+S
S S
S
FIGURE 37.7 Numerical PI regulator with correction.
is as follows:
Y(k) = Kpe(k) + Kie(k) +k−1∑n=0
e(n) (37.1)
which is represented in Fig. 37.6.During normal operation, large reference value variations
or disturbances may occur, that result in the saturation andoverflow of the regulator variables and output. To solve thisproblem, one solution is to add a correction of the integralcomponent as depicted in Fig. 37.7.
The constants Kp , Ki , Kc , proportional, integral, and integralcorrection components, are selected based on the samplingperiod and on the motor parameters. After defining the DSP-controlled motor drives requirements, in the following, wedescribe the digital control algorithms for permanent magnetmotors and induction motors.
37.4 DSP-based Control of PermanentMagnet Brushless DC Machines
Permanent magnet alternating current (PMAC) motors aresynchronous motors that have permanent magnets mountedon the rotor and poly-phase, usually three-phase, armaturewindings located on the stator. Since the field is provided bythe permanent magnets, the PMAC motor has higher efficiencythan induction or switched reluctance motors. The advantagesof PMAC motors, combined with a rapidly decreasing costof permanent magnets, have led to their widespread use inmany variable speed drives such as robotic actuators, com-puter disk drives, appliances, automotive applications, and airconditioning (HVAC) equipment.
In general, PMAC motors are categorized into two types.The first type of motor is referred to as PM synchronous
0 20 40 60 80 100 120 140 160 180−40
−30
−20
−10
0
10
20
30
40
Rotor Position (deg)
Bac
k-E
MF
(V
)
A B C
(a)
0 20 40 60 80 100 120 140 160 180−50
−40
−30
−20
−10
0
10
20
30
40
50
Rotor Position (deg)
Bac
k-E
MF
(V
)
A C
(b)
B
FIGURE 37.8 The back-EMF of PMAC motors: (a) three-phase back-EMF of PMSM and (b) three-phase back-EMF of BLDC motors.
motor (PMSM). These motors produce a sinusoidal back-EMF, shown in Fig. 37.8a, and should be supplied withsinusoidal current/voltage. The PMSM’s electronic control anddrive system uses continuous rotor position feedback andPWM to supply the motor with the sinusoidal voltage or cur-rent. With this, constant torque is produced with very littleripple.
The second type of PMAC motor has a trapezoidal back-EMF and is referred to as the brushless DC (BLDC) motor.The back-EMF of the BLDC motor is shown in Fig. 37.8b. TheBLDC motor requires that quasi-rectangular-shaped currentsare fed into the machine. Alternatively, the voltage may beapplied to the motor every 120◦, with a current limit to holdthe currents within the motor’s capabilities.
37.4.1 Mathematical Model of the BLDC Motor
The phase variables are used to model the BLDC motor due toits non-sinusoidal back-EMF and phase current. The terminal
1038 H. A. Toliyat et al.
voltage equation of the BLDC motor can be written as
va
vb
vc
=
R + pLs 0 0
0 R + pLs 00 0 R + pLs
·
ia
ibic
+
ea
eb
ec
(37.2)
where va , vb , vc are the phase voltages, ia , ib , ic are the phasecurrents, ea , eb , ec are the phase back-EMF voltages, R is thephase resistance, Ls is the synchronous inductance per phaseand includes both leakage and armature reaction inductances,and p represents d/dt . The electromagnetic torque is given by
Te = (eaia + ebib + ec ic )
ωm(37.3)
where ωm is the mechanical speed of the rotor. The equationof motion is
d
dtωm = (Te − TL − Bωm)
J(37.4)
where TL is the load torque, B is the damping constant, and Jis the moment of inertia of the rotor shaft and the load.
Eb
Ec
Ia
Ib
Ic
T1
T2
T3
T4
T5
T6
30 600 120 15090 210 240180 300 330270 360
Ea
Torque
Switches (T1-T6) turn onRotor position (Deg.)
FIGURE 37.9 The principle of the six-step current control algorithm. T1–T6 are the gate signals, Ea , Eb , and Ec are the motor phase back-EMF, Ia ,Ib , and Ic are the motor phase currents.
37.4.2 Torque Generation
From Eq. (37.3), the electromagnetic torque of the BLDCmotor is related to the product of the phase back-EMF andcurrent. The back-EMFs in each phase are trapezoidal in shapeand are displaced by 120 electrical degrees with respect to eachother in a three-phase machine. A rectangular current pulseis injected into each phase so that current coincides with thecrest of the back-EMF waveform; hence the motor developsan almost constant torque. This strategy, commonly called six-step current control is shown Fig. 37.9. The amplitude of eachphase’s back-EMF is proportional to the rotor speed, and isgiven by
E = kφωm (37.5)
where k is a constant and depends on the number of turnsin each phase, φ is the permanent magnet flux, and ωm isthe mechanical speed. In Fig. 37.9, during any 120◦ interval,the instantaneous power converted from electrical to mechan-ical, Po , is the sum of the contributions from two phases inseries, and is given by
Po = ωmTe = 2EI (37.6)
where Te is the output torque and I is the amplitude of thephase current. From Eqs. (37.4) and (37.6), the expression for
37 DSP-based Control of Variable Speed Drives 1039
output torque can be written as
Te = 2kφI = kt I (37.7)
where Kt is the torque constant. Since the electromagnetictorque is only proportional to the amplitude of the phasecurrent in Eq. (37.7), torque control of the BLDC motor isessentially accomplished by phase current control.
37.4.3 BLDC Motor Control Topology
Based on the previously discussed concept, a BLDC motor-drive system is shown in Fig. 37.10. It can be seen that the totaldrive system consists of the BLDC motor, power electronicsconverter, sensor, and controller.
The BLDC motors are predominantly surface-magnetmachines with wide magnet pole arcs. The stator windingsare usually concentrated windings, which produce a squarewaveform distribution of flux density around the air-gap. Thedesign of the BLDC motor is based on the crest of each half-cycle of the back-EMF waveform. In order to obtain a smooth
D1
D2D4
D3
C
T1
T4
T3
T6
T5
T2
Ld
Vs
BLDC
Hall sensors
controller
DC-Buscurrent
Gates T1 to T6
FIGURE 37.10 BLDC motor control system.
PermanentMagnet
Stator
Windings
Rotor
A+
A+
B+
B+
C+
C+
C−
C−
A−
A−
B−
B−
FIGURE 37.11 The 4-pole 12-slot BLDC motor.
output torque, the back-EMF waveform should be wider than120◦ electrical degrees. A typical BLDC motor with 12 statorslots and 4 poles on the rotor is shown in Fig. 37.11. Theinverter is usually responsible for the electronic commutationand current regulation. For the six-step current control, if themotor windings are Y-connected without the neutral connec-tion, only two of the three phase currents flow through theinverter in series. This results in the amplitude of the DC linkcurrent always being equal to that of the phase currents. ThePWM current controllers are typically used to regulate theactual machine currents in order to match the rectangularcurrent reference waveforms shown in Fig. 37.9. For example,during one 60◦ interval, when switches T1 and T6 are active,phases A and B conduct. The lower switch T6 is always turnedon and the upper switch T1 is chopped on/off using either ahysteresis current controller with variable switch frequency ora PI controller with fixed switch frequency.
When T1 and T6 are conducting, current builds up in thepath as shown in Fig. 37.12a with dashed line. When switch T1
is turned off, the current decays through diode D4 and switchT6 as depicted in Fig. 37.12b. In the next interval, switch T2 is
1040 H. A. Toliyat et al.
C
T6 T2
ra Lc Ea
rb Lc Eb
rc Lc Ec
T1 T3 T5
T4
D1 D3 D5
D2D6D4
C
T4 T6 T2
ra Lc Ea
rb Lc Eb
rc Lc Ec
T3 T5T1
D1 D3 D5
D2D6D4
(a)
(b)
FIGURE 37.12 The current path when the switch T1 turns on and turns off.
on, and T1 is chopped so that phase A and phase C conduct.During the commutation interval, the phase B current rapidlydecreases through the freewheeling diode D3 until it becomeszero and the phase C current builds up.
From the above analysis, each of the upper switches isalways chopped for one 120◦ interval and the correspondinglower switch is always turned on per interval. The freewheelingdiodes provide the necessary paths for the currents to circulatewhen the switches are turned off and during the commuta-tion intervals. There are two types of sensors for the BLDCdrive system: a current sensor and a position sensor. Since theamplitude of the dc link current is always equal to the motorphase current in six-step current control, the dc link current ismeasured instead of the phase current. Thus, a shunt resistor,which is in series with the inverter, is usually used as the cur-rent sensor. Hall-effect position sensors typically provide theposition information needed to synchronize the stator excita-tion with rotor position in order to produce constant torque.Hall-effect sensors detect the change in magnetic field. Therotor magnets are used as triggers for the Hall sensors. A sig-nal conditioning circuit is needed for noise cancellation inHall-effect sensors circuits. In six-step current control algo-rithm, rotor position needs to be detected at only six discrete
points in each electrical cycle. The controller tracks these sixpoints so that the proper switches are turned on or off for thecorrect intervals. Three Hall-effect sensors, spaced 120 elec-trical degrees apart, are mounted on the stator frame. Thedigital signals from the Hall sensors are then used to determinethe rotor position and switch gating signals for the inverterswitches.
37.4.4 DSP Controller Requirements
The controller of BLDC drive systems reads the current andposition feedback, implements the speed or torque controlalgorithm, and finally generates the gate signals. The con-nectivity of the LF2407 in this application is illustrated inFig. 37.13. Three capture units in the LF2407 are used to detectboth the rising and falling edges of Hall-effect signals. Hence,every 60 electrical degrees of motor rotation, one capture unitinterrupt is generated which ultimately causes a change in thegating signals and the motor to move to the next position. Oneinput channel of the 10-bit A/D converter reads the dc linkcurrent. The output pins PWM1–PWM6 are used to supplythe gating signals to the inverter.
37 DSP-based Control of Variable Speed Drives 1041
TMS320F2407
PWM-1 &PWM-6
ADCIN0Idc
Capture-1
Capture-2
H1
H2
Capture-2H2
GateDrive
FIGURE 37.13 The interface of LF2407.
37.4.5 Implementation of the BLDC MotorControl Algorithm Using LF2407
A block diagram of the BLDC motor control system is shownin Fig. 37.14. The dashed line separates the software from thehardware components introduced in the previous section. It isnecessary to choose hardware components carefully in orderto ensure high processing speed and precision in the overallcontrol system. The overall control algorithm of the BLDCmotor consists of nine modules:
• Initialization procedure• Detection of Hall-effect signals• Speed control subroutine• Measurement of current• Speed profiling• Calculation of actual speed• PID regulation• PWM generation• DAC output
BLDC
FiringCircuit
Rectifier VoltageSource
~120 V
Integrator
Current PIController
Speed PIController
PWMGenerator
HallSignal
Hall_drvHall_state
ω fb
−
+
LF2407
I ref
I fb
−+
Speed Profile
ωref
FIGURE 37.14 The block diagram of BLDC motor control algorithm.
The flowchart of the overall control algorithm is illustratedin Fig. 37.15.
37.5 DSP-based Control of PermanentMagnet Synchronous Machines
As previously described, the permanent magnet synchronousmotor (PMSM) is a PM motor with a sinusoidal back-EMF.Compared to the BLDC motor, it has less torque ripple becausethe torque pulsations associated with current commutation donot exist. A carefully designed machine in combination witha good control technique can yield a very low level of torqueripple (<2% rated), which is attractive for high-performancemotor control applications such as machine tool and servoapplications.
In this section, following the same procedures used in theprevious section, the principles of the PMSM drive system will
1042 H. A. Toliyat et al.
Read DC link current Idc ; Load Hall Effect signals
Start
Initialization procedure
Executespeed loop?
Read reference speed wref
Read Hallsensor signal
End
No
Yes
Calculate the motor actual speed wr
Speed PI regulatorCalculate the commended torque
Current PI regulator
Generate the PWM using ∆ generator
End
Output the program variables to DAC0~DAC3
Calculate the command DC link current idc using (28.7)*
FIGURE 37.15 BLDC algorithm flowchart.
be introduced. Later, the control implementation using theLF2407 DSP will be described in detail.
37.5.1 Mathematical Model of PMSM
Figure 37.16 depicts the simplified three-phase surfacemounted PMSM motor for our discussion. The stator wind-ings, as–as′, bs–bs′, and cs–cs′, are shown as lumped windingsfor simplicity, but are actually distributed around the stator.The rotor has 2 poles. Mechanical rotor speed and position aredenoted as ωrm and θrm , respectively. Electrical rotor speed andposition, ωr and θr , are defined as P/2 times the correspondingmechanical quantities, where P is the number of poles.
Based on the above motor definition, the voltage equationin the abc stationary reference frame is given by
Vabcs = Rsiabcs + d
dtλabcs (37.8)
as
as'
bscs
bs' cs'
A-axis
B-axis
C-axis
Wrm
N
S
d-axis
q-axis
FIGURE 37.16 The cross section of PMSM.
37 DSP-based Control of Variable Speed Drives 1043
where
fabcs = [fas fbs fcs
]T(37.9)
and the stator resistance matrix is given by
Rs = diag[rs rs rs] (37.10)
The flux linkages equation can be expressed by
λabcs = Lsiabcs + λ′m
sin ϑr
sin(ϑr − 2π3 )
sin(ϑr − 4π3 )
(37.11)
where λ′m denotes the amplitude of the flux linkages estab-
lished by the permanent magnet as viewed from the statorphase windings. Note that in Eq. (37.11) the back-EMFs aresinusoidal waveforms that are 120◦ apart from each other.
The stator self-inductance matrix, Ls , is given as
Ls =
Lls + LA − LB cos 2θr − 12 LA − LB cos 2(θr − π/3) − 1
2 LA − LB cos 2(θr + π/3)
− 12 LA − LB cos 2(θr − π/3) Lls + LA − LB cos 2(θr − 2π/3) − 1
2 LA − LB cos 2(θr + π)
− 12 LA − LB cos 2(θr + π/3) − 1
2 LA − LB cos 2(θr + π) Lls + LA − LB cos 2(θr + 2π/3)
(37.12)
The torque and speed are related by the electromechanicalmotion equation
Jd
dtωrm = P
2(Te − TL) − Bmωrm (37.15)
where J is the rotational inertia, Bm is the approximatedmechanical damping due to friction, and TL is the load torque.
37.5.2 Mathematical Model of PMSM in RotorReference Frame
The voltage and torque equations can be expressed in the rotorreference frame in order to transform the time-varying vari-ables into steady-state constants. The transformation of thethree-phase variables in the stationary reference frame to therotor reference frame is defined as
fqd0r = Kr fabcs (37.16)
where
kr = 2
3
cos θr cos(θr − 2π3 ) cos(θr + 2π
3 )
sin θr sin(θr − 2π3 ) sin(θr + 2π
3 )
12
12
12
If the applied stator voltages are given by
Vas = √2Vs cos θev
Vbs = √2Vs cos(θev − 2π
3 )
Vcs = √2Vs cos(θev + 2π
3 )
(37.17)
Then applying (37.16) to (37.8), (37.11), and (37.17) yields
vrqs = rs ir
qs + ωrλrds + d
dtλr
qs (37.18)
vrds = rs ir
ds − ωrλrqs + d
dtλr
ds (37.19)
λrqs = Lqs ir
qs (37.20)
λrds = Lds ir
ds + λ′rm (37.21)
where the q- and d-axes self-inductances are given byLqs = Lls + Lmq and Lds = Lls + Lmd , respectively.The electromagnetic torque can be written as
Te = 3
2
P
2[λ′r
mirqs + (Lds − Lqs)iqs ids] (37.22)
The electromagnetic torque may be written as
Te = P
2
{λ
′m
[(ias − 1
2ibs − 1
2ics)cosθr −
√3
2(ibs − ics)sinϑr
]
+ Lmd −Lmq
3
[(i2
as −1
2i2bs −
1
2i2cs − ias ibs − ias ics +2ibs ics)
sin2θr +√
3
2
(i2bs i2
cs −2ias ibs +2ias ics)cos2θr
]}+Tcog (θr )
(37.13)
In Eq. (37.13), Tcog (θr ) represents the cogging torque andthe d- and q-axes magnetizing inductances are defined by
Lmd = 3
2(LA − LB)
and
Lmd = 3
2(LA + LB) (37.14)
1044 H. A. Toliyat et al.
From Eq. (37.22), it can be seen that torque is related onlyto the d- and q-axes currents. Since Lq ≥ Ld (for surfacemount PMSM both inductances are equal), the second itemcontributes a negative torque if the flux weakening control hasbeen used. In order to achieve the maximum torque/currentratio, the d-axis current is set to zero during the constanttorque control so that the torque is proportional only to theq-axis current. Hence, this results in the control of the q-axiscurrent for regulating the torque in rotor reference frame.
37.5.3 PMSM Control Topology
Based on the above analysis, a PMSM drive system is developedas shown in Fig. 37.17. The total drive system looks similar tothat of the BLDC motor and consists of a PMSM, power elec-tronics converter, sensors, and controller. These componentsare discussed in detail in the following sections.
The design consideration of the PMSM is to first generatethe sinusoidal back-EMF. Unlike the BLDC, which needs con-centrated windings to produce the trapezoidal back-EMF, thestator windings of PMSM are distributed in as many slots perpole as deemed practical to approximate a sinusoidal distri-bution. To reduce the torque ripple, standard techniques suchas skewing and chorded windings are applied to the PMSM.With the sinusoidally excited stator, the rotor design of thePMSM becomes more flexible than the BLDC motor where thesurface-mount permanent magnet is a favorite choice. Besidesthe common surface-mount non-salient pole PM rotor, thesalient pole rotor, like inset and buried magnet rotors, areoften used because they offer appealing performance charac-teristics during the flux weakening region. A typical PMSMwith 36 stator slots in stator and 4 poles on the rotor is shownin Fig. 37.18.
Due to the sinusoidal nature of the PMSM, control algo-rithms such as V/f and vector control, developed for other ACmotors, can be directly applied to the PMSM control system. Ifthe motor windings are Y-connected without a neutral connec-tion, three-phase currents can flow through the inverter at any
D1
D4
D3C
T1
T2
T3
T4
T5
T6
Ld
Vs
Controller
to T1~T6
PMSM
ias
ibs
Resolver
D2
q
FIGURE 37.17 The PMSM speed control system.
N
N
S
S
A
A
A
A
−C−C−C
−C
−A−A−A
−A
−A−A −A
−A
−B
−B−B
−B
−C−C
−C−C
−B−B
−B
−B
CCB
BB
BC
C
CC
CC
BB
BB
A
A A
A
FIGURE 37.18 A 4-pole 24-slot PMSM.
moment. With respect to the inverter switches, three switches,one upper and two lower in three different legs conduct at anymoment as shown in Fig. 37.19. The PWM current control isstill used to regulate the actual machine current. Either a hys-teresis current controller, a PI controller with sine-triangle, oran SVPWM strategy is employed for this purpose. Unlike theBLDC motor, the three switches are switched at any time.
37.5.4 DSP Controller Requirements
The LF2407 is used as the controller to implement speed con-trol of the PMSM system. The interface of the LF2407 isillustrated in Fig. 37.20. Similar to the BLDC motor controlsystem, three input channels are selected to read the two-phase currents and resolver signal. Because a resolver is usedin one case, the quadrature-encoder-pulse (QEP) inputs arenot used. The QEP inputs work only with a QEP signal that arotary encoder supplies. The DSP output pins PWM1–PWM6used to supply the gating signals to the switches and form theoutput of the control part of the system.
37 DSP-based Control of Variable Speed Drives 1045
C
T2 T4 T6
ra Lc Ea
rb Lc Eb
rc Lc Ec
T1 T3 T5
FIGURE 37.19 The current path when the three phases are chopped.
GateDrive
PWM-1 toPWM-6
TMS320LF2407
ADCIN0
ADCIN1
ia
ib
ADCIN2q
FIGURE 37.20 The interface of LF2407.
37.5.5 Implementation of the PMSM AlgorithmUsing the LF2407
The block diagram of the PMSM drive system is displayed inFig. 37.21.
The flowchart of the developed software is shown inFig. 37.22. The control program of the PMSM has one main
Software
+
wref
−−
−
−Tec
Vbs
sVcs
Sc
Sb
wr
SaVas
vqsr
vdsr
iqsr
idsr
ibs
ias
+
PWMInverter
d, q
a, b ,c PWMGenerator
PI
PI
d, q
a b,c
PMSM
+
PI= 0*i dsr
*i qsr
−
Speed
calculatorCurrent
calculator
*
q
FIGURE 37.21 Block diagram of PMSM speed control system.
routine and includes four modules:
• Initialization procedure• DAC module• ADC module• Speed control module
In the following section speed control module is disscussed.
37.5.5.1 The Speed Control AlgorithmThe requirement for speed control algorithm can be item-ized as:
• Reading the current and position signal, then generatingthe commanded speed profile
• Calculating the actual motor speed, transferring thevariables in the abc model to the d–q model and reverse
• Regulating the motor speed and currents using thevector-control strategy
1046 H. A. Toliyat et al.
No
Yes
Start
Initialization procedure
Read phase current ia ,ib ; read the position signal;
Executespeed loop?
Set reference speed wref and calculate the actual speed
Speed PI regulator used to calculate the commend torque
Calculate the command q-axis current iqs ; Set ids = 0
Current PI regulator used to calculate the vds ,vqs in RRF
Transfer ia ,ib to ids ,iqs in Rotor Reference Frame (RRF)
Transfer vds ,vqs in RRF to va ,vb ,vc
Generate the PWM using sine-D generator
End
Output the program variables to DAC0~DAC3
* *
FIGURE 37.22 The flowchart of PMSM control system.
• Generating the PWM signal based on the calculatedmotor phase voltages
The PWM frequency is determined by the time intervalof the interrupt, with the controlled phase voltages beingrecalculated every interrupt.
37.6 DSP-based Vector Control ofInduction Motors
For many years, induction motors have been preferred fora variety of industrial applications because of their robustand rugged construction. Compared to dc motors, inductionmotors are not as easy to control. They typically draw largestarting currents, about six to eight times their full load values,and operate with lagging power factor when loaded. However,with the advent of the vector-control concept for motor con-trol, it is possible to decouple the torque and the flux, thusmaking the control of the induction motor very similar to thatof the dc motor.
The most popular type of induction motor used is the squir-rel cage induction motor. The rotor consists of a laminatedcore with parallel slots for carrying the rotor conductors, whichare usually heavy bars of copper, aluminum, or alloys. One baris placed in each slot; or rather, the bars are inserted from theend when the semi-closed slots are used. The rotor bars arebrazed, electrically welded, or bolted to two heavy and stoutshort-circuiting end-rings, thus completing the squirrel cageconstruction. The rotor bars are permanently short-circuitedon themselves. The rotor slots are usually not parallel to theshaft, but are given a slight angle, called a skew, which increasesthe rotor resistance due to increased length of rotor bars and anincrease in the slip for a given torque. The skew is also advan-tageous because it reduces the magnetic hum while the motoris operating and reduces the locking tendency, or cogging, ofthe rotor teeth.
When the three-phase stator windings are fed by a three-phase supply, a magnetic flux of a constant magnitude rotatingat synchronous speed is created in the air-gap. Due to therelative speed between the rotating flux and the stationaryconductors, an electromagnetic force (EMF) is induced in therotor in accordance with Faraday’s laws of electromagneticinduction. The frequency of the induced EMF is the same asthe supply frequency, and the magnitude is proportional to therelative velocity between the flux and the conductors. There-fore, the rotor current develops in the same direction as theflux and tries to catch up with the rotating flux.
37.6.1 Induction Motor Field-oriented Control
The term “vector” control refers to the control technique thatcontrols both the amplitude and the phase of ac excitationvoltage. Vector control controls the spatial orientation of theEMF in the machine. This has led to the coining of the termFOC, which is used for controllers that maintain a 90◦ spatialorientation between the critical field components.
The required 90◦ of spatial orientation between key fieldcomponents can be compared to the dc motor, where thearmature winding magnetic field and the filed winding mag-netic filed are always in quadrature. The objective is to force
37 DSP-based Control of Variable Speed Drives 1047
the control of the induction machine to be similar to the con-trol of a dc motor, i.e., torque control. In dc machines, thefield and the armature winding axes are orthogonal to oneanother, making the magnetomotive forces (MMFs) estab-lished orthogonal. If the iron saturation is ignored, thenthe orthogonal fields can be considered to be completelydecoupled.
It is important to maintain a constant field flux for propertorque control. It is also important to maintain an indepen-dently controlled armature current in order to overcome theeffects of the detuning of resistance of the armature winding,and leakage inductance. A spatial angle of 90◦ between the fluxand MMF axes has to be maintained in order to limit inter-action between the MMF and the flux. If these conditions aremet at every instant of time, the torque will always follow thecurrent.
With vector control, the mechanically robust inductionmotors can be used in high-performance applications wheredc motors were previously used. The key feature of the controlscheme is the orientation of the synchronously rotating q–d–0frame to the rotor flux vector. The d-axis component is alignedwith the rotor flux vector and regarded as the flux-producingcurrent component. On the other hand, the q-axis current,which is perpendicular to the d-axis, is solely responsible fortorque production.
In order to apply a rotor flux field-orientation condition,the rotor flux linkage is aligned with the d-axis, so the q-axisrotor flux in excitation reference frame λe
qr will be zero andthe d-axis rotor flux in the excitation reference frame will bethe rotor flux; λe
dr = λ̂r . Therefore we have:
ieds = λe
dr
Lm(37.23)
ωslip = rr
λ̂r
(Lm
Lr
)ieqs = Lmie
qs
τrλr(37.24)
Te = 3
2
P
2
Lm
Lrλ̂d ie
qs (37.25)
where τr is rotor time constant, Lm is magnetizing inductance,Lr rotor leakage inductance, rr rotor resistance, ie
qs q-axis statorcurrent in excitation frame, ie
ds d-axis stator current in exci-tation frame, and ωslip angular frequency of slip. We can findout that in this case ie
ds controls the rotor flux linkage and ieqs
controls the electromagnetic torque. The reference currents ofthe q–d–0 axis (ie∗
qs , ie∗ds ) are converted to the reference phase
voltages (ve∗ds , ve∗
qs ) as the commanded voltages for the con-trol loop. Given the position of the rotor flux and two-phasecurrents, this generic algorithm implements the instantaneousdirect torque and flux control by means of coordinate trans-formations and PI regulators, thereby achieving accurate andefficient motor control.
It is clear that for implementing vector control we have todetermine the rotor flux position. This usually is performed bymeasuring the rotor position and utilizing the slip relation tocompute the angle of the rotor flux relative to the rotor axis.
Equations (37.23) and (37.24) show that we can controltorque and field by ids and iqs in the excitation frame. However,in the implementation of FOC, we need to know ids and iqs
in the stationary reference frame. So, we have to know theangular position of the rotor flux to transform ids and iqs fromthe excitation frame to the stationary frame. By using ωslip ,which is shown in Eq. (37.24) and using actual rotor speed,the rotor flux position is obtained.
t∫0
ωslipdt + θre (t ) = θr (t ) (37.26)
Where θre (t ) is electrical angular rotor position, and θr (t )angular rotor flux position.
The Current Model takes ids and iqs as inputs as well as therotor mechanical speed and gives the rotor flux position as anoutput. Figure 37.23 shows the block diagram of the vector-control strategy in which speed regulation is possible using acontrol loop.
As shown in Fig. 37.23, two-phase currents are measuredand fed to the Clarke transformation block. These projectionoutputs are indicated as is
ds and isqs . These two components
of the current provide the inputs to Park’s transformation,which gives the currents in the qdse excitation reference frame.The ie
ds and ieqs components, which are outputs of the Park
transformation block, are compared to their reference val-ues ie∗
ds , the flux reference, and ie∗qs , the torque reference. The
torque command, ie∗qs , comes from the output of the speed
controller. The flux command, ie∗ds , is the output of the flux
controller which indicates the right rotor flux command forevery speed reference. For ie∗
ds , we can use the fact that themagnetizing current is usually between 40 and 60% of thenominal current. For operating in speeds above the nomi-nal speed, a field weakening section should be used in theflux controller section. The current regulator outputs, ve∗
dsand ve∗
qs , are applied to the inverse Park transformation. Theoutputs of this projection are vs
ds and vsqs , which are the com-
ponents of the stator voltage vector in the dqss orthogonalreference frame. They form the inputs of the space-vectorPWM block. The outputs of this block are the signals thatdrive the inverter.
Note that both the Park and the inverse Park transforma-tions require the exact rotor flux position, which is given bythe Current Model block. This block needs the rotor resistanceor rotor time constant as a parameter. Accurate knowledge ofthe rotor resistance is essential to achieve the highest possibleefficiency from the control structure. Lack of this knowledgeresults in the detuning of the FOC. In Fig. 37.23, a space-vector PWM has been used to emulate vs
ds and vsqs in order to
implement current regulation.
1048 H. A. Toliyat et al.
FluxController
PI PI
PI
SVPWM
3-phaseInverter
Induction
Motor
abc
CurrentModel
− ids −
−
Vdc
ClarkeTransformation
ParkTransformation
Inv. ParkTransformation
θr
+ +
+
Mechanical Speed of Rotor
e*
iqse*
vqse*
vdse*
vqss*
vdss*
dqss
dqssdqs
e
dqse
dqss
wref
wrm
Σ Σ
Σ
idss
idse
iqss
iqse
FIGURE 37.23 Vector-control algorithm for induction motor.
37.6.2 DSP Controller Requirements
The controller of the induction motor control system is used toread the feedback current and position signals, to implementthe speed or torque control algorithm, and to generate thegate signals based on the control signal. Analog controllers ordigital signal processors, such as LF2407 can perform thesetasks.
The interface of the LF2407 is illustrated in Fig. 37.24.Two quadrature counters detect the rising and falling edgesof the encoder signals. Two input channels related to the 10-bit ADC are selected to read the two-phase currents. The pinsPWM1 to PWM6 output the gating signals to the gate drivecircuitry.
QEP-1
QEP-2
PWM-1 & PWM-6GateDrive
TMS320F2407
En A
ADCIN-1
ADCIN-0Ia
Ib
En B
FIGURE 37.24 The interface of LF2407.
37.6.3 Implementation of Field-oriented SpeedControl of Induction Motor
Some practical aspects of implementing the block diagramof Fig. 37.24 are discussed in this section and subsections.The software organization, the utilization of different vari-ables, and the handling of the DSP controller resources aredescribed. In addition, the control structure for the per-unitmodel is presented. Next, some numerical considerations havebeen made in order to address the problems inherent withinthe fixed-point calculation. As described, current model is oneof the most important blocks in the block diagram depictedin Fig. 37.23. The inputs of this block are the currents andmechanical speed of rotor. In the next sections, technical
37 DSP-based Control of Variable Speed Drives 1049
points that should be considered during current and speedmeasurement, as well as their scaling are discussed.
37.6.3.1 Software OrganizationThe body of the software consists of two main modules: theinitialization module and the PWM interrupt service routine(ISR) module. The initialization model is executed only once atstart-up. The PWM ISR module interrupts the waiting infiniteloop when the timer underflows. When the underflow inter-rupt flag is set, the corresponding ISR is served. Figure 37.25shows the general structure of the software. The complete FOCalgorithm is executed within the PWM ISR so that it runs atthe same frequency as the switching frequency or at a frac-tion of it. The wait loop could be easily replaced with a userinterface.
HardwareInitialization
Start
VariableInitialization
Inf. LoopPWMI.S.R
FIGURE 37.25 General structure of software.
37.6.3.2 Base Values and Per-unit ModelIt is often convenient to express machine parameters andvariables of per-unit quantities. Moreover, the LF2407 is afixed point DSP, so using a normalized per-unit model of theinduction motor is easier than using real parameters. In thismodel, all quantities refer to the base values. Base power andbase voltage are selected, and all parameters and variables arenormalized using these base quantities. Although one mightviolate this convention from time to time when dealing withinstantaneous quantities, the rms values of the rated phasevoltage and current are generally selected as the base voltagefor the a–b–c variables while the peak value is generally selectedas the base voltage for d–q variables. The base values are deter-mined from the nominal values by using Eq. (37.27), whereIn , Vn , fn are the nominal phase current, the nominal phase toneutral voltage, and the nominal frequency in a star-connectedinduction motor, respectively. The base value definitions are
as follows:
Ib = √2In
Vb = √2Vn
ωb = 2πfn
ψb = Vb
ωb
(37.27)
Ib and Vb are the maximum values of the nominal phase cur-rent and voltage, ωb is the electrical nominal rotor flux speed,and ψb is the base flux.
37.6.3.3 Speed Estimation during High-speed RegionAs previously mentioned, this method is based on countingthe number of encoder pulses in a specified time interval. TheQEP assigned timer counts the number of pulses and records itin the timer counter register (TxCNT). As the mechanical timeconstant is much slower than the electrical one, the speed reg-ulation loop frequency might be lower than the current loopfrequency. The speed regulation loop frequency is obtained inthis algorithm by means of a software counter. This counteraccepts the PWM interrupt as input clock and its period isthe software variable called SPEEDSTEP. The counter variableis named speedstep. When speedstep is equal to SPEEDSTEP,the number of pulses counted is stored in another variablecalled np and thus the speed can be calculated. The schemedepicted in Fig. 37.26 shows the structure of the speed feedbackgenerator.
Assuming that np is the number of encoder pulses in oneSPEEDSTEP period when the rotor turns at the nominal speed,a software constant Kspeed should be chosen as follows:
01000h = Kspeed .np
The speed feedback can then be transformed into a Q4.12format, which can be used in the control software. In theproposed control system, the nominal speed is 1800 rpm andSPEEDSTEP is set to 125. The np can be calculated as follows:
np = 1800 × 64 × 4
60× SPEEDSTEP × Tp = 288 (37.28)
CounterQEP
speedstep is equalto SPEEDSTEP?
Kspeed
wm
No
yes
No change
FromEncoder
FIGURE 37.26 Block diagram of speed feedback calculator.
1050 H. A. Toliyat et al.
w = Kspeed*np
speedstep = speedstep-1
speedstep = 0
speedstep = SPEEDSTEP
np = TxCNT
Yes
No
TxCNT=0
FIGURE 37.27 Complete flowchart of speed measurement block duringhigh-speed region.
where Tp = 3fpwm
= 3 × 10−4 (PWM frequency is 10 kHz
but the program is running at 3333 Hz) and hence Kspeed isgiven by:
Kspeed = 4096
288= 14.22 ⇔ 0E38h Q8.8
Note that Kspeed is out of the Q4.12 format range. The mostappropriate format to handle this constant is the Q8.8 format.The speed feedback in Q4.12 format is then obtained from theencoder by multiplying np by Kspeed . The flowchart of speedmeasurement is presented in Fig. 37.27.
37.6.3.4 Speed Measurement during Low-speedRegion
To detect the edges of two successive encoder pulses, the devel-oped program can use either the QEP counter or the captureunit input pins. The program has to measure the time betweentwo successive pulses, therefore it must utilize another GPtimer. In this program, Timer 3 has been dedicated to thetime measurement. During the interrupt service routine ofthe capture unit or counter QEP, speed can be calculated. Toobtain the actual speed of the motor, the appropriate numberis divided by the value in the count register of Timer 3.
As it can be inferred, at very low speeds an overflow mayoccur in Timer 3. The counter would then reset itself to zeroand start counting up again. This event results in a large error
T3CNT=FFFFh
Timer 3Disable
Start of Timer 3Overflow ISR
End of Timer 3Overflow ISR
Temp=T3CNT
T3CNT=0
ACC=31238*32
w=np/8
Enable Timer3
np=ACC / Temp
Start of Capture unit orCounter QEP ISR
End of Capture unit orCounter QEP ISR
FIGURE 37.28 Flowchart of speed measurement at low speed.
in speed measurement. To avoid this event, Timer 3 will be dis-abled in the overflow interrupt service routine. However, thistimer is enabled in the capture unit (counter QEP) interrupt.
The flowchart of this implementation is presented inFig. 37.28
37.6.3.5 The Current ModelThe Current Model is used to find the rotor flux position.This module takes ids and iqs as inputs plus the rotor electricalspeed and then calculates the rotor flux position. The currentmodel is based on Eqs. (37.23) and (37.24). Equation (37.23)in transient form can be written as:
Lr
rr Lm
dλdr
dt+ λdr
Lm= ids (37.29)
Assume λdr /Lm = im where im is the magnetizing current,therefore Eq. (37.29) can be written as follows:
Trd
dtim + im = ids (37.30)
Rotor flux speed in a per-unit system can be shown by:
fs = 1
ωb
dθ
dt= ωre + iqs
Tr imωb(37.31)
37 DSP-based Control of Variable Speed Drives 1051
where θ is the rotor flux position and Tr = Lr /rr and ωre arethe rotor time constant and rotor electrical speed, respectively.The rotor time constant is critical to the correct functionalityof the Current Model. This system outputs the rotor flux speed,which in turn will be integrated to get the rotor flux position.Assuming that iqs(k+1) ≈ iqs(k) , Eqs (37.30) and (37.31) can bediscretized as follows:
imr(k+1) = imr(k) + Tp
Tr
(ids(k)
− imr(k)
)
fs(k+1) = n(K+1) + 1
Trωb
iqs(k)
imr(k+1)
(37.32)
Measure Ia and Ib
Regulatespeed?
Calculate speed
Start
Iabc Idqs
Clark Trans.
s
Speed PI regulator,Calculate Iqs
High speed?
Current ModelModule
Ids and Iqs
to PI regulatorand calculateVds and Vqs
(Vdqs) (Vdqs)New θr.
Space Vector PWM
End
Idqs Idqss e
ee
e e
e s
Calculate Sin andCos of qr
Yes
No
Yes
No
s∗
FIGURE 37.29 Flowchart of digital implementation of FOC algorithm.
For example, let the constants Tp/Tr and 1/Trωb be renamedto Kt andKr , respectively. Here Lr = 73.8 mH, rr = 0.73 ,and fn = 60 Hz. So for Kt and Kr we have:
Kr = Tp
Tr= (10000/3)−1
101.09 × 10−3
= 2.967 × 10−3 ⇔ 000Ch Q4.12
Kt = 1
Trωb= 1
30.232 × 10−3 × 377
= 26.237 × 10−3 ⇔ 006Bh Q4.12
1052 H. A. Toliyat et al.
By knowing the rotor flux speed (fs), the rotor flux position(θcm) is computed by the integration formula in the per-unitsystem.
θcm(k+1) = θcm(k) + ωb · fs(k) · T (37.33)
In Eq. (37.33), let ωbfsT be called θinc . This variable is therotor angle variation within one sampling period. Thus, the
Current Model Module has three input variables ids , ids , andωre and one output, which is the rotor flux position θcm
represented as a 16-bit integer value. The flowchart of thefield-oriented speed control of induction motor is presentedin Fig. 37.29. This routine is placed inside the PWM interruptservice routine.