Design of a Prediction System for Hydrate Formation in Gas Pipelines using Wireless Sensor Network

Before the evolution of the Wireless Sensor Networks (WSN) technology, many production wells in the oil and gas industry were suffering from the gas hydration formation process, as most of them are remotely located away from the host location. By taking the advantage of the WSN technology, it is possible now to monitor and predict the critical conditions at which hydration will form by using any computerized model. In fact, most of the developed models are based on two well-known hand calculation methods which are the Specific gravity and K-Factor methods. In this research, the proposed work is divided into two phases; first, the development of a three prediction models using the Neural Network algorithm (ANN) based on the specific gravity charts, the K-Factor method and the production rates of the flowing gas mixture in the process pipelines. While in the second phase, two WSN prototype models are designed and implemented using National Instruments WSN hardware devices. Power analysis is carried out on the designed prototypes and regression models are developed to give a relation between the sensing nodes (SN) consumed current, Node-to-Gateway distance and the operating link quality. The prototypes controller is interfaced with a GSM module and connected to a web server to be monitored via mobile and internet networks. Keywords—WSN; Sensing Node; K-Factor; ANN; Link Quality Indicator; Hydrate Formation Temperature; Received Signal Strength Indicator


INTRODUCTION
WSN technology has proven a great potential in the field of data monitoring systems.Their simple device design and enhanced energy consumption gave them the opportunity to contribute in a wide range of applications such as the military, Environmental, Health and industrial applications [1].In the field of process monitoring, various parameters such as the operating pressure, temperature, flow and specific gravity are collected and transferred wirelessly to the host location for operation and management [2].Wireless sensor networks are mainly consists of three main elements which are the sensing elements, sensor nodes & sink node.The sink node can be either the gateway or the router node, while the sensor node are usually connected to a single or a group of sensors from which data is collected and transmitted to the gateway sink node.They are commonly structured of a microcontroller, energy source and a wireless transceiver [3].One of the base WSN applications in the oil and gas industry is monitoring the gas hydration formation process for remote production wells.
The Gas hydration is a well-known problem specifically in the oil and gas industry which costs millions of dollars due to production losses.They are ice-like crystalline solid compounds formed from water and molecular non-polar or slightly polar molecules (usually gasses) under low temperature [4].At a defined temperatures & pressures, the production and transmission pipelines are blocked with what looked like to be ice.
The key for gas hydration prevention, is by using prediction systems that can give a random estimation of how far is the current operating conditions from the critical hydration values so that operator could take the necessary actions to shift the operating conditions away from the critical predicted values.
Most of the developed models depend on two methods; the first method is the specific gas gravity method [5], while the second method is the K-Factor method [6].In fact, both of them are hand calculation methods that depend on some interpolations from data charts.
It is intended in this research to design a WSN prototype system capable of predicting the critical temperatures at which hydration will form based on the Artificial Neural Network algorithm.The research work developed three prediction models for determining the hydrate formation temperature.
For the input parameters, the first ANN model is based on the operating gas specific gravity values, the second model is based on the mole fraction of the flowing gas mixture components, while the input parameters for the third ANN model is the the Gas, Oil and Water production rates.The developed models are trained with data records taken from a live petroleum company history logs.
On the other side, two WSN prototypes are designed and implemented with different hardware devices arrangements and power analysis is carried out for their wirelessly operated sensing nodes.The research work in this phase aims to develop mathematical correlations to emphasis the relation between the sensing node consumed current, Node-to-Gateway distance and the operating link quality value.They can be used for real time estimation of the remaining conserved battery power in the WSN nodes and also for the power efficient node localization.
The designed prototypes are interfaced with a GSM module to be able to send the predicted data wirelessly through mobile networks via SMS.In addition to the GSM module, the collected data is also uploaded to a web server by means of a designed web program, so that data can be accessed through internet networks.

A. Wireless Sensor Networks
The increasing demand for the automated monitoring systems make WSN technology a target of research for many Researchers during the last decade.Although WSN is considered as a promising technology, there still many open research contributions needed to overcome the current challenges so that it can fulfill the industrial needs.
One of the challenges that WSN technology faces is energy conservation of battery-powered nodes.This topic has attracted many researchers during the last years to develop new techniques that could prolong the battery life time.Some developed techniques went through designing an adaptive control system that controls the transmission power related to the operating link quality to save power loss during high link quality conditions.In [7], "M.Tahir et al" proposed an Energy-efficient Adaptive Scheme for Transmission in WSNs.The scheme uses an open loop for link quality estimation and compensation due to temperature variations.While in [20], "Jang-Ping Sheu1 el al." proposed a distributed transmission power control algorithm that is based on investigating the impact of utilizing different transmission power on the link quality values.The Received Signal Strength Indicator (RSSI) and the Link Quality Indicator (LQI) parameters are used to determine the appropriate transmission power.
"Shan Lin et al." [8] and "Yong Fu et al." [9] also have designed an Adaptive Transmission Power Control (ATPC) algorithm using a feedback-based transmission power control algorithm that gives an indication of the operating link quality values over the time to estimate the amount of the transmission power needed."C.Behrens el al." [10] addressed the energy conservation topic from the different point of view.They studied the effect of temperature on batteries life time and developed a computationally linear model which is capable of calculating the residual energy as a function of temperature directly on the sensing node.
In [11], Eric Alberto de Mello Fagotto et al." used the "Received Signal Strength Indicator" to develop a mathematical model that can predict the power depletion at the sensing nodes.The model should be able to monitor the charge consumption process, giving the possibility for predicting the batteries behavior and choosing the right time to replace them.

B. Gas Hydrate Formation prediction Models
Prediction of the critical conditions at which hydration is formed requires a quite understanding of how hydration is formed, and finding out the relationship between the hydrate formers such as the Methane and carbon dioxide from one side and the pressure and temperature measurements from the other side.
Several studies have been carried out on the measurement and prediction of hydrate formation temperature (HFT) for various gas mixtures.These studies can be classified as follows: a) Hand Calculation Methods K-VALUE METHOD The K-Value method was developed by "Wilcox et al" in 1941 [6], it utilizes the vapor-solid equilibrium constants for prediction.The hydrate forming conditions are predicted from empirically estimated Vapor-solid equilibrium constants given by: Where,   is the mole fraction of the  ℎ hydrocarbon component in the gas phase on a water-free basis and   is the mole fraction of the same component in the solid phase on a water-free basis.For any given pressure, the value of each gas component   can be interpolated at any given   value.The hydrate formation conditions should satisfy the equation: Using this method requires applying the following steps: 1. First a random value for the critical temperature should be assumed.2. Using the assumed temperature with the given current pressure and   value,   can be interpolated for each gas composition.

K = y i
x i 4. is calculated for each gas composition.

∑ y i
x i n i=1 = 1 6. is calculated, if the summation result: • < 1 or > 1, all the previous steps should be repeated again by assuming new value for the critical temperature T c .
• = 1 then the assumed temperature is the exact critical value at which hydration will starts to form.
In fact, this method is not commonly used due to the large number of interpolations needed to figure out the exact critical temperature at each given pressure values, which as a result impacts negatively on the generated error.

GAS GRAVITY METHOD
The gas gravity method was developed by "Katz" [5].The chart shown in Figure 1 is a plot of the pressure, temperature and the specific gravity of the flowing gas mixture.For any gas gravity in addition to the current operating pressure,   can be calculated.In fact, as this method is not considered to be accurate, yet it is frequently used in the industry as it gives a random estimation of the critical temperatures with the minimum input data.b) Neural Network models "Ehsan Khamehchi et al" [12] used 356 data records to train an ANN with a back propagation learning algorithm that is capable of determining the HFT at variuos system conditions, the training data used were gathered from the gas specific gravity chart and valid for the ranges between: 31.95-78.8 F, 50.98 -3874.1 psi and 0.6-1 for the temperature, pressure and the specific gravity respectively.While "Amir Heydari et al" [13] developed a Neural Network model for estimation of temperature for gas hydrate formation using a training data of 167 input records ranging between 32-74 F , 50-4200 psia and 0.554-1 for temperature, pressure and specific gravity, respectively.Results in "Ehsan Khamehchi et al" [12] and Amir Heydari et al" [13] research work shows that that the proposed ANN models can be used successfully for the prediction of hydrate formation in natural gas within their mentioned boundaries.
In [14] presented by "Jalal Foroozesh el al", an investigation was formed for the relation-ship between growth rate of methane hydrate with temperature and pressure using Artificial Neural Network and Adaptive Neuro-Fuzzy Inference System (ANFIS).The results have shown that ANIFS is a more potential tool in predication relationship of kinetics of hydrate formation with temperature and pressure in comparison of ANN.The training data used in the mentioned paper was gathered from the experimental data of Chang Feng [15] and Chang Yu [16].

c) Data Regression models
Sharareh Ameripour [17] developed two correlations for calculating the hydrate-formation pressure or temperature for single components or gas mixtures.They are based on over 1,100 published data points of gas-hydrate formation temperatures and pressures and are valid for many hydrate formers such as methane, ethane, propane, carbon dioxide and hydrogen sulfide.Statistical Analysis Software (SAS) was used to find the best correlations among the input variables.They are applicable to temperatures up to 90ºF and pressures up to 12,000 psi.The results have shown excellent agreement with the experimental data.
In [18], "A.Bahadori" used the Katz gas-gravity chart for developing a new correlation between pressure, temperature & molecular weights.It proves reliablity for pressures between 1200 to 40000 kPa and temperatures between 265 K and 298 K, as well as the gas molecular weight within the range 16 to 29.While "Javanmardi et al." [19] employed approaches for predicting the hydrate equilibrium based on the vdWP (Van der Waals and Platteeuw) hydrate equation.They cover the hydrate formers: ethane, carbon dioxide, xenon, and nitrogen.

III. AIM OF THE RESEARCH
Most of the developed hand calculation methods used for determining the hydrate formation temperature gives inaccurate results as they depend on some kind of interpolation.In addition to this, real-time protection for the Oil and Gas production wells from the hydrate formation process requires an effective online monitoring system based on an accurate computerized model which hand calculation methods cannot provide.
The first phase in this research work is minimizing the hand calculation error due to the interpolations by developing an accurate three computerized prediction models based on the neural network algorithm to accurately predict the critical hydrate temperature at which hydration will form.The intellectual contribution in this phase is developing a new computerized prediction model that is based on the Well production quantities of Oil, Gas and Water.Also two other models are developed based on the gas specific gravity and the K-Factor charts.
While the aim of the second phase, is developing a mathematical correlation between the sensing nodes consumed current, Node-to-Gateway distance and the operating link quality for modeling the remaining conserved power in the battery-operated nodes and for their better localization.Certain parameters are used to monitor the learning process of the developed network such as the min_grad, max_fail, mu, mu_dec, mu_inc and the mu_max parameters.For every successful step (validation error decreased) the mu parameter is multiplied by the mu_dec factor, while in case the validation error increases, the mu parameter is multiplied with the mu_inc factor.The training will stop when the validation error is kept constant for a certain number of steps determined by the max_fail parameter which means no further improvement in the network training process.Also the training stops when the mu parameter reaches either it's minimum or maximum values according to the min_grad and mu_max parameters respectively.

• Regression curve
In this method, the regression curves in Figure 1 shows that the correlation coefficient is 1, 0.99998 and 1 for the training, validation and test sets respectively with a total average of 0.99997.

• Error
According to the model test results in Table II, the maximum error of 0.161088% was found between the ANN model output and the experimental test data.

• Regression curve
In this method, the regression curves shows that the correlation coefficient is 0.99713, 0.99225 and 0.96628 for the training, validation and test sets respectively with a total average of 0.99279.

• Error
According to the model test results in Table III, it is shown that a maximum error of 0.10684% was found between the ANN model output and the experimental test data.

• Regression curve
In the proposed model, the correlation coefficient for the training, validation and test curves shows high linearity between the model output and the target data.By plotting the regression curves as shown in Figure 7, the correlation coefficient value was 0.99713, 0.99225 and 0.96628 for the training, validation and test sets respectively with a total average of 0.99279.

• Error
A maximum error of 1.8 % was found between the ANN output data and the experimental test data.The output data results of the ANN model are shown in Table IV.b) Distance Vs.Link quality analysis for both Nodes The ambient temperature of the experiment is 20 Celsius to find out the effect of distance variation between the sensing nodes and the Gateway sink node on the link quality measurements.As shown in Figure 8, various line of sight test points as are selected at different distance points captured by Google Earth.The experiment results are shown in Table VI.
c) Power analysis The power consumption analysis in this research work concerning the battery powered sensor nodes uses the NI power quality tool kit, while the power calculations for the solar powered hardware devices refers to the manufacturer's datasheet.
For the sensor node power analysis, the sensor node-link quality indicator is used to monitor the transmission efficiency between the sensor node and the gateway node, while the NI 9227 current input module of the NI power quality tool kit is used to measure the consumed current from the sensor nodes side at every monitored link quality value.Measurements are carried out at full battery voltage with one sample interval per second.
All the consumed current calculations are measured in terms of the Root Mean Square value (RMS) by the LabVIEW RMS function in the electrical power suite software kit, while the graphical representation used for simulation is programmed by the LabVIEW graphical functions.

NODE 1
• Current consumption vs. Link quality This experiment was done for each node to investigate the relation between the sensing node consumed current at different link quality values.The link quality points selected for this node were taken randomly at values of 96, 87, 64, 44, 30, 23 and 11.The minimum and maximum current consumptions were found 13.31 RMS at link quality of 96 and 16.69 RMS at 11.In the second loop, the EFCOM GSM module is initialized and programmed by the AT commands using the LabVIEW block functions.At program execution, the module is initialized and enters into a while loop waiting for a Ring signal from the host cell phone.Once the module receives the ring signal, it cancels the host phone call and starts to collect the predicted data from the first loop to send it directly to the preconfigured host number.The time taken between receiving the ring signal and sending the predicted data via SMS was found to be with an average value of 10 seconds  V.

CONCLUSION AND FUTURE WORK
Designing wireless monitoring systems capable of predicting the hydrate formation temperatures is highly concerned by many industrial domains.The remotely located production wells, in the Oil and Gas industry make the wireless monitoring systems the ideal solution for the HFT prediction.The designing process in this research work is divided into two phases.In the first phase, three Artificial Neural Network models have been developed for Hydrate formation prediction with different input parameters.The developed models have been trained and tested with an input data of more than 700 data records collected from the history logs of a working Petroleum Company.The test results for all the developed models have shown correlation coefficient values nearly equals to one which indicates the high linearity between the models output and the target data records.ANN model 1 test results confirmed the observations presented in the previous work giving the best results with a maximum correlation coefficient (R) of 0.9999 while ANN model 2 is 0.99721.A third model was proposed in this research work based on new input parameters that are not commonly known in HFT prediction systems.The model has shown acceptable results with a correlation coefficient of 0.9921.All the developed models are valid to use in computerized systems within the mentioned training data ranges.
While in the second one, two WSN prototypes have been designed and implemented with National Instruments hardware devices.Different analyses were carried out on the wireless nodes and two mathematical correlations have been developed.The developed correlations gave a quite understanding of the relation between the WS consumed current, Node-to-Gateway distance and the link quality parameters.
WSN is considered as one of the promising technologies in the field of monitoring and control, yet there still some barriers that prevent their fuller adoption in various industrial applications.Nodes power efficiency is considered as one of the existing challenges that are concerned by many researchers during the last decades.The remotely located nodes in most cases are powered up by internal batteries that have a specified life time.Different techniques have been developed for battery power conservation such as: the duty cycle based operation and the automatic transmission power control, while other techniques are used for maximizing the amount of the conserved power such as Energy harvesting from wind, mechanical vibration, temperature variation and the solar power sources.For the future work, it is intended to explore the opportunities and challenges of using the Energy Harvesting techniques combined with the rechargeable batteries and super capacitors for the energy storage.Developing the harvesting techniques enables the wireless sensor nodes to last potentially more than what it typically lasts by normal batteries.

Fig. 1 .
Fig. 1.Gas-gravity chart (Association, 1972)TABLE I. THEORY AND TRAINING PARAMETERS OF THE DEVELOPED MODELS Production rates (Oil, Gas, Water) and the operating pressure Experiment will run in this phase on two designed WSN prototypes implemented with National Instruments hardware devices.All the designed WSN prototypes uses ANN model 1.IV. EXPERIMENTAL WORK All the proposed ANN models in this research work are trained by the "trainlm."training function where the "trainlm" function updates the weights and biases according to the Levenberg-Marquardt optimization.During the training process, the ANN model starts to divide the input data records into three subsets according to the set division function.There are four types of them used in the ANN models which are the Dividerand, divideblock, divideint and the divideind function.For the proposed model the Dividerand default function is used to divide the data randomly into the Training, Validation and Testing subsets.The training data set is used for training and updating the weight and biases of the proposed network, while the validation set is then used to tune up the developed network by comparing the model results to the validation data set, when the validation error is computed, the network is retrained by adjusting its weights again with the training data set.

Fig. 7 . 3 PHASE 2 A
Fig. 7. Regression curves for Model 3 PHASE 2 A. Prototype Model 1 a) Hardware All the hardware devices used in this prototype model can be used in the industrial environments except for the Sensors

Fig. 9 .
Fig. 9. NI Node 3202 consumed current at different link quality values

Fig. 10 .
Fig. 10.NI Node 3212 consumed current at different link quality values

TABLE III .
MODEL 2 OUTPUT DATA RESULTS

TABLE IV .
MODEL 3 OUTPUT DATA RESULTS Table V shows the hardware devices used in this prototype.

TABLE VII .
POWER ANALYSIS FOR NI WSN 3202 AT DIFFERENT LINK QUALITY VALUES chart representation for the generated results in Table VII is shown in Figure 9. A

•
Regression EquationThe regression Equation 4 is developed based on the generated results in Table VII from the node power analysis.Microsoft Excel regression tool is used to develop the regression equation with a total number of 7 input data points.Where  is the node consumed current while x L is the link quality value.Current consumption vs. Link qualityThe randomly selected quality link points for this node are at values of 99, 95, 87, 67, 54, 41, 31, 22, 17 and 11.Results shown in TableVIIIshows that the maximum current consumption was 10.98 mA at a link quality of 98 while, the minimum current consumption was 13.926 mA at link quality 11.

TABLE VIII .
POWER ANALYSIS FOR NI WSN 3202 AT DIFFERENT LINK QUALITY VALUES chart representation for the generated results in Table VIII is shown in Figure 10. A

TABLE IX .
PROTOTYPE MODEL 2 HARDWARE DEVICES