MRFT-based design of robust and adaptive controllers for gas loop of oil–gas separator

The modified relay feedback test (MRFT), which was recently proposed as a continuous oscillation method for identification of the process parameters and controller tuning, is used for the design of a robust and an adaptive ProportionalIntegral (PI) controller for a gas loop in the oil–gas separator. The gas normally found in the separator is the natural gas (mostly methane) which is contained in crude oil coming from the reservoir. The robust and adaptive PI controllers are developed from analysis of 64 operating modes corresponding to certain ranges of the gas inflow and liquid-level values. It is shown through the developed model and simulations that these operating modes have significant effect on the dynamics of the gas loop. Dynamic properties of the process in each mode are studied through MRFT. The controllers are designed in order to maintain the pressure during the change of the operating conditions. Performance of the designed control system is studied by simulations. Subjects: Control Engineering; Dynamical Control Systems; Process Control Chemical Engineering


PUBLIC INTEREST STATEMENT
In oil production, when the fluids from the oil reservoir reach the surface, they usually contain a mixture of gas, oil, and water. The first surface production step is to separate oil from gas and water that come from the wells, which is done by separators. Control of separators is important to the quality of oil and gas produced. A method of controller tuning for the gas pressure control in a separator is presented in the research. The approach proposed involves the modified relay feedback test. Two different approaches to controller design, robust and adaptive, are developed.
feedback test (RFT). It is worth noting that this test leads to the same ultimate gain and ultimate frequency as Z-N test if the model of the oscillations is based on the describing function (DF) method (Atherton, 1975).
In RFT, the excitation of the oscillations always occurs at the frequency ω n corresponding to −180° of the phase response of the process. However, it is known that the controller introduction in such system would change the frequency ω n , so that the frequencies of the test oscillations and the phase crossover frequency of the open-loop system are different. The modified relay feedback test (MRFT), that introduced a coordinated selection of test parameters and tuning rules, was proposed by Boiko (2012) to eliminate the noted drawback of RFT. The MRFT can be considered as a further logical development of the ideas used in the Ziegler-Nichols and Åström-Hägglund tests. The approach proposed in MRFT was also termed as the holistic approach to the test and tuning. The main advantage of this test is that it can provide the desired value of the gain or phase margin exactly in nonparametric tuning (under the assumption that the DF method provides an exact model). In the present research, we aim to design a tuning procedure for the PID controller of the pressure loop of the oil-gas separator, using MRFT.
In oil production, when the fluids from the oil reservoir reach the surface, they usually contain a mixture of gas, oil, and water. The first surface production step is to separate oil from gas and water that comes from the wells, which is done by separators. The separation process involves equilibrium considerations or phase changes of these components. The equilibrium separation is done by four basic mechanisms as listed below (Roussean, 1987): • Gravity separation which depends mainly on the density differences of the fluid components (water, crude oil, and associated gas) and occurs by reducing the velocity of a stream so that terminal velocity of particles due to gravity exceeds the velocity of bulk flow.
• Centrifugal force is similar to gravity separation, but it uses geometrical effects and dispersed phase concentrations for high-speed mechanical separation.
• Separation by impaction where the fluid will deflect around the body, while the particle having greater inertia will impact the body allowing the opportunity for separation.
• Electrically induced charge separation to attract the particles using fixed bodies such as plates with an opposite electrical charge.
We will further consider only gravity separators. There are two designs available: horizontal and the vertical separators, which are suitable to separate the fluids in oil and gas production facilities using the gravity separation techniques. The horizontal type is used when the amount of liquid is higher than the amount of gas, while the vertical type is used in the opposite case.
The horizontal-type liquid-gas separator is shown in Figure 1 and works as follows. First, the fluids flow into the separator and hit an inlet diverter, causing a sudden change in momentum. The initial separation of liquid and vapor occurs at the inlet diameter. The gravity force causes the liquid droplets which have a higher density to fall out of the gas stream (with a lower density) to the bottom of the vessel, where it is collected. Then, the liquid leaves the vessel through the level control valve (LCV). The gas passes through a mist extractor that removes very small droplets of liquid which are not easily separated by the gravity force (Roussean, 1987). The separation process is accomplished in one or more stages of decreasing pressure. There exist an optimum number of the stages required to separate the fluids. However, increasing the number of stages would normally increase the cost: due to necessity of additional separator, piping, controls, and space. According to Stewart and Arnold (2009), only one initial separation stage is necessary for the considered industrial case study, as the pressure of the gas in the plant is maintained at around 80 PSIG. Due to the relatively low pressure of fluid coming to the separator and the low water content (around 7%), the horizontaltype two-phase separator is used for initial separation within the considered platform production facilities.
In the considered case study, the separator is a horizontal-type two-phase separator. The gas is separated from the liquid with the gas and liquid being discharged. The gas is coming with crude oil from the wells. The separated gas is supplied to another plant for further treatment and use as a fuel gas for the gas turbine and high-pressure pumps. The separated oil is pumped to the storage and sales facilities. Therefore, two different loops are used to control the liquid and the gas in the vessel.
The model of the gas loop is considered as the process in this system which is to be controlled by the Proportional-Integral (PI) controller. The aim of the PI controller is to maintain the pressure equal to the set point despite various disturbances coming from the inflow stream and the gas pressure manifold. Maintaining the pressure equal to the set point is important not only to protect the vessel from the over-pressurization. When the separator pressure grows above the set-point of 80 PSIG, depressurization has to be done by sending the gas to flaring, which leads to a negative environmental impact. Thus, a pressure controller with a good performance is necessary for this application.
Conventional control used in the separator gas pressure loop is a PI control (Liptak, 2005), which also agrees with authors' industrial experience. To the best of the authors' knowledge, there are no publications suggesting other controls. This probably happens due to the fact that the basic model of the process (without actuator-valve model), which can be found in Sayda and Taylor (2007), can be written as a linear first-order differential equation. If a control is designed for this model only, then any proportional control with sufficiently high gain would reveal excellent performance. This design and model would not, however, match the reality: the actuator-valve dynamics has a significant effect on overall pressure loop dynamics, and cannot be neglected. A new model that involves all main contributors to the gas loop dynamics, such as gas-phase dynamics, valve dynamics, and gas flow between the separator and the gas manifold, is developed in the present paper. This paper is organized as follows. First, the process model of the separator gas pressure is developed on the basis of the conservation laws. The models of the actuator and valve are presented too. Then MRFT is described. After that, a Simulink model of the industrial separator considered in the case study is introduced; MRFT is performed on this model; and with PI, optimal tuning rules optimized through ITAE criterion for the pressure loop are obtained. The robust and adaptive controllers are designed involving 64 operating modes. Finally, the simulation results showing performance of the system are presented and analyzed.

Process model
As shown in Figure 1, the typical industrial liquid-gas separator has two outlets to be controlled. The gas loop controls the gas outlet, where the pressure controller with indicating function (PIC) compares the set point with the process variable (gas pressure) which is measured by the pressure transmitter. The PIC sends the control signal (command) to the pressure control valve to operate accordingly. The level loop controls the liquid level in the separator where the level controller with indicating function senses the change in the liquid level and controls the LCV accordingly. In order to design the model that represents the gas pressure loop for the separator, the following equations of gas pressure process given by Figure 1 are considered. The ideal gas law is used to represent gas pressure in the vessel: where p s is the gas pressure inside the separator which is the process variable to be controlled, V g is the volume of the gas in the separator, R is the universal gas constant, T 1 is the temperature of fluid inside the separator μ is the molecular weight, m g is the mass of the gas.
The difference between the total volume of the vessel and the volume of crude oil is equal to the volume of the natural gas inside the vessel, which is given by the following equation: where V max is the total volume of the vessel, L is the length of the vessel, and A o is the part of the vertical cross-sectional area of the vessel filled with crude oil.
There are two cases for the cross-sectional area of crude oil which depends on the ratio between the level of the crude oil and the separator radius R s : Case 1: the level of the crude oil is less than or equal to the radius of the separator h ≤ R s (Figure 2).
The cross-sectional area of crude oil is computed as the difference between the circle area, the area of the triangle A 1 , and the area of the sector A 2 : where: (1)  Then, Case 2: the level of the crude oil is higher than the radius of the separator: h > R s (Figure 3).
The cross-sectional area of crude oil for Case 2 is computed as the sum of the triangle area A 3 and of the sector area A 4 : where: As shown in Figure 1, the separator has inlet and outlet lines (pipes). The control valve, installed in the outlet line, controls the gas outflow. The inlet flow is uncontrolled and acts as a disturbance applied to the system. The pressure process has also relation with rate of change for the mass of gas as given by the following mass balance equation: where w gin and w gout are the mass gas flow rates for the inlet and the outlet of the separator.
The outlet mass gas flow rate from the separator through the control valve is given by the St. Venant and Wantzel's equation (Beater, 2007): where C d is the discharge coefficient.  is the critical pressure ratio, A v is the function characterizing valve orifice pass area which related to the valve travel ( ), A v ( ) ∝ for the linear control valve (such as the globe valve), P cin is the discharge or manifold pressure of the control valve, R spec is the specific gas constant of the methane, and is the isometric constant of methane.
The PI controller has the following equation: where K c is the proportional gain, T i is the integral time constant, r p is the set point pressure of the PI controller.
Finally, the relation between the valve travel and the controller commands is represented by the first-order plus dead time model (Boiko, 2013;Sayedain & Boiko, 2011): where v is the dead time, T v is the time constant, and k v is the valve gain.

MRFT and holistic test and tuning
The MRFT is used in this research as a method of controller tuning for the pressure loop. The test signal that it generates (through the feedback principle) is similar to the one of a relay controller, which is discontinuous. The control output u(t) of the MRFT is given as follows by Boiko (2012): where h is the amplitude of the relay, b 1 = ße max , b 2 = −ße min , e min < 0, e max > 0 are the last "singular" point of the error sinusoid signal corresponding to the last maximum and minimum values of e(t) after crossing the zero level, ß is a parameter of MRFT and of the tuning rules, and u(t−) = lim →0, <0 u(t − ) is the control value at the time immediately preceding the current time t (Boiko, 2013).
The system under MRFT can be represented by the block diagram (Figure 4), in which, however, relay hysteresis value b is not constant but variable-as defined above. Process model under the test is shown in Figure 4 in either the state space form or as the transfer function W p (s).

Describing function of MRFT
The DF method is applied in Boiko (2012) to analyze the periodic motion that occurs during the test. MRFT acts as hysteretic relay, in a sense, with unknown value of the hysteresis though. The DF of the hysteretic relay having hysteresis value b is given by (Atherton, 1975): where a is the amplitude of the input sinusoidal signal.
But the system has unknown hysteretic value, which depends on the amplitude value: b = ßa. Therefore, the DF formula can be written as follows (Boiko, 2012): The following harmonic balance equation can be used to find the parameters of oscillations during the MRFT.
where a 0 and Ω 0 are the amplitude and the frequency of the periodic motions.
MRFT allows for the exact design of the gain margin (assuming that the DF method provides an exact model). Since the amplitude of the oscillation a 0 is measured from the test, the process gain at frequency Ω 0 can be obtained as follows: which after introduction of the controller becomes the process gain at the critical frequency.

MRFT optimal design and tuning
For a gas pressure process, from the point of view of possible parameter variation, it is important to find the gain margin of the system (Boiko, 2013). It was shown in Boiko (2013)  where γ m is the required gain margin, and the designed controller will provide the desired gain margin exactly. To provide specified gain margin, MRFT must be carried out with parameter: Yet, there is an issue of optimal combination of the coefficients that define tuning rules because there is only one Equation 13 and three variables. Optimal values of the PID parameters could be found by applying the tuning rules and optimization methods.

Figure 4. Modified relay feedback test.
Among the optimization criteria, the most suitable are criteria that are measured from the output response of the system to the step change. The use of criteria that depend on the time domain rather than the frequency domain is preferred (Boiko, 2013). Therefore, the following popular time domain criteria can be used.

Integral absolute error (IAE):
Integral time absolute error (ITAE): where t is the time and e(t) is the error.

Separator model and controller design
The Matlab and Simulink are used to simulate the system dynamics. The process and equipment data related to each part were collected in order to build the model of the process. Control valve data sheets were used to identify the actuator-valve characteristic and to calculate the required parameters: A v C d = 0.0054921 m 2 , with the dynamic model being W v (s) = e −0.5s 0.5s+1 . The initial conditions of the model values are calculated such as the outlet gas pressure from the valve, gas mass, and inlet gas flow rate. It is considered that the control valve is linear and can open from 0 to 100% so that ∈ [0,1]. The total volume of the two-phase separator is 100 m 3 . However, the level of the liquid is specified by two limiting values, and the gas volume can be found from Equation 2. Gas properties such as the density, molar mass, and specific gas constant are those of methane, as it is the main ingredient of the gas contained in the separator, with 78% from the gas content.
From Equation 1, by considering the constant volume of gas (we disregard the dynamics of volume change because it is slow and addresses the variable volume in a quasi-static manner), the pressure rate of change: The modes of operation that affect the dynamics of the gas loop depend on the level and gas inflow for the separator, where • Level of the liquid in the separator: L ∈ [515 mm, 1825 mm] • Gas inflow to the separator: w in ∈ [2.73 kg/s, 9.92 kg/s] We split the above ranges of level and gas inflow into seven segments each and consider (7 + 1) × (7 + 1) = 64 operating modes of the separator in the controller design. The MRFT technique is applied for the 64 modes of operation. The model is run in Matlab-Simulink; first, the MRFT method is applied for each mode individually, and the critical amplitude a u and critical frequency Ω u are calculated and presented in Table 1. The MRFT is carried out in the incremental way described in Boiko (2013), so that the produced control is the increment to the control value is a steady state corresponding to a certain operating mode. The tuning of the controller parameters is done by specifying the gain margin of three using the optimal tuning rules for gas pressure loops given in Boiko (2013), as the values of the constants used in the tuning rules: c 1 = 0.331, c 2 = 0.216, and the parameter of MRFT β = 0.132. Gain margin of three is considered a good option for providing "moderately fast" closed-loop response-as per Boiko (2013). From Table 1, the parameters k c and T i for each mode are calculated using the tuning rules and are shown in Table 2. It can be noted that the value of the k c is very small since our control variable (gas pressure) is in Pascal as per SI standards.

Robust controller
From Table 2, the robust controller can be designed by choosing the parameters K c and T i that provide the least aggressive action and, therefore, will be suitable for all modes. In this design, the performance of the control system is guaranteed regardless of changes in the plant dynamics. However, none of the modes provides a combination of lowest gain and highest time constant. The robust controller values are selected from Table 2 at the point of (1.451 m, 2.73 kg/s), which provides the highest value of 9.485 for T i and sufficiently low value of K c being 1.1 × 10 −5 . The overall performance is then verified by simulations.

Adaptive controller
Another method of approaching the issue of variable parameters of the process is the use of a controller having variable parameters. This approach constitutes the adaptive control. In using this approach, we utilize the data of Table 2 to design a gain schedule for the controller. Table 2 serves as a look-up table for finding the controller gain for a given mode, which is characterized by L and w in . This approach is straightforward but inconvenient in realization, as it requires storing look-up tables and using interpolation. A more convenient way would be to obtain a suitable approximation for the values of Table 2 as functions of L and w in .
The 3D graphs for the proportional gain K c and integral time constant T i as functions of L and w in are given in Figures 5 and 6, respectively. One can notice that the dependence of K c on L and w in is nearly linear, so that linear approximation would be appropriate. The dependence of T i on L and w in has more complex character, which requires higher order approximations. Both approximating functions were found through minimization of mean square error technique. The dependence of K c on L and w in is given by: And the approximating dependence of T i on L and w in is given by third-order surface as follows:

Simulation
The dynamics of the system with the robust and adaptive (gain scheduled) controllers was tested by the Matlab simulations under two different operating modes which are the normal (inflow rate w gin = 6.3 kg/s and level h = 1.17 m) and the "minimum" (inflow rate w gin = 2.73 kg/s and level  manifold pressure and the pressure set point. The performance of the robust PI controller is demonstrated by the loop reaction to the disturbances and set point combinations, which is a sinusoidal change of the inflow and level with a step change of the separator pressure set point (Figures 8,10,12,14,16,18,20,22,24,and 26). The performance of the adaptive PI controller is demonstrated by the loop reaction to the three disturbances and set point change, which are the sinusoidal changes of  the inflow and level and a step change of the separator pressure set point, the inflow and level and the manifold pressure (Figures 9,11,13,15,17,19,21,23,25,and 27). IAE index values for the step tests are presented in Table 3. IAE index was selected as a metric because it was the basis for the development of the tuning rules in Boiko (2013) that are used in this research. One can see from the  trends of the separator pressure in Figures 12-27, and Table 3 that the performance of the robust controller is slightly higher, which is revealed as smaller pressure fluctuations. Also, the trends of the separator pressure with adaptive controller in Figures 9 and 11 are shifted down which means that  during the simultaneous action of the gas inflow and level, the separator pressure with adaptive controller does not go to high value as with the use of the robust controller in Figures 8 and 10. One of the main objectives to design the gas loop controller was to protect the vessel from overpressurization. As mention earlier, when the separator pressure grows above the set point of 80 PSIG,    depressurization has to be done by sending the gas to flaring, which leads to a negative environmental impact. Therefore, a pressure controller with a good performance is highly recommended in this case. Thus, the choice of the adaptive PI controller over the robust controller is preferred.

Conclusions
Oil-gas separators are widely spread in the oil industry. As per authors' observations, gas pressure controllers often suffer poor performance due to operating mode change because once tuned in a certain operating mode, they may reveal either too-aggressive or too-sluggish closed-loop behavior in other operating modes. In the present research, a nonlinear model of the separator, which considers multiple operating modes, is presented. On the basis of MRFT, characterization of the process dynamics in various operating modes is proposed. This characterization allows one to use relatively simple methods of linear systems controller design and ensures overall stability through either conservative or gain scheduling strategies.
Respectively, two different approaches to the controller design/tuning are proposed: robust and adaptive. Methodology of realization of each of them is developed. Matlab/Simulink model of the system is developed. It is shown through simulations that both approaches are valid, with the robust approach being simple, whereas the adaptive approach providing higher performance.