Abstract
In this paper, a non-fragile optimal observer is proposed for the decentralized multiphase flow measurement based on the interconnections between the two subsystems, that is, gas and liquid, constituting the whole system. Due to the dynamic model of system and presence of disturbances and slowly varying quantities, a non-fragile decentralized observer is designed and the states of the condensate and gas sub-systems were separately estimated. Lyapunov-based stability conditions are converted to linear matrix inequality (LMI) and observer gains are optimally selected from solution set such that the effect of the disturbance on the states’ estimation error becomes minimized. The estimation is conducted using the real-time measurements including lines pressures, single-phase gas flow, and single-phase liquid flow in the refinery outlet. To check the stability and performance of the system against the changes, the Lyapunov theory has been used. Finally, the estimation results are compared with real-world data from the industry showing the high accuracy of this method as the estimations were consistent with the operation data. In all stages, the investigations were based on the data collected from the actual process in the South Pars Gas Complex (SPGC), Iran. Additionally, the Extended Kalman Filter (EKF) based on the simplified drift flux model (DFM) was used to estimate the states then both methods’ results are compared and using the HYSYS simulator with the real process data, it is found that both observers are capable to identify the states with some differences in performance and DFM model is sufficient for estimation of parameters and states of the multiphase flow entering the gas refinery. As a result, these techniques not only can be substituted for the existing system at the gas refinery, but also can be as a backup for available measurement systems.
Introduction
The increasing demand and reducing hydrocarbon resources have led to higher accuracy; as a result, precision in measurement is needed in the sales and export. Due to the nature of the fluid extracted from the well and the changes in the temperature and pressure of the fluid during the long-distance pipeline transport, the extracted fluid is likely to go through a multiphase flow. Therefore, it should be measured as a multiphase fluid either on-site, that is, at the platforms, or upon the arrival in the production plants. Despite considerable advances in accuracy of measurement equipment for single-phase fluids, they do not have a high degree of accuracy for multiphase fluids (composed of gas, oil, and solids) as they fail to measure the flow (mass or volumetric) or phase fraction accurately (Mathew et al., 2018). Some research has focused on the use of technologies specific to the single-phase flow measurement for measuring multiphase flows (Wang et al., 2019), (Li et al., 2016), (Wang et al., 2018) and (Meribout et al., 2010). Despite their high accuracy for the gas/liquid single-phase or oil-water two-phase flows, these types of flow meters, are not recommended for oil-gas two-phase flows. They have also some drawbacks, including higher maintenance and initial costs, build-up on the inside pipe walls, and dirt on the transducers and sensors, which can affect the signals and performance and reduce the measurement accuracy as well. Soft sensors and observers are convenient solution for improving the measurements. In this method, the mass or volume of the multiphase fluid is not measured directly but obtained through other parameters, including temperature and pressure or single-phase outflows.
Due to the inevitable existence of uncertainties in the complex industrial systems where parameters change regularly by the environmental and operational conditions it necessary to employ observers in a robust model (Vijayaraghavan and Valibeygi, 2016). Furthermore, if we need to have simultaneously parameter identification robust adaptive observers is a suitable solution in this regard (Atta Oveisi, 2017). Moreover, observers’ gain is usually obtained from off-line calculations and it may become deviated from its true value and as a result it leads to an error or even diverging in estimating the states (Mahdi Pourgholi, 2011). Observers that fail to withstand small disturbances in the gain are referred to as fragile observers. Several studies have shown that, sometimes, small perturbations in the observer and controller gains lead to the instability of the system, so different approaches must be used to stabilize such systems. For example, some focused on the cost controlling in stochastic systems through time-variable delay (Hui et al., 2015). Some others presented an observer for the linear parameter varying (LPV) system in presence of uncertainty with using robust control (Alsuwaii, 2016). One way to overcome this issue is to use observers with different gains to improve the accuracy and convergence rate while allowing switching to different gains for convenience (Kharkovskaya et al., 2018).
With uncertainty and disturbance in the system, sliding mode control is considered a powerful controlling tool. For example, in Zhou et al. (2018), the impact of irregular disturbance was effectively attenuated with the help of the H∞ control theory and Integral Sliding Mode Control (ISMC). For a physical, uncertainty-prone system where the bounded input–bounded state condition is not satisfied, authors (Apaza-Perez, 2018), presents a generic sliding mode observer that provides convergence accurately in finite time by dissipative approach. In this paper, we proposed a robust optimal nonlinear observer design by considering observer gain perturbation and existence of exogenous disturbances in the dynamic and system outputs with interconnections between the sub-systems in measuring the flow of multiphase fluids. Using real data simulation of the decentralized gas refinery input process by dynamic HYSYS is done and results are compared with a real inlet and outlet of a gas refinery. Based on the Lyapunov method a novel decentralized multiphase flow observer is propose that capable of measuring the flow of multiphase fluids at the inlet of refineries.
The main contribution of this paper is to present a new form of the soft sensor using the new decentralized robust optimal observer to measure the multiphase flow at the entrance of a gas refinery, which leads to better performance, higher accuracy, and repeatability.
In this paper, to show the performance of the proposed adaptive observer, it is evaluated against and compared with the Extended Kalman Filter (EKF) and HYSYS simulator using information collected from the actual process in a real gas refinery. Furthermore, drift flux model (DFM) for flow characterization in the decentralized multiphase flow measurement system is evaluated. The outstanding achievements accomplished with this soft sensor are as follows:
This soft sensor increases accuracy of multiphase flow measurement by using a relatively simple model, without the need to use the costly and high-maintenance multiphase measurement systems.
Using this soft sensor, maximum overall uncertainty for the gas and liquid flow measurement is better than 0.23%. Thus, this technique not only can be used as an alternative to the costly multiphase measurement systems or low-accuracy conventional systems but also serves as a fault-detection system or as a backup when the existing measurement system is in fault or removed due to maintenance or replacement.
Evaluating the DFM for flow characterization in the decentralized multiphase flow measurement system consisting of two interconnected subsystems in the gas refinery inlet employing a robust-optimal observer and EKF.
Consistency of both estimators with the real process in a gas refinery in the South Pars Gas Complex (SPGC) in Iran is shown.
The rest of the paper is organized as follows. In Section 2, our gas refinery system is discussed. In Section 3, dynamic model of system is presented. In section 4, the proposed robust optimal observer is presented. In Section 5, simulation results are provided. Finally, in Section 6, the conclusion and remarks are given.
Gas refinery system
Given the nature of the well outflow and the considerable variations of the fluid temperature and pressure along the path, the inflow to the refinery is multiphase and measurement systems both at the platform and the points of entry to the refinery must be capable of measuring such flow. A schematic view of the entry of the multiphase flow of gas and condensate, their allocation to different refinery units, and the measurement process is presented in Figure 1. In the past few decades, researchers exhibited much interest in the measurement of multiphase flow rate with several studies addressing different aspects of the topic. For example, in Lorentzen et al. (2003), a Kalman filter was used to adjust different parameters in a multiphase flow model, estimating the gas and oil flow rate by measuring the wellbore pressure and temperature. In some cases, the outflow of the well was estimated using an Ensemble Kalman Filter (EnKF) to measure the wellbore pressure and the output flow rate in a horizontal well (Gryzlov and Leskens, 2011). Due to the importance of the amount of the outlet fluid from the well and controlling the variations of the oil and gas reservoirs, most studies have focused on well’s outlet measurement. Using inference methods with a focus on gas lift wells is a notable subject in this regard (Aamo et al., 2005; Kaasa et al., 2012; Nikoofard et al., 2018).

P&ID of a real plant in POGC (Company, 2015).
In some studies, a constant, measurable flow is assumed, and the flow of gas and oil is estimated separately by measuring indirect parameters. This method is, however, useless without knowledge of a constant flow. For example, in a study by Gryzlov et al. (2011), the authors assumed that lateral flows from the porous pipe are known and seek the volume fractions and velocities of the different phases, this is all the while in practice, measuring the lateral flows are even more difficult than measuring the flow inside the pipe. (Brono et al., 2014) assumed that the injected gas for lifting is known and attempted to estimate the reservoir pressure by measuring some parameters by feedback control. Although several studies have addressed multiphase flow and related technological developments, none seem to have discussed the multiphase inflow to petrochemicals and refineries in spite of the poor accuracy of the majority of these systems and their immoderate installation and maintenance costs. Accordingly, this study addresses the design of a decentralized nonlinear observer to overcome this shortcoming. Figure 1 shows an as-built Piping & Instrumentation Diagram (P&ID) of a gas refinery in POGC (Pars Oil and Gas Company) in Iran. As is evident from Figure 1, the refinery is composed of two large, interconnected sub-systems. Condensate stabilization unit and gas reception unit are the two principal sub-systems of the refinery. Sub-systems, the system boundaries, inlets, and outlets are as follows in Figure 2.

Subsystem boundaries, inlets, and outlets.
In this system, the multiphase fluid passes through a slug catcher immediately after entering the refinery. Because the separation is not complete, the slug catcher output is divided into two two-phase lines (a gas line containing condensates and a condensate line containing gas). It is evident that the overall system was assumed as a decentralized system composed of two distinct and correlated sub-systems. The two pipes were assumed to be interconnected and correlated. The first pipe, which is the output of the condensate, unit 103 (predominantly liquid containing some gas) the exiting gas first enters the second pipe whereas the liquids in line 2, which is the output of unit 100 (predominantly gas containing some liquid) enter the beginning of the first pipe. The input is introduced to the system in the form of a multiphase fluid and is measured at the outlets of the separate gas and liquid lines after the end of the process in the two sub-systems. Considering the consumption of the process, flaring, sand and water separation, and the uncertainty of the input measurement systems, that are often inaccurate orifice meter systems, the input is never the same as the sum of single-phase outputs, and the system output cannot be regarded as a measure of the exchanges. Accordingly, this study aims to establish an accurate soft sensor that can be used to obtain the input gas and liquid by measuring other system parameters.
Due to the dynamics of the system, some sources of uncertainty in the system and, consequently, the observer gain, are as follows:
System parameters where established during design and start-up will be different in practice during operation after a few years.
In the course of time, changes such as exhaustion, reduced efficiency, the impact of maintenance, and so forth, on the equipment make it possible to diverge from the design point.
Due to the nature of hydrocarbon reservoirs, wells, and pipelines, the system inlet experiences much fluctuation with several parameters changing—some of which were assumed fixed in modeling.
Delays resulting from process and system inertia that make the simultaneous comparison of the input and output data difficult.
Lack of systems for measuring the fuel consumption inside the refinery, the amount of flare, water content and condensate.
Separation of condensates from the gas due to temperature variations and creation of pulses in the fluid flow.
Leaving the linear range of the instruments and the measurement systems for pressure, temperature, and flow rate.
Dynamic model
DFM formulation of the conservation of mass and momentum balance, the main governing equations for flow in the pipe, are used in dynamic models’ extraction in this study. These equations have been written for each subsystem separately in a way that for each subsystem, three equations are generated that are conservation of mass for liquid and gas and conservation of momentum for mixture and, consequently, we will have two sets of a triple equation (Aarsnes et al., 2014; Gryzlov et al., 2011)
In these formula, p is the line pressure,
The conservation of mass for the subsystems by considering their interconnections are as follows
where
hi is bounded and can be measured directly.
Jacobian of
Interconnections between subsystems are single-phase and do not have second phase.
(3) There is no return from the counter process of hi and it is one-way flow.
(4) Considered disturbances are bounded.
Considering the bounded states of the system, the nonlinear behavior of equations is Lipschitz with definite and limited range.
Conservation of momentum law will be written for the mixture of each pipe. L, G index is used for different subsystem. L stands for oil and gas mixture in liquid line of unit103 (condensate unit) and G stands for the mixture of oil and gas in gas line of unit100 (Gas reception unit).
In the aforementioned conservation of momentum equations, the first equation is for the existing liquid and gas in the condensate line plus the inlet liquid is due to the interconnection of subsystems from gas process and the second equation is for the existing gas and oil in gas line plus the achieved gas from the condensate subsystem.
By integrating equations (3)–(7), the compact matrix form of the above mentioned equations for conservation of mass and momentum derived in Appendix A is as follows (Varvani Farahani and Montazeri, 2018)
where
Changing the variables and defining new matrixes changes the equations to the new following form (derived in Appendix B)
Where
If R is invertible, for the LMI to be possible, both of the following conditions must be satisfied
Observer design
The employed observer is characterized in the following form
Where
Where
According to the observer equation, the estimation error equation becomes
Where
To minimize the impact of noise and disturbance, the
For this to be realized and the stability to be proved, the common Lyapunov function is rewritten for the case of this problem
By differentiating from both sides of (22), the simplified form of the Lyapunov function derived in Appendix C is as follows
Where
By applying the
Accordingly, using Lemma 2, the feasibility of the LMI is investigated as follows
Considering that
Therefore, the following equation will hold
It is thus revealed that LMI is possible; On the other hand, equation (2) 6 yields the following equation, indicating sufficiency for the equation to hold
Using the Schur complement and a change of variables (S = LTP), we have:
This inequality can be solved using the YALMIP, solver sdpt3 and LMI toolbox in MATLAB.
Simulation
The measurements and information employed in this study were supplied from a real POGC oil platform, and the simulation was carried out with the help of MATLAB and HYSYS in parallel. Table 1 presents subsystems process parameter values on the real process.
Subsystems process parameter values.
Table 2 presents the 24-hour average real refinery data including the gas and condensate input and output, the fuel, flaring, and so forth.
Input-output balance.
HYSYS simulation diagram is shown in figure 3. The HYSYS simulation was carried out based on the same real process data—partly summarized in Table 2. In the HYSYS simulation, pressure control was considered over the lines and pressure and level control for the reservoirs.

HYSYS schematic simulation.
Considering that control parameters change depending on process conditions, the auto-tune feature of the controllers was used to select control parameters. It must be noted that only proportional and integral parameters were used to adjust the controllers. In other words, the process has PI controllers. Control parameters, after adjustment, are summarized in Table 3.
HYSYS control parameters.
In the following, to simulate the process, the software integrator is adjusted using the parameters of Table 4.
Integrator parameters.
Ultimately, running the dynamic process, the results can be observed in the output. It must be noted that changes are possible in the input flow rate and the impact of such changes in the inflow is visible in the output.
In practice, calculations of the rich (two-phase) downstream input are carried out by measuring the single-phase gas outflow. At the outlet of the refinery, the dry natural gas transmitted to the route pipeline (IGAT) is measured by a single-phase meter that reports the upstream gas input by taking into account the shrinkage factor. According to Table 2, 1.32 million m3 per dry gas was measured, in which by considering the coefficient of 1.13, the amounts of received gas from upstream will be 1.49 million m3 per day. On the other hand, at the upstream, the well output—measured by a high-pressure Venturi meter or based on the opening of the wellhead choke valve—is reported as input to the refinery (which is 1.64 million m3 per day according to Table 2). It is evident that this method is associated with a high 8% error in the upstream-downstream exchanges, suggesting a high mismatch between the two sources. The most notable reasons for the error can be summarized as follows:
The amounts of water, flare, fuel, and so forth are not constant whereas they were assumed to be fixed;
The reported shrinkage factor dates back to the time the refinery was first established despite the elements on which the coefficient was based on have been changed and the efficiency of the equipment has deteriorated;
The inaccuracy of the upstream choke and meter;
The multiphase nature of fluid at the upstream and at the inlet of the refinery.
The 24-hour average multiphase flow rate in the refinery’s input was assumed to be
Through discretization and obtaining the separate matrices using the “sdpt3 solver” and solving the problem, design parameters
In Figure 4, state variables (density, velocity, and volume fraction) were plotted using the extended Kalman filter. Results corresponding to the condensate and gas lines are plotted in the first and second rows, respectively. Figure 5 illustrates the states of the two sub-systems using LMI with the first row corresponding to the condensate line and the second to the gas line. Figures 6 and 8 show the flow velocity and phase fraction variations in the condensate sub-system plotted along the pipe based on position, and Figures 7 and 9 plot the flow velocity and phase fraction variations with the position in gas lines.

States estimation using EKF.

States estimation using LMI.

Phase fractions and velocities in the condensate line using LMI.

Phase fractions and velocities in the gas line using LMI.

Phase fractions and velocities in the condensate line using EKF.

Phase fractions and velocities in gas line using EKF.
Given the fact that space was divided into several different nodes during numerical solution, the system states were plotted against time for the nodes in Figures 4 and 5. As evident from a comparison of Figures 4 and 5, using LMI and determining the observer gain by this method improves state estimation.
Table 5 shows the mean square error of estimation in two cases (with and without LMI), according to the above table, using the gain obtained from the observer design method improves the results by reducing the estimation error. It is clear that the overall uncertainty that is introduced in the mass flow measurement by LMI-based observer is 0.23% and by EKF is 0.44%. it shows that, although both observers are capable to identify the states but there are some differences in their performance and MLI-based observer has a better performance than EKF technique.
RMSE of state estimation.
It is evident from Figures 6–9—showing the changes in velocity and liquid volume fraction in the condensate and gas sub-systems—that the gain specified by the observer has a significant impact on the estimation accuracy, and the designed observer proved useful despite the uncertainty and disturbance. Furthermore, the gain of the proposed observer design offered an accurate estimation of the rate of the multiphase flow despite uncertainty in the observer gain and disturbance in the dynamics and output signal. All of the above mentioned are emphasizing the necessity of using soft sensor to reduce the waste of energy and increase accuracy in the measurement of oil and gas.
Given that EKF requires the computation of a Jacobian, which leads to poor estimation, the EKF is expected to be less accurate than the proposed observer. Choosing the time step specify trade-offs in the EKF design, choosing larger time step in the EKF leads to faster soft sensor but typically more sensitivity towards an error in the initial estimate. Choosing smaller time step leads to slower soft sensor but typically less sensitivity towards an error in the initial estimate.
According to Figures 6–9, it is found that both observers are capable to identify the states with some differences in performance and although the Lyapunov-based optimal observer has better performance than the EKF, but performances of both methods for estimation of velocity are more accurate than estimation of phase fraction.
Since the phase fraction is accurately measured, error of the phase fraction estimation is not the main concern in this situation, but this implies that the simplifications we assumed in the modeling, do not have much effect on the accuracy of the velocity estimation. Therefore, it seems to be a good assumption to ignore the slip between gas and liquid velocities, but more information is needed on mass transfer between phases and fluid quality properties.
Conclusion
This paper presents the Lyapunov-based robust optimal observer using the Navier Stock equations governing multi-phase flow for a gas refinery were extracted as a decentralized system (consisting of two subsystems). Furthermore, an EKF is applied to estimate states for the decentralized system by using measurements created by HYSYS simulator.
To ensure the reliability of the simulation results, three simulation methods (robust observer, EKF and HYSYS) have been used, prior to the MATLAB simulation, the Dynamic HYSYS simulation was performed using the actual process data from a gas refinery in the South Pars field in Iran. The simulation results show that the HYSYS output is fully compliant with the existing refinery system. All input data to HYSYS, including pressure, temperature, pipe size, and oil and gas flow, were in accordance with the actual system in the refinery. Dynamic HYSYS results have been compared to refinery outputs and they are consistent with the actual refinery process. Fortunately, the results of all three methods are consistent and additionally all the results are in accordance with the real process in the existing refinery.
By taking into account the disturbances, interconnections between the subsystems and the uncertainty in the observer gain, a decentralized nonlinear observer is designed. Lyapunov stability conditions are converted to an LMI so that by solving the LMI, the optimal observer gains satisfy the stability conditions in the presence of uncertainties and gain perturbation.
It is found that both estimators (proposed observer and EKF) are capable of estimating the densities, velocities and phase fractions in the subsystems and the proposed non-fragile observers have a fast convergence rate with the reasonable performance of the estimation.
The result of simulation implies that the simplifications we assumed in the modeling do not have much effect on the accuracy of flow estimation; therefore, more accurate and faster soft sensor with reasonable performance, optimal cost and very low complexity is obtained by using this method. Moreover, for the EKF, by selecting the optimal time step, an acceptable sensitivity and speed and consequently a high level of performance is achieved.
Simulation results demonstrated that although both observers are capable to identify the states with some differences in performance, the nonlinear robust Lyapunov-based observer has better accuracy and is simpler than the EKF for estimation of the states. However, this indicates that the proposed method is stable for the specified operating conditions and is highly reliable.
Footnotes
Appendix A
By integrating equations (3)–(7) in the matrixes, the compact form of equations of conservation of mass and momentum are as follows
The important thing to note is that, the variables like
Appendix B
The decentralized system equations can be written as follows
Which finally results in the principle equations
Appendix C
By differentiating from both sides of (20) yields
Using Lemma 1, the definition of
Ultimately, the equation becomes
The simplified form of the Lyapunov function is as follows
Declaration of conflicting interests
The author(s) declared no potential conflict of interests with respect to the research, authorship and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
