Automatic Determination of Liquid's Interface in Crude Oil Tank using Capacitive Sensing Techniques

The petroleum sector has a significant influence on the development of multiphase detection sensor techniques; to separate the crude oil from water, the crude oil tank is used. In this paper, a measuring system using a simple and low cost two parallel plate capacitance sensor is designed and implemented based on a Micro controlled embedded system plus PC to automatically identify the (gas/oil) and (oil/water) dynamic multi-interface in the crude oil tank. The Permittivity differences of two-phase liquids are used to determine the interface of them by measuring the relative changes of the sensor’s capacitance when passes through the liquid’s interface. The experiment results to determine the liquid’s interface is satisfying and close to the theoretical analysis model.


INTRODUCTION
Capacitance sensor, which is used in the measurement system, is a sensor which converts nonelectrical quantity into capacitance value. Capacitance sensor has four benefits that are: high resolution, fast dynamic response, small energy consumption, and modest mechanism. So such sensor is very useful in accurate measurement (zhao et al., 2006). In oil field, exploited crude oil and water mixture is fed to the tank. After processing, the resulting fluid is separated to oil and water. The intermediate surface of gas/oil and oil/water should be determined so that we can separate precisely the resulting two fluids. The forming process of the interface is changing with time, the gas/oil and oil/water intermediate surfaces are always changes, therefore, the depth must be done immediately; the space above the first liquid level is full of the natural gas that can easily burst. It is very important to ensure safety and prevent blasting (C. Li & Yanmin, 2007;X. Li & Xu, 2007). However, when the tank holds oil and water, many approaches have been suggested to detect the water level in the tank and to measure the heights of the water and oil in the tank. These methods are based on auditory range (Bardyshev, 2002), microwave echo (Khalid, Grozescu, Tiong, Sim, & Mohd, 2003), reflectometry (Bruvik, Hjertaker, Folgerø, & Meyer, 2012) This research is divided into six sections. The first gave an introduction to the capacitive sensor technique. The second will discuss the principle of the measurement system operation. The theoretical considerations are discussed in the third section, while the fourth section will produce the necessary mathematical model of the measurement system. The fifth section will list the experiments and results of the system. Finally, the conclusion is introduced in the sixth section.

Many researchers used the microcontroller circuits to control their devices and plants (Ghani et al 2019; Hashim et al 2018).
This research used the microcontroller as the control circuit for the plant. The proposed measurement system consists of three main elements: the capacitive sensing element, the Measurement and Control Unit (MCU), and the motion control unit as shown in Fig.1

Figure 1. Measurement system.
The MCU is the main element in the measurement system which has the circuit diagram of Fig. 2 and it works as follows: A Hartley oscillator is employed as part of that main sensing element where U2 is the active element and the frequency selective feedback network consisting of two inductors (L1 and L2) and the sensing capacitor C. The capacitor C is the level sensing element as the nominal value of the capacitance is determined by the relative permittivity of the medium within the sensing capacitance plates, which in turns determines the oscillator frequency. The output of the oscillator is fed to the high-speed comparator which consists of the LT119 comparator. The comparator is used to change the sine wave into a square wave, which is acceptable as an input to the ATmega 328p chip. The output of this comparator is fed to the Prescaler, which consists of the CMOS device 4017 that is used to lower the output frequency coming from the level sensing circuit to suit the ATmega 328p microcontroller. The ATmega 328p microcontroller was used since it is cheap and easy to use. This device is used to control the operation of the measuring system by performing the following functions: the first is controlling the motion of the drive motor via the L198 H bridge in clockwise and counter-clockwise direction. This motor is attached to a gearbox that drives a pulley assembly that lowers and lifts the capacitive measuring element. The second task is measuring the current location of the level sensing capacitor during its descent, the rope drive pulley is coupled to an increment shaft encoder which is used along with a reflective opt coupler. The opt coupler detects the upper limit of the level measuring system while the shaft encoder is used to measure the instantaneous depth of the level sensing capacitor. The third task of the microcontroller unit is to calculate the capacitance value from the frequency computed inside the 16-bit timer/counter 1 module, while at the same time it measures the depth of the sensing element obtained from the accumulated readings of the increment shaft encoder. The fourth task is communicating with the master computational device; a PC or a notebook computer. The calculated values of the sensing capacitor along with its location are sent to the PC via USB adapter operating as a COM port. This operation is repeated every 5mm decent of the sensing capacitor along its way to the bottom of the reservoir requiring liquid level measurement. The flowchart shown in Fig. 3 shows the function of the measuring program of the microcontroller-based circuit described earlier.

THEORETICAL CONSIDERATION
Different phase apparatuses of the two-phase liquids have different dielectric coefficients and hence permittivity (  ). The change in the  value of the two-phase permittivity will result in the variation of capacitance measured. The permittivity difference of the water and oil is one of the clear characteristics, the relative dielectric constant of water is about 80 whereas the relative dielectric constant of oil is approximately 2.3 (C. Li & Yanmin, 2007). A capacitance sensors made of two parallel plate structure is used since the manufacturing process of this sensor is easy and the capacitance electric field is unvarying as shown in Fig. 4. The parameters 1  and 2  is the relative permittivity of water and oil respectively, which will get in touch with each other. A two-electrode capacitance configuration, in which the electrodes are adjacent to each other, parameters W and L represent the width and length of the sensor electrode, while the two plates are separated by a distance d, which is much smaller than any of the two other dimensions) so that the border effects are neglected.

MATHEMATICAL MODEL
The effective capacitance of the sensor is expressed as: Where A is the effective area of each electrode (A = L * W), 0  is the dielectric constant of vacuum ( 0  =8.85 * 10-12 F/m), r  is the relative permittivity of insulating material, and d is the distance between the two plates. If the space between the plates is completely filled with liquid 1 (water) of 1  , the measured capacitance would be: Similarly, for liquid 2 (oil) of 2  : (3) When the space of sensor plates is filled with two types of liquids, so the value of the sensor's capacitance would be equivalent to the relative value of two parallel-connected capacitance (Chiang & Huang, 2006). ) , ( Each liquid's dielectric contributes with part of the total sensor capacitance, which depends on the sensor's plate position across the interface (i.e. depended on the value of X).
Where: C can be written as: (2) and (3) show that the capacitance is fixed and independent with the sensor،s height in (oil-water) tank while Eq. (7) shows a linear association between the capacitance and the sensor،s height (X).

EXPERIMENTS AND RESULTS
The liquids used in the experiment for interface identify with water were oil and kerosene mixture. The kerosene employed was available as fuel for heating application. Similar results are expected from other fuels obtained from oil since their dielectric constants are approximately the same. From a theoretical point of view it is expected that when a phase of liquid 1 fills the sensor،s gap, the capacitance value stays constant until the upper sensor's plate penetrates the liquid's interface leading to decreasing the capacitance value linearly as soon as the sensor exceeds the liquid's interface and the sensor gap filled with liquid 2 again the measured capacitance is constant as predicted in Eq. (7) and investigated experimentally as shown in Fig. 4 and Fig. 5 When the sensor moves upward in the (oil-water) tank, the PC reads the capacitance values as a function of sensor height which is proportional with the motor speed controlled by the computer program. The PC reads the data from the sensor instantaneously and determines the slope of the capacitance measured curve, then identify the interface height precisely. In order to improve the interface level identification, increasing the slope of the measured capacitance curve can significantly improve sensor sensitivity. This is done by decreasing the sensor length (L) as shown in Fig. 5 and comparing it with Fig. 6. The sensor length can improve the measurement sensitivity it is seen in Fig. 5 and 6, which shows clearly that as we decrease the sensor length, the sensitivity increases. To overcome the sensitivity issue in long sensors, we can decrease the measurement time which in turn increase the sensitivity of the system.

CONCLUSION
Direct capacitance variable measuring using PC without converting it to another type of variable leads to improve the liquid level measuring and identifying technique used. The high sensitivity and simplicity make the suggested measurement system developed here, more practical and efficient than other measuring systems adopted before. The sensor detects the fuel-air and water-fuel intermediate surface and it also measures the height of every fluid enclosed in the tank instantaneously. A major benefit is that this sensor can measure the height of the fuel regardless of its kind, whereas other sensors have to be specifically designed for a given fuel.