InTech uses cookies to offer you the best online experience. By continuing to use our site, you agree to our Privacy Policy.

Engineering » Control Engineering » "Advances in PID Control", book edited by Valery D. Yurkevich, ISBN 978-953-307-267-8, Published: September 6, 2011 under CC BY-NC-SA 3.0 license. © The Author(s).

Chapter 14

PID Controller Using FPGA Technology

By Abdesselem Trimeche, Anis Sakly, Abdelatif Mtibaa and Mohamed Benrejeb
DOI: 10.5772/18295

Article top

Overview

A PID-based feedback control system.
Figure 1. A PID-based feedback control system.
PID Architecture.
Figure 2. PID Architecture.
Diagram of DIGILENT AIO1.
Figure 3. Diagram of DIGILENT AIO1.
A/D interface converter.
Figure 4. A/D interface converter.
AD7823 Timing Diagram.
Figure 5. AD7823 Timing Diagram.
A/D interface converter.
Figure 6. A/D interface converter.
AD7303 Timing Diagram.
Figure 7. AD7303 Timing Diagram.
Design properties.
Figure 8. Design properties.
PID Controller Block.
Figure 9. PID Controller Block.
Simulation diagram of PID controller block.
Figure 10. Simulation diagram of PID controller block.
Devices utilizations summary for the PID controller Implementation.
Figure 11. Devices utilizations summary for the PID controller Implementation.
Installation Diagram of the system of second order.
Figure 12. Installation Diagram of the system of second order.
System Answer in open bucklem>1.
Figure 13. System Answer in open bucklem>1.
Answer of the system ordered by proportional regulator P.
Figure 14. Answer of the system ordered by proportional regulator P.
Answer of the system ordered by PI regulator (m>1).One notices the annulment of the static mistake well thanks to the introduction of the I action.
Figure 15. Answer of the system ordered by PI regulator (m>1).One notices the annulment of the static mistake well thanks to the introduction of the I action.
Answer of the system in open buckle(m<1).
Figure 16. Answer of the system in open buckle(m<1).
Answer of the system ordered by proportional regulator P.
Figure 17. Answer of the system ordered by proportional regulator P.
Answer of the system ordered by proportional regulator P D.
Figure 18. Answer of the system ordered by proportional regulator P D.
Answer of the system ordered by proportional regulator P I.
Figure 19. Answer of the system ordered by proportional regulator P I.
Answer of the system ordered by proportional regulator P ID.
Figure 20. Answer of the system ordered by proportional regulator P ID.
Tentative evaluation of the sampling period (T).
Figure 21. Tentative evaluation of the sampling period (T).

PID Controller Using FPGA Technology

Abdesselem Trimeche1, Anis Sakly, Abdelatif Mtibaa and Mohamed Benrejeb

1. Introduction

Since the Years 60, the law of Moore predicts that the complexity in terms of built-in circuit transistors doubles every two years, remain verified. The programmable FPGA circuits (Field Programmable Gate Array)didn't escape to this law. Since the first FPGA, developed like an evolution natural of the CPLD (Complex Programmable Logic Devices), these circuits didn't stop winning in complexity and integrated henceforth until one billion of transistors for the most recent generations. This increase of the integration level resulted in a similar growth of the power of calculation of these circuits. The FPGAs have been used then to make the fast samples of ASICs (Application Specific Integrated Circuits) and find since some years their place in many domains of applications. However, the order of the processes industrial requires more and more elements of powerful calculations.This type of order is in the same way in perpetual evolution with the development of the numeric circuits of calculation. Thus, the PID controllers represent the majority of the controllers used in the industrial systems control. Of this fact, it will be necessary to digitalize the PID algorithm. The modern digital control systems require more and more strong and fastest calculation components. This type of elements becomes yet indispensable with the utilization of some new control algorithms like the fuzzy control, the adaptive control, the sliding mode control… [1].Although the PID controllers are the oldest they represent the most used controllers in the industrial control systems

2. Discrete PID equation

The PID algorithm consists of three basic modes, the Proportional mode, the Integral and the Derivative modes. When utilizing this algorithm it is necessary to decide which modes are to be used (P, I or D) and then specify the parameters (or settings) for each mode used. Generally, three basic algorithms are used P, PI or PID.

The implementation of PID controllers using microprocessors and DSP chips is old and well known [2] [3], whereas very little works can be found in the literature on how to implement PID controllers using FPGAs [4].

Field Programmable Gate Arrays (FPGA) have become an alternative solution for the realization of digital control systems, previously dominated by the general purpose microprocessor systems.

In our work we introduce a simple method for implementing PID controllers. Some other contributions focused on proposing algorithms for tuning the coefficients of PID controllers using FPGAs while the controller itself is still implemented in software.

In [5] the authors describe the architecture of a data acquisition system for a gamma ray imaging camera.

In the past two years, Spartan II and III FPGA families from Xilinx have been successfully utilized in a variety of applications which include inverters [6][7], communications [8][9], imbedded processors [10], and image processing [11].

In our work, data acquisition for the PID controller, which is implemented using Xilinx Spartan-3 Starter Kit Board, is based on 8-bitserial A/D converters extensible from Digilent board AO1. Similar converters are utilized in [12] to implement an adaptable strain gage conditioner using FPGAs.

The application of a PID controller in a feedback control system is shown in fig1, where ref is the set point signal, y is the feedback signal, e is the error signal, and u is the control input.

media/image2.jpeg

Figure 1.

A PID-based feedback control system.

The simplest form of the PID control algorithm is given by:

u(t)=kp(e(t)+1Tie(t)dt+Tdde(t)dt)
(1)

According to the study done in [13] the digitized PID equation is brought back to:

uk=uk1+b0ek+b1e(k1)+b2e(k2)
(2)

Where the coefficients b0, b1, and b2 are evaluated by the expressions:

b0=kp(1+TdT);b1=kp(1+TTi2TdT);b2=kpTdT
(3)

The Kp, Ti and Td, are PID parameters for tuning, and T is the sampling period in seconds.

3. Digital PID architecture

To improve the speed and minimize the cost while offering clearly good performances, the adopted architecture used includes essentially three combinational logic multiplier, one substractor three adders and three registers. The fig 2 gives the adopted architecture.

Indeed, this architecture requires the availability of all calculation operators in each phase.

media/image6.jpeg

Figure 2.

PID Architecture.

3.1. Conversion blocks presentation

The AIO1 board is a peripheral board designed to work with Digilent’s family of system boards. The AIO1 contains analog to-digital and digital-to-analog converters from Analog Devices, two dual op amps, a variety of analog signal I /O connectors, and a solderless breadboard. All analog components use an on-board 5VDC voltage source. All unused I/O signals are passed through the AIO1 board so that it can be used between a system board and other peripheral boards.

The AIO1 uses an 8-bit, 200Ks analog-to-digital converter (the AD7823), and an 8-bit, 1 MHz digital-to-analog converter (the AD7303), both from Analog Devices. The AD8534 op amps (also from Analog Devices) can drive 250mA outputs rail-to-rail with a 3 MHz bandwidth, so many useful devices can be driven directly.

Fig 3 describes all the components of this block.

3.2. Analog input interface

FPGAs are well suited for serial Analog to Digital (A/D) converters. This is mainly because serial interface consumes less communication lines while the FPGA is fast enough to accommodate the high speed serial data. The AD7823 is a high speed, low power, 8-bit A/D converter. The part contains a 4 µs typical successive approximation A/D converter and a high speed serial interface that interfaces easily to FPGAs. The A/D interface adapter (ADIA) is implemented within the FPGA (Figure 5). Inside the FPGA, this adapter facilitates parallel data acquisition. Sampling is initiated at the rising edge of a clock applied at the line sample. The timing diagram of the communication protocol is illustrated in figure 4. The whole conversion and acquisition period is 5.4 µs allowing sampling up to a rate of 185 Kilo Sample per second. This rate is more than sufficient for most PID control applications.

media/image7.jpg

Figure 3.

Diagram of DIGILENT AIO1.

media/image8.jpeg

Figure 4.

A/D interface converter.

media/image9.jpg

Figure 5.

AD7823 Timing Diagram.

The output coding of the AD7823 is straight binary. The designed code transitions occur at successive integer LSB values (i.e., 1 LSB, 2 LSBs, etc.). The LSB size is = VREF/256.

3.3. Analog output interface

The AD7303 is a dual, 8-bit voltage out Digital to Analog (D/A) converter. This device uses a versatile 3-wire serial interface that operates at a clock up to 30 MHz. The serial input register is 16 bits wide; 8 bits act as data bits for the D/A converter, and the remaining 8 bits make up a control register. It is interfaced to an FPGA as illustrated in Figure 6. The D/A interface adapter (DAIA), which is implemented within the FPGA, facilitates parallel data input for the dual D/A converters. The timing diagram of the communication protocol is illustrated in figure 7. The transmission period of a sample is 680 ns allowing D/A conversion at an excellent rate of 1.47 MHZ.

media/image10.jpeg

Figure 6.

A/D interface converter.

media/image11.jpg

Figure 7.

AD7303 Timing Diagram.

Any DAC output voltage can ideally be expressed as:

VOUT = 2 × VREF × (N/256) where: N is the decimal equivalent of the binary input code. An N range from 0 to 255xVREF is the voltage applied to the external REF pin when the external reference is selected and is VDD/2 if the internal reference is used.

3.4. Implementation results

The proposed based PID controller is implemented using the Xilinx Inc FPGA technology and can be used as a general purpose controller for different applications. The simulation results obtained with the generated VHDL, in this work, the ModelSim® simulator was used. The circuits for the PID controllers have been obtained by logic synthesis and place and route using Xilinx ISE 7.1i, from the VHDL representation generated by the static analyzer. We use a Xilinx Spartan-3 xc3s200-ft256 -4 FPGA. The results presented herein are estimations directly obtained from Xilinx ISE 7.1i.

media/image12.jpg

Figure 8.

Design properties.

Table 1 shows the minimum number of multiplications, additions and registers required for the PID controller without conversions block.

Multiplication3
Addition3
subtraction1
register3
total10

Table 1.

Arithmetic Number for PID controller.

The PID controller block, into a complete control system consisting of analog and digital I/O, is illustrated in figure 9.

media/image13.jpeg

Figure 9.

PID Controller Block.

The simulation results adapted to this block is shown in figure 10.

media/image14.jpg

Figure 10.

Simulation diagram of PID controller block.

The synthesis of PID controller block using a Xilinx Spartan-3 xc3s200-ft256 -4 FPGA gives the following results.

media/image15.jpg

Figure 11.

Devices utilizations summary for the PID controller Implementation.

A design which is efficient in terms of power consumption and chip area means that the FPGA chip can be used to accommodate more controllers with adequate speed and low power consumption, resulting in a cost reduction of the controller hardware.

4. Application of PID controller using FPGA technology to command a system of second order

4.1. System presentation

The figure 12 describe the system of second order.

media/image16.jpeg

Figure 12.

Installation Diagram of the system of second order.

The values of all the components are:

R = 12 k

R1 = 15

R2 = 10

C1 = 6,8 nF

C2 = 22 nF

The Transfer function of the system is given by the following equation

G(p)=Vs(p)Ve(p)=Ks1+2mω0p+(1ω0)2p2
(4)

With:

Ks=R2R1=0,67 : static gain

ω0=1RC1C2=6,81*103rd/s 
(5)

m=C2C1=1,80>1 : Amortization factor

While permuting the positions of C1 and C2, the amortization factor becomes:

4.2. Experimental result

At the time of the order of the system two cases appear; when the amortization is m>1 and m<1.

4.2.1. Experimental results for an amortization m>1

4.2.1.1. System answer results in open buckle

For an order (ref) of the order of 2V applied to the system in BO one gets the answer y (t) presented on the following figure.

media/image22.jpg

Figure 13.

System Answer in open bucklem>1.

According to this answer, one verifies that the tension of exit stabilizes without oscillations (m>1) nearly to the value 1,4V, that corresponds more or less to the theoretical value:

Vs=KsVe=0,67*2=1,34V.
(7)

4.2.1.2. System answer results with P regulator

For an order (ref) of the order of 2V applied to the system ordered by a Proportional regulator (P) with KP = 2, one gets the answer y(t) presented on the following Figure

media/image24.jpg

Figure 14.

Answer of the system ordered by proportional regulator P.

One notices that this answer presents a static mistake of the order of 40%. Theoretically this mistake is given by:

4.2.1.3. System answer results with PI regulator

For an order (ref) applied of the order of 2V to the system ordered by a PI regulator with KP=2, KI=0.5, one gets the answer y(t) presented in the following figure:

media/image26.jpg

Figure 15.

Answer of the system ordered by PI regulator (m>1).One notices the annulment of the static mistake well thanks to the introduction of the I action.

4.2.2. Experimental results for an amortization m<1

4.2.2.1. System answer results in open buckle

For an order (ref) of the order of 2V applied to the system in BO one gets the answer y (t) presented on the following figure

media/image28.jpg

Figure 16.

Answer of the system in open buckle(m<1).

According to this answer, one verifies that the tension of exit stabilizes with oscillations (m <1) nearly to the value 1,4V.

4.2.2.2. System answer results with P regulator

For an order (ref) of the order of 2V applied to the system ordered by a Proportional regulator (P) with KP = 2, one gets the answer y (t) presented on the following Figure

media/image30.jpg

Figure 17.

Answer of the system ordered by proportional regulator P.

One notices that this answer presents a static mistake of the order of 40%. Theoretically this mistake is given by:

4.2.2.3. System answer results with PD regulator

For an order (ref) of the order of 2V applied to the system ordered by a PD regulator with KP = 2,KD=1 one gets the answer y (t) presented on the following Figure

media/image32.jpg

Figure 18.

Answer of the system ordered by proportional regulator P D.

One notices that the answer gotten present less oscillations that the one with the regulating P thanks to the Derivative action.

4.2.2.4. System answer results with PI regulator

For an order (ref) of the order of 2V applied to the system ordered by a PI regulator with KP=2, KI=0,5 one gets the answer y (t) presented on the following Figure.

media/image34.jpg

Figure 19.

Answer of the system ordered by proportional regulator P I.

one notices the annulment of the static mistake well thanks to the introduction of the I action

4.2.2.5. System answer results with PID regulator

For an order (ref) of the order of 2V applied to the system ordered by a PI D regulator with KP = 2, KD=1 and KI=0, 5 one gets the answer y (t) presented on the following Figure

media/image36.jpg

Figure 20.

Answer of the system ordered by proportional regulator P ID.

One notices that with the addition of the Derivative action, one has a light reduction of the oscillations in relation to the answer gotten by a regulating PI.

4.3. Tentative evaluation of sampling period

While following the evolution of the order u (t) one could estimate the value of the sampling period experimentally (T) as it’s indicated in the following figure

media/image38.jpg

Figure 21.

Tentative evaluation of the sampling period (T).

According to the figure 21, one estimates the value of the sampling period (T) that is the order of 6,7µs.

5. Conclusion

A digital PID controller implemented in FPGA technology is a configurable controller in terms of latency, resolution, and parallelism.

The speed or execution or latency of the controller can be precisely controlled with the amount of reuse of arithmetic elements such as the speed of execution of FPGA based PID controller can be less then 100 ns if desired for high throughput requirements.

Implementing PID controllers on FPGAs features speed, accuracy, power, compactness, and cost improvement over other digital implementation techniques.

In a future fork we plan to investigate implementation of fuzzy logic controllers on FPGAs. Also we plan to explore embedded soft processors, such as MicroBlaze, and study some applications in which design partitioning between software and hardware provides better implementations.

References

1 - L. Samet, N. Masmoudi, M. W. Kharrat, L. Kamoun, 1998A Digital Pid Controller for Real Time and Multi Loop Control, 5ème Colloque d’Informatique Industrielle CII’98 8,9 et 10 février,Djerba Tunisie
2 - H. D. Maheshappa, R. D. Samuel, A. Prakashan, 1989Digital PID controller for speed control of DC motors”, IETE Technical Review Journal, 6N3, 171176India
3 - J. Tang, 2001PID controller using the TMS320C31 DSK with on-line parameter adjustment for real-time DC motor speed and position control”, IEEE International Symposium on Industrial Electronics, 2786791Pusan.
4 - M. Abdelati, The Islamic University of Gaza, Gaza, Palestine:" FPGA-Based PID Controller Implementation".
5 - K. Nurdan, T. Conka-Nurdana, H. J. Beschc, B. Freislebenb, N. A. Pavelc, A. H. Walentac, 2003FPGA-based data acquisition system for a Compton camera”, Proceedings of the 2nd International Symposium on Applications of Particle Detectors in Medicine, Biology and Astrophysics, 510N1, 122125Sep.
6 - R. Jastrzebski, A. Napieralski, O. Pyrhonen, H. Saren, 2003Implementation and simulation of fast inverter control algorithms with the use of FPGA circuit”, 2003 Nanotechnology Conference and Trade Show, 238241Nanotech.
7 - F. S. Lin, J. F. Chen, T. J. Liang, R. L. Lin, Y. C. Kuo, 2004Design and implementation of FPGA-based single stage photovoltaic energy conversion system”, Proceedings of IEEE Asia Pacific Conference on Circuits and Systems, 745748Taiwan, Dec..
8 - B. Aliane, A. Sabanovic, 2004Design and implementation of digital band pass FIR filter in FPGA”, Computers in Education Journal, 147681
9 - M. Canet, F. Vicedo, V. Almenar, J. Valls, 2004FPGA implementation of an IF transceiver for OFDM-basedWLAN”, IEEEWorkshop on Signal Processing Systems, SiPS: Design and Implementation, 227232USA.
10 - X. Li, T. Li, 2004ECOMIPS: An economic MIPS CPU design on FPGA”, Proceedings- 4th IEEE International Workshop on System-on-Chip for Real-Time Applications, 291294Canada.
11 - R. Gao, D. Xu, J. P. Bentley, 2003Reconfigurable hardware implementation of an improved parallel architecture for MPEG-4 motion estimation in mobile applications”,IEEE Transactions on Consumer Electronics, 49N4, November.
12 - S. Poussier, H. Rabah, S. Weber, 2004Smart Adaptable Strain Gage Conditioner: Hard- ware/Software Implementation”, IEEE Sensors Journal, 4N2, April.
13 - L. Samet, 1996Etude de l’intégration électronique en technologie FPGA d’un algorithme de contrôle de processus: le PID" Thèse Docteur Ingénieur, ENIS-TUNISIE, décembre