You are on page 1of 5

DSCs Enable Field-Oriented

Control for Washer Motors


By Jorge Zambada,Applications Engineer, Digital Signal
Controller Division, Microchip Technology, Chandler, Ariz.

Digital signal controllers enable drives for


permanent magnet synchronous motors
to be optimized with complex algorithms at
low cost.

W
hen used in an appliance, a permanent with PWM modules enables inexpensive current-sensing
magnet synchronous motor (PMSM) circuitry, by sensing inputs at specific times where switching
provides very good efficiency because of transistors allow current to flow through the current-sense
its constant rotor magnetic field, which is resistors.
produced by a permanent magnet on the
rotor. In addition, its stator magnetic field is generated by Development Tools
sinusoidal distribution of the windings. Compared to induc- The FOC motor-control firmware discussed in this article
tion motors, PMSMs have a very high power/size ratio. They was developed based on Microchip’s dsPICDEM MC1 Mo-
also produce less electrical noise compared to dc motors tor Control Development Board.[1] Microchip’s data moni-
since brushes are not used. tor and control interface (DMCI) tool, which is a module
In PMSM-based appliances, field-oriented control (FOC) within the MPLAB Integrated Development Environment
offers a great cost benefit because it eliminates the position (IDE), was used to test and debug the FOC algorithm. The
sensors. The sensorless FOC technique also overcomes re- DMCI tool provides a quick and dynamic IDE, which allows
strictions placed on some applications that cannot deploy designers to graphically represent the application feedback.
position or speed sensors, such as those in which the motor For instance, DMCI’s IDE provides project-aware naviga-
is immersed in oil. Although proprietary FOC designs using tion of program symbols (variables) that can be dynami-
ASICs are available, a new generation of digital signal con- cally assigned to any combination of slider, direct input or
trollers (DSCs) offer a low-cost alternative for implementing Boolean controls. These controls can be used interactively
the FOC algorithm. to change the values of program variables within the DMCI
DSCs are suitable for appliances like washing machines IDE. Further, the graphs can be dynamically configured for
because they feature peripherals tailored for motor control viewing program-generated data.
such as pulse width modulators (PWMs), analog-to-digital In the system overview block diagram (Fig. 1), it can be
converters (ADCs) and quadrature encoder interfaces. When seen that no position sensors are attached to the motor shaft.
executing controller routines and implementing digital fil- However, there are some sensors used for current measure-
ters, DSCs help designers optimize code execution by being ments on the motor. These sensors feature low-inductance
able to carry out the multiply-accumulate instructions and resistors that are part of the inverter function block. A three-
fractional operations in a single cycle. Also, for operations phase inverter stage drives the motor windings (Fig. 2).
requiring saturation capabilities, DSCs help designers avoid
overflows by offering hardware saturation protection. The FOC Algorithm
DSCs need fast and flexible ADCs for current sensing, The following is a step-by-step summary of the FOC (or
a crucial function in motor control. For example, the Mi- vector-control) algorithm:
crochip dsPIC DSC family features ADCs capable of con- 1. Measure the stator currents phase currents iA and iB.
verting inputs at a 1-Msample/sec rate and handling up to Calculate iC from the fact that iA + iB + iC = 0 and calculate
four inputs simultaneously. Multiple trigger options on the the currents from the two current sensors.
ADCs enable the use of inexpensive current-sense resistors 2. Convert the set of these three-phase currents onto
to measure motor phase-winding currents. Triggering ADCs a two-axis system. This conversion provides the variables

Power Electronics Technology March 2007 34 www.powerelectronics.com


DIGITAL SIGNAL CONTROLLERS

variables from i and i. Now, trans-


����� ������������
�������� form the quadrature currents, iD and
����� iQ, onto the rotating coordinate system.
����� ������ During steady-state conditions, iD and
������ ����� iQ will remain constant. This step is
����� ����

�����������
called the Park Transformation.
����� 4. Error signals are formed using iD,
����� � iQ and reference values for each. The
��
iD reference controls rotor-magnetiz-
���� ing flux. The iQ reference controls the
��� torque output of the motor. The error
��
��� signals are input to proportional and
�� integral (PI) controllers. Then, the PI
�������������

���
������������ controller’s output provides VD and
���� VQ , which is a voltage vector that will
��� be sent to the motor.
���������������
��� ������ 5. Estimate the new coordinate
��� transformation angle, where V, V, i
��� ������������ and i are the inputs. The new angle
���������� �� guides the FOC algorithm as to where
���
to place the next voltage vector.
��� 6. Rotate the VD and VQ output val-
���
��� ues from the PI controllers back into
���
���
���
��� the stationary reference frame, using
���� ��� the new angle. This calculation pro-
�� vides new quadrature voltage values,
���
�� V and V.
���
��� 7. Transform the V and V values
���
back to three-phase values VA, VB and
VC. The three-phase voltage values are
Fig. 1. In this basic implementation of a field-oriented-control-based PMSM driver, one advan-
tage that is immediately apparent is the absence of position or speed sensors. used to calculate new PWM duty-cycle
values that generate the desired voltage
�������������������� vector. The entire process of trans-
forming, PI iteration, transforming
back and generating PWM is shown
����� ����� ����� ����
������� in Fig. 3.
�� �����
�������
����� ����� ����� Sensorless FOC for PMSMs
The sensorless control technique
implements the FOC algorithm by
estimating the position of the motor
�������� without using speed or position sen-
�����
������������� sors. Fig. 4 shows a simplified block
�� diagram of the position-estimator
��
function. The FOC algorithm is ex-
ecuted at the same rate as that of the
�� PWM duty-cycle algorithm. In the
FOC algorithm, the PWM triggers two
Fig. 2. A three-phase inverter drives the PMSM windings. The figure shows the three-phase respective ADC conversions for the
windings, along with the current-sensing and fault-generation circuitry built into the power two winding-current shunt resistors.
inverter, to protect the system against excessive currents.
Then a potentiometer is used to set the
i and i from the measured iA, iB and 3. Rotate the two-axis coordinate reference speed of the motor. The ADC
iC values; i and i are time-varying system to align with the rotor flux, us- interrupts generate the data samples
quadrature current values, as viewed ing the transformation angle calculated needed to execute the algorithm.
from the stator’s perspective. This step at the last iteration of the control loop. From the motor model in Fig. 5, the
is called Clarke Transformation. This conversion provides the iD and iQ input voltage can be obtained:

Power Electronics Technology March 2007 36 www.powerelectronics.com


DIGITAL SIGNAL CONTROLLERS

���� ����� �� ��
� �� � �� ���� ������ � ����
� ��� ����� � ���
� � �� ������ �
�� ����
�����
� ��
� �����
� �

���� �� ��
����
��
�� �� Fig. 5. The PMSM can be approximated by an
�� �����
���� electrical model, comprising the winding
resistance, winding inductance and back EMF,
����
����� which is dependent on the motor speed.
�������� �������� ��
����� ���������
��������� �� either a positive feedback gain (K) or
a negative feedback gain (-K) to get
Fig. 3. In the field-oriented-control (or vector-control) algorithm, the three-phase voltage values the estimated current to match the
are used to calculate new PWM duty-cycle values to generate the desired voltage vector. measured current. Because the input
voltages are the same for both the mo-
tor and its model, the back EMF can
���������
��� ������� be calculated when the estimated and
���� measured currents match.
���

����
���

��� � ��������
������� �����
Back-EMF Estimation
����� Once the input currents and volt-
� �
ages of the model and the actual motor
�������� ��
��������� � match, the correction factor z from
���

���������� ��
the motor model can be filtered to get
the back EMF. For this step, we use a
first-order digital low-pass filter, with
Fig. 4. The position estimator is based on the currents and voltages of the motor, and uses a the equation:
motor model to measure the motor position indirectly via a current observer model. The motor
position can be estimated by assuming that the PMSM’s motor model above is the same as y[n] = y[n − 1]]+
+ T × 2πfC × (x[n]
n] − y[n]).
n
that of a dc motor, shown in Fig. 5.
To filter z to get eSESTIMATED , we sub-
v S = Ri
d
Ri S + L i S + e S . Current Observer Model stitute the value of fPWM in the equation
dt A current observer model enables below:
And solving for iS gives the motor the indirect measure of the back EMF  1 
e[n] = e[n − 1] + 
current: by ensuring that the input to the system  f PWM 
d R 1 (motor) is equal to the input to the mo-
i S = − i S + (v S − e S ), ×2πfC × (z[n] − e[n]),
dt L L tor model. Here is how it works: The
where iS equals motor current vec- motor and motor model are fed with where e[n] equals the next estimat-
tor, vS equals input voltage, eS equals the same input, but the motor model ed back-EMF value, e[n-1] equals the
back-EMF vector, R equals wind- has a closed-loop controller to ensure last estimated back-EMF value, fPWM
ing resistance and L equals winding that the estimated value matches the equals the PWM frequency at which
inductance. measured value. For example, at any the digital filter is being calculated,
In the digital domain, this equation given time, if the actual motor input fC equals the cutoff frequency of the
becomes: voltage and current are the same as the filter and z[n] equals the unfiltered
i S[n + 1] − i S[n] model, then we can “observe” the back back EMF, which is output from the
= EMF by solving for eS. sliding-mode controller
TS
For the observer model compensa- Solving this equation for e[n]
R 1 tion, a sliding-mode controller can yields the updated back-EMF value.
− × i S[n] + × (v S[n]
n] − e S[n]).
n
L L track the input reference and force the The value of the cutoff frequency
Again, solving for iS yields: error to zero between the measured can be determined through trial and
i S[n + 1] = current iS and the estimated current error, depending on the selection of the
iSESTIMATED. Depending on the error sign, sliding-mode controller gain. The re-
 R TS
 1 − TS ×  i S[n] + × (v S[n]
n] − e S[n]).
n the sliding-mode controller will apply lationship between back EMF and the
L L
www.powerelectronics.com 37 Power Electronics Technology March 2007
DIGITAL SIGNAL CONTROLLERS
���������
��
��� ������ ��
��������

����
��
������������
����������
�����������
����������������� ��

�����������
��
���������������������

Fig. 6. The motor model’s closed-loop controller works to ensure that the estimated value
matches the measured value, which yields the back EMF by solving for eS .

rotor’s updated position is given by: works as follows: When motor is at


θROTOR = arcc tan(e α , eβ ). standstill, and with the start/stop but-
ton pressed, the dsPIC DSC generates
Speed Calculation a series of sinusoidal voltages to set the
Due to the filtering function applied motor spinning. While the motor spins
during the theta calculation, some at a fixed acceleration rate, the FOC
phase compensation is needed before algorithm controls the currents iD and
the calculated angle can be used to en- iQ. The value of θ is incremented based
ergize the motor windings. The amount on the acceleration rate.
of theta compensation is dependent on
the rate of change of θROTOR, or the speed Software State Machine
of the motor (ROTOR). The compensa- It is helpful to visualize the FOC
tion for θROTOR is performed in two algorithm as a software state machine
steps: First, the speed of the motor is (Fig. 7). First, the motor windings are
����������������������� calculated based on the uncompen-
sated theta calculation; second, this
de-energized and the system awaits
the user to press the start/stop button.
������������ speed is used to calculate the amount Once the user presses the start/stop

�����
of compensation. The speed can be button, the system enters the initial-
calculated by summing θROTOR values ization state where all variables are set
���������� over M samples, and then multiplying
the summed values by a constant. This
to their initial value. Then, the startup
subroutine is executed. The current
is given by: components for torque (iQ) and flux
ω ROTOR [n] = production (iD) are being controlled by
 M  the FOC, and commutation angle (θ) is
 ∑ (θROTO
ROTORR [n] − θ ROTOR [n − 1]) × K ,

being generated in a ramp fashion, to
n=0
get the motor spinning and reaching
where  ROTER [n] equals angular the minimum speed required to run
velocity of the motor, θROTOR[n] equals the estimator.
current rotor position value, θROTOR[n- After going through the startup
����������������������������������� 1] equals previous rotor position value subroutine, the system switches over
����������������������� and K equals amplification factor for to sensorless FOC control, where the
����������������������������� desired speed range. speed controller is added to the ex-
ecution thread, and the sliding-mode
����������������������������
Motor Startup controller (SMC) starts estimating θ,
�������������������������������������� Because the sensorless FOC algo- as previously explained.
rithm is based on the back-EMF calcu- Upon entering the sensorless FOC
��������������������� lation, the motor needs to run at a min-
imum speed to get the back-EMF value.
control state, the reference speed is
continuously read from an externally
���������������������� Therefore, energizing motor windings connected potentiometer, and the
������������ with the appropriate estimated angle start/stop button is also monitored to
������������������������ is required. To handle this, a motor determine whether or not to stop the
startup subroutine was developed and motor.

Power Electronics Technology March 2007 38 www.powerelectronics.com


DIGITAL SIGNAL CONTROLLERS

�������
������� �����������
���������� ������� ���������
������ ��������
�������
���������� ���� ����������
����� ������������� ��������� �����������
������� ������� ����������� �������������
���������� ����� ��� ���
������������� ���������
�����������
��� ���������
������������� �����
������ ������� �������� �������
PwrBlade® Power Distribution �����
����������
����������
���������� ������� ������������ �������
���
Connector System
����������������� �������������
Ideal for servers, storage systems, fault-tolerant ���������������� �������
���
computers, uninterruptible power systems, and ���� �����������������
���������������� ���������
����� �����
redundant power distribution systems. The one-piece ������� ����
����������
PwrBlade connector mixes power and signal contacts ������� ���
���������
����������� ����������
for a variety of custom design configurations. ��������� ���
www.fciconnect.com/pwrblade
�������
������� �������
�������������� ��������
����������
���������

�������
���������� �����������
������� ���������
�������� ��������
��������� �������
����� ���

Fig. 7. This state-machine diagram shows the different states of a sensorless FOC control
for PMSM, as well as the conditions that make the system transition to a different state.

In addition to the stop/start but- the CodeGuard feature,[2] which helps


Bus Bar Simplifies Complex Wiring ton being pressed while the motor is to protect IP in collaborative design
FCI’s Laminated Bus Bars and Power Distribution running, any fault in the system will environments by securing IP segments
Systems solve power distribution challenges in
cause the motor to stop and return to separately.
electronic systems, such as wireless base stations,
switches, storage enclosures, routers, and servers. the “motor stopped” state. The motor Since programming DSCs is similar
Where space, temperature rise, current or voltage drops remains stopped until the start/stop to programming microcontrollers, ap-
are critical concerns, FCI bus bars replace bulky cable button is pressed again. pliance designers can quickly design
harnesses, optimize cabinet space, and increase power their motor-control algorithm and
transmission efficiency. Multilayer bus bars may be
equipped with cables ultra-sonically welded to specific
DSC-Based FOC Control test their prototypes. Best of all, fine-
conductors, clinch studs, integrally stamped connector A major advantage of deploying tuning the motor control has been
contacts, as well as active components. DSCs in motor control is the practi- simplified through the use of IDE-
www.fciconnect.com cality of a common design platform, based tools such as the DMCI, which
which can lower production costs. This allows designers to easily port their
means appliance makers now have an algorithms across a variety of motor
economical way to offer a range of platforms including PMSM, brush-
appliance models that use PMSMs, less-dc, brushed-dc and ac-induction
or other motor types, with sensor- motors.[3] PETech
less FOC algorithm control. These
software-based motor-control designs References
enable rapid customization to address 1. The dsPICDEM MC1 Motor Con-
multiple applications. trol Development Board is available at
Firmware IP protection is a major www.microchipdirect.com.
issue for manufacturers with design 2. See www.microchip.com/codeguard
AirMax VS® Power Connectors teams across many geographies. De- for information on the CodeGuard
FCI’s compact and cost-effective AirMax VS power sign teams based in different locations security feature, including how it can
connectors address system designers’ need to carry could work in tandem to implement be used to improve IP protection.
higher current to faster, more powerful processors on
FOC firmware, develop the appli- 3. See www.microchip.com for appli-
add-in cards. A 2x2 connector has a current-carrying
capacity of up to 80 amps and a voltage rating of 150V ance front panel and complete the cation notes on motor control of ac
and are used in data, industrial or communications final system integration. Furthermore, induction (AN984, AN908 and GS004)
equipment, as well as in medical electronics in developing their designs, these and brushless dc (AN901, AN957,
and instrumentation. teams will generate their own IP. AN992, AN1017) motors, based on the
www.fciconnect.com/airmax
Microchip’s dsPIC DSC family offers dsPIC30F motor-control family.

Power Electronics Technology March 2007 40 www.powerelectronics.com

You might also like