dokumen.tips ieee-2013-international-conference-on-control-decision-and-information-technologies-Implemntation of predective controller on the STM32 board

Telechargé par mr.zakifull
Implementation of a Predictive controller
on the STM32 board
1Smeti A.,2Chagra W., 3Ksouri M.
Laboratory of Analysis Conception and Control of Systems,
1: Faculty of Sciences of Tunis,
2: Preparatory Institute for Engineering Studies El Manar, Tunis
3: National School of Engineering of Tunis, Tunisia.
Smetiabir@yahoo.fr, wassila.chagra@isetn.rnu.tn, moufida_ksouri@yahoo.fr
Absract— In the literature, there is few practical
works about the implementation on miniaturized
devices like FPGA (Field Programmable Gate Arrays)
and microcontrollers of the Generalized Predictive
Control (GPC) technique. The reason can be
attributed to its programming complexity. In this
work, we took advantage of the advancement in the
field of embedded systems and we realized an
application based on a GPC implemented on an
STM32 microcontroller to control a basic second
order system. Also, a PID (Proportional-Integral-
Derivative) controller has been implemented in the
STM32 to make a performance comparison with the
GPC.
Key words- Predictive control; PID; STM32;
Microcontroller
I. INTRODUCTION
Implementation of control techniques on
miniaturized devices is often used because it saves
a lot of space thus reducing clutter [1], [5], [6], [7],
[8], [9], [10]. In addition, there exist several
softwares that facilitate the communication and the
programming of the mentioned devices. Another
reason is the appearance of several types of
microcontrollers with low cost that are becoming
more and more efficient, thanks to a decreased time
processing. The STM microcontrollers are an
example of the advancement in the embedded
technology that combines low cost, low
consumption and more performance. In this paper,
the implementation of the GPC (Generalized
Predictive Control) control of a system of second
order on the STM32VLDiscovery board is
performed using the software IAR Embeded
Workbench. The results will encourage us to look
for the implementation of more advanced control
techniques on the mentioned microcontroller
applied to nonlinear and complex systems. The
paper is organized as follows. In section II, we
present the GPC controller. The section III deals the
stm32 board and Iar Embeded Workbench. In the
section IV, we present the experimental results.
II. THEORICAL REVIEW OF GPC
We consider systems that can be modelized by the
following discrete state space model:
(1)
The matrices F, G and H, are given as mentioned in
[2]:
F=
1
1
10
01
00
n
n
a
a
a
⎛⎞
⎜⎟
⎜⎟
⎜⎟
⎜⎟
⎝⎠
"
##"#
"
"
, G=
0
2
1
n
n
b
b
b
⎛⎞
⎜⎟
⎜⎟
⎜⎟
⎜⎟
⎝⎠
#
,
H=
()
10 0"
with (1, )n
H
R, (,)nn
F
R, (,1)n
GR.
The state of the system is x(k)
Rn, the measured
output is 1
1
()
y
kR, the control increment is
Δ
u(k) and 1
1
z
Δ= − is an operator that denotes
the integral action which ensures static error
elimination. Using the equation (1) we obtain the
state expression at (k+j):
(2)
The use of both equations (1) and (2) leads to the
output j-step ahead predictor:
(3)
The GPC is based on the minimization of a
quadratic cost function wich is given by:
(4)
1
1
0
(/) () ()
j
jji
i
yk j k HF xk HF G uk i
−−
=
+= + Δ+
1
1
0
(/) () ()
j
jji
i
x
kjk Fxk F Guki
−−
=
+= + Δ+
(1) () ()
() ()
xk Fxk G uk
yk Hxk
+= +Δ
=
22
11
(( / ) ( )) ( 1)
pc
HH
jj
J ykjk wkj ukj
λ
==
=+++Δ+
∑∑
CoDIT'13
978-1-4673-5549-0/13/$31.00 ©2013 IEEE
250
where Hp is the prediction horizon; Hc is the
control horizon, λ is the weighting factor, w(k+j)
denotes the set-point at time k+j and
(/)
kjk+ and
j[1,Hp] is described in equation (3). In this
section, we adopt the output deviation method [2].
Using F, G and H above , we define the following
matrices:
L=
12
00
0
pp pc
HH HH
HG
HFG HG
H
FGHFG HF G
−− −
⎛⎞
⎜⎟
⎜⎟
⎜⎟
⎜⎟
⎜⎟
⎝⎠
#
#
####
#
;
M=
2
p
H
H
F
HF
HF
⎡⎤
⎢⎥
⎢⎥
⎢⎥
⎢⎥
⎢⎥
⎣⎦
#
The matrix L has dimension (Hp, Hc) where Hc is
the control horizon and the vector M has Hp
elements.
The output sequence can be written as follows:
(5)
Where:
The objective function (4) can be expressed as:
(6)
In which
Minimizing the equation (6), we obtain the optimal
control sequence:
Where (,)
cc
c
HH
H
IR is the identity matrix.
Finally, we have the recursive form of the
command described by the following equation:
In wich Δu(1) is the first element of Δu.
III. The STM32 BOARD AND IAR
EMBEDDE WORKBENCH
A microcontroller is a computer system that
includes a single integrated circuit memory ROM
(Read Only Memory) and RAM (Random Access
Memory), a processor that executes information and
input-output circuits for the interaction with the
outside environment.
A. STM32F100RB microcontroller
The choice of the STM32 value line discovery
is based on the following characteristics: low cost,
low power consumption, as well as a great
performance. Indeed, the mentioned card includes a
microcontroller type STM32F100rb, where it
integrates the cortex M3 32-bit processor. The
cortex M3 is based on the RISC (Reduced
Instruction Set Computer) architecture, which
constitutes the main cause of the success of the
combination between low cost and fast processing
and enables also the STM32vldiscovery to reach a
frequency speed of 74 MHz. The mentioned
microcontroller has also a 128 kb flash memory and
8 kb RAM [3].
Adding to this, the board includes a large number of
input pins / outputs, some of which are connected to
the ADC and DAC via a bus 32 MHz. Power can be
provided either through a USB cable or an external
power supply from 3.3V to 5V.
For debugging, the card has an interface called ST-
link that enables communication between the PC
and board. Fig.1 shows the stm32 boards.
Fig 1. STM32VLDiscovery board
B. IAR Tool Chain
IAR Embedded Workbench is a development
tool easy to use. It allows debugging embedded
applications using assembler, C and C++.
Programming becomes easier using a standard
library given by the manufacturer which provides a
firmware of initializing [3], the peripherals of the
microcontroller. Table I shows the source code
provided by Stmicroelectronics.
[]
1()
c
TT
H
uLLI LWMxk
λ
⎡⎤
Δ= +
⎣⎦
()()
TT
J
YW YW u u
λ
=− − +ΔΔ
(1) (2) ( )
T
p
Wwk wk wkH
=+ + +
"
 
(1/) (2/) ( /
T
p
yyk kyk k ykHk
⎡⎤
=+ + +
⎣⎦
"
[]
() ( 1) ( 1
T
c
uukuk ukHΔ=Δ Δ + Δ + −"
YLuMx+
() ( 1) (1)uk uk u=−+Δ
(1) ( 2)... ( )
p
Wwk wk wkH
⎡⎤
=+ + +
⎣⎦
CoDIT'13
978-1-4673-5549-0/13/$31.00 ©2013 IEEE
251
TABLE I.
Source Code Provided By ST
File name Roles of
p
stm32f10x_rcc Configura
t
that will b
e
stm32f10x_adc Initializati
Digital co
n
stm32f10x_dac Initializati
Analog co
n
stm32f10x_gpio Configura
t
output
p
or
t
stm32f10x_dma Initializati
Memory
A
After that, we need routines
computation. Routines will be su
m
following table:
TABLE II.
GPC firmwar
e
File name
Roles of p
e
Zero_matrix Initializati
o
at zeros
Product_matrix Multiplicat
i
matrices
Sum_matrix Addition o
f
Tr_matrices Transpositi
Prod_vect_mat Multiplicat
i
with a vect
o
IV. EXPERIMENTAL RESU
L
In this work, we are intereste
d
results when using the STM32 mi
c
we chose a basic second order
s
serie. We configured the pin PC4 in
connected it to the capacity output
a
in output mode and connected it t
o
The process has a second order diff
e
that leads to the following transfer
fu
In our work, we have considere
d
values:
R=268; L= 11.48 H and C= 680 μF
The discretized transfer function
w
time T
e
= 0.02s, is given by
expression:
The matrices F, G and H are given
b
2
() 1
() ()
s
e
Vp
Hp Vp LCp RC
p
==
+
1
1
0.02197 0.0188
() 1 1.586 0.6269
zz
Gz
zz
+
=−+
Microelectronics
p
eripherals
t
ion of all the clocks
e
use
d
on o
f
Analog /
n
verter
on o
f
the Digital /
n
verter
t
ion of input and
t
s
on the DMA (Direct
A
ccess)
for matrices
m
marized in the
e
e
ripherals
o
n all the matrices
i
on of two
f
two matrices
o
n
of a matrice
i
on of a matrix
or
L
TS
d
in the control
c
rocontroller, so
s
ystem an RLC
input mode and
a
nd the pin PA4
o
the resistance.
e
rential equation
fu
nction:
d
the following
w
ith a sampling
the following
b
y:
2.586
2.2129
0
10
01
00.6269
F
=
,
[]
100H=
.
In order to use the GPC c
o
steps illustrated in the flo
w
followed:
Fig 2. Flowchart of
In order to evaluate the per
f
technique mentioned above
w
PID (Proportional-Integral-
D
The expression of the disc
r
only the next form:
where: T
e
is the sample tim
e
and e is the difference betw
and the system output.
The latter was implem
e
microcontroller. The para
m
obtained by the method o
f
closed loop simulation resul
t
following GPC and PID pa
r
1; λ = 1; k
p
= 0.22; k
i
=0.00
9
is the proportional gain, k
i
i
s
the derivative gain.
The results are displayed i
n
and Fig. 6, where we can
s
RLC system output, the re
f
1
p
+
2
2
z
z
0
() (() ()
n
p
j
i
k
T
uk k ek e j
k=
=+ +
0.022
0.0188
0
G
⎡⎤
⎢⎥
=
⎢⎥
⎢⎥
⎣⎦
,
o
ntroller algorithm, the
w
char
t
, (Fig.2) must be
the
G
PC method
f
ormance of the control
w
e use the well known
D
erivative)
controller.
r
ete PID controller has
e
, u is the control input
een the reference input
e
nted on the same
m
eters o
f
the PID are
f
Takahashi [4]. The
t
s are obtained with the
r
ameters: H
p
= 4; H
c
=
9
8; k
d
=0.0392, where k
p
s
the integral gai
n
, k
d
is
n
Fig. 3, Fig. 4, Fig. 5
s
ee the behavior of the
f
erence output and the
( ( ) ( 1)))
d
k
ek ek
T−−
CoDIT'13
978-1-4673-5549-0/13/$31.00 ©2013 IEEE
252
control input using respectively the GPC and the
PID controller.
Fig 3. RLC system response (vs(k) solid line and ve(k) dashed
line) (GPC controller)
Fig 4. GPC control input
Fig 5. RLC system response (vs(k)solid line and ve(k) dashed
line) (PID controller)
Fig 6. PID control input
In the table below, we compare the performance of
execution time between PID and GPC controller.
TABLE III.
Performance comparison between GPC and PID Controller
PID GPC controller
Average execution time (μ s) 4.613 532.142
Based on this table, we note that the computing
time of the GPC is greater than that of the PID.
Indeed, the GPC algorithm has several matrix
resolutions, see Table II.
The implementation of the PID and the GPC
controller on STM32 was successful. From the
experimental results we can see that both
controllers have a good tracking of the reference
input. Although the execution time of the PID
algorithm is less than that of the GPC; the latter has
the advantage of anticipating the change in the
reference input and thus acts before it occurs, which
is not the case of the PID controller.
V. Conclusion
In this work, we have implemented a PID and a
GPC controllers on a STM32 microcontroller. The
IAR embeded workbench was used to load the
firmware which enables the microcontroller to
control a second order system. The presented work
is the first step that enables us to consider in the
future the control of complex and nonlinear systems
with the GPC strategy implemented on the STM32
microcontroller.
REFERENCES
[1] E.Aridhi, M. Abbes, A. Mami. “FPGA Implementation of
Predictive Control”, MELLECON’2012, March 25-28,
Hammamet Tunisia.
[2] K. Watanabet, K. Ikeda, T. Fukuda, S.G. Tzafestas.
“Adaptive Generalized Predictive Control using A State-Space
Approach”,IEEE International Workshop on Intelligent Robots
and Systems IROS’91, p. 1609-1614, November 3-5, 1991,
Osaka Japan.
[3] STMicroelectronics. Datasheet STM32F100, 2009.
www.st.com
[4] M. Mathelin and I. Bara. Commande numériques des
systèmes. Cours, Ecole Nationale Supérieure de Physique de
Strasbourg, 2ème année, 2007
[5] J. Ghabi. Synthèse et implémentation sur FPGA de la
commande prédictive robuste des systèmes linéaires
multivariables. PhD thesis, Ecole Nationale d’Ingénieurs de
Monastir, 2010.
[6] A. Kheriji, F. Bouani, and M. Ksouri, “Efcient
implementation of constraind robust model predictive control
using a state space model,” in Proceedings of International
Conference on Informatics in Control, Automation and Robotics
(ICINCO), 2010.
[7] Y. F. Chan, M. Moallem, W. Wang, “Efficient
implementation of PID control algorithm using FPGA
technology”, Proceedings of the 43ed IEEE Conference on
Decision and Control, V5, PP. 4885-4890, Bahamas2004.
[8] U. R. Y. Jayaraman, “Fpga implementation of predictive
control strategy for power factor correction,” in Proceedings of
World Academy of Science, Engineering and Technology, 2008.
[9] G. Palomo, K. Hilton, and J. Rossiter, “Predictive control
implementation in a plc using the iec 1131.3 programming
standard,” in Proceedings of American Control Conference,
2009.
[10] G. Pannochia, “Robust model predictive control with
guaranteed set point tracking,” Journal of Process Control, vol.
14,pp.927–937, 2004
CoDIT'13
978-1-4673-5549-0/13/$31.00 ©2013 IEEE
253
1 / 4 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !