You are on page 1of 6

International Journal of Advanced Engineering Science and Information Technology

Vol.1, Issue 1, January 2014


Design and Simulation of DA based PID Controller using Verilog
J. Jerald Linus Kumar
, Dr. V. Jeyalakshmi

P.G. Scholar
, Assistant Professor
M.E. Final Year (Applied Electronics)
V.L.B. Janakiammal College of Engineering and Technology, Coimbatore.

A Proportional Integral Derivative
(PID) controller is a generic control
loop feed back mechanism widely used
in control systems. A PID controller
attempts to correct the error between a
measured process variable and the
desired set point by calculating and
then putting a corrective action that can
adjust the process accordingly to reach
the set point. FPGA (field
programmable gate array) can be very
effectively used for control purposes in
process demanding very high loop
cycle time. The implementation of a
digital (PID) controller in a FPGA can
be parallel, resulting in very high speed
of operation. This fact enables FPGAs
to score over general purpose
computing chips like DSP chips, which
have a limited number of multipliers
accumulator (MAC) units that can be
used for the controller design. This
makes use of the look up table (LUT)
rich characteristics of the FPGA. This
work looks at the serial and parallel
implementation of PID controller on a
FPGA. A more efficient
implementation of a PID using
Distributed Arithmetic (DA) was
looked in the implementation.

The proportional integral
derivative controller is one of the most
common type of feedback controllers
that are used in dynamic systems. This
controller has been widely used in
many different areas, such as
aerospace, process control,
manufacturing, robotics, automation
and transportation systems.
Implementation of PID controller has
gone through several stages of
evolution, from early mechanical and
pneumatic designs of microprocessor
based system.
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

A Proportional-Integral-Derivative
(PID) controller is a common feedback
loop component in industrial control
systems. The controller takes a
measured value from a process or other
apparatus and compares it with a
reference set point value.
The difference is then used to
adjust some input to the process in
order to bring the process measured
value back to its desired set point.
Unlike simpler controllers, the PID can
adjust process outputs based on the
history and rate of change of the error
signal, which gives more accurate and
stable control. PID controllers do not
require advanced mathematics to
International Journal of Advanced Engineering Science and Information Technology
Vol.1, Issue 1, January 2014


design and can be easily adjusted (or
"tuned") to the desired application,
unlike more complicated control
algorithms based on optimal control
theory.[Stephen (1996)]

Figure 1: Traditional PID Controller

2.1 Control Loop Basics
Intuitively, the PID loop tries to
automate what an intelligent operator
with a gauge and a control knob would
do. The operator would read a gauge
showing the output measurement of a
process, and use the knob to adjust the
input of the process until the process's
output measurement stabilizes at the
desired value on the gauge.
In older control literature this
adjustment process is called a "reset"
action. The position of the needle on
the gauge is a "measurement", "process
value" or "process variable". The
desired value on the gauge is called a
"set point" (also called "set value").
The difference between the gauge's
needle and the set point is the "error.
[Wei zhao (2005)]

A control loop consists of three parts
1. Measurement by a sensor
connected to the process (or the
2. Decision in a controller
3. Action through an output
device ("actuator") such as a
control valve.
As the controller reads a sensor,
it subtracts this measurement from the
"set point" to determine the "error". It
then uses the error to calculate a
correction to the process input variable
(the "action") so that this correction
will remove the error from the
processes output measurement. [Wei
In a PID loop, correction is
calculated from the error in three
Cancel out the current error
directly (Proportional),
The amount of time the error
has continued uncorrected
Anticipate the future error from
the rate of change of the error
over time (Derivative).

A PID controller can be used to
control any measurable variable which
can be affected by manipulating some
other process variable. It can be used to
control temperature, pressure, flow
rate, chemical composition, speed, or
other variables. Automobile cruise
control is an example of a process
outside of industry which utilizes crude
PID control.
Some control systems arrange PID
controllers in cascades or networks.
That is, a "master" control produces
signals used by "slave" controllers.
One common situation is motor
controls: one often wants the motor to
have a controlled speed, with the
"slave" controller (often built into a
variable frequency drive) directly
managing the speed based on a
proportional input.

2.2 PID Functional Blocks
International Journal of Advanced Engineering Science and Information Technology
Vol.1, Issue 1, January 2014


The PID loop adds positive
corrections, removing error from the
process's controllable variable (its
input). Differing terms are used in the
process control industry: The "process
variable" is also called the "process's
input" or "controller's output." The
process's output is also called the
"measurement" or "controller's input."
This "up a bit, down a bit" movement
of the process's input variable is how
the PID loop automatically finds the
correct level of input for the process.
"Turning the control knob" reduces
error, adjusting the process's input to
keep the process's measured output at
the set point. The error is found by
subtracting the measured quantity from
the set point. "PID" is named after its
three correcting calculations, whose
sum constitutes the output of the PID
controller. [Joao lima]

1. Proportional - To handle the
immediate error, the error is multiplied
by a constant p (for "proportional"),
and added to the controlled quantity. P
is only valid in the band over which a
controller's output is proportional to
the error of the system.
For example, for a heater, a
controller with a proportional band of
10 c and a set point of 20 c would
have an output of 100% at 10 c, 50%
at 15 c and 10% at 19 c. Note that
when the error is zero, a proportional
controller's output is zero. [Jomo lima]
2. Integral - To learn from the past,
the error is integrated (added up) over
a period of time, and then multiplied
by a constant i (making an average),
and added to the controlled quantity. A
simple proportional system either
oscillates, moving back and forth
around the set point because there's
nothing to remove the error when it
overshoots, or oscillates and/or
stabilizes at a too low or too high
value. By adding a proportion of the
average error to the process input, the
average difference between the process
output and the set point is continually
reduced. Therefore, eventually, a well-
tuned PID loop's process output will
settle down at the set point. As an
example, a system that has a tendency
for a lower value (heater in a cold
environment), a simple proportional
system would oscillate and/or stabilize
at a too low value because when zero
error is reached p is also zero thereby
halting the system until it again is too
3. Derivative - To handle the future,
the first derivative (the slope of the
error) over time is calculated, and
multiplied by another constant d, and
also added to the controlled quantity.
The derivative term controls the
response to a change in the system.
The larger the derivative term, the
more rapidly the controller responds to
changes in the process's output.
A PID controller is called a PI,
PD, or P controller in the absence of
respective control actions. It may be
noted that EWMA (exponential
weighted moving average) controller is
equivalent to pi controller.

The generic transfer function for a PID
controller of the interacting form is
given in Equation 1.

Where C is a constant which depends
on the bandwidth of the controlled

International Journal of Advanced Engineering Science and Information Technology
Vol.1, Issue 1, January 2014


Traditionally, the output of the
controller (i.e. The input to the
process) is given by Equation 2.

where P
, I
, and D
are the
feedback contributions from the PID
controller, defined in Equations 3 to 5.

1. K
: Proportional gain -larger K

typically means faster response since
the larger the error, the larger the
feedback to compensate.
2. K
: Integral gain larger K
steady state errors are eliminated
quicker. The trade off is larger
overshoot: any negative error
integrated during transient response
must be integrated away by positive
error before we reach steady state.
3. K
: Derivative gain - larger K

decreases overshoot, but slows down
transient response. [Joao lima]

The PID control algorithm is one
of the most commonly used control
algorithms in industry. The controller
output is computed in continuous time
in Equation (6).

Where K
is the proportional gain, T
the reset time and T
is the derivative
time. The above Equation (6) is
discretized and the following Equation
(7) is obtained.

Where K
= K
is the integral
coefficient and K
= K
/T is the
derivative coefficient. This form is
called the position form of the PID
algorithm. [Wai zhao]

An alternative method for discrete
would be to compute u(n) based on
past output u(n-1) and correction term
u(n). This approach is often called as
the velocity form of the PID algorithm.
The first step in this regard would be to
calculate u (n-1) based on Equation 8.

Then calculate correction term as
Equation 9 and 10


The current control output is calculated

International Journal of Advanced Engineering Science and Information Technology
Vol.1, Issue 1, January 2014


Figure 2: Distributed Scheme
From the above explanation the
DA based PID controller has more
compact, power efficiency, less
hardware utilization and provide high
speed capabilities as compared to other
methods. So, in this work DA is
proposed to achieve. [Daijin]

Da Multiplier

By Pass Multiplier

Fig 3: Simulation Result

An FPGA-based digital feedback
control system using a novel DA-based
PID controller was proposed. Based on
the LUT scheme, the proposed PID
controller reduces the cost of the
FPGA design. In addition, due to the
flexibility of the LUT in the FPGA,
this FPGA-based PID controller can be
easily extended to incorporate other
algorithms, such as antiwindup
protection or adaptive schemes. This
design approach would specifically be
suitable for the next generation of
FPGA chips, in which ADC and DAC
converter are built inside the chip. In
such a case, the proposed structure
would be more efficient in terms of
hardware resources and control
performance compared with the
standard microcontroller IP cores.
The complete system was designed
using a modular approach and
integrated and downloaded into both
xilinx and altera FPGA chips. The
system was tested by simulations and
experiments, demonstrating good
closed-loop stability and performance.
The controller modules are reusable
and reconfigurable, which can be
ported into matlab/simulink as
simulink blocks for hardware/software
cosimulation and can be utilized in
other embedded control applications.


1. Y.F.Chan M. Moallem W.
Wang,December 14-17,(2004)
Efficient Implimentation of
PID Control Algorithm using
FPGA Technology 43
Conference on Decision and
Control, Atlatis, Paradise
2. Daijin Kim,(2007). An
implementation of fuzzy logic
controller on the reconfigurable
figurable FPGA system. IEEE
International Journal of Advanced Engineering Science and Information Technology
Vol.1, Issue 1, January 2014


Transaction on industrial
electronics, vol 47 No 3.
3. G.Frantz, Nov(2000). Digital
signal Processor trends. IEEE-
MICRO,20,Page 52-59.
4. S.Ferreira, F. Haffner, L.F.
Pereira, and F. Moraes, sep
(2003).Design and Prototyping
of direct torque control of
induction motors in FPGAs, in
proc. IEEE Symp. Integr.
Circuits and Syst. Des., pp.
5. Joao Lima, Ricardo Menotti,
Joao M.P. Cardoso, and
Eduardo Marques. Oct (2006).
A Methodology to Design
FPGA based PID Controllers.
IEEE Trans., pp 120-132.
6. S. L. Jung, M. Y. Chang, J. Y.
Jyang, L.C. Yeh, and Y.Y.
Tzou,May (1999). Design and
implementation of an FPGA
based control IC for AC-
voltage regulation, IEEE
Trans. Power Electron., vol. 14,
no.3, pp. 522-532.
7. National Instruments:, FPGA
based control: Millions of
transistors at your command.