0% found this document useful (0 votes)
41 views13 pages

Prototyping MPC For PMSM

This document describes a platform for prototyping model predictive control (MPC) algorithms for motion control of permanent magnet synchronous motors (PMSM) used in robotics. It focuses on finite set MPC methods which have stringent hardware and software requirements. The platform allows testing MPC algorithms through both simulation and real-world experiments. Instructions are provided on using the platform located in building KN:E-8.

Uploaded by

Long Vũ Văn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views13 pages

Prototyping MPC For PMSM

This document describes a platform for prototyping model predictive control (MPC) algorithms for motion control of permanent magnet synchronous motors (PMSM) used in robotics. It focuses on finite set MPC methods which have stringent hardware and software requirements. The platform allows testing MPC algorithms through both simulation and real-world experiments. Instructions are provided on using the platform located in building KN:E-8.

Uploaded by

Long Vũ Văn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Platform for prototyping MPC algorithms

for motion control with PMSM motors


Lukáš Černý Zdeněk Hurák
November 9, 2020

In this report we describe a setup for fast prototyping of model predictive control (MPC)
algorithms for motion control with permament magnet synchronous motors (PMSM). In
particular, we focus on the methods of finite set model predictive control (FS-MPC), which
impose quite some stringent implementation requirements on the hardware and software.
The intended use is hybrid position and force control in robotics. We give both detailed
instructions on how to use the setup and comments on some experiments already conducted
with this setup.

1 Introduction and motivation


PMSMs are often used in both industrial applications and robotic projects in academia. The reasons
are their advantages over other types of motors. Namely, the advantages include absence of commutator
(which ensures energy efficiency, mechanical simplicity, reliability), relatively high torque-to-volume ratio,
and the ability of field weakening.
Classical and well-estabilished control methods for PMSMs include six-step operation, hysteresis direct
torque control, and primarily field-oriented PID control. MPC for PMSM is an alternative that, based on
a mathematical model of PMSM with constraints taken into account, finds optimal control inputs over
a finite time horizon. There are in fact two different types of MPC for PMSMs. The first is continuous-
control-set MPC (CCS-MPC), which assumes the control inputs to be from a continuous interval, for
example [0, 24 V]. The switching nature of the inverter is neglected and the actual control inputs are
only approximations of the controller outputs obtained by pulse-width-modulation (PWM). The second
is finite-control-set MPC (FCS-MPC), which takes the switching nature into consideration and generates
the switching signals for the inverter directly, which can be used to optimize the switching losses. To
control velocity and position, both MPC algorithms can be designed either as a single controller in a
centralized structure, or as a cascaded connection of multiple controllers.
The implementation of the MPC algorithms is however challenging and computationally demanding.
The reason is the fast dynamics of PMSMs, which requires sampling frequency of several tens of kilohertz
in the case of CCS-MPC, and ten up to hundred times more in the case of FCS-MPC. The required
sampling frequency is determined mostly by PMSM electrical time constant and DC-bus voltage of the
inverter power supply (or a DC link). Therefore, the MPC algorithms for PMSMs are usually designed
with a short prediction horizon. Specifically, FCS-MPC for PMSMs is almost exclusively designed with
prediction horizon of one or two.
The goal of this report is to describe the two MPC algorithms, their possible hardware implementation,
and the hardware platform used to test the implementation. It should also serve as an instruction manual
to anyone who wants to start working with the platform in KN:E-8. Also, it presents data obtained by
simulation and real-world experiments.

2 Modeling permanent magnet synchronous motors (PMSM)


In this chapter, a brief description of the mathematical model is summarized. More details are in [1].

1
a Star configuration. b Delta configuration.

Figure 1: Model of electrical part of PMSM (the voltage arrows are oriented toward the reference point).

2.1 ABC model


The model if delta and star configurationis in fig. 1. It is described by
diabc
L = −Rs iabc − ωL0 iabc − eabc + vabc , (1)
dt
dω 1 0 1 T
J = iTabc L iabc + i eabc − Bω + τcog + τex , (2)
dt 2 ω abc

= ω (3)
dt
where

       
va ia ea sin (npp θ)
iabc = ib  , eabc = eb  = −npp ωΨm sin npp θ − 2π

vabc = vb  , , (4)
      
3 

vc ic ec sin npp θ + 3
   
cos 2 npp θ − π3 cos 2 npp θ + π3

Ls −Ms −Ms cos 2 (npp θ)
−Ms  + Lg cos 2 npp θ − π3 cos 2 npp θ − 2π
 
L = −Ms Ls cos 2 (npp θ)  , (5)
   
3
cos 2 npp θ + π3 cos 2 npp θ + 2π
 
−Ms −Ms Ls cos 2 (npp θ) 3
∂L
L0 = . (6)
∂θ

2.2 Two-phase equivalent model


Delta and star connected PMSM model is transformed to a two-phase equivalent model using the reduced
Clarke transformation
 
"
1 1
# 1 0
2 1 −2 −2 2 √
K̃ := √
3

3
, K̃ −1 := − 21 3 .
2√ 
(7)
3 0 2 − 2
3 1 3
−2 − 2

2
The model is then
diαβ
Lαβ = −Rs iαβ − ωL0αβ iαβ − eαβ + vαβ , (8)
dt
dω 3 3 T
J = iT L0 iαβ + i eαβ − Bω + τcog + τex , (9)
dt 4 αβ αβ 2ω αβ

= ω, (10)
dt
where
h iT
iαβ = iα iβ = K̃iabc , (11)
h iT
vαβ = vα vβ = K̃vabc , (12)
h iT
eαβ = eα eβ = K̃eabc , (13)

and
" "# #
Ls + Ms 0 3 cos(2npp θ) sin(2npp θ)
Lαβ = + Lg , (14)
0 Ls + Ms 2 sin(2npp θ) − cos(2npp θ)
" #
− sin(2npp θ) cos(2npp θ)
L0αβ = 3npp Lg , (15)
cos(2npp θ) sin(2npp θ)
h iT
eαβ = −npp ωΨm sin(npp θ) − cos(npp θ) . (16)

2.3 DQ model – matrix form


The model is further transformed to the rotating frame of reference using the Park transformation
" # " #
cos (ϕ) sin (ϕ) cos (ϕ) − sin (ϕ)
R̃ (ϕ) := , R̃−1 (ϕ) := . (17)
− sin (ϕ) cos (ϕ) sin (ϕ) cos (ϕ)

The model is then

didq ˜ i −e +v ,
Ldq = −Rs idq − ω L̃ dq dq dq dq (18)
dt
dω 3 3 T
J = iT L̃dq idq + i edq − Bω + τcog + τex , (19)
dt 4 dq 2ω dq

= ω, (20)
dt
where
h iT
idq = id iq = R̃ (npp θ) iαβ , (21)
h iT
vdq = vd vq = R̃ (npp θ) vαβ , (22)
h iT
edq = ed eq = R̃ (npp θ) eαβ , (23)

and
" #
Ls + Ms + 23 Lg 0
Ldq = , (24)
0 Ls + Ms − 23 Lg

3
" #
0 Lg
L̃dq = 3npp , (25)
Lg 0
" #
˜ 0 − Ls + Ms − 32 Lg
L̃dq = npp (26)
Ls + Ms + 32 Lg 0
h iT
edq = npp ωΨm 0 1 . (27)

2.4 DQ model – scalar form


The DQ model in scalar form is
did
Ld = −Rs id + npp ωLq iq + vd , (28)
dt
diq
Lq = −Rs iq − npp ωLd id − Kb ω + vq , (29)
dt
dω 3 3
J = npp id iq (Ld − Lq ) + Kb iq − Bω + τcog + τex , (30)
dt 2 2

= ω, (31)
dt
where
3
Ld = Ls + Ms + Lg , (32)
2
3
Lq = Ls + Ms − Lg , (33)
2
Kb = npp Ψm . (34)

2.5 Linearized model


For control purposes, the DQ model of PMSM is linearized into the following standard state-space form
ẋ = Ac x + Bc u, (35)
y = Cc x + Dc u, (36)
where the state vector and input vector are
h iT
x = id iq ω θ , (37)
h iT
u = vd vq . (38)

The cogging torque and the external torque are not considered in this model. The linear DQ model is
obtained by making a two assumptions and approximations, which simplify the nonlinear model into a
linear one. Firstly, the reluctance torque is neglected as it is usually small compared to the synchronous
torque. Secondly, it is assumed that ω does not change too much during controller sampling period, or
over the prediction horizon in case of MPC. This justifies one to consider ω a constant parameter in the
nonlinear terms npp ωLq iq and npp ωLd id . This gives linear time-varying model
Rs Lq
   1 
− npp ω 0 0 0
 Ld Ld   Ld 
Ld Rs Kb
   1 
−npp ω − − 0
   0 
Ac =  Lq L q L q  , Bc =   Lq

 (39)
3 Kb B
   

 0 − 0
  0 0 
 2 J J   
0 0 1 0 0 0

parametrized by ω. Matrix Dc = 0 is zero matrix and Cc is chosen based on the control objective. Such
linearized model was also used in [2].

4
2.6 Discretization
Discrete-time linear model of PMSM with sampling period Ts

xk+1 = Ad xk + Bd uk , (40)
yk = Cd xk + Dd uk (41)

is obtained from the continuous-time model assuming constant inputs over the sampling period, which
results in

Ad = eTs Ac , (42)
 τ =T 
Z s
Bd =  eτ Ac dτ  Bc , (43)
τ =0
Cd = Cc , (44)
Dd = Dc . (45)

When the discrete-time state-space matrices are to be computed online within a limited amount of time,
Euler approximation

Ad ≈ I + Ts Ac , (46)
Bd ≈ Ts Bc (47)

can be used.

2.7 Constraints
The current constraints in the DQ variables are approximated by

i2d + i2q ≤ Imax


2
. (48)

This nonlinear constraint is further approximated by set of linear constraints. Specifically, octagon is
used as the approximated feasible region in a similar way as in [3]. The octagon is in fig. 2a and is
described by

Px x ≤ p x , (49)

where

+√2 − 1 0
 
+1 0 I 
max
 +1 −√ 2 + 1 0 0 I
 −1

+√2 − 1 0 0
  max 
Imax 
 −1 − 2+1 0 0 Imax 
 
Px =  √ , px = 
Imax  .
 (50)
+√2 − 1 +1 0 0 I 
+√2 − 1

−1 0 0
  max 
Imax
−√ 2 + 1 +1 0 0
 
Imax
− 2+1 −1 0 0

The voltage constraints in the DQ variables are

vd2 + vq2 ≤ Vmax


2
. (51)

This nonlinear constraint is again approximated by octagon

Pu u ≤ p u , (52)

5
a Aprroximated constraints on DQ currents. b Approximated constraints on DQ voltages.

Figure 2: Current and voltage constraints transformed to DQ variables.

where

+√2 − 1
 
+1 V 
max
 +1 −√ 2 + 1  V
 −1

+√2 − 1
  max 
Vmax 
 −1 − 2 + 1 Vmax 
 
Pu =  √ , pu = 
Vmax  .
 (53)
+√2 − 1 +1  V 
+√2 − 1

−1 
  max 
Vmax
−√ 2 + 1 +1
 
Vmax
− 2+1 −1

The octagon is in fig. 2b.

3 Field oriented PI controller


4 Continuous-control-set model predictive control (CCS-MPC)
4.1 Sparse form
CCSMPC formulates the control task as an optimization problem. The following formulation of convex
quadratic program with linear constraints was chosen
N
X −1
min (yk+1 − rk+1 )T Q(yk+1 − rk+1 ) + ∆uT
k R∆uk (54a)
z
k=0
s.t. xk+1 = Axk + Buk , (54b)
yk+1 = Cxk+1 , (54c)
Px xk+1 ≤ px , (54d)
Pu uk ≤ pu , (54e)
T
z = u0 T T
uT

u1 ... N −1 , (54f)
∆uk = uk − uk−1 , (54g)
x0 = x(t), (54h)
u−1 = u(t − Ts ), (54i)
rk+1 = r(t + kTs ), (54j)

where weighting matrix Q is symmetric and positive semidefinite, weighting matrix R is symmetric and
positive definite, and N is the prediction horizon. In this formulation, the control horizon is the same as

6
prediction horizon. The controller operates with sampling period Ts and the control law is as follows. At
time t, state x(t) is measured and system matrix A is obtained by discretization of the linear continuous-
time state-space matrix, which is parametrized by ω. Matrices B and C stay fixed. The controller then
finds optimal sequence z, from which only ∆u0 is taken to compute u0 = u−1 + ∆u0 . The voltage
vector u0 is then applied to the motor and saved for the next sampling period. If the reference output r
is given for the next sampling period r(t + Ts ) only, constant reference over the whole prediction horizon
is assumed, i.e. rk+1 = r(t + Ts ).

4.2 Condensed form


The above formulation of the optimization problem can be expressed in condensed form, in which the
predicted state is eliminated. The condensed form is
1 T   T
min z Hz + xT 0 uT
−1 r1
T
r2T . . . T
rN F z (55a)
z 2
s.t. Gz ≤ W + Sx0 , (55b)
 T
z = uT0 uT
1 . . . uN −1T , (55c)
x0 = x(t), (55d)
u−1 = u(t − Ts ), (55e)
rk = r(t + kTs ), k = 1, 2, . . . , N, (55f)

where matrices H, F , G, W , S are derived in appendix [1]. To obtain solution, this formulation can be
easily plugged into standard QP solvers. Choice of matrix C determines reference outputs to be tracked.

4.3 Dual QP of the condensed form


Now we denote
 T
a = xT0 uT
−1 r1T r2T ... T
rN . (56)

The dual cost function of the condensed cost function is defined as


 
1 T T T T
q(y) = inf L(z, y) = inf z Hz + a F z + y (Gz − W − Sx0 ) , (57)
z z 2
where y is the vector of Lagrange multipliers and is dual feasible if y ≥ 0. Because H is positive deinite,
the infimum is achieved for
∂L(z, y)
= 0, (58)
∂z
i.e.

z = −H −1 (F a + Gy). (59)

Therefore, the dual cost function is


1 T 1
q(y) = − y T GH −1 GT y − W + Sx0 + GH −1 F a y − aT F T H −1 F a, (60)
2 2
The dual problem is

max q(y) (61)


y

s.t. y ≥ 0, (62)

or

min − q(y) (63)


y

7
s.t. y ≥ 0, (64)

which is a convex QP. The dual problem in this case satisfies strong duality, i.e. the optimal value of the
dual problem equals the optimal value of the primal problem and the duality gap is zero. This can be
proven e.g. by showing that the Slater’s condition is satisfied, i.e. that the problem is strictly feasible.
The dual problem is rewritten as
1 T
min y Qy + dT y (65)
y 2
s.t. y ≥ 0, (66)
−1 T
Q = GH G , (67)
−1

d = W + Sx0 + GH Fa . (68)

4.4 Solution to the dual QP


We denote the dual cost function in the minimization problem as
1 T
f (y) = y Qy + dT y. (69)
2
It can be shown that

∂f (x) ∂f (y)
∂x − ∂y = kQ(x − y)k2 ≤ |λmax (Q)| kx − yk2 . (70)

2

The idea behind fast proximal gradient method is to take


1
λ ≥ (71)
|λmax (Q)|

such that

y k+1 = max y k − λ(Qy k + d), 0



(72)

quickly converges to the minimum. Due to the projection to the feasible set, y k at every iteration is
dual feasible. However, the choice of λ is subtle and affects the rate of convergence. The fast proximal
gradient is as follows (todo). The optimal solution to the primal QP is obtained from (59).

4.5 Single-loop v. multi-loop

5 Finite-control-set model predictive control (FCS-MPC)


FCS-MPC formulates the control task almost identically as CCS-MPC:
N
X −1
min (yk+1 − rk+1 )T Q(yk+1 − rk+1 ) + ∆uT
k R∆uk (73a)
z
k=0
s.t. xk+1 = Axk + Buk , (73b)
yk+1 = Cxk+1 , (73c)
Px xk+1 ≤ px , (73d)
 1   1   1  1  1  1  1  1 
 +2 +2 +2 +2 −2 −2 −2 −2 
uk ∈ + 12  , + 12  , − 1  , − 1  ,
2 2
+ 1  ,
2
+ 1  ,
2
− 1  ,
2
− 1  ,
2  (73e)
+ 12 − 12 + 12 − 12 + 12 − 12 + 12 − 12

T
z = u0 T u1 T . . . uT

N −1 , (73f)
∆uk = uk − uk−1 , (73g)

8
x0 = x(t), (73h)
u−1 = u(t − Ts ), (73i)
rk+1 = r(t + kTs ). (73j)
The main difference is that constraints on uk are replaced such that now uk belongs to a finite set of
vectors, where each vector describes one switching combination in the inverter. Each element of the
vectors corresponds to one phase-leg in the inverter, where +1/2 means it is connected to +vdc /2 and
-1/2 means it is connected to −vdc /2. Matrix B is therefore obtained by discretizing Bc R̃K̃vdc , which
is the continuous-time input matrix multiplied by the reduced Park and Clarke transformation matrices
2
and by DC-bus voltage. In this formulation, the 2-norm squared k∆uk k2 is equal to the number of
switching transitions that happen during step from time k − 1 to k. As there is usually no reason to
penalize some switches of the inverter more than others, one usually chooses R = λI, where λ is a scalar
weighting parameter. This parameter penalizes the switching events and, thus, it can be used to tune
the average steady-state switching frequency. This problem can be solved by enumerating all possible
sequence of the input vector. However, number of such sequences is 8N , which makes the exhaustive
search a feasible option only for very short prediction horizons.
FCS-MPC can also be expressed in a condensed form as
1 T   T
min z Hz + xT 0 uT
−1 r1
T
r2T . . . T
rN F z (74a)
z 2
s.t. Gz ≤ W + Sx0 , (74b)
 T
z = uT 0 uT
1 . . . uN −1T , (74c)
uk ∈ U, (74d)
x0 = x(t), (74e)
u−1 = u(t − Ts ), (74f)
rk = r(t + kTs ), k = 1, 2, . . . , N, (74g)
where the definition of some matrices slightly differs from CCS-MPC. In [4], the following formulation
is ... (todo)

6 Simulink simulation designs


7 Prototyping setup
For hardware implemenattion, AD-FMCMOTCON2-EBZ was chosen as a suitable commercially available
platform for PMSM control.

7.1 Description of hardware


For hardware implementation, AD-FMCMOTCON2-EBZ driver by Analog devices together with Zed-
Board was chosen. AD-FMCMOTCON2-EBZ is a driver system allowing control of two motors simulta-
neously. It contains sigma-delta modulators for measuring the phase currents with 16-bit resolution at
78.1 kHz. To measure at higher frequency, the resolution has to be decreased by decreasing decimation
ration of demodulating filters. ZedBoard is a prototyping platform with Zynq-7000 SoC, which contains
ARMr dual Cortexr -A9 and Xilinx 7-series FPGA fabric on a single chip. Both the ARMr process-
ing system and FPGA fabric are supported by MATLAB and Simulink, and one can relatively easily
implement co-designs both parts of the chip. A photograph of the platform is shown in fig. 3.

7.2 Descrition of software


In order to run the Simulink control designs on the ZedBoard, the following software is reqired.
• Xilinx Vivado – any version compatible with MATLAB HDL Coder should work after minor changes
to the design. The designs were created using Xilinx Vivado 2019.2 HL WebPACK (free license)

9
Figure 3: ZedBoard and AD-FMCMOTCON2-EBZ with two coupled PMSM.

• MATLAB, Simulink, HDL Coder, Embedded Coder (available within the student MATLAB license)
• The following MATLAB add-ons:
– MinGW-w64 (MATLAB Support for MinGW-w64 C/C++ Compiler)
– Embedded Coder Support Package for Xilinx Zynq Platform
– HDL Coder Support Package for Xilinx Zynq Platform

7.3 Descrition of created simulink control designs


There are five Simulink control designs, which are

• pmsm_pi – field-oriented PI control


• pmsm_ccsmpc_sl – CCS-MPC single-loop control
• pmsm_ccsmpc_ml – CCS-MPC multi-loop control

• pmsm_fcsmpc_ss – FCS-MPC single-step control (N = 1)


• pmsm_fcsmpc_ms – FCS-MPC multi-step control (N = 3)
• pmsm_fcsmpc_ms_ip – FCS-MPC multi-step control (N = 3) implemented in VHDL with Simulink
interface

Each of the designs is in its own directory and consists of multiple files. In all cases the files are almost
the same.
simulink_design
pmsm_pl.slx
pmsm_ps.slx
init.m
sources
libs
HDLReferenceDesigns
pmsm_lc_lib.slx

10
Figure 4: pmsm_pl.slx

Figure 5: pmsm_ps.slx

8 *Prototyping setup – customized inverter


In order to improve the hardware design, the inverter desgn was customized. (todo)

Figure 6: LV board

11
Figure 7: MZ split board

Figure 8: ZB split board

9 Experiments
9.1 Instructions for running the experiments

Figure 9: Top bar in pmsm_pl.slx

Figure 10: Running HDL Workflow Advisor in pmsm_pl.slx

12
Figure 11: Top bar in pmsm_ps.slx

9.2 Some conducted experiments

10 Conclusions
10.1 What was achieved
10.2 What remains to do
• Automatic calibration/identification.
• Better way to find zero angle (angle offset).
• Field weakening MPC.

• Inspect the centralized structure, try to tune.


• Measure the switching losses.
• Kalman filter instead of observers.

• Better current sensors.

References
[1] Lukáš Černý. “Algorithms for Advanced Motion Control Using Permanent Magnet Synchronous Mo-
tors and Brushless DC Motors”. Master’s Thesis. Faculty of Electrical Engineering, Czech Technical
University in Prague, Aug. 2020.
[2] K. Belda. “Study of predictive control for Permanent Magnet Synchronous Motor drives”. In: 2012
17th International Conference on Methods Models in Automation Robotics (MMAR). 2012, pp. 522–
527. doi: 10.1109/MMAR.2012.6347831.
[3] G. Cimini, D. Bernardini, A. Bemporad, et al. “Online model predictive torque control for Permanent
Magnet Synchronous Motors”. In: 2015 IEEE International Conference on Industrial Technology
(ICIT). Mar. 2015, pp. 2308–2313. doi: 10.1109/ICIT.2015.7125438.
[4] Tobias Geyer. Model Predictive Control of High Power Converters and Industrial Drives. John Wiley
& Sons, 2017. isbn: 978-1-119-01086-9.

13

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy