AI BASED DETECTION OF GAS HYDRATE FORMATION IN THE FIELD

During the production of natural gas one of the major problems is the formation of hydrate crystals in the pipeline. The forming hydrate crystals can form hydrate plugs in the pipeline. The hydrate plugs lengthen production outages and result in financial losses for the producer, because the removal of the plugs is a time consuming procedure. One of the solutions used to prevent hydrate formation is the injection of modern compositions to the gas flow. The modern compositions help to dehydrate the gas, thus, the size of hydrate crystals does not increase. The substances, used in low concentrations, have to be locally injected, at the gas well sites. Inhibitor dosing depends on the amount of gas hydrate present. In the article a neural network based predictive detection solution is presented, which uses four factors.


Introduction
Natural gas hydrates are crystalline solids composed of water and gas. The gas molecules are trapped in water cavities that are composed of hydrogen-bonded water molecules [1]. Typical natural gas composition includes methane, ethane, propane and carbon dioxide. There are three conditions for hydrate formation, which are water production of gas well; low temperature; and high pressure of pipeline [2]. The number of hydrate molecules can increase to a level, where the molecular agglomeration process can begin, which can cause of plug formation in a given section of the pipeline. In worst cases the hydrate plugs can affect production outages [1].
In the gas industry the most popular solution to inhibit the formation of hydrates is the use of thermodynamic inhibitors, which shift the hydrate curve to a region where the conditions are not appropriate for stable hydrate formation [3]. Newer alternative technologies include the injection of low doses of hydrate inhibitors like kinetic hydrate inhibitors, which can prevent the growth of hydrate molecules [4].
To inhibit hydrate formation and to determine correct inhibitor dosage it is essential to determine the presence of hydrates in time. In this article a neural network based detection method will be presented, that predicts the hydrates' formation using the four following parameters, pressure temperature, and the quality and quantity of the inhibitor.

About the data used
The data used in my research comes from the measurement system of a motorized chemicals-injector device, placed in the vicinity of a well. After installing and putting the device into operation a test run sequence was started. The tests had begun in October of 2012 and continued till May of 2013, up until when the hydrate inhibitor's injection was no longer necessary. The measurement data, presented in Fig. 2 using computer software, developed for tests in the field, with a few custom modifications added.
The whole set of data, or just parts of it for easier processing, can be downloaded from a database, on a server. During the evaluation, the measurement data was divided into one-week long segments for easier understandability. The most important parameters amongst the gathered data are: -the soil temperature; -the pipeline pressure; -the injection frequency; -the inhibitor's chemical composition [5], [6]. Out of all these four have higher importance. Out of the four most important parameters the three that are measured are the temperature, pipeline pressure and the injection frequency and these significantly effect hydrate development. The last one, the inhibitor's chemical composition is noted down during filling the inhibitor tank with it and is unchanged, thus known throughout the measurement. To determine if an inhibitor composition has any effect or not, Table I is used as reference.
In this work the used data has been generated throughout 29 test weeks. After analysis of the data 45 data sets with around 4500 data points were manually selected. Using these data sets the neural network can later be taught.
Selected raw data was scaled and normalized. From the resulting data that was suitable for the networks three main datasets were generated, which were training on a validation and a test dataset.
Pollack Periodica 15, 2020, 3  The training dataset is suitable to train the features of prediction and configure the weights of the network's variables during the training process [7]. The validation dataset is used to stop the training process at the right time. This independent dataset is very important; it has to stop the training process after it has managed to reach a predetermined progress level. If an early stop occurs, then the network does not learn the main features of the training data. In the other case, when the training process of the neural networks takes longer than the optimum, the network can be over-trained [8]. This means that the network can give a good estimation when an unknown, independent dataset is used. The test dataset is used to compare the results of different network structures. This dataset is also independent of the training and validation sets. The main parameters of datasets can be found in Table II.

AI based predictive detection
The goal was to develop an accurate, stable and neural network based structure that is an Artificial Intelligence (AI) based solution. Several network structures have been studied. In this paper one family was used, the Neural Network Auto-Regressive X (NNARX) model with exogenous input, which uses the required outputs as inputs in the regressor [9] (set of input variables). The transfer function of neural network is: where y est (t) is the network output at the t th instant of time; x(t-1) is the used input of the network at t-1 th instant of time; y req (t-1) is the required output from the network at t-1 th instant of time; n i is the size of used tapped delay line of the inputs; and n ro is the size of used tapped delay line of the required outputs. One example for NNARX network can be seen in Fig. 3, with the used regressor and the mapping function.

Pollack Periodica 15, 2020, 3
A NNARX structured a Multiple Input, Single Output (MISO) neural network has been taught. There are, in total, four inputs, which are x, y t and r and a single hidden layer is used. To find the best network for the system the influence of various network sizes were investigated.
As outputs, artificially generated alarm patterns were created. There was an alarm where the pressure reached 75% of its maximum value. Until the actual differential pressure value was under the limit, the alarm signal was also zero. When it reaches the limit, the signal changed to 1. Using this condition, the outputs can be produced and used for teaching.
During the training process multiple neural networks were trained, where the number of hidden neurons and the tapped delay size of inputs and outputs were varied. The Levenberg-Marquard training algorithm was used for training in Matlab environment with NNSYSID toolbox [10]. To avoid over-learning a maximum of 1000 iterations were used during a training process, and training was stopped where Mean Squared Error (MSE) of validation dataset was found to be minimal [11].
To determine the performance of a newly developed system, since the MSE value does not give adequate information about the efficiency of the networks, the use of a different index value is suggested. The characteristics of the outputs are similar to shorter or longer impulse waveforms. The Rising Edge (RE) of these impulses in outputs of the network can be investigated and used for comparison. There are several methods, which can be used to find edges in one dimension. A traditional method is where, after some filtering, the signal's differentials are analyzed to find the step like changes in the signal [12]. A major drawback of the method is its sensitivity to the noises. The other method that was used is the Canny edge detection method, which uses the first differential of Gaussian type to approximate the optimal finite length filter [12], [13]. This method gives good result in this case.
Results from five networks were compared, using the MSE and the relative error of the found rising edges in the simulated outputs of the network and the required alarm signals. The comparison of the network can be found in Table III [14].
Graphics Processing Units (GPU) definitely can be used to speed up neural networks. GPU computing is all about leveraging the parallelism in the GPU architecture to perform computing intensive operations [15], [16].

Conclusion
In this paper a method is shown, which is capable to predict hydrate growth in time. The method is based on neural network with recurring architecture. Using the results, some experimental data sets were generated for training, validation and test purposes of neural networks. Five networks were trained and their results compared to acquire accurate, usable alarm signals in wide parameter range. For comparison, the found rising edges of the signal were investigated with success besides the well-known MSE value.