Predictive Control of a Permanent Magnet Synchronous Machine based on Real-Time Dynamic Optimization

Predictive Control of a Permanent Magnet Synchronous Machine based on Real-Time Dynamic Optimization

Jean-François Stumper, Alexander Dötlinger, Janos Jung and Ralph Kennel
Institute of Electrical Drive Systems and Power Electronics
Technische Universität München
Munich, Germany


«Optimal Control», «Control of Drive», «Permanent Magnet Motor».


A predictive control scheme for a permanent-magnet synchronous machine (PMSM) is presented. It is based on a suboptimal method for computationally efficient trajectory generation based on continuous parameterization and linear programming. The torque controller optimizes a quadratic cost consisting of control error and machine losses in real-time respecting voltage and current limitations. The multivariable controller decouples the two current components and exploits cross-coupling effects in the long-range constrained predictive control strategy. The optimization results in fast and smooth torque dynamics while inherently using field-weakening to improve the power efficiency and the current dynamics in high speed operation. The performance of the scheme is demonstrated by experimental results.


The efforts of implementing predictive controllers in electrical drives aim at replacing the classical cascaded field-oriented control structure with PI controllers. The machine can be better exploited by improved control behavior, the system variables are optimized. In this contribution, the conventional torque and current control structure of two separate controllers is changed to multi-input multi-output (MIMO) control. By transformation into the field-oriented frame, torque generation is decoupled from flux variation, however, the current controllers are still strongly coupled, therefore a MIMO controller is advantageous. The obtained improvements are better decoupling, better current and voltage constraint handling by exploiting cross-coupling between the orthogonal components, and better power efficiency and dynamics by optimally adjusting the currents in both dynamic and steady-state operation.

The major obstacle in implementing predictive control schemes is the limited computational power, inherited by the high sampling rates. Existing implementations suffer from this restriction and can not exploit the full advantages of model predictive control (MPC). For instance, generalized predictive control (GPC) has a high optimization horizon but is unconstrained, whereas predictive torque control (PTC) is constrained but so far only reaches steps of prediction [2]. For good performance, both, inclusion of constraints and a high optimization horizon are required. Using control in the field-oriented frame, the analytical problem description enables using mathematical optimization algorithms. Such schemes are computationally efficient and maximize the obtained information for a given computational power.

The online solution of the linearly constrained linear-quadratic problem, typical for MPC, requires quadratic programming (QP) algorithms, which are, however, computationally too expensive for drive systems. A recent development is the use of explicit MPC, where an offline solution is computed and stored as look-up table in the real-time controller [3] [4]. The scheme reaches prediction steps with constraints. While several fast online algorithms were recently proposed [5] [6], most of them based on gradient search algorithms, the interest in online solutions is growing. Advantages of online optimization are manipulation and adaptation of parameters, resulting in a more flexible choice of machines for the control system.

This implementation is based on a suboptimal trajectory generation algorithm presented in [7], embedded in a flatness-based predictive control scheme [8]. It is based on a continuous approach, the variables are not discretized but represented as a polynomial with undetermined coefficients. With this method, higher optimization horizons can be reached with comparably few parameters, considerably reducing the computational burden. Constraints are handled by linearization of the cost functional and the use of a linear programming (LP) solver, which is amongst the smallest and fastest numerical optimizers. As result, a (suboptimal) prediction of ms with current and voltage constraints is obtained at kHz sampling rate.

Problem Statement

Machine Model

As linear-quadratic optimization problems with linear constraints are simpler to solve in real-time, the machine model is linearized. Assuming that the rotor speed does not change too much over the optimization horizon ,


the PMSM model and the voltage equations become linear. The electrical subsystem of the machine, consisting of the quadrature and direct currents and (peak values), is given as


The nomenclature is shown in table II in the appendix. It is noted that the reluctance torque is neglected, as this term is very small compared to the electromagnetic torque in surface-mounted PMSMs or in machines with small saliency. Furthermore, it would render the model nonlinear, requiring nonlinear optimization methods [9].

Optimization Goals and Cost Functional

The formulation of a suitable cost functional is a key point in predictive control, as it is the only tuning possibility of the control scheme. The optimization is aiming at minimizing the control error for good dynamical performance as well as machine losses for better efficiency. Both goals are included in the cost functional. By choosing the cost functional and weights well, it is possible to find a good trade-off between both goals during transients, or eventually to fulfill both goals in steady-state. The cost functional for the predictive torque controller is


which trades off the squared control error


with machine losses


The first term in represents copper losses, and the second term represents the iron losses consisting of hysteresis losses. Eddy current losses are negligible on the tested machines, however, they could be included using the model presented in [10]. Iron losses can be reduced by field-weakening, where a trade-off between copper and iron losses is found [11]. Imposing a negative direct current , the flux magnitude in the stator is reduced while the copper losses increase. As the iron loss constant is not part of standard motor parameters, it has to be determined experimentally [12]. The last term in is the end-weight of the control error and aims at reducing the steady-state control error. The weight was set , the value was determined heuristically.

The optimization horizon is set ms such that the cost functional includes the complete setpoint change. It is important that the optimization horizon is high enough, otherwise the open-loop and closed-loop trajectories differ and the behavior is strongly suboptimal. This is illustrated in Fig. 1. If the horizon is too small, due to the end-weight of the control error, a significant difference between the optimized open-loop trajectories, and the closed-loop trajectories resulting from regeneration at every sampling step, appears. Then, the closed-loop trajectories simply don’t fit the cost functional anymore. For a horizon higher than required for the setpoint change, the difference between open- and closed-loop trajectories becomes smaller.


#y \psfrag#t \psfrag#T

Figure 1: Open- and closed-loop trajectories in predictive control. Left: small horizon, right: high horizon.

Current and Voltage Constraints

The most important nonlinearities of a PMSM, in terms of control, are the voltage and current limitations. The current constraints prevent overheating of the machine, and the voltage is limited by the maximum DC-link voltage of the inverter. The voltage constraints limit rotor speed as well as current dynamics in high-speed operation. These constraints are linearized, in order to be computationally efficiently treated.

The current range for the direct current is limited to . Only negative values of are desirable, as they improve power efficiency and reduce the induced voltage by weakening the flux magnitude in the stator [4] [11]. The lowest value is the optimum value at rated speed () and is given as


which is independent of quatrature current as the reluctance torque was neglected. The value is doubled to enable further field-weakening to improve dynamics in high speed, an effect described in the experimental results section. For the quadrature current , the largest possible range of values should be available. The resulting linear constraints, shown on Fig. 2, almost completely fill the current region of interest. A linearization is thus acceptable.

The voltage linearization is a little bit more difficult. The -axis should not be restricted, as the induced voltage is aligned to it and is the largest value that will appear. A steady-state analysis of the system equations (2), (3) shows that a rectangular voltage area results


This rectangle is expanded such that the outer circle of the voltage limitation is hit (light grey on Fig. 2). During dynamical transients, the voltage vector points to one of the outer corners, subsequently touching the outer limiting circle. Therefore, linearizing the voltage limits as a rectangle by the presented method, as shown on Fig. 2, does not limit the operational range and only marginally affects dynamics. A less restrictive method is presented in [6], where a time-varying linearization in form of a hexagon in stator frame is presented. While such a linearization is possible with the underlying predictive control algorithm, the chosen method in the ()-frame is chosen for simplicity.


#iq \psfrag#id \psfrag#uq \psfrag#ud \psfrag#imx \psfrag#umx \psfrag#-il

Figure 2: Linearized current and voltage constraints. Circle: feasible set of current and voltage vectors, grey: feasible set after linearization of the constraints.

Optimal Control Algorithm

To study real-time applicability of the presented scheme, first, the highest possible amount of optimization parameters is determined. The fastest optimizer with constraints is the widely known linear programming (LP) method. Table I shows some worst-case computational results of LP (simplex method from [13]) as function of the number of free parameters (CPU: GHz industrial PC). More parameters lead to a higher number of iterations which are also more complex; the worst-case number of iterations is the number of parameters plus the number of constraints. As in the underlying application, the constraints are decoupled, however, this worst-case is not to be expected. The maximum runtime is given by the sampling rate minus latency of input/output, therefore at kHz sampling rate, it must be less than about s. Thus, at best, parameters can be optimized. Runtime of the predictive controller is further discussed at the end of the section.

Parameters Constraints Iterations Runtime [s]
20 48 67 769
12 32 34 165
8 14 10 35
Table I: Runtime of a linear program for some worst-case problems on a GHz CPU

Trajectory Generation

The trajectory generation algorithm presented in [7], a development related to flatness-based methods [14], was designed for this application. It can optimize a quadratical cost function with linear constraints. As major differences to standard algorithms, it is applying a continuous parameterization instead discretization, and the computationally efficient linear programming solver is used instead of quadratic programming or iterative gradient search.

The trajectories for the current are defined as degree power series with undetermined coefficients ,


Due to the analyzed computational limitations, is chosen as polynomial degree. The first coefficients and are the initial conditions, and the remaining coefficients are determined by optimization. The corresponding voltages are computed by algebraic differentiation of (11) and by solving for the model equations (2) and (3), this is also called the flatness-based approach [15]. This way, the voltages do not need to be represented by additional parameters.

Substituting the variables , and by the found functionals in the cost functional (5) and constraints can easily be done with a computer-algebra tool (for instance Maplesoft’s Maple). The cost functional is then a quadratic function of the unknown parameters, of the machine parameters, the measured currents, the speed and the torque reference . Graphically, can be represented as in Fig. 3 (left).

As is convex, the unconstrained optimum is found algebraically by solving first-order necessary conditions, in this case, the solution of a system of linear equations by matrix inversion. Then, by an affine coordinate transformation, the problem can be reformulated as least-distance problem, i.e. a quadratical cost describing the distance to the unconstrained optimum. As result, the cost functional looks much simpler, see Fig. 3 (middle).


#a1 \psfrag#a2 \psfrag#b1 \psfrag#b2 \psfrag#a1* \psfrag#a2* \psfrag#a1-*- \psfrag#a2-*-

Figure 3: Trajectory generation algorithm. Left: original problem, middle: transformed least-distance problem, right: transformed and linearized problem.

In the next step, the least-distance problem is linearized around the unconstrained optimum, see Fig. 3 (right). As the coordinate transformation to the least-distance problem is an affine transformation, and as the linearization doesn’t affect the constraints, it is obvious that the linear constraints remain linear after this transformation. One point is, however, more difficult, the parameterization of the constraints with the polynomial coefficients, presented in [7]. The linearization of the cost function inherits a large error in the value of , but the values of the coefficients are not affected that much: the least-distance problem is not so much different in the linear form as it would have been in quadratical form. Furthermore, see that a difference only appears if a constraint is active, the unconstrained optimum is the same. It can be shown that the resulting cost inherited by the linearization is


in the worst case, where is the unconstrained cost, and the extra cost when considering constraints. The suboptimality is therefore bounded. As , there are parameters in the quadratical cost function. During the linearization, this number is increased to , as in the LP standard form, only positive values are possible. After the transformation, the problem is reformulated in standard form for linear programming, and a simplex solver [13] can be run. To visualize the suboptimality, a comparison (simulations) between the linearized and the original problem is presented in [7].

All presented computations are done using Maplesoft’s Maple, from where the matrices for the LP solver are generated using a C code generation toolbox. The real-time software thus consists of a simplex tableau assignment, which is automatically generated code, a simplex LP solver and some post-processing. As the assignment is based on symbolic calculations, the machine parameters can be changed online.

Predictive Control

The trajectory generation scheme is embedded in a predictive controller. The control structure is shown in Fig. 4. A cascaded control structure is chosen as speed is assumed constant for trajectory generation. As the mechanical plant is generally only roughly known, this structure is advantageous. Model-based control can be used for the machine as the parameters are known, but for the mechanical part, any robust feedback controller can be chosen.


#speedspeed \psfrag#ctrlcontrol \psfrag#trajtrajectory \psfrag#gengeneration \psfrag#delaydelay \psfrag#compcomp. \psfrag#discdiscretization \psfrag#PMSMPMSM


#fieldframerotor coordinates \psfrag#stator framestator coordinates


#w \psfrag#w* \psfrag#t* \psfrag#u(t) \psfrag#u \psfrag#i[k] \psfrag#i

Figure 4: Control structure of the predictive torque controller cascaded by PI speed control.

First, measurement and control timing is analyzed. Two timing sequences are shown on Fig. 5 (a) and (b). The interrupt-based control system triggers an interrupt every s (green signal). At this instant, the applied voltage command (magenta signal) is modulated by space-vector modulation. At the same instant, the A/D conversion of the current measurements (blue signal) is performed to avoid the impact of current ripples. After the interrupt, the current is available and the controller (cyan signal) is started to compute the next voltage command , to be modulated at the next interrupt. The computational delay is accounted with a delay compensation technique that is applied to generate as feedback value for the control law to compute [16], it corresponds to a prediction of one sampling step with the model, the current as well as the previously commanded voltage . Furthermore, see that the response to the commanded voltage is which is available one interrupt later, this is the plant delay and it is naturally included by recalculating the trajectory at every sampling step, see Fig. 1. From the predicted trajectory, the applied voltage is .

From the timing sequences, interesting insight into the computational demands of the algorithm is gained. The first part of the cyan signal shows the calculation time for the simplex tableau initialization, it takes about s. Included in these calculations, which are results of symbolical calculations, is a calculation of the unconstrained optimum and the linearization of the problem. The second and biggest part of the cyan signal is the runtime of the linear program. At the beginning of Fig. 5 (a), where voltage and current are both zero, it is only about s, but to calculate the voltage step at rpm shown on Fig. 5 (b), more iterations are involved as many constraints are active, and the computation time rises to almost s. The total time of the interrupt handling, the simplex initialization, the LP solver and the post-processing sum up to almost s in the worst case, therefore up to of the available time is used.


A surface-mounted PMSM with parameters shown in table II is used. It is coupled to a load drive such that an arbitrary load torque or speed can be applied. The algorithm is implemented on a PC-104 based real-time system with a GHz CPU described in [17]. The voltage limitation was set to of the possible V to clearly see behavior of saturation in control, accordingly, rated speed is reduced from to rpm.

Experimental results of the proposed scheme are shown in Fig. 5. Subfigure (c) shows the response to two subsequent speed reference steps, the load drive is deactivated. The torque is increased rapidly by a high but feasible voltage peak. Interestingly, no overshoot arises, even though the speed change is performed quickly. The direct current is proportional to the speed and thereby reduces iron losses which are considerable at high speeds. Losses are decreased by about , and the efficiency is improved by about at rpm. Better results are obtained on machines with higher inductances [11].

The next three subfigures (d), (e) and (f) show fast torque transients at zero, medium and high speed, respectively. The PMSM is in torque control mode while the load drive keeps speed constant at , and rpm, respectively. The current components are well decoupled, a fast current change on the quadrature axis does not affect the direct axis at all in (d) and (e). With two separate PI controllers, a short current excursion would be seen on the direct axis during the torque transient. Again, the current on the direct axis is proportional to the speed. Furthermore, the torque is fast and at the same time smooth, the voltage becomes proportionally small for smaller control errors – a nice characteristic of quadratic cost functionals, compared to linear cost functions which result in deadbeat behavior and are more sensitive to uncertainties [16].

On subfigures (d) and (e), behavior with active voltage constraint is the same as when using standard saturation or anti-windup strategies. On subfigure (f), however, a different behavior is seen, the direct current is reduced to perform field-weakening. This implies that the stator induced voltage is reduced on the quadrature axis, see eq. (3). Thereby the derivative of quadrature current is higher and the torque-generation dynamics increased, at the cost of higher copper losses on the direct axis. Without additional field-weakening, the reference torque would not be reached after the optimization horizon of ms, thereby the end-weight in oversizes the loss term. Therefore, in this predictive control implementation, field-weakening not only improves efficiency, but also improves dynamics by exploiting cross-coupling between the orthogonal current components to optimally bypass the voltage saturation.

It is also possible to operate the PMSM beyond rated speed by steadily doing field-weakening to bypass the voltage saturation on the quadrature axis, as shown in [4]. It is remarked that the current on the direct axis has no reference, its value is obtained from the optimization of the cost function. Therefore the method works well and is numerically stable; the optimal value follows inherently.

(a) Timing at rpm.
(b) Timing at rpm.
(c) Speed steps from to to and rpm.
(d) Torque step at zero speed.
(e) Torque step at rpm.
(f) Torque step at rpm.
Figure 5: Experimental results of the predictive control scheme. Subfigures (a)-(b): blue: quadrature current without delay compensation ( A/div), cyan: quadrature voltage (160 V/div), green: interrupt handling, cyan: control law computation. Subfigures (c)-(f): green: rotor speed ( rpm/div), blue: quadrature current with compensation ( A/div), cyan: quadrature voltage (160 V/div), cyan: direct current ( A/div).


A predictive control scheme for a PMSM was introduced. Based on suboptimal real-time optimization, the currents and voltages are computed according to a cost functional. The prediction horizon is ms at a sampling rate of kHz, and voltage and current constraints are respected. The advantages of the long-range constrained predictive MIMO control scheme can be concluded as follows: improved decoupling and accounting of cross-coupling, precise measurement and control timing, respecting current and voltage constraints, fast and smooth dynamical behavior, improved power efficiency by field weakening, and improved dynamics close to voltage saturation by field-weakening.

Furthermore, it was shown that it is possible to implement long-range MPC with constrained online-optimization even on fast-sampling systems such as electrical drives.


This work was supported through the National Research Fund of Luxembourg under grant PhD-08-070.

Appendix: Machine Parameters

Manufacturer Model Merkes MT5 1050
Rated Power W
Rated Torque Nm
Rated Current (peak) A
Rated Speed rpm
Pole Pairs
Rated Voltage (peak) V
Stator Inductance , , mH
Stator Resistance
Motor Constant (peak) Vs
Iron Loss Constant (Hysteresis)
Table II: Nominal Parameters of the Synchronous Machine


  • [1]
  • [2] P. Cortés, M. Kazmierkowski, R. Kennel, D. Quevedo and J. Rodriguez, Predictive control in power electronics and drives, IEEE Trans. Ind. Electron., Vol. 55, No. 2, pp. 4312–4324, 2008.
  • [3] S. Bolognani, R. Kennel, S. Kuehl and G. Paccagnella, Speed and current model predictive control of an IPM synchronous motor drive, Int. Electric Machines and Drives Conf., 2011.
  • [4] S. Bolognani, S. Bolognani, L. Peretti and M. Zigliotto, Combined speed and current model predictive control with inherent field-weakening features for PMSM drives, Proc. of the IEEE Med. Electrotechnical Conf., pp. 472–478, 2008.
  • [5] B. Kouvaritakis, M. Cannon, J.A. Rossiter, Who needs QP for linear MPC anyway?, Automatica, Vol. 38, pp. 879–884, 2002.
  • [6] S. Richter, S. Mariethoz and M. Morari, High-speed online MPC based on a fast gradient method applied to power converter control, Proc. of the American Control Conf., pp. 4737–4743, 2010.
  • [7] J-F. Stumper and R. Kennel, Computationally efficient trajectory optimization for linear control systems with input and state constraints, Proc. of the American Control Conf., 2011.
  • [8] M. Fliess and R. Marquez, Continuous-time linear predictive control and flatness: a module-theoretic setting with examples, Int. J. of Control, Vol. 73, No. 7, pp. 606–623, 2000.
  • [9] E. Delaleau and A.M. Stanković, Flatness-based hierarchical control of the PM synchronous motor, Proc. of the American Control Conf., pp. 65–70, 2004.
  • [10] C. Mademlis, J. Xypteras and N. Margaris, Loss minimization in surface permanent-magnet motor drives, IEEE Trans. Ind. Electron., Vol. 47, No. 1, pp. 115–122, 2000.
  • [11] C. Cavallaro, A.O. Di Tommaso, R. Micelli, A. Raciti, G.R. Galluzzo and M. Trapanese, Efficiency enhancement of permanent-magnet synchronous motor drives by online loss minimization approaches, IEEE Trans. Ind. Electron., Vol. 52, No. 4, pp. 1153–1160, 2005.
  • [12] N. Urasaki, T. Senjyu and K. Uezato, A novel calculation method for iron loss resistance suitable in modeling permanent-magnet synchronous motors, IEEE Trans. Energy Convers., Vol. 18, No. 1, pp. 41–47, 2003.
  • [13] W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery, Numerical recipes in C: the art of scientific computing, 2nd ed., Ch. 10.8. Cambridge: Cambridge University Press, 1992.
  • [14] M. Guay and J.F. Forbes, Real-time dynamic optimization of controllable linear systems, J. of Guidance, Control and Dynamics, Vol. 29, No. 4, pp. 929–935, 2006.
  • [15] H. Sira-Ramírez and S.K. Agrawal, Differentially flat systems, Ch. 8.2. New York: Marcel Dekker, 2004.
  • [16] H-T. Moon, H-S. Kim and M-J. Youn, A discrete-time predictive current control for PMSM, IEEE Trans. Power Electron., Vol. 18, No. 1, pp. 464–472, 2003.
  • [17] N.A. Ameen, A.A. Naassani, R. Kennel, Design of a digital system dedicated for electrical drive applications, EPE J., Vol. 20, No. 4, pp. 37–44, 2010.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description