Anda di halaman 1dari 6

Comparative Study of Strategies for Fuzzy Control P

and PD applied to a pH plant


Authors: André Felipe Oliveira de Azevedo Dantas, Fábio Araújo de Lima, André Laurindo Maitelli, Gaspar Fontineli Dantas
Júnior.
E-mail: andre_o_a_dantas@hotmail.com, fabioarsp@gmail.com, maitelli@dca.ufrn.br, gsatnad@yahoo.com

Abstract- This article presents a fuzzy controller applied to a The control using fuzzy logic has been widely applied in
process of pH (hydronium potential) neutralization. The recent years, in several processes [8]. Generally, the fuzzy
controller shall be applied for the pH correction in waters with control is based on fuzzy sets and logic that can be used to
soap (wastewaters) and rainwaters, aiming at the reuse of such describe the human knowledge in mathematical format [13].
but not for drinking purposes. The controller has been
A typical fuzzy controller is composed of three basic parts:
implemented from the “Mamdani” model with the analysis of
two situations, one in which only the error is considered as the fuzzy application of the input signal, an engine of fuzzy
plant’s input, and another where error and variation of error inference that deals with rules and the fuzzy reverse process
are considered for it. All simulations were performed in a that generates continuous signal for actuators. In all, two
MATLAB® Simulink environment, and tested in an distinct characteristics of fuzzy logic is that the human
experimental microcontrolled plant using a PIC 18F4550, experience can be easily integrated, so it is not necessary a
demonstrating the benefits of the fuzzy logic’s application in this mathematical model of the system and that the fuzzy logic
process. provides nonlinear relation induced by functions of
pertinence, rules and the fuzzy reverse process [9].
I. INTRODUCTION However, in spite of the whole importance of the control,
the projects should always be associated with words such as
Current Studies show that the scarcity of water has been
quality, reliability and low cost. A device that has been
much discussed. Water misuse has created many problems
widely used for the implementation of controllers in projects
throughout the world. In our planet most of it is not available
that involve low cost is the microcontroller, usually applied
for human consumption, only 0.007 % of all is drinking
for automation and process control, such as the control
water. As there is still water in large quantities on the planet,
systems for automotive engines, remote controls, office and
many people have forgotten that it is important to rethink the
residential machinery, toys and supervisory systems.
forms of use this element of vital importance.
The microcontroller is able to reduce the size, cost and
For its reuse, something is important to control the water’s
energy consumption compared to conventional
pH. The pH control plays a very important role in industrial
microprocessors. Summarizing, the microcontrollers are an
processes [10], such as neutralization of effluents,
efficient alternative to control many processes and
biotechnological processes, precipitation, and chemical
applications.
industry[11].
Many programming languages, such as, assembly, C, and
Among many applications of pH’s control, the
even Ladder, make the microcontrollers increasingly sought
neutralization process is one of the most important. This
for automation. The project here proposed, suggests an
process has important characteristics is (i) nonlinear, (ii) the
intelligent reuse of wastewaters and rainwaters but not for
sensitivity of the pH (for the addition of reagents that may
drinking purposes. Its reuse will be applied for washing of
result in a change of one or more units), (iii) the gain of the
sidewalks, watering gardens, sanitary discharges. It’s possible
process is a complicated function of the solution’s
because of the control of its hydronium potential, also known
components, making its curve unknown. In truth, the
as pH.
procedures for pH’s control are very unpredictable [8]. The
This project will show an implementation of a pH
main difficulty in the pH control is its great sensitivity to
controller using fuzzy logic. The simulations were developed
disturbances and uncertainties parameters [11]. Thus, the pH
in a MATLAB® environment and the results obtained in
processes are known by its complexity.
practice show the good performance of the fuzzy controller
In 1965, Professor L. A. Zadeh, from Berkeley University
applied to it.
(USA), suggested an alternative for the conventional theory
of sets, it was the fuzzy sets theory [7]. It is much more
flexible and similar to the theory of the possibilities. In this II. HYDRONIUM POTENTIAL (PH)
theory, the change of pertinence to the non pertinence
happens in a slow and gradual way and not sudden as in
Based on Fontes et. al [5], pH is a characteristic of various
conventional theory of sets [6]. Through this technique it is
substances, determined by the concentration of ions of
possible to control complex processes, such as, for example,
hydrogen (H+). Solutions with a pH less than 7 are said to be
the control of a robotic arm or even pH of liquid substances.
acidic, solutions with a pH greater than 7 are basic or alkaline excess of turbidity. The second reservoir contain the pH
and neutral, with a pH close to 7. sensor. It will receive the water from the first reservoir and
Based on Campos [2] the lower the pH of a substance, the liquids used to control the pH, according to the
greater is the concentration of H+ ions and lower the microcontroller.
concentration of OH- ions. It is possible to find pH values In summary, the plant operates in the following way: a
lower than 0 and greater than 14, but it is very rare, and these pump positioned in the bottom reservoir moves the water
values cannot be measured with a normal probe. from it (which in a system represents a cistern) in the
In a substance the pH varies according to its composition, direction of the top reservoir (which symbolizes the water
temperature and concentration of salts, metals, acids, bases tank). Upon receiving the first reading of the level sensor, it
and organic substances. Mathematically, the "p" is equivalent will indicate that the reservoir already has enough quantity of
to the symmetrical logarithm (base 10) of the activity of ions water to initiate the control process.
to which it refers. Basically, pH is defined as a negative The top reservoir, or control tank, contain a pH sensor.
decimal logarithm of the hydrogen ion activity in a solution. This sensor will dynamically do the reading of the obtained
For H+ ions : values, and send it to the microcontroller. From the first
reading at a pH value different from the set-point, another
water pump starts its task of inserting reducer in the water,
pH=-log10 [aH+] (1) since the wastewater and rainwater tend to have a basic pH.
The pump launches water constantly in the top reservoir,
Knowing that aH+ represents the activity in mol dm-3, in however, in case it reaches its capacity limit indicated by the
dilute solutions (below 0.1 mol dm-3), the values of the level sensor, the pump stops. In fact, the pH must be
activity is closer to the values of the concentration, allowing neutralized simultaneously to the filling of the reservoir.
the above equation is written as illustrated in equation 2: It is important to emphasize that the hardware was
developed with low-cost parts, to show that it is possible to
make water reuse with quality and inexpensively. Figure 1
pH=-log10 [H+] (2) shows a simplified scheme of the project.

By controlling the pH, it is possible to use the water for


discharges of the toilets, washing of sidewalks or cars and
watering of gardens.

III. MICROCONTROLLER 18F4550


For implementation of the control and automation in the
project, a microcontroller was used. The 18F4550 is a
microcontroller for high performance and low cost of the
PIC18 series manufactured by MICROCHIP®. The chip
contains 256 bytes of EEPROM and its program’s memory is
the flash type. It also has 34 input/output pins which includes
a converter-analog-to-digital of 10 bits, a USART (for serial Fig. 1 Simplified Model of the Project
communication), serial synchronous ports that can be used for
The hardware, in this project, was developed from some
SPI and I2C communication (external EEPROM), modulation
recyclable parts, two monophasic pumps, two direct current
by pulse width (PWM), two analogue comparators and USB
pumps, two reservoirs and a pH sensor. It is known that in
port for communication. The programming language used for
practice the excess of noise, temperature variations, as well as
implementation of the codes in the microcontroller was C.
the circuit itself generated for acquisition of information are
factors that directly influence the readings that the pH sensor
will offer the microcontroller. Therefore, in this project, we
IV. PH PLANT
also used a transmitter to connect the sensor to the
The pH can be determined indirectly by inserting a pH microcontroller. The figure 2 shows the project built for
indicator in the solution under analysis. The graywater is testing.
usually an alkaline solution, so it is necessary to add, during,
or even after filtering, a pH reducer liquid, it is also added
based on the data obtained through the reading of the pH
sensor.
To prove theoretical results in practical experiments, a
plant was built to control the water’s pH. This plant has two
reservoirs. The first is in series with a single filter of sand
and aquarium stones. This filter is not controlled, its only
objective is to receive the gray or blue water and remove the
controlled by the Fuzzy Logic Controller block with
ruleviewer, where they were associated with the implemented
rules.

Fig. 3 Process diagram in Simulink


Fig. 2 Real Prototype of reservoirs for the pH control.
C. Sensor
A. Plant The pH meter is a millivoltmeter with a scale that
A Fuzzy Logic Controller with ruleviewer was used for translates the value of electrode potential in pH units. This
the construction of the block that represents the behavior of kind of electrode is known as a glass electrode, which is
the plant. The graph of Figure 3 represents an attempt actually a type electrode "ion selective". Each pH sensor is
approach performed to obtain the control. an ion sensitive electrode and the measurement is made by
"swapping" of ions in the glass membrane, thereby altering
the electrical potential of the membrane. The tension, then,
represents the potential difference between the measuring
electrode and the reference.

Fig.3 Dynamic behavior of the pH plant

From the graph obtained, and with some mathematical Fig. 5 pH Sensor
manipulations, it is possible to reach the function that In current systems, the electrodes are combined (figure 5),
represents the dynamics of the plant (equation 5). in other words, the measuring and the reference electrodes are
mounted together on the same glass body and thus can
1
G p (s)  (5) decrease the size of the set and, consequently, facilitate its
912.53s  1 assembly in the process where the measurement will be
performed. The sensor is represented in the system by a first
It’s possible to notice that the dynamics of the plant is order transfer function. This function was obtained through
relatively slow, but this is due to climatic influences such as experimental tests and has a time constant of 22.78s and
temperature, relative humidity, which can influence the unitary gain, where its output is given in pH (0 to 14).
density of water, consequently altering the pH constantly.
1
G s (s)  (3)
B. PH Control Process 22.78s  1
For the completion of the proposed process simulation,
the variables which would have a greater and direct influence D. Actuator
in the pH control were modeled, and with that, were obtained In the actuator block, which is the set of two small water
the transfer function in continuous time from the sensor (a pumps and liquid used to raise or lower the pH, was modeled
digital filter was used to reduce noise for the microcontroller). a transfer function to represent its dynamics, as shown by
Through MATLAB® Simulink environment, the plant and equation 4, as well as the function that represents the sensor,
controller were simulated (Figure 3). The controller operates both were obtained experimentally.
in a regulated manner so that any disturbance to the system is 8.8  10 6
eliminated. The disturbance ranges from 0 to 14 and are Ga ( s )  (4)
s
The function (4) was modeled with the ratio between the The Second controller to be implemented was a fuzzy PD,
volume and the PWM (pair of input and output of this with the goal of making a comparison between the results
actuator block), which explains the system’s integrative obtained in the fuzzy P, figures 9, 10 and 11 show the
action, thus justifying the use of a fuzzy PD controller with membership functions developed.
the scheme zero error.
V. SIMULATION RESULTS
From the Simulink, controllers were simulated. The first
one was the fuzzy P, implemented with only three rules:
1. If (Error is En) then (pH- Controlled is Acid) (1);
2. If (Error is Ez) then (pH- Controlled is Neutral) (1);
3. If (Error is Ep) then (pH- Controlled is Basic) (1).
It is possible to observe membership functions in
MATLAB® through the figures 6 and 7.
Fig. 9 Error Input of the Fuzzy PD

Fig. 6 Inputs of fuzzy controller


Fig. 10 Variation of Error Input of the Fuzzy PD

Fig. 7 Outputs of fuzzy controller Fig. 11 Outputs of the Fuzzy PD

The rules for the operation of the controller:


A satisfactory result can be shown in figure 8, using as the
set point a pH equivalent to 7 (neutral). In this case, a 1. If (Error is En) then (pH-Controlled is MtAcid) (1);
negative disturbance was applied, and the rejection of the 2. If (Error is Ez) and (difError is DENP) then (pH
disturbance occurs in a short time, considering that the fuzzy Controlled is Acid) (1);
P controller relies only on the error as input. 3. If (Error is Ez) and (difError is DEZ) then (pH-
Controlled is Neutral) (1);
4. If (Error is Ez) and (difError is DEPP) then (pH-
Controlled is Basic) (1);
5. If (Error is Ep) then (pH-Controlled is Mtbasic) (1)
6. If (Error is Enp) and (difError is DENP) then
pHControlled is Acid) (1);
7. If (Error is Enp) and (difError is DEZ) then (pH-
Controlled is Acid) (1);
8. If (Error is Enp) and (difError is DEPP) then (pH-
Controlled is Neutral) (1);
9. If (Error is Epp) and (difError is DENP) then (pH-
Fig. 8 Negative disturbance in the fuzzy P obtained in a Simulink Controlled is Basic) (1);
environment
10. If (Error is Epp) and (difError is DEZ) then (pH-
Controlled is Basic) (1);
11. If (Error is Epp) and (difError is DEPP) then (pH-
Controlled is Neutral) (1).

Once implemented the rules, the simulated result for the


fuzzy PD were obtained, note in Figure 12 that its behavior is
better than the fuzzy P, because it also considers the variation
of the error, a negative disturbance is applied at the same time
in which it was applied to the previous controller, but a new
result is found with a lower error.

Fig. 14 Negative disturbance applied to the pH plant with fuzzy PD

The results show that both controllers managed to behave


well when exposed to negative disturbance, but the fuzzy PD
showed more softness to return to the set point and there was
no overshoot in the process of doing so.
The fuzzy P controller, despite responding with greater
speed, lost a litter in accuracy and showed a small overshoot,
which causes the use of greater quantities of reagents for
decreasing or increasing the pH level.
Fig. 12 Negative disturbance in the fuzzy PD obtained in a Simulink After implementation of both controllers to show the
environment behavior for negative disturbance, in other words, response
when the pH is acidic, the next set of tests occurs with a
positive disturbance and the new results obtained are shown
VI. EXPERIMENTAL RESULTS
in the figures 15 and 16.
From now, all results observed in the article were
obtained by comparing the results of a fuzzy P and fuzzy PD
controllers embedded in the experimental plant showed in the
figure 2.
The simulations were implemented in the real plant
considering the same parameters. In Figure 13, the fuzzy P is
rejecting a negative disturbance, while in Figure 14, the fuzzy
PD is rejecting the same disturbance.
Usually, there is a difference between results from the
simulation and practice, because the results obtained are
directly related to the concentration of the substances used in
the reduction and increase of the pH, it can also vary with Fig. 15 Positive disturbance applied to the pH plant with fuzzy P
temperature and disturbances. However, as it can be seen, the
result is not affected, because the fuzzy logic control is
capable to treat such nonlinearities, which makes it a good
disturbance rejection system.

Fig. 16 Positive disturbance applied to the pH plant with fuzzy PD

With similar behavior as with the negative disturbance,


the fuzzy PD controller, showed a slower response but more
Fig. 13 Negative disturbance applied to the pH plant with fuzzy P satisfying. In Figure 15, it shows a small undershoot, where
the blunt response of the fuzzy P controller, causes a large
amount of reagent released into the system in order to control
it. The results allow a conclusion that the fuzzy PD obtained a
better response for not presenting an overshooting and for The output provided by the fuzzy PD controller, have
that reason, using less amount of reagent to achieve the shown their effectiveness when applied to the neutralization
control. process, with smoother results than when simulated in the
Simulink environment.
The control system projected showed a satisfactory
VII. ANALYSIS OF PERFORMANCE INDICATORS
performance, inside the main objective, which is the
From the analysis of the performance indicators of the application in the control of the graywaters and rainwaters
proposed controllers, it was observed the response of the that have a slightly basic pH.
controlled plant. The Neutral pH level (7) was used as an Through the calculation of performance indicators, it was
input signal of the reference system. The visualization of the still possible to make a numerical comparison between the
plant behavior with respect to the error becomes even clearer system error of both fuzzy P and fuzzy PD controllers. When
because the analysis of the parameters relating to errors. subjected to positive and negative disturbances, the values
Figure 17 shows the zero approximation error of the two observed, lead to the conclusion that the fuzzy PD controller
controllers. fits better for the proposed problem, because despite being
twice as slow, showed great economy of material and proved
to work well even if the there is contamination of the
reagents.
As future projects, one can analyze the application of
adaptive or even predictive controllers to the system,
comparing their performances with those already obtained in
this project.
ACKNOWLEDGMENT
We thank the reviewers and their contributions to the
adjustment and review of this project. Also, a special thanks
to the teaching, research institutions and programs that helped
us make this project possible. They are the UFRN (Federal
University of Rio Grande do Norte), UnP (Potiguar
University), IFPB (Federal Institute of Technology and
Education of Paraíba), Human Resources Program (HRP),
NUPEG PRH-14 ANP and ANP.
REFERENCES
Fig. 17 Analysis of errors for P and PD fuzzys
[1] Bazzarela, B. B. Caracterização e aproveitamento de água cinza para
uso não potável em edificações. 2005. 150 p. Dissertation (Masters in
The fuzzy PD showed similar behavior, even with the Environmental Engineering) – UFES, Vitória, 2005.
variation in dilution of the substance which raises or lowers [2] Campos, M. M.; Saito, K. Sistemas Inteligentes em Controle e
Automação de Processos. 1. ed. Rio de Janeiro: Ciência Moderna.
the pH. Causing greater saving of solution in the application, 235p, 2004.
showing that the fuzzy PD is best suited to situations where [3] Campos, R.C.C. Projeto e Construção de Planta Piloto de Neutralização
there is no need of great precision in the dilution of the de pH e Proposta de Metodologia para incorporação de Informações
reagents or there is contamination of the reagents. Auxiliares na Identificação NARX Racional. Dissertação. Engineering
Program of the University Center of the East of Minas Gerais –
Table 1 shows the calculations for four performance Unileste MG, 2007.
indicators, IAE, ISE, ITAE and ITSE. [4] E. H.Mamdani and S. Assilian. An experiment in linguistic synthesis
with a fuzzy logic controller. International Journal of Man-Machine
Studies, 7:1–13, 1975.
TABLE I: RESULTS OF PERFORMANCE INDICATORS [5] Fontes, A. B. ; Maitelli, A. L. ; Campos, M. M. M. ; Santo, M. Técnicas
Indicators IAE ISE ITAE ITSE de Controle aplicadas em um Processo de Controle de pH. In:
Congresso Brasileiro de Automática 2008, 2008, Juiz de Fora.
Fuzzy P 0.5400 0.2916 0.3024 0.1633 Proceedings of the Congresso Brasileiro de Automática 2008.
Fuzzy PD 0.0190 0.0361 0.0380 0.00722 [6] Zadeh, L. A. Fuzzy Sets, Information and Control, 8:338–353.
[7] R. A. Wright and C. Kravaris “Nonlinear control of pH processes using
the strong acid equivalent”, Ind. Eng. Chem. Res., vol. 30, 1991, pp.
VIII. CONCLUSION 1561 – 1572, 1965.
[8] C. Karr and E. Genv. Fuzzy control of pH using genetic algorithms.
Throughout the article were detailed implementations of IEEE fm. on Furry Sysrem, 1:46-53.1993.
a fuzzy P and a fuzzy PD controller in a pH neutralization [9] F. Tadeo, A. Holohan, and P. Vega. L1 optimal regulation of a pH
control plant. Computers Chem. Eng., 2245M. 1998.
plant. It is possible to observe from the responses that both [10] Zárete L., Resende P., Menezes B., A Fuzzy Logic and Variable
controllers had good disturbance rejection applied to the Structure Based Controller for pH Control, IECON, 2001.
system, but the fuzzy P, showed faster responses, which meant [11] Zárete L., Resende P.Control Of A Ph Process Using Variable
Structure Regulator And Smith Predictor, IECON, 1991.
that it generates overshoot and undershoots in their responses. [12] D.P. Kwok and P. Wang, Enhanced Fuzzy Control of pH
Neutralization Processes, IECON, 1993.

Anda mungkin juga menyukai