WATER AND OIL AUTOMATIC SEPARATION SYSTEM USING FUZZY CONTROL

This paper presents the design of a water and oil separation system as a contribution to reduce the problem of contamination of water in domestic and industrial sewage. The project consists of improvements in level detection in an automatic separation tower and in the use of the Fuzzy control. The main objective is to design a controller based on the values of the levels and increase the reliability in the process of separation of the fluids. The validation of the controller is obtained through simulation in MATLAB engineering software and the improvements applied are corroborated according to the results observed in the separation process. Satisfactory results show increased reliability in the fluid separation process, leaving the minimum fluid within the reservoir.


I. INTRODUTION
Mechatronics is currently being applied in various sectors of society, in homes, in commerce, and is mainly in the industrial sector [1]. For technology to meet the needs of your applications more accurately, a more robust control design is required. Artificial intelligence techniques are widely used in process control, including the fuzzy controller, to assist the system with more accurate results, in addition to stability and robustness [2].
Initially presented by Lotfi Zadeh [3], fuzzy logic verifies information that is difficult to interpret at the system entrance and allows a closer and more adequate output to the desired one. Among the various applications of fuzzy control, drinking water treatment plants (DWTPs) [4], thermal comfort [5] and the diagnosis of prostate cancer [6], among others, can be cited. The separation system presented in this work is a prototype, and as a final product can be applied in various environments, such as airports, vehicle wash and maintenance facilities, railways, parking lots and areas of heavy circulation of vehicles, military installations and in oil deposits and the like.
This work aims to propose improvements in the water and oil separation tower based on the idea of the bromine funnel [7], which are the sensing of all fluids in the tank, since the oil valve is always activated after a certain time without the need for such a flow, or even if the time is not sufficient for a complete flow. It is also proposed to apply the fuzzy rules-based controller that uses level values as input parameters for valve treatment. Once the proposed improvements have been made, the fluid level monitoring algorithm performs fuzzy calculations and treats valves, and should terminate the process with minimal fluid in the tank.
This paper introduces a literature review in the second section. Next, a model is proposed in the third section. In the fourth and fifth sections are presented the operation of the system and the implemented fuzzy system, respectively. Finally, the results and conclusions are presented respectively in the sixth and seventh sections.

II.1 FLUID SEPARATION
Separating water from oil is a very important task as it allows the oil to be given a correct destination. If one liter of oil is incorrectly discharged into soil or sewage, up to 20,000 liters of water can be contaminated. One of the biggest problems caused by the discharge of oil into rivers is the formation of a film that forms on the surface of rivers, preventing the transfer of oxygen to water [8].
The water-oil separation system proposed in this article utilizes the oil's property of not dissolving in water. Property that is due to the fact that water is polar and oil is nonpolar and the bond between water molecules is very strong (hydrogen bond) not allowing oil molecules to separate and interact with water molecules [9]. Then the oil being together with the water in a container forms a heterogeneous mixture, where there are two phases and the water having higher density is in the lower part of the container.
It is observed that being more judicious there is a small solubility of oil in water. So the water coming out of this separator is not completely oil free, and an analysis is needed to know what concentration of oil will still be in the water, this value should be in accordance with the norm. According to [10] this allowable value can range from 40mg L-1 to 100mg L-1 according to local law. If this amount of oil is above the recommended by the norm, a further treatment should be performed to return the water to the environment.
In [7] the project of a system that contributes to the solution of the growth of the pollution of the water is approached. Where an automatic separation system of water and oil mixed in the same reservoir was developed. It was built based on the idea of the bromine funnel also known as the settling flask that observes the concepts of fluid density.

II.2 INTRODUCTION TO FUZZY LOGIC
In [3] a new set theory was proposed in which there are no discontinuities, ie there is no definition of elements belonging and not belonging to a set, but there is a degree of pertinence that indicates how much the element is part of the set. Unlike digital logic combinations, their values can be between 0 and 1, instead of just contemplating the extremes [10]. Fuzzy logic is part of the concept of intelligent systems, which makes systems more autonomous for solving various problems. A fuzzy based system must have the following basic items: Fuzzy logic is applied in projects such as thermal comfort that has sensors to measure temperature, humidity, solar radiation and others, the sensing values cannot be fixed, because the sensitivity differs for each individual [5]. In the medical field, a fuzzy-based system for laboratory data analysis can help a medical expert determine appropriate treatment for a patient who has been diagnosed with a certain degree of cancer risk [6].

III. METHODOLOGY
The sketch presented in Figure 1 illustrates the proposed system for study in this work. As shown in Figure 1, the tank shall consist of two sensors for level measurement in centimeters, two solenoid flow valves, a micro controller for system automation and a cable for serial communication with the computer and sending information to the tool. MATLAB.
The level sensor is formed by a float attached to one end of a rod that has a potentiometer on the other end. Observing the density of each element, the buoys are filled with oil and air so that they are positioned in the region between the two fluids and on the oil, respectively. They are responsible for rotating the axis of each potentiometer as the levels vary.
The float that is positioned between the two fluids measures the water Height and the float that is on the oil measures the oil Height. The waterLevel and oilLevel are obtained as follows: In this project, the maximum level is indicated by the height of 50 cm. The tank shall have sides greater than 50 cm wide to facilitate the movement of the buoys in measuring this level.

IV. SYSTEM OPERATION
When starting the system, a time is expected before the separation process, ensuring that the poured heterogeneous mixture stabilizes, leaving the oil above water inside the tank. This time is also required for the sensors to position themselves properly.
The dynamic aspects of the system are represented in the activity diagram of the Unified Modeling Language -UML visual modeling. The interaction of elements of interest and the messages that are exchanged between them is described. Figure 3. The sensors provide the measurement values for the system, the Fuzzy controller analyzes the signals to decide the next task, and the solenoid valves are handled discretely by the system for fluid flow. The activity diagram facilitates the understanding of the system functioning, presenting the interactions between the elements that must be focused during the algorithm development, which will be embedded in the selected microcontroller.

V. FUZZY SYSTEMS
In this project, the input parameters used are the values of waterVariation and oilVariation, and used as output the parameter called valves. Variations are differences between fluid levels with respect to heights of 5 and 6 cm, midpoint of safety margin between valves and minimum oil valve height, respectively. They are calculated as follows: For fuzzification of these variables is used pertinênica functions negative (negative) zero (zero), positive (positive), all closed (CloseAll), open oil (openOil) and open water (Openwater). After assembling the FIS framework in MATLAB's Fuzzy Logical Toolbox [13], system settings and rules can be evaluated using basic commands through Command Window, as well as fuzzy inference calculations can be performed. Below is the readfis command for assigning the system structure to the fis variable.  The designed controller works under the following conditions: In order of priority, because it is in the lower position in the tank, the water must first be treated. For positive water variation values, only the water valve should be opened. For negative or zero values, it must remain closed. Then the oil will be treated. For positive oil change values, only the oil valve should be opened. For negative or zero values, all valves must be closed.
With the data obtained through sensing, 9 fuzzy rules were determined for the fluid separation process. The rules are displayed below.
>> plotmf(fis,'input',1)   Another way to analyze results is through the ruleview command, where inputs can be simulated while rules are displayed. This last form was chosen for analysis and simulation of the inputs. Its syntax is described below: This way you can illustrate the fuzzy controller outputs that will be presented in the following session.    The simulation in MATLAB engineering software shows that fuzzy controller designed based on the values of all levels results in increased reliability in the fluid separation process, leaving minimal fluid inside the reservoir.

VII CONCLUSION
The improved system proposed in this work was developed with the main objective of contributing to improvements in the separation tower for water treatment in domestic and industrial environments. This paper describes the design using theoretical concepts of fuzzy logic, which is used to make system control smarter. The use of Fuzzy logic can contribute greatly to engineering projects, when control systems are complex to model. Besides having low cost and easy handling, the system proved to be more efficient in fluid separation due to the application of more level sensors, which returns greater reliability in the fluid separation process. Oil level sensing that replaces proper valve actuation time also generates energy savings compared to the previous system when it was also unnecessarily actuated. As future work, it is suggested that the prototype be assembled using a fuzzy library in the Arduino algorithm, eliminating the cable for serial communication with the computer.