Sei sulla pagina 1di 6

Fast Online Model Predictive Control of IPMSM

Using Parallel Computing on FPGA


Michael Leuer and Joachim Böcker

Abstract—Model predictive control (MPC) offers a variety of manipulated variables can be scheduled in this way so that
advantages compared to conventional control methods. The prob- a faster and better damped transient response is achieved in
lem with MPCs is the high computational cost and the associated comparison to conventional concepts. Here, possible control
long control cycle time. This makes the use of MPCs unattractive
for processes with small time constants, as in permanent magnet and state variable constraints are directly taken into account.
synchronous motors with interior magnets (IPMSM) for electric By doing so, the model predictive control is particularly
vehicles. In this paper a model predictive control method for suitable for the control of coupled non-linear multivariable
nonlinear systems with inherent output limitation is presented. systems. The online optimization of the controller in each
This approach offers real-time capability for online MPCs even cycle step enables an intelligent foresighted planning of the
for processes with time constants in the millisecond range. This
becomes feasible by the possibility of parallel computation, as control variables, in contrast to the reactive character of a PI
provided by a FPGA (Field Programmable Gate Array). In the controller. This leads to an optimal utilization of the available
following, the functional principle of this real-time MPC ap- control variables - both for small as well as large deviations
proach is presented and the functionality is verified by simulation from the reference set point. Despite many advantages of
results of an IPMSM control for automotive applications. MPC approaches enormous demands on processing power for
high-dynamic control systems, as they are common in the
I. I NTRODUCTION electric drive technology, have to be faced. However, there are
new MPC approaches which allow a reduction of the online

E LECTRICAL and hybrid electrical vehicles are becoming


increasingly important in the public interest and the
automotive industry. As traction drives permanent magnet syn-
computation time. In this context, the explicit MPC [4] has
to be mentioned. The optimization is performed offline in the
controller design. The results of this optimization are stored
chronous motors with interior magnets (IPMSM) are favored in an n-dimensional table, and read by the control algorithm
due to their high power and torque density as well as efficiency during run time. By doing so, the online computational com-
[1]. To reach the full performance potential of an electric plexity of the MPC is drastically reduced. Such explicit MPC
drive, an adequate control is essential. Conventional controls for IPMSM drives have been presented in [5], [6] and [7]. As a
for IPMSM are based in general on PI control algorithms, fast online MPC for nonlinear systems the suboptimal MPC,
such as introduced in [2]. From the perspective of the control as presented in [8], is worth mentioning. With this method,
algorithm, the IPMSM can be represented as a coupled non- the computational complexity can be reduced by calculating
linear system (see equation 1). When controlling this system only a certain number of iterations for the optimization in
with a PI control structure, a decoupling of the system is each sampling step. In this way, only an approximate solution
recommended. However, the decoupling cannot always be is determined. By reinitializing the optimization algorithm
guaranteed due to physical limitations. This can lead to with the approximate solution in the following sampling step,
incorrect setting of the operation points. A further problem the next calculated solution can be improved incrementally.
liesin the nonlinearity that is introduced into the control loop The established MPC calculates the mean of the optimal
by the control variable restriction. Since the parameters of manipulated variable by an optimization algorithm. The new
the PI controller are calculated only once during the design fast MPC considers the adjustable voltage vectors of the
process, a compromise between short rise time and minimum switching states to solve the optimization problem best. The
overshoot has to be designed. Today’s remedy was creating procedure solves the minimization problem without using an
reconfigurable control [3]. Hereby it can be problematic to optimization algorithm.
switch between the different controls algorithms because of
transients. That is why the principle of the model predictive II. M OTOR M ODEL
control (MPC) is more effective. MPCs are based on the The model predictive control is performing its predictions
solution of a dynamic optimization problem on a moving based on a model of the system which has to be controlled.
horizon. Here, a model of the plant is used to predict the Therby the plant has to be identified as precisely as possible.
trace of the state variables over a specified time horizon. The As a starting point for the model the voltage equations of the
Michael Leuer and Joachim Böcker are with the department for Power
IPMSM
Electronics and Electrical Drives, University of Paderborn, D-33095 Pader- ud = Rid + Ld i˙d − ωLq iq
born (Germany), E-Mail: {leuer, boecker}@lea.upb.de (1)
This work was developed as part of the program ”Rationale Energiev- uq = Riq + Lq i˙q + ω(Ld id + ψp )
erwendung, regenerative Energien und Energiesparen, progress.nrw”, and
was funded by the ”Europäischen Fonds für regionale Entwicklung” and are used. The dynamic behavior of the inverter is simulated by
”Ziel2.NRW”. one P-T1 link with the corresponding inverter time constant.
Subsequently the resulting overall system is being discretised Start
with the bilinear transformation and included in the MPC.

III. M ODEL P REDICTIVE C ONTROL Initialization of the controller and model parameters

The practical use of the model predictive control can be


demonstrated by the fact that it has its origin in the industry
and arrived in the research at universities later. The MPC Measurement of the DC-link voltage uDC, motor current id, iq and
* *
the rotor position ε and reading of the current pretending id , iq
was developed in the 70s in the petrochemical industry,
where coupled multivariable systems with relatively large time
constants have to be controlled. Meanwhile, due to its excellent
Update the nonlinear plant model A(ω) through measurements
controller performance the MPC was also applied in controls
of high dynamic processes. However, problems arise if the
model predictive control is to be used for processes with very
small time constants, such as the electrical behavior of an Predictive calculation of the optimum manipulated variable sequence
for ns time steps, taking the manipulated variable limit and minimization
IPMSM. Here, it is often impossible to optimize the manipu- of the quality function np time steps into account
lated variable sequence and perform the predicted calculation
of the state trajectory within the desired control cycle time. To
estimate the computing time relative to the control cycle time,
Output of the first output value from the calculated manipulated
an MPC with online optimization and consideration of circular variable sequence
manipulated variable limits was implemented. The basic flow (Option to reinitialize the optimization algorithm by remaining
predicted manipulated variable values)
chart of the MPC is shown in figure 2. The MPC implemented
here operates with np = 6 prediction steps and ns = 2
control steps. The state variable for the next np time steps
are pre-calculated and the next ns control values with respect Fig. 2. Schematic flow diagram of the MPC
to a quality function are optimized (see figure 1). Figure
a) 50
*
past future id
0
i
i in A

d,PI
setpoint r(t) −50 i
d,MPC
d

−100
optimal controlled variable y(t)
−150
0 0.002 0.004 0.006 0.008 0.01
Time in s
b) 150
umax i*
100 q
iq,PI
i in A

optimal manipulated variable u(t) 50 i


q,MPC
q

−50
umin 0 0.002 0.004 0.006 0.008 0.01
Time in s
c) 0.35
Computing time in s

k-2 k-1 k k+1 k+2 k+ns-1 k+np time 0.3


control horizon
prediction horizon 0.25

0.2
Fig. 1. predictive calculation of the state model and the manipulated variables
0 0.002 0.004 0.006 0.008 0.01
3 provides a comparison of the MPC with a PI controller, Time in s

which has been designed by the magnitude optimum method.


Further more the figure shows the computation times that Fig. 3. Step response of the MPC (red curve) compared to the PI control
are required in each cycle step. As computing hardware, a (green curve); a) Motor current in d-direction; b) Motor current in q-direction;
personal computer with an Intel Core i7 CPU (2, 8 GHz) and c) Computation time of the MPC in each cycle step
4 GB memory was used. As operating system and simulation
environment 64 Bit bit Windows 7 with MATLAB Simulink
was used. Both control algorithms have been implemented calculation has to be performed about 300 times faster in
with a control cycle time of 100 µs. From the step responses order to be realized as a real-time capable MPC. Due to the
of the currents it can be clearly seen that the model predictive considerable improvement of the MPC controller performance
control has a significantly better performance than the PI compared to PI control algorithms, a real-time implementation
controller. The curve with the respective processing times for of MPC is desirable. One possible method of a real-time online
the corresponding sampling point shows that the optimization MPC is presented below.
IV. V ECTOR -MPC A PPROACH cycle times are possible. The problem is that during a period
Conventional MPCs usually work with an optimization only one switching change is possible. To maintain the current
algorithm, in order to achieve an optimal control variable ripple to an acceptable level, further reduction of the control
sequence with respect to a defined quality function. As a result cycle time is required.
a voltage mean value is calculated as the manipulated variable.
These mean values can be generated from adjustable voltage A. Working Principle of The Real-time Online Vector-MPC
vectors by using a pulse width modulation (PWM). In order to find the optimal voltage vector for the next output
In the method presented here, the optimization problem is step, the eight possible voltage vectors will be applied to the
addressed differently, however. It can be concluded through plant-model contained in the MPC and the model response is
systems analysis of the inverter (see Figure 4) that 23 switch calculated. In this way the resulting quality function for each
states and 8 voltage vectors can be realized. These voltage voltage vector can be calculated. As the output manipulated
vectors are shown in Figure 5. Since the voltage vector v0 variable, the voltage vector is chosen which fulfills the smallest
and v7 are the same, only 7 different voltage vectors are value of the quality function. This procedure allows saving
possible. The following proposal, called Vector-MPC, does not the computation and time consuming optimization algorithm.
calculate the optimal control value, which has to be adjusted in Furthermore, this algorithm is suitable for the implementation
turn by using a PWM from different voltage vectors averaged on a FPGA, as the model calculations and the calculation
over time. Rather, it is investigated very specifically which of the voltage vectors associated quality functions can be
of the 8 voltage vectors minimizes the quality function best. performed in parallel. Figure 6 represents the basic operation
The basic procedure has been introduced in [7] as an offline and Figure 7 represents the schematic functional flow chart of
MPC. In the selected approach the optimal control variable the MPC for one prediction step. Due to the fact, that it is
idc(t)

vi(Ji,min)
udc + ia ua

min(Ji)
2 sa(t)
- + ib
udc ub
sb(t)
- +
J0

J1

J6
udc ic uc
sc(t)
J0 = f (e)

J1 = f (e)

J6 = f (e)
2 -
ed
eq

ed
eq

ed
eq
id* iq*

id* iq*
iq

Fig. 4. Block diagram of the inverter


-

-
*
d
i
iq -

iq -

iq -
id

id

id

ub
xk = AT xk-1 + BT uk-1 + BT uk + ET k-1 + ET k

xk = AT xk-1 + BT uk-1 + BT uk + ET k-1 + ET k

xk = AT xk-1 + BT uk-1 + BT uk + ET k-1 + ET k

v3 - + - v2 ++ -
εk

εk

εk

v0 +++ v1 + - -
yk = C xk + D uk

yk = C xk + D uk

yk = C xk + D uk

v4 - ++ v7 - - - udc ua
2

v6 + - +
ud
uq

ud
uq

ud
uq

v5 - - +
d, q

d, q

d, q
α, β

α, β

α, β
εk

εk

εk

uc

Fig. 5. Adjustable voltage vectors of the inverter


α, β

α, β

α, β
a, b, c

a, b, c

a, b, c

sequence will not be determined by means of an optimization


v0

v1

v6

algorithm but rather by means of trial & error. While in


conventional MPCs any manipulated variables must be taken Fig. 6. Basic work principle of the Vector-MPC
into consideration, the Vector-MPC only considers 8 realizable
voltage vectors. By doing so, the computational cost can be only possible to switch the voltage vectors once during each
significantly reduced, so that a reduction of the controller controller period, a correspondingly lower control cycle time
Start board was used. For optimal utilization of the available hard-
ware the control algorithm has been split up between the two
dSPACE boards (see Figure 8). The actual control algorithm
is performed in a parallel manner on the FPGA board to
Initialization of the controller and model parameters
achieve a controller cycle time of 10 µs. The calculation of
the state model and the update of the non-linear plant model,
is executed on the processor board. This is done with a cycle
Measurement of the DC-link voltage uDC, motor current id, iq and time of 100 µs. The caused error during this 10 times longer
* *
the rotor position ε and reading of the current pretending id , iq cycle time is only very small, as the state matrices are changing
only slightly. The data exchange between the two control
boards is done using the peripheral high-speed bus (PHS).
Update the nonlinear plant model A(ω) through measurements
For a better visualization of the distributed control algorithm,

dSPACE DS1006 Quad-Core Processorboard dSPACE DS5203 Xilinx FPGA-Board

Cycle time: 100 μs Cycle Time: 10 μs


Predictive calculation of the rotor position ɛ for the Park-transformation,
and forecast of the possible voltage vectors in d, q-coordinates Measurement of motor current
Rotorposition measurement (ε) ia,b,c and DC-link voltage udc

PHS-Bus
State model calculation Calculation of the best
A(ω), B(ω), E(ω) voltage vector
Predictive state calculation of the time step k +1, when the first
intervention is possible Providing of the state-model Gate signal output
A(ω), B(ω), E(ω) to the inverter

Predictive calculation of the system response for each of the Fig. 8. Distribution of the control algorithm on the processor and FPGA board
voltage vectors vi from the time k +1 computation of the quality function
for the corresponding voltage vectors
it will be explained with the phase-locked loop (PLL) which
is shown in Figure 9. The measurement of the sine and
cosine signal from the encoder of the IPMSM is done by
the A/D-converters on the processor board. That is the reason
Comparison of the Ji quality functions resulting from the different
voltage vectors and output of the gate signals of the voltage vector why new mesurement results are available only every 100 µs.
with the minimal quality function However, for the Vector-MPC an updated rotor position signal
is necessary every controller cycle step. To realize this, the
integrator of the PLL is embedded on the FPGA board. In
this way, the intermediate steps of the rotor position can be
Fig. 7. Schematic flowchart of the real-time online Vector-MPC interpolated accordingly so that all 10 µs, an updated value
is available. In addition to providing these interpolated rotor
dSPACE DS1006 Quad-Core Processorboard dSPACE DS5203 Xilinx FPGA-Board
is necessary. With the division of the control algorithm on the
dSPACE DS1006 quad-core processor board and the dSPACE Cycle time: 100 μs Cycle time: 10 μs
DS5203 FPGA board, a control cycle time of 10 µs can be
realized. As advantages of this Vector-MPC approach the pos- sin(εm)
sin(εm-ε0) Oscillator ε0
Phase ω0
PI-Controller
sibility of parallelization (see Figure 6), the low computational cos(εm) detector (Integrator)

complexity, as well as the optimal use of the available DC-


link voltage can be mentioned. While the consideration of the sin(ε0)

output limit in an MPC optimization algorithm may require a cos(ε0)

high computational effort, the output limit is implied by the


fact, that the Vector-MPC directly sets the full voltage vector.
Unlike other control algorithms, the whole spanned Hexagon Fig. 9. Distribution of the control algorithm on the processor- and the FPGA-
board
from the eight possible voltage vectors (see Figure 5) can be
chosen as the working area. Moreover, no further processing positions, the phase locked loop will be used to filter the
of the manipulated variables, generated by the controller, measurement signal, and to predict the future rotor positions
by PWM or similar components is necessary because this for the MPC. The example of the PLL shows the possibility
approach generates directly the gate signals for the inverter. of very properly allocating certain portions of the control
algorithms to a suitable hardware, without increasing the
B. Vector-MPC Implementation computational effort. While spliting up the control algorithm,
As rapid control prototyping hardware a dSPACE RCP it is necessary to pay particular attention to the consideration
system consisting of a quad-core processor board and a FPGA of the different cycle times. Also the output control signals
have to be taken into consideration because of the limited a) 50

switching frequency of the converter. If the switching of the


0
inverter is allowed in every cycle step of the Vector-MPC,
a very good controller performance will be reached. On the

id in A
−50
other hand, the inverter can be thermally destroyed due to the i*d
high switching losses. Therefore, the switching frequency was −100 i
d,PI
limited to 10 kHz. So the Vector MPC and the PI control with id,MPC
PWM will have the same maximum switching period for the −150
following comparisons. 0 0.5 1 1.5 2 2.5 3 3.5 4
Time in ms
Following successful implementation of the Vector-MPC
b) 150
scheme using MATLAB Simulink and Xilinx System Gener- i*q
ator, the performance of the Vector-MPC method was shown 100 iq,PI
by simulations. For these simulations the real computing time iq,MPC

i in A
on hardware has been considered. 50

q
0
C. Quality Function Design
After implementation of the parameterization the MPC has −50
to be performed. In the model predictive control this is very 0 0.5 1 1.5 2 2.5 3 3.5 4
Time in ms
easy because the MPC is based on the optimization of a quality
function. Therefore it is only necessary to define a suitable
Fig. 10. Step response of the Vector-MPC (blue curve) compared to the PI
quality function with appropriate weighting matrices. For the control (green curve); a) Motor current in d-direction; b) Motor current in
presented vector MPC following quality function is selected: q-direction

J = eT Qe + ∆uT R∆u + ∆sS + F∆f −→ min (2)


a) 10
with
e = rk+1 − xk+1 ... control error after execution of the 0

respective voltage vector; −10


i in A

∆u = uk − uk+1 ... gradient of the respective voltage vector


d

in d-q coordinates; −20 i*d

∆s ... number of necessary switching procedures for the −30


i
d,PI

respective voltage vector; id,MPC

∆f ... number of switching procedures during the last five −40


0 0.5 1 1.5 2 2.5 3 3.5 4
sampling periods that are higher than one; Time in ms
Q, R, S, F ... weighting matrix of the control error, the gra- b) 40
dient, the switching procedures and the switching frequency. i*q
30
By strong weighting of the control error, a possible quick iq,PI
iq,MPC
adjustment of the set value is reached, while a strong weighing 20
i in A

of the voltage vector gradient results a slowly changing


q

10
manipulated variable sequence. By weighing the switching
operations, the switching frequency can be affected. That 0

way, an optimal compromise between switching losses and −10


dynamics of the control has to be found. The controller design, 0 0.5 1 1.5 2 2.5 3 3.5 4
Time in ms
and the configuration of the MPC can be represented as pareto
optimization. The choice of weighing matrices also depends
Fig. 11. Small-signal step response of the Vector-MPC (blue curve) compared
on the scaling of the respective factor. A high scaling value to the PI control (green curve); a) Motor current in d-direction; b) Motor
in a weighting matrix means not directly that the appropriate current in q-direction
factor in the quality function is also given more weight than
any other.
shown in Figure 10. It can be seen, that this MPC approach is
V. S IMULATION R ESULTS superior the PI control with regard to the control performance.
To verify the operation of the Vector-MPC technique, a The MPC distinguishes with short rise time and low overshoot.
simulative comparison of the MPC with the PI controller was The weighting of the switching frequency and the gradient of
performed. The PI-controller was designed according to the the voltage vectors make it possible to reduce the switching
magnitude optimum method. Since the Vector-MPC calculates frequency in stationary operating points compared to the PI
the switching sequence, the switching behavior of the PI control, without increasing the current ripple too much. To
controller has also been considered rather than the average investigate the dynamics of the Vector-MPC with respect to
behavior as shown in Figure 3. The simulation results are its small-signal behavior, the simulation results for a small
step response are shown in Figure 11. Comparing Figure 10
with Figure 11, we see the benefits of the non-linear control
algorithm over the linear PI-controller. While the step response
of the linear PI control has the same shape for both the
small signal behaviour, as well as the large-signal behaviour
it can be seen that the MPC always seeks the quickest way to
compensate the control error.

VI. C ONCLUSION
Model predictive controls are characterized by their the-
oretical high controller performance. For implementation of
traditional real-time online MPC the computational effort is so
high that the solution of the optimization algorithm is likely
to significantly exceed the control cycle time. However, it was
shown that with the Vector-MPC a real-time online MPC can
be implemented. This method does not rely on a complex
and thus computationally expensive optimization algorithm
and therefore turns out to be suitable for controlling processes
with small time constants, such as IPMSM. Moreover the step
response demonstrated that the dynamics of the drive can be
improved by the use of the model predictive control.

R EFERENCES
[1] T. Finken and M. Felden and K. Hameyer, Comparison and design of
different electrical machine types regarding their applicability in hybrid
electrical vehicles IEEE, 2008.
[2] W. Peters and O. Wallscheid and J. Böcker, Current Controller with De-
fined Dynamic Behavior for an Interior Permanent Magnet Synchronous
Motor IECON2011, Melbourne, Australia, 2011.
[3] S. Mathapati and J. Böcker, Dynamically Reconfigurable Control Struc-
ture for Induction Motor Drives on FPGA Control Platform EPE
Journal, Vol. 20-1, 2010.
[4] A. Bemporad and M. Morani and V. Dua and E. Pistikopoulos, The ex-
plicit solution of Model Predictive Control via multiparametric Quadratic
Programming Proceedings of the American Control Conference, 2000.
[5] S. Bolognani, R. Kennel, S. Kuehl, G. Paccagnella, Speed and Current
Model Predictive Control of an IPM Synchronous Motor Drive TU
Mnchen, Germany, 2012
[6] A. Horch, Angewandte Regelung und Optimierung in der Prozessindus-
trie, ABB 2010.
[7] H. Kobayashi and H. Kitagawa and S. Doki and S. Okuma, Realization
of a Fast Current Control System of PMSM based on Model Predictive
Control IEEE, 2008.
[8] K. Graichen and M. Egretzberger and A. Kugi, A Suboptimal Approach
to Real-time Model Predictive Control of Nonlinear Systems at -
Automatisierungstechnik, 2010.

Potrebbero piacerti anche