ABSTRACT

In the oil and gas industry, one of the most important stages in processing petroleum is separation� It can be classified by operating configurations such as vertical, horizontal, and spherical or by its function, which is two phase or three phase� In this chapter, the vertical three-phase separator was chosen and researched� A three-phase separator is used to separate water, oil, and gas� Gas forms at the top, oil forms at the middle layer, and water forms at the bottom due to gravitational force and the density of the substance� The objective was to tune the proportional-integral-derivative (PID) controller controlling the level of the water in the separator� Outflow rate of the water from the bottom of the separator will be used to control the water level� Currently, there are controlling methods, namely Proportional Integral (PI) control using trial-and-error method, PI control using Butterworth filter design method, and internal model control (IMC) method� These methods were having quite high percent overshoot and long settling time� Therefore, this chapter discusses the use of bacterial foraging optimization algorithm (BFOA) in optimizing the parameters for PI control of a three-phase separator�

A three-phase separator is used to separate water, oil, and gas where the gas forms at the top, oil forms at the middle layer, and water forms at the bottom due to gravitational force and the density of the substance�

PID control is the most commonly used control algorithm in a three-phase separator� There are a few methods in selecting the proper parameters which are manual method, Ziegler-Nichols method, and Cohen-Coon tuning method� In the manual method, experienced personnel have to select the optimum parameters by trial and error as well as by observing the output response of the system� Ziegler-Nichols tuning method requires trial and error to obtain the ultimate gain and period� Then, some minor calculation will be done in selecting the parameters� Cohen-Coon tuning method only applies to first-order processes with dead time and a series of calculations need to be done in selecting the parameters� In terms of three-phase separator, the conventional methods used are IMC method, PI controller using Butterworth filter design method, and PI controller using trial-and-error method� All these methods require time as well as cost and the performance of the PID controller might not be satisfactory�

Currently, there are intelligent algorithms that can select and optimize the parameters of the plant, for example: genetic algorithm (GA), particle swarm optimization (PSO), ant colony optimization (ACO), and BFOA� These techniques find and optimize the parameters faster than the conventional tuning methods and are very cost-effective�

Over the past years, BFOA method has been applied in many industrial fields� In this context, PID controller design for a power plant (Bensenouci, 2011), a new power system stabilizer design (Daryabeigi, Moazzami, Khodabakhshian, & Mazidi, 2011), automated tuning of PID controllers of unmanned aerial vehicles (UAVs) (Oyekan & Hu, 2010), bacterial foraging oriented by PSO strategy for PID tuning (Korani, Dorrah, & Emara, 2009), high-dimensional function optimization (Chu, Mi, Liao, Ji, & Wu, 2008), optimization design of PID controller parameters based on improved Escherichia coli foraging optimization algorithm (Yijian & Yanjun, 2008), improved bacterial foraging strategy for controller optimization applied to robotic manipulator system (Coelho & Silveira, 2006), and optimum design of PID controllers using only a germ of intelligence (Niu, Zhu, He, & Zeng, 2006), are just a few of the applications�

In this chapter, the details of the mathematical model of three-phase separator, the working principle of BFOA, simulation of BFOA and three-phase separator, and performance comparison of BFOA with other existing techniques are presented� The scope of the study takes into consideration the percentage overshoot, settling time, and integral squared error (ISE) after implementing BFOA of the PID controller of different orders and applications�

A three-phase separator is created to separate and remove water from the mixture of water and crude oil� Figure 4�1 is a schematic diagram of a horizontal three-phase separator�

The fluid will hit the inlet diverter after entering the separator� There form an initial gross separation of the liquid and vapor due to the sudden change in momentum

of the fluid� This forces the inlet mixture of oil and water to mix with the water continuous phase in the bottom of the vessel and rise to the oil-water interface� This process is called “water-washing”; it promotes the coalescence of water droplets which are entrained in the oil continuous phase� Some of the gas flows over the inlet diverter and then horizontally through the gravity settling section above the liquid� As the gas flows through this section, small drops of liquid that were entrained in the gas and not separated by the inlet diverter are separated out by gravity and fall to the gas-liquid interface� Some of the drops are of such a small diameter that they are not easily separated in the gravity settling section� Before the gas leaves the vessel it passes through a coalescing section or mist extractor to coalesce and remove them before the gas leaves the vessel (Sayda & Taylor, 2007)�

When the hydrocarbon fluid stream enters a three-phase separator, two distinctive phenomena take place� The first phenomenon is fluid dynamic, which is characterized by the gravity separation of oil and water droplets entrained in the aqueous and the oil phases respectively, the gravity separation of gas bubbles entrained in the stream, and the gravity separation of liquid droplets which are dispersed in the gas phase� The second phenomenon is thermodynamic, in the sense that some light hydrocarbons and gas solution flash out the oil phase and reach a state of equilibrium due to the pressure drop in the separator� Furthermore, preceding gravity separation processes minimize the amounts of gas entrained in the main stream� Figure 4�2 shows the simplified separation process� Oil-well fluid with molar flow Fin and gas, oil, and water molar fractions Zg, Zo, and Zw, respectively, enters the separator�

The hydrocarbon component of the fluid separates into two parts; the first stream Fh1 separates by gravity and enters the oil phase, and the second stream Fh2 stays in the aqueous phase due to incomplete separation� The gas component in the separated hydrocarbon stream, which enters the oil phase, separates into two parts: the first gas stream Fg1 flashes out of the oil phase due to the pressure drop in the separator, and the second gas stream Fg2 stays dissolved in the oil phase� The oil discharge Foout from the separator contains the oil component of the separated hydrocarbon Fo and the dissolved gas component Fg2� The flashed gas Fgout flows out of the separator for further processing�

The water and oil levels and the gas pressure inside the separator are controlled by a number of separate control systems� Figure 4�3 shows the control loop involved in a three-phase separator�

It can be observed that a level indicator transmitter (tagged LIT-340018) is employed to measure the water level inside the separator if we focus on the waterlevel control loop� The measured level signal is sent to a level controller, tagged LC-340018� The level controller sends the control signal to a level control valve, tagged LCV-340018� In order to control the water level inside the separator, the LCV340018 regulates the water outflow� It can be noticed that a flow indicator transmitter, named FIT-340012, is used to measure the water outflow rate for some other purpose� This measurement is not used by the current level controller (Yang et al�, 2010)�

Considering the behavior of the bacteria in searching for nutrients, BFOA mimicked it by focusing on the four main sections which are chemotaxis, swarming, reproduction as well as elimination, and dispersal�

4.3.1.1 Chemotaxis Chemotaxis is the movement of the bacteria in search of food or nutrients by taking small steps� The bacteria tumble around randomly until they find higher concentration or gradient of nutrient� Then, the bacteria will run toward that direction until they reach the highest food concentration�

This process simulates the movement of an E. coli cell through swimming and tumbling via flagella� Biologically, an E. coli bacterium can move in two different ways� It can swim for a period in the same direction or it may tumble, and alternate between these two modes of operation for the entire lifetime�

Suppose θi( j + 1, k, l) represents i-th bacterium at j-th chemotactic, k-th reproductive, and l-th elimination-dispersal step� C(i) is the size of the step taken in the random direction specified by the tumble (run length unit)� Then in computational chemotaxis the movement of the bacterium may be represented by

( ) ( ) ( ) ( )( ) ( )θ + = θ + ∆

∆ ∆ j k l j k l C i i

i i 1, , , ,i i

T (4�1)

where Δ indicates a vector in the random direction whose elements lie in [–1, 1] (Das, Biswas, Dasgupta, & Abraham, 2009)�

4.3.1.2 Swarming Swarming is the behavior or the tendency of the bacteria to group together� Each bacterium will release signals to other bacteria to attract or to repel them�

An interesting group of behavior has been observed for several motile species of bacteria including E. coli and Salmonella typhimurium, where intricate and stable spatiotemporal patterns (swarms) are formed in semisolid nutrient medium� A group of E. coli cells arrange themselves in a traveling ring by moving up the nutrient gradient when placed amid a semisolid matrix with a single nutrient chemo-effecter� The cells when stimulated by a high level of succinate release an attractant aspartate, which helps them to aggregate into groups and thus move as concentric patterns of swarms with high bacterial density� The cell-to-cell signaling in E. coli swarm may be represented by the following function�

( )

( )

( )

( )( ) ( )θ = θ θ

= − − θ − θ  

 

  

  

+ − − θ − θ  

 

  

  

J P j k l J j k l

d w

h w

, , , , , ,

exp

exp

(4�2)

where Jcc(θ, P( j, k, l)) is the objective function value to be added to the actual objective function (to be minimized) to present a time-varying objective function, S is the

total number of bacteria, p is the number of variables to be optimized, which are

present in each bacterium, and θ = θ θ … θ , , , p1 2 T is a point in the p-dimensional search domain� dattractant, wattractant, hrepellant, and wrepellant are different coefficients that should be chosen properly (Das et al�, 2009; Korani et al�, 2009; Bensenouci, 2011)�

4.3.1.3 Reproduction Reproduction is the behavior of bacteria where the weaker half of the group of bacteria will die and the other stronger half will split and reproduce asexually� The number of bacteria of the group will remain constant�

For the given k and l, and for each i = 1, 2,…, S, let

∑ ( )=

J J i j k l, , ,i j

(4�3)

be the health of the bacterium i (a measure of how many nutrients it got over its lifetime and how successful it was at avoiding noxious substances)� Sort bacteria and chemotactic parameters C(i) in order of ascending cost Jhealth (higher cost means lower health)�

4.3.1.4 Elimination and Dispersal Elimination and dispersal are the probability of a bacterium being eliminated in a group and if elimination has happened, another bacterium will be dispersed to a random location in the optimization domain�

4.3.1.5 Combination of All Four Parts For each bacterium, the cost of its movements involved the swarming effect from the other bacteria and the chemotaxis effect� The equations had accounted for a whole set of chemotactic steps for each swarming effect done� The equation of the swarming effect is represented by

( )( ) ( ) ( ) ( )+ = + θJ i j k l J i j k l J j k l P j k l, 1, , , , , , , , , ,icc (4�4) Then, for each swarming effect, a set of chemotactic steps will be calculated� A chemotactic step is represented by

( ) ( ) ( ) ( )( ) ( )θ + = θ + ∆

∆ ∆ j k l j k l C i i

i i 1, , , ,i i

T (4�5)

and the cost or J(i, j, k, l) can be calculated from that equation� A series of J(i, j, k, l) will be calculated and at the same time the new value will be compared with the previous one� The lower value or cost will be the better one� Then, another bacterium will be selected, the swarming effect as well as the chemotactic steps will be recalculated, and the process will be repeated for every other bacteria� Besides, this bacterial movement will be repeated for Nc times in random direction to obtain the best results� After Nc times of looping, the J(i, j, k, l) for each bacterium will be summed

up to obtain Jhealth� Jhealth will be sorted, the weaker half will die, the other half will reproduce asexually, and the whole process will start over again� Elimination and dispersal process will eliminate a bacterium and disperse another one to its domain with a probability of Ped after Nre times of reproduction�

The bacteria undergo chemotaxis, swarming, reproduction as well as elimination, and dispersal in order to survive and maintain the population by considering the optimum concentration of food, tendency of swarming, and the health of the bacteria� Hence, the cost finding the food and maintaining in a group has to be low� In other words, bacteria use the smallest amount of effort to achieve best results� The formulas or methods mentioned previously are combined and show the behavior of the bacteria�

By implementing this survival technique in searching for the best parameters, ISE which is represented by Jhealth (higher cost means lower health) will be chosen� BFOA will implement convergence on the parameter values to the optimum level and produce the best result in a short time� So, the optimum parameter of Kp, Ki, and Kd will be chosen�

Figure 4�4 is the block diagram of a plant where the algorithm will take the input and find the optimum parameters which are Kp, Ki, and Kd� Then, PID controller will take the parameters to control the system�

Figure 4�5 shows the flowchart of the BFOA� It can be seen from Figure 4�5 that it represents all the four parts, that is, che-

motaxis, swarming, reproduction as well as elimination, and dispersal� Jlast with the smallest value will be produced and chosen since it represents the ISE and is also known as cost�

A three-phase separator can be modeled and represented by using a transfer function to show its characteristics� Figure 4�6 shows the block diagram of three-phase separator with disturbance, with Qin included�

BFOA is used and implemented as shown in Figure 4�6 on top of C(s)� The input, R(s), and output, H(s), are the desired level and actual level of the water in the separator�

= =

+ G s H sQ s s( )

( ) ( )

1 47.55 1.811 in

(4�6a)

= = −

+ G s H s

U s s ( ) ( )( )

10.82 47.55 1.812

(4�6b)

Equations 4�6a and b show the transfer function of the plant and the disturbance (Yang et al�, 2010)�

For each of the methods, the parameters that were used are shown in Table 4�1� And for IMC method (Yang et al�, 2010),

= −

+s

s Internal model control 47.55 1.81

45.958 (4�7)

By using MATLAB® Simulink®, the following system was constructed as shown in Figure 4�7�

The results obtained for each of the methods through the simulation are illustrated in Figures 4�8 through 4�15� Figures 4�8 through 4�11 show the initial set-point change followed by the disturbance due to the input well fluids of the three-phase separator�

Figures 4�12 through 4�15 show the responses which include the input disturbance and the set point changes as well�

Figures 4�8 through 4�11 show that the response of using BFOA tuning method produces the best results which are almost the same as the desired results� Trialand-error method and Butterworth filter design method produce results that have high overshoots and undershoots� IMC method produces slow responses which have long rise time� IMC method, trial-and-error method, and Butterworth filter

design method have large settling time or very slow responses compared to BFOA tuning method�

Figures 4�16 through 4�18 show the ISE, percentage overshoot, and settling time respectively for all methods�

The lower the values, the better the response is� For these three figures, BFOA shows the lowest values� This has proved that BFOA optimizes better parameters compared with these conventional methods� From all of the four methods used, BFOA shows the most significant improvements by having the least or almost 0% overshoot and the shortest settling time� This had shown that BFOA performs the best of all the methods tested�

Besides comparing the results of BFOA and the conventional methods, a Graphical User Interface (GUI) was developed to ease the user in optimizing the parameters using BFOA� The software developed can optimize parameters for PID or PI controllers with up to third-order system� Figure 4�19 is a screen shot of the GUI of the BFOA based software:

Transfer function can be input into the GUI in the first box and then generate the equation to initialize the required parameters� Then, optimization can be done� After that, values of Kp, Ki, and Kd will be displayed and a step response of the system can be plotted�

A mathematical model of the three-phase separator was derived and based on the model, trial-and-error method, Butterworth filter design method, IMC method, and BFOA tuning method were tested using MATLAB Simulink simulation� A set of parameters was used and the results were obtained� The results have shown that the BFOA method produces the best results and far better that the other three conventional methods� BFOA has more than 90% improvements compared to the conventional methods� BFOA can improve the performance of the system and thus increase productivity, decrease cost, and save time� A GUI is developed in order to ease the optimization process� This is a promising technique to be used in oil and gas industry other than three-phase separator� Further studies can be carried out on an actual plant and plants with higher order� Besides, BFOA can be used to compare with other intelligent techniques�