Implementation of PID Controller On FPGA
Implementation of PID Controller On FPGA
preparation of seminar.
Last but not least I am thankful to Mr. M Sultan M Siddiqui, Research Scholar
my efforts successful.
A.H.Sajid
Contents
1. Abstract
2. Introduction
3. Importance of PID & its Application
4. Digital Implementation of PID
5. Advantages of Using FPGA over other Digital Techniques
6. PID Implementation using DA Algorithm
7. FPGA Architecture
8. FPGA Design Flow
9. Proposed Experimental Setup
10. Advantages of the Approach
11. Conclusion
12. References
Abstract
Introduction
A control system seeks to make a physical system output track a desired reference
input by setting physical system input. Designing a control system in not easy. The
objective of a control system design is to make a physical system behave in a useful
fashion, in particular, by causing its output to track a desired reference input even in
the presence of measurement noise, model error and disturbances.
e(t) u(t)
þ Physical
Controller
System
y(t)
Measurement
System
Figure: Block Diagram of a Control System.
Controller
In a control system, one of the main components is the controller (control element). It
is the component required to generate the appropriate control signal applied to the
physical system. It measures the error or difference between the output and the
desired output. The output signal of controller regulates the system performance.
Many a times the function of a controller is to obtain the desirable characteristics
avoiding undesired characteristics.
Controller Types
1. Continuous Controller
The most common controller action used in process control is one or a
combination of contino
i. Proportional Controller
ii. Integral Controller
iii. Derivative Controller
2. Discontinuous Controller
i. Two-Position Controller
ii. Multi-position Controller
3. Composite Controllers
i. Proportional-Integral Controller
ii. Proportional-Derivative Controller
iii. Proportional-Integral-Derivative Controller
It does not need a precise analytical model of the system that is being controlled.
Used in many different areas, such as aerospace, process control, manufacturing,
robotics, automation, and transportation system.
Concept of DA
In this case we feed four parallel scaling accumulators with unique serialized data.
Each multiplies that data by a possibly unique constant, and the resulting products
are summed in an adder tree.
Consider
1.
If each Xk is a 2’s compliment binary number such that Xk is less than 1 then
2.
Where the bkn are the bits, 0 or 1, bk0 is the sign bit, bk N-1 is the LSB.
3.
Equation 3 defines Lumped Arithmetic Computation
Let change the order of Summation we get
4.
5.
Since bkn can take 0 & 1 only therefore Equation 5 have 2k possible values
Rather than computing these values online, we pre-compute them & store in ROM. The
I/P data can be used directly address the memory & the result of equation 5 can be
dropped directly into an accumulator.
After N cycles the memory contains the result y.
Consider an example with K=4, A1= 0.72, A2 = -0.3,A3= 0.95, A4= 0.11.
The memory must contains all possible 24 combinations. As a consequence we need to
use 2* 24 word ROM.
PID Implementation Using DA Algorithm
Therefore we use a modified PIDcontrol algorithm that overcomes the above problems &
is given in laplace domain as
U(s) = K(bUc(s)−Y(s)+(1/sTi)(Uc(s)−Y(s))−(sTd/1+sTd/N)Y(s)) 2
To implement the control algorithm using digital technology, equation (2) has to be
discretized.
Let T be the sampling period, and using backward differences to discretize the derivative
term and forward differences for the integral term, we get
u(kT ) = P (kT ) + I(kT ) + D(kT ) 3
I(kT)=I((k−1)T)+(KT/Ti)(u((k−1)T)−y((k− )T))
D(kT)=(Td/Td+NT)D((k−1))−(KTdN/Td+NT)(y(kT)−y((k−1)T)) 4
where,
y(kT) is the output of the system at the current instant,
y((k −1)T) is the output of the system at the previous instant,
uc (kT ) is the desired output of the system,
I((k − 1)T ) is the integral term at the previous instant,
D((k − 1)T ) is the derivative term at the previous instant, and
K, b, Ti , Td , N are controller parameters,
The direct(Multiplier & Adder/Substractor) Implementation of above algorithm us
5 Multipliers 5 Adders/Substractors 4 Delay blocks
i.e.
P(kT) uses 2 Multipliers & 1 Adder/Substractor
I(kT) uses 1 Multipliers & 2 Adder/Substractor
D(kT) uses 2 Multipliers & 2 Adder/Substractor
Since Multiplier -Based Design uses many Multipliers & Adders, in order to reduce the
number of Multipliers & Adders we use DA Algorithm for PID Implementation.
Let us consider the controller terms given in Equation 4.
Assume that u(kT), u((k-1)T), y(kT) & y((k-1)T) are M-bit numbers & [j] represents the
jth bit of number then
We have
m−1
P(kT) = Ʃ (Kb×u(kT)[ j]−K × y(kT)[ j]) × 2j 5
j=0
m−1
I(kT) = Ʃ (I((k−1)T)[ j] + (KT/Ti)(u((k−1)T)[ j] − y((k−1)T)[ j])) × 2j 6
j=0
m−1
D(kT ) = Ʃ ((Td/Td+NT)D((k−1)T)[ j] −(KTd N/Td + NT)((y(kT )[ j] −y ((k−1) T )
j=0 [ j]) × 2 j)) 7
The results of
(Kb×u(kT)[ j]−K × y(kT)[ j]),
I((k−1)T)[ j] + (KT/Ti)(u((k−1)T)[ j] − y((k−1)T)[ j]))((Td/Td+NT)
D((k−1)T)[ j] −(KTdN/Td + NT)((y(kT )[ j]−y((k−1)T)[ j]) × 2 j)) can be pre-computed
& the result can be stored in 3 LUT's namely LUTp, LUTi, & LUTd.
Using the 3 LUTs and the corresponding shift-add accumulators (ACCs), the P (kT),
I(kT), and D(kT) terms can be obtained in m clock cycles.
Main advantage of the DA expression given by (5), (6) and (7) lies in its capability to
compute the PID function utilizing the LUT-rich FPGA.
Based on the above Equations the DA Implementation of PID Controller is shown in Fig
It consists of 4 delay blocks, 3 LUT's, 3 ACC's & 2 Adders.
i.e.
3 LUTS's & 3 ACC's for P(kT),I(kT) & D(kT).
ACC consists of shift register & adder
2 Adders to produce sum of P(kT),I(kT) & D(kT).
Speed of this PID is M+1 clock cycles i.e. M clock cycles to generate the result & 1 clock
cycle to update the I((k−1)T) and D((k−1)T) terms.
FPGA Architecture
The typical FPGA consists of the following components:
1. Programmable Logic blocks
2. Interconnection Resources
3. Input output blocks
The CLB can be realized in many ways; one of them being the Look Up Table (LUT)
based CLB.
The LUT is a one bit wide memory location . The memory address lines are the inputs to
the LUT and the one bit output is the LUT output. Thus the LUT with K-inputs acts as a
2k by 1 bit memory and the user can directly implement any k input function by
programming the functions truth table into the LUT
Fig: Xilinx FPGA CLB Schematic
Interconnect Resources
The IOB provides the interface between the FPGA and the real world signals.
DA-based PID controller is to be implemented using the Xilinx Inc. FPGA technology.
ie. SPARTAN IIE Xc2s200e-FT256
Conclusion
The proposed PID controller reduces the cost of the FPGA design.
Due to the flexibility of the LUT in the FPGA, this FPGA-based PID controller
can be easily extended to incorporate other algorithms,
This design approach would specifically be suitable for the next generation of
FPGA chips, in which ADC and D/A converter are built inside the chip.
References
K. J. Astrom and B. Wittenmark, “Computer Controlled Systems”. Englewood
Cliffs, NJ: Prentice-Hall, 1997.
L. Samet, N. Masmoudi, M. W. Kharrat, and L. Kamoun, “A digital PID
controller for real-time and multi-loop control: A comparative study,” in
Proceedings of IEEE International Conference Electron., Circuits and Systems,
Sep. 1998, vol. 1, pp. 291–296.
B. Wittenmark, K. J. Astrom, and K-E., Arzen, “Computer Control: An
Overview”, Technical Report, Department of Automatic Control, Lund Institute of
Technology, Sweden (www.control.lth.se/ kursdr/ifac.pdf), April 2003.
R. Chen, L. Chen, and L. Chen, “System design consideration for digital
wheelchair controller,” IEEE Trans.. Ind. Electronics, vol. 47, no. 4, pp. 898–907,
Aug. 2000.
Altera Flex10 K Embedded Programmable Logic Family Data Sheet, 2003, San
Jose, CA: Altera Corp. [Online]. Available: http://altera.com
R. Ruelland, G. Gateau, T. A. Meynard, and J.-C. Hapiot, “Design of FPGA-based
emulator for series multi-cell converters using co-simulation tools,” IEEE Trans.
Power Electronics., vol. 18, no. 1, pp. 455–463,Jan. 2003.
K. Sridharan and T. K. Priya, “The design of a hardware accelerator for real-time
complete visibility graph construction and efficient FPGA implementation,” IEEE
Trans. Ind. Electronics., vol. 52, no. 4,pp. 1185–1187, Aug. 2005.
M. Gabrick, R. Nicholson, F. Winters, B. Young, and J. Patton, “FPGA
considerations for automotive applications,” in Proc. SAE Conf., 2006, CD-ROM.
Mikulá˘s Huba and Miroslav Simunek “Modular Approach to teaching PID
Controller”, IEEE Trans. Ind. Electronics, vol. 54, no. 6,dec. 2007.
Eric Monmasson, and Marcian N. Cirstea “FPGA Design Methodology for
Industrial Control Systems—A Review” IEEE Trans. Ind. Electronics, vol. 54, no.
4, Aug. 2007.
V. Sornam Viswanathan “Embedded Control Using FPGA Seminar Report”
Interdisciplinary Programme in Systems and Control Engineering Indian Institute
of Technology, Bombay.
Y.F. Chan M. Moallem W. Wang “Efficient Implementation of PID Control
Algorithm using FPGA Technology” 43rd IEEE Conference on Decision and
Control December 14-17, 2004 Atlantis, Paradise Island, Bahamas
Yuen Fong Chan, M. Moallem, and Wei Wang, “Design and Implementation of
Modular FPGA-Based PID Controllers” IEEE Trans. Ind. Electronics, vol. 54, no.
4, Aug. 2007.
WWW.Xilinx.com
www.google.com