You are on page 1of 9

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/275345880

Labview FPGA FOC implementation for synchronous Permanent Magnet Motor


Speed Control

Conference Paper · December 2014


DOI: 10.1109/INDUSCON.2014.7059427

CITATIONS READS
17 2,201

3 authors:

Matheus Bevilaqua Ademir Nied


Fisher and Paykel Appliances Universidade do Estado de Santa Catarina
2 PUBLICATIONS   17 CITATIONS    69 PUBLICATIONS   561 CITATIONS   

SEE PROFILE SEE PROFILE

José de Oliveira
Universidade do Estado de Santa Catarina
50 PUBLICATIONS   272 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Aplicação de inteligência computacional em MPC View project

matheus bevilaqua View project

All content following this page was uploaded by Matheus Bevilaqua on 23 April 2015.

The user has requested enhancement of the downloaded file.


Labview FPGA FOC Implementation for Synchronous
Permanent Magnet Motor Speed Control

Matheus Alexandre Bevilaqua Ademir Nied, José de Oliveira


Whirlpool Corporation, Motors Team Grupo de Controle de Sistemas - GCS
State University of Santa Catarina - UDESC State University of Santa Catarina – UDESC
Joinville, SC, Brazil Joinville, SC, Brazil
matheus.bevilaqua@gmail.com email.ademir@gmail.com, jose.oliveira@udesc.br

Abstract — this paper describes an implementation of FOC In this paper a complete platform for rapid motor control
(Field Oriented Control) algorithm for speed control of a prototyping based on Labview FPGA is described. It is
Permanent Magnet Synchronous Motor - PMSM. The motor composed of a hardware that includes a power inverter with
considered is a Brushless-AC type - BLAC, with sinusoidal braking capability and interface board for signals, a software
back-electromotive force - BEMF waveform, and the application that implements FOC algorithm for BLAC motor and a user
intended for this motor is the direct drive - DD type of washing interface – UI, that allow the user to set command speed, and
machines. The FOC algorithm is implemented using a National observe the motor signals and control variables during real
Instruments Labview FPGA System. This system is composed of time operation.
a high level/high productivity tool for FPGA logic synthesis. The
paper describes the design principles for FOC algorithm and II. DYNAMIC MODEL OF A BLAC MOTOR
then explains the implementation of the designed controllers in
the Labview FPGA platform. Experimental results are provided
to verify the FOC implementation. In this section, the dynamic equations that describe the
variables of interest for the FOC implementation are shown.
Labview, FPGA, FOC, BLAC, Electric Drives These variables are the motor currents in the d-q reference
frame and the rotor speed and position. In this paper the d axis
I. INTRODUCTION of the d-q reference frame is aligned on the rotor magnets flux.
A. Electric dynamic modeling
The FOC algorithms have been used widely in the Electric The direct axis current – id and quadrature axis current – iq
Drives Industry in the recent years. As this technology
dynamics in a BLAC motor can be modeled as in (1) where R
becomes increasingly popular new applications arises, even
is the phase to neutral resistance of the stator, Ld and Lq are
where cost is a hard restriction. One of these new applications
is the direct-drive type of washing machines. In this type of the direct axis and quadrature axis phase to neutral
drive system, there is not a mechanical transmission interface inductances of the stator, vd and vq are the direct axis and
e.g., belts or gearboxes, between the motor and the washing quadrature axis voltages applied to the stator, ωe is the electric
machine drum. The motor most commonly used in the angular frequency of the stator voltages and λm is the magnets
appliance industry for this application is a permanent magnet, flux constant [1], [2] and [3]:
sinusoidal BEMF – BLAC type. The use of direct-drive
BLAC – DD-BLAC motors improves efficiency of the
washing machine, increases the dynamic control of the speed (1)
during tumbling or spin, as well as it allows new sensing
methodologies for washing machines that brings new
consumer benefits and makes the appliance quiet and energy- Equation (1) can be written in terms of transfer functions
efficient. as shown in the block diagram of Fig.1. There is a coupling
mechanism between the d and q axis currents, and this
To take advantage of all benefits of FOC applied in DD-
coupling is proportional to ωe . This coupling needs to be
BLAC motors, it is necessary to conduct a lot of research and
compensated by the current controllers. A technique presented
development activities. In this scenario, a rapid motor control
in [4] for three phase induction motors is extended for BLAC
prototyping tool is recommended to save time and resources
motors and explained in this paper.
during the development phase of electric drives.
TABLE I. MOTOR PARAMETERS
P

PARAMETER VAL
LUE UNIT
R 4.48 Ω
N – number of pole pairs 21
Ld =Lq 54.80
0 mH

Kt 7.52 Nm/A
λm 1
0.201 Vs
b 0.005
57 Nm/rad/s
J 0.300
06 Kgm²
Nominal Torque 40 Nm

Figure 1. Block diagram of the electricc model Maximum current to avoid


8 A (peak)
demagnetization - Imax
B. Mechanic dynamic modeling
The mechanic dynamics of an electriic motor can be
modeled by (2), where ωr is the rotor speedd, θm is the rotor The electromagnetic torque - Te produced by the motor is
position, b is the dynamic friction coefficieent, J is the total proportional to the iq current imposeed to the stator. Therefore,
inertia (rotor + load), Te is the electromagnetic torque, Tl is the the speed controller is designed to actuate
a over the iq current
load torque and Tc is the Coulomb or static toorque necessary to controller reference – i*q to mitigaate the error between the
start the rotation of the system: measured speed ωr and the referencee speed –ω*r .

(2)

In the frequency domain, the mechaniccal model can be


described by the block diagram of Fig. 2.

Figure 3. FOC Alg


gorithm

C. Speed controller design


The speed controller used in n this paper is of the
proportional-integral - PI action typ
pe and it is shown in the
block diagram of Fig. 4, where k p and
a k i are the proportional
Figure 2. Block diagram of the mechaniic model
and integral gains, and eωr is the sp
peed error that is input to
III. CONTROLLER DESIGN
N the controller.

A. Motor parameters
To design the controllers and perforrm the dynamic
simulations it is necessary to know the m motor parameters.
Usually, these parameters are determined ffrom experiments,
and the description of the tests performed iss out of the scope
of this paper. The reader can find complete iinformation about Figure 4. Speed Co
ontroller
procedures in the references [5] and [6]. The parameters of the
motor considered in this paper are summarizeed in the Table 1. Considering Tl and Tc as externaal disturbances, the closed
loop transfer function – Tωr s , of the speed controller is
B. FOC algorithm
shown in (3). Considering that b<<JJ it is possible to compare
The FOC algorithm is shown on Fig. 3. In this structure (3) to a second order system as sho own in (4), [4]. Therefore
the motor currents are controlled in the d-qq reference frame. the gains of the controller can be written
w as a function of the
The id current is associated with the maggnetic flux in the damping coefficient ξ and bandwidth h of the controller - ωb as
motor and the id current reference – i*d is seet to zero, as in a in (5) and (6), [4]. The ωb is co onsidered as the angular
PMSM this flux is generated exclusively by tthe magnets in the
rotor [3].
frequency that leads to a reduction of 3dB on the gain of a control of the iq (that generates the torque) and id (that control
transfer function. the flux) as independent variables.
The controllers are designed considering the coupling as
an external disturbance to be compensated as shown in Fig. 6.
(3)

(4)

(5)

(6)

Figure 6. Current controllers for iq and id


The bandwidth and damping coefficient of the controller
were determined by simulation of the mechanical model. The The closed loop transfer function – Tiq s , of the iq
design goal was to have the better dynamic response that do controller is given by (7). Considering that the proportional
not cause saturation in the control action (i*q imax ) during a gain k >>R it is possible to compare (7) to a second order
20Nm (50% of the nominal motor torque considered) step in system as in (4). Therefore the gains of the controller can be
the load torque – Tl . written as a function of the damping coefficient ξ and
Considering the maximum motor current to not bandwidth of the controller - ωb as in (8) and (9), [4]:
demagnetize the rotor as imax = 8A (peak value), the controller
parameters are:
k =0.63; k ω =26.34; ξ=1.2; ωb =45Hz. (7)
ω

The step response of the designed controller is shown on


Fig. 5.

(8)

(9)

As the Iq controller is inside a cascade loop of speed


control, the bandwidth was selected to be 10 times higher than
the speed control bandwidth. The damping coefficient was
selected to provide a good step response, with no overshoot.
Therefore, by simulations of the plant model the controller
Figure 5. Step response of the ωr controller parameters were determined as:

D. Current controllers design k =150; k =11521; ξ=3; ωb =450Hz.


The d-q current controllers used in this paper are of the PI The step response of the designed controller is shown on
type. These controllers have two objectives: (i) to control the Fig. 7.
current amplitudes with high bandwidth and (ii) to de-couple
the d and q axis coupling shown in Fig. 1, allowing a better
Figure 8. Power inverter voltages

Substituting (11) in (12) it is possible to determine the six


Figure 7. Step response of iq current controller
constraints that the signal v0 must obey to comply (12). These
constraints are given by (13) and are shown graphically with
For surface mounted permanent magnets motors, the Ld
the voltages normalized to Vdc in Fig. 9, considering vab and
and Lq inductances have ideally the same value. Therefore, the vbc as sinusoidal voltages of the same amplitude of Vdc . The
dynamics of the id and iq currents is similar as can be choice for the v0 signal in this paper is given by (14) and it is
observed in Fig. 6. This interesting fact allows the designed iq shown on Fig. 9.
controller gains to be used for id controller. It is important to
note that coupling between d and q axis currents is considered c1 v0 ‐2vab ‐vbc
as an external disturbance in the design procedure used in this c2 v0 vab ‐vbc
paper. However, these disturbances have different impacts on c3 v0 vab 2vbc
(13)
the d and q axis depending on the speed. That might lead to c4 v0 3Vdc ‐2vab ‐vbc
small adjustments on the controller gains for optimum c5 v0 3Vdc vab ‐vbc
performance. c6 v0 3Vdc vab 2vbc
IV. PWM MODULATION
A Pulse Width Modulation (PWM) technique was used to max c1;c2;c3 min c4;c5;c6
v0 (14)
translate the voltage commands va* , vb* and vc* in PWM 2
commands to the switches of the power inverter. This
technique is based on a geometric approach, adding a v0
signal, producing a line-to-line voltage with a maximum peak
value equal to the DC bus voltage, optimizing its use [7].
The power inverter voltages are shown in Fig. 8. The
relationship between the output voltages vab and vbc and the
voltages on the lower switches vag , vbg and vcg is given by
(10) and (11). The signal v0 is defined as the sum of lower
switches voltages.

vab 1 ‐1 0 vag Figure 9. Constraints and the v0 signal


(10)
vbc 0 1 ‐1 vbg
v0 1 1 1 vcg The signals vag , vbg and vcg – modulated signals, as
defined by (11), are then compared to a triangular high
vag 1 vab frequency (15kHz) portrait waveform to generate the PWM1,
1 2 1
PWM2 and PWM3 commands for the power inverter
vbg ‐1 1 1 vbc (11)
vcg 3 switches.
‐1 ‐2 1 v0
V. ELECTRIC DRIVE SIMULATION
The lower switches voltages must operate in the range of 0
to Vdc . This constraint is defined by (12). The FOC algorithm, the designed controllers and the
power inverter were simulated to verify the performance of
the electric drive. The simulation of the complete system
0 vag Vdc before a practical implementation is a very important step and
0 vbg Vdc (12) potentially save a lot of effort and resources in the laboratory.
0 vbg Vdc In an industrial basis, the effort to build models and learn
the physics before going to the implementation is called
Simulation Based Design – SBD and has been incentived by
companies in the effort for operational excelllence in the recent
decades.
The ambient chosen for this electric drivve simulation was
the PSIM® software as on it is possible too integrate native
power electronics simulation capability wiith a C language
DLL where the FOC algorithm was implem mented. This way,
the power electronics and its switched w waveforms can be
integrated in the motor control signals for verification. This
simulation is very close to the signals tthe electric drive
engineer might expect in real-world applicatiions. An overview
of the simulation code is given in Fig. 10.

Figure 11. Simulation


n Results

VI. FPGA IMPLEM


MENTATION

nted in a Labview FPGA


The FOC algorithm is implemen
platform, as shown in Fig. 12.
A. Hardware Implementation
The Labview FPGA system used d is a CompactRIO, from
Figure 10. Electric Drive PSIM® Simuulation National Instruments. It is composed of a PC based user
PGA chassis and C series
interface, a real-time controller, a FP
A simulation result is given at Fig. 111. The motor is modules for I/O signals.
accelerated to 50rpm (typical washing macchine application).
Then a 20Nm load step is applied to the mottor shaft at t=0.2s. The NI9401 module is a 100kS/ss digital I/O that is used to
The speed controller rapidly recovers the sspeed and then at read incremental encoder A, A, B, B, Z and Z signals. The
t=0.4s the motor is accelerated to 100rpm. Ann overshoot of the NI9205 is an analog input module iss used to read the two Hall
same order that Fig. 5 is observed. At t=0.6s the motor speed effect current sensors feedback.
is reduced to 50 rpm and at t=0.8s the load iis taken out of the
motor shaft. There is an interface board that is
i intended to generate the
5Vdc supply to the incremental enco oder, ±15Vdc to supply the
The operation of the id and iq controllerss can be observed Hall sensors and PWM drivers, acqu uire and filters the encoder
during all the transients, as well as the toque and current levels signals by differential measurement as well as to amplify the
that the motor presents. It is important to note that the current TTL level PWM signals from the NI9401
N module to the 15V
levels do not reach the demagnetization limitt (8A) in any case. signals to the IGBT switches drivers..
Figure 13. Labview Block Diagram
Figure 12. Experimental setup
Differently from most of Digital Signal Processors – DSPs
B. Software Implementation and microcontrollers developed for motor control applications
the Labview FPGA does not have drivers for encoder reading
The Labview FPGA system can be programmed in three and PWM generation. Therefore, it is necessary to program
layers of software: (i) FPGA (ii) Real Time Controller - RT parts of the FPGA gates to perform such functionalities.
and (iii) Host PC. To program all these layers, the Labview
high level language is used. For the FPGA layer, there is a The encoder driver VI is shown at Fig. 14. It uses a SCTL
compiler that translates the Labview code in VHDL logic, and structure that executes at a rate of 40MHz. The A and B
then synthesizes the logic gates to a Virtex5™, Xilinx® signals are debounced for a “Nsamples debouncing” number
FPGA chip. This process runs automatically, without any of samples. Then the current A signal is compared with the
interference of the programmer. This way, the Labview FPGA past A signal by exclusive-OR gate to check for a change in
system allow the programmer to abstract the complex state. The same border detection technique is performed on B
programming details in a high productivity, high level signal. Each time a border is encountered (in A or B) the
programming language, accelerating the code development. electrical position is incremented or decremented according to
the direction of rotation (clock-wise - CW or counter-clock-
Inside the FPGA layer it is possible to run program loops wise - CCW). The electrical position “Position” returns to zero
at 40MHz (for the chassis used in this paper), however there when a “LimitTetaE” value is reached. This value is expressed
are strong restrictions in the mathematical functions available, in (15) and depends on the encoder resolution - PPR, the
and the variables data types are limited to single precision number of borders that are being considered (low to high, high
floating point (32 bits). To reach such a high speed the code to low or both) - Nborders and the number of pole pairs of the
must fit inside a Labview structure called single-cycle timed motor - N. In this paper LimitTetaE=380.95 as the encoder
loop - SCTL. The code inside this structure executes in one used is 2000 pulses per revolution, the motor has 21 pole pairs
FPGA clock cycle. In addition, in the FPGA layer it is and the 4 transitions of the A and B signals are considered.
possible to execute code outside a SCTL with rates as high as
1MHz. PPR*Nborders
LimitTetaE (15)
The RT controller has a dedicated RT operational system N
that can execute Labview Code at rates as high as 1kHz and
improves the determinism as it has a dedicated processor that The speed is measured by the period between borders in A
is not shared with the Host PC operational system. There is a and B signals. This “Period” information is measured in tick
limited set of functions that can run inside this layer. It is an counts of the FPGA processor that runs at 40MHz loop rate.
intermediate set between the Host PC and FPGA capabilities. The conversion to RPM is done by (16).

The Host PC uses the computer processor to execute the 60 40 10


RPM (16)
code and is susceptible to fluctuations in the execution rate, as Period*PPR*Nborders
it shares the processor with the PC operational system. The
non-deterministic tasks as the user interface – UI are
The PWM modulator is shown at Fig. 15. It receives the
programmed in this layer of code.
modulating signals vag , vbg and vcg from the FOC algorithm,
In this paper an implementation of the FOC algorithm of compares each one to a saw tooth waveform and generates the
Fig. 3 under the FPGA layer is explained. Software in PWM signals to the digital outputs S1 to S6. The dead-time
Labview code is called Virtual Instrument – VI, and a VI can between upper and lower switches of an inverter leg is defined
be composed of various sub-VIs that executes well-defined by the hardware driver circuit and do not need to be
functions. implemented by the FPGA software.
The VI that implements the FOC algorithm is shown at
Fig. 13. It receives the measurements of motor currents and
encoder and generates the PWM modulating signals for the
PWM driver sub-VI.
In order to verify the performance of the id and iq current
controllers presented in section III-D, step response curves on
i*d and i*q reference currents are shown at Fig. 17 and Fig. 18.
The rotor was kept at standstill by external fixture to not rotate
during the i*q step response test. Note that the effect of the
coupling between d and q axis currents is rapidly compensated
by the controllers.

Figure 14. Encoder driver block diagram

Figure 17. Step response in i*d signal (from 0 to 0.4 pu)

Figure 15. PWM Modulator VI

VII. EXPERIMENTAL RESULTS


In order to verify the power inverter modulation technique
of section IV, the power inverter was commanded to generate
three-phase voltages that were applied to the stator of the
BLAC motor (without the rotor). Therefore for a passive RL
load as this, the sinusoidal three-phase voltages must produce
sinusoidal three-phase currents – Ia, Ib, and Ic on the stator
coils. The three-phase modulating signals (in pu) and the 3-
phase currents are shown in Fig. 16. In this case, the Vdc
voltage was set to 40V using an external AC power source to Figure 18. Step response in i*q signal (from 0 to 0.4 pu)
fed the three-phase rectifier.
The speed controller implementation can be verified on
Fig. 19. This experimental results shows the ωr , iq , id , Ia, Ib,
Ic and Vdc parameters. The motor runs at 20rpm and in
time=4s a load torque of 21Nm is imposed on the shaft. Note
that the speed controller requests more Iq current and rapidly
compensates the load step. In time=9.5s the motor is
accelerated to 40rpm. As an induction motor with DC current
applied in the stator was used as brake mechanism, the load
torque drops to approximately 17.5Nm. When time=13s the
rotor is decelerated to 20rpm and around time=16s the load is
take off.
CONCLUSIONS
This paper described a new platform implementation
(Labview FPGA) of FOC algorithm to PMSM - BLAC
motors. The current and speed controllers design procedure as
Figure 16. Power inverter modulation experimental result well as a power inverter modulation scheme were explained in
details. Simulation results were shown to validate the design acceleration-deceleration tests”, IEEE Transactions on Industrial
methodology. Experimental results provided validated the Electronics, Vol. 54, No. 4, August, 2007.
FOC algorithm implementation. This paper opens a new [7] Vieira, R. P., Gastaldini, C. C., Azzolin, R. Z., Pinheiro, H., Gründling,
H. A., “Abordagem gemétrica para modulação de conversores três
investigation path to explore the Labview FPGA capabilities braços no acionamento de máquinas de indução bifásicas simétricas e
on electric machines control and power electronics. assimétricas”, Revista Controle e Autoação, Vol. 23, No. 1, January
and February, 2012.
[8] Pinheiro, H., Botterón, F., Rech, C., Schuch, L., Camargo, R. F., Hey,
H. L., Grundling, H. A., Pinheiro, J. R., “Modulação space vector para
inversores alimentados em tensão; uma abordagem unificada”, SBA
Controle e Automação Sociedade Brasileira de Automática 16: 13-24,
2005.
[9] Ryan, M., Lorenz, R., De Doncker, R., “Modeling of multi-leg
sinewave inverters: a geometric approach”, IEEE Transactions on
Industrial Electronics 46(6): 1183-1191, 1999.
[10] Wu, T., Chi, Y. L., Guo, Y., Xu, C., “Simulation of FOC vector control
of induction motor based on labview”, International Conference on
Information Engineering and Computer Science - ICIECS, 2009.
[11] Ali, F.H., Mahmood, H.M., Ismael, S.M.B.,“Labview FPGA of a PID
controller for DC motor speed control”, International Conference on
Energy, Power and Control - EPC-IQ, 2010.
[12] National Instruments CompacRIO website at
http://www.ni.com/compactrio/

Figure 19. Speed control experimental result

ACKNOWLEDGMENT
The authors would like to thank Whirlpool Corporation,
specially the LAR Motors Team by the availability of
equipments to develop the experimental part of this paper. The
authors also would like to thank Marcelo Campos Silva, by
the valuable technical discussions on the motor control
software implementation.

REFERENCES
[1] Krause, P. C., Wasynczuk, O., Sudhoff, S.D., Analysis of electric
machinery and drive systems, 2nd ed. Wiley Interscience, 2002.
[2] Bose, B. K., Modern Power Electronics and AC Drives, Prentice Hall,
2002.
[3] Figueiredo, D., Bim, E., “Controle linear de máximo torque de um
motor síncrono de imãs permanentes interiores”, Revista Controle e
Automação, Vol. 21, No. 3, May and June, 2010.
[4] Câmara, H. T., Uma contribuição ao controle de motores de indução
trifásicos sem o uso de sensores mecânicos, Doctorate Thesis, UFSM,
2007.
[5] Cãlin, C., Torque control in field-weakning mode, Master Thesis,
Aalborg University, PED4-1038C Group, 2009.
[6] Babau, R., Boldea, I., Miller, T.J.E., Muntean, N., “Complete
parameter identification of large induction machines from no-load

View publication stats

You might also like