Development of Tools for the Analysis of Pre-Emergency Situations on the Drilling Rig Based on Neural Network Technologies

Today complications during drilling and operation of oil and gas wells are unavoidable. Most of them are the result of violation of technological discipline (technology), some are due to insufficient knowledge of geological and physical conditions (especially in exploratory drilling), a lack of understanding of the causes of the phenomena preceding the complication. Sometimes performers in performing complex technological operations go to the so-called “justified” risk, as a result of which complications and accidents occur. It should be taken into account that the failure of the well even for a short time - the loss of oil and gas production. Therefore, the development of modern methods for their detection, prevention (prevention) and methods to combat their consequences is an urgent task.


Introduction
The purpose of the thesis is to develop a neural network analyzer to identify pre-emergency situations at the drilling site in order to promptly make decisions on their prevention and elimination. The main tasks to be accomplished to achieve this goal are [1]: 1. Analysis of the research object with the purpose of determining the characteristics that reflect its state. 2. Classification of the states of an object in order to determine the set of pre-emergency states. 3. Definition of a set of attributes available for measurement in existing geological information systems. 4. Choice of a mathematical apparatus for solving the problem of determining the current state of an object of research according to a given set of characteristics. 5. Implementation of software for the rapid identification of pre-emergency situations at the drilling site.
In the work, existing algorithms for learning the neural network are used to recognize the main pre-emergency situations. The structure of a neural network is proposed for recognition of such situations as gas and oil and gas manifestation, absorption of drilling mud, stuck to the drilling tool.
The introduction of the results of the work into practice will allow to identify, at earlier stages, the development of pre-emergency situations, which helps to reduce the costs of dealing with the consequences of their occurrence.
The unsatisfactory condition of any element of this system, as well as the discrepancy between the selected drilling technology regime and the geological conditions of the well, may cause complications during drilling or pre-emergency situations [2].
In the process of drilling oil and gas wells, various complications are possible that can lead to pre-emergency and emergency situations with various consequences, up to the elimination of the well [3].
The main causes of such complications are as follows: 1. Unexpected and unaccounted features of the geological section; 2. Frequent alternation of rocks by properties; 3. Insufficient rock stability; 4. Deviations from the well logging project.
Unfortunately, the latter reason in real practice is most frequent. Among the complications that arise in the process of wiring the well, we can distinguish: 1. Gas and oil extracts -they are characterized by a fairly specific set of characteristic values, according to which it is possible to predict their appearance and improve the effectiveness of their control; 2. Absorption of drilling fluids used in drilling; 3. Instability of the wellbore and clamping of the drilling tool; 4. Other complications, such as flushing the instrument, malfunctioning pumps, wear of the chisel support The task of this work is to determine the minimum set of characteristics that make it possible to confidently determine the approach of a complication based on the available information of the GTI.

Materials and Methods
The problem of recognition of the state of the system under investigation is characterized by a multitude of external factors influencing the result and the absence of a formalized mathematical description of the effect of these factors on the state of the system [4]. Under these conditions, it is impossible to accurately determine the settings of algorithms using hard logic, as well as to identify clear linearly separated clusters in the state space of the system used by the classical image recognition methods.
Genetic algorithms that use random variations of model parameters and preserve those that approximate the result of recognition to a given one are also rejected as very slow and do not give guarantees of obtaining an acceptable result for a given time. Thus, artificial neural networks were chosen as a theoretical basis for solving the problem of recognition of emergency situations.
Artificial neural networks have the ability to learn, i.e. can change their behavior depending on the external environment. After presenting the input signals (possibly together with the required outputs), they are self-tuning to provide the required response [5].
In addition, artificial neural networks have the ability to generalize and abstract data, but these opportunities were not used in this work. The theory of neural networks today is quite extensive. In this paper we used several basic concepts, namely: 1. Single-layer neural networks 2. Multilayered artificial neural networks 3. Networks with feedbacks 4. Learning algorithm for back propagation Single-layer neural networks are characterized by a fairly simple structure. Each element of the set of inputs X of a separate weight is connected to each artificial neuron. And each neuron gives a weighted sum of inputs to the network.
Back propagation is a systematic method for learning multi-layered artificial neural networks [6]. This method refers to optimization methods. The minimized objective function of the neural network error is the value: Minimization is carried out by the method of gradient descent: The formula for calculating the values of j(n) of the layer n from the values of k(n+1) of the higher layer n + 1: For the same output layer: Now we calculate the changes in weights: Training of the reverse distribution network requires the following operations: 1. Select the next training pair from the training set; Feed the input vector to the input of the network. 2. Calculate the output of the network. 3. Calculate the difference between the output of the network and the required output (the target vector of the training pair). 4. Correct the network weights so as to minimize the error. 5. Repeat steps 1 through 4 for each training set vector until the error on the entire set has reached an acceptable level.
After a sufficient number of repetitions of these four steps, the difference between the actual outputs and the target outputs should decrease to an acceptable value, while the network is said to have learned. Now the network is used for recognition, and the weights do not change anymore.

Results and Discussion
The problems of creation and research of models of artificial neural networks for solving recognition problems are considered [5]. The questions connected with modelling of training of a neural network to recognition of linearly inseparable classes are considered. Using the example of a typical task (calculation of the values of the XOR function), it is shown that a neural network of two layers successfully copes with the solution of such a problem. The structure of the obtained model is shown in Figure 1. The algorithm for learning the presented neural network was implemented by means of the Visual Basic for Application language in the MS Excel environment. The results of recognizing the input values of the network after training are presented in Table 1. The recognition error for all combinations of input signals does not exceed 9%. The process of convergence of the network learning process for solving this recognition problem is studied. Charts for changing network weights are shown in Figure 2.
The nature of the processes on all the presented graphs is convergent, the established values of the weights for different initial values are close to each other.
The results of development and investigation of software for solving the problem of recognition of pre-emergency situations on the drilling on the basis of the neural network model and the training algorithm presented earlier are presented.
When developing the software, an object-oriented approach has been adopted, the C ++ language has been chosen as the programming language [7]. Figure 3 shows the developed class hierarchy for the problem of simulating and learning a neural network. The developed class library [8] was used to simulate a neural network and its learning to solve the "XOR Function" task. The learning outcomes (changing the weights of the links) were recorded in a file. Based on these results, a graph is plotted in MS Excel. Recognition of the state of the research object -drilling rig -was conducted in the absence of physical installation on the real data recorded during the operation of the real drilling rig by the Geo Scape program. To organize the import of data from the Geo Scape program, a special program was developed [8], the interface of which is shown in Figure 4:

Fig. 4. Geo Scape data analysis interface
In the database used, there are data on routine situations and complications on drilling in the form of readings from the following sensors: • S101 -bottomhole depth (m.); • S102 -position of the bit over the face (m.); • S103 -position of the talblock (m.); • S104 -speed of the talblock (m/s); • S105 -position of wedges; • S108 -penetration to the bit (m.); • S109 -Drilling time per flight (h.); • S110 -position of the chisel by candle; • S111 -number of candles; Based on the analysis of these data using the above class library, a program was developed for training the neural network to recognize routine and pre-emergency situations during drilling [10]. First of all, the training was conducted for the recognition of standard situations during drilling operations.
By the help of this program, the construction and training of a neural network for recognizing the main routine situations during drilling for various Geo Scape data files has been performed [11]. Recognition results are shown in Table 2: Analysis of the obtained results allows us to state that the used recognition method gives stable good results. The share of correctly recognized normal situations during drilling averaged 94.12%. The quality of training is quite high, which confirms the adequacy of the choice of parameters for recognition, as well as the data files themselves.
For learning the recognition of pre-emergency situations, models of neural networks have been developed using MS Excel. Figure 5 shows the structure of the neural network model for the pre-accident situation "Gas oil extraction" and the results of its learning by the method of back propagation of the error: To distinguish this situation, three characteristics are selected: • S112 -Drilling speed in time (m); • S600 -density of the solution at the inlet (g/cm 3 ); • S900 -outlet temperature (deg. C) Table 3. Results of recognition of the situation "Gas-oil-water-manifestation".

No
Type of situation S112 S600 S900 Y Delta -Deviation The average recognition error was: 5.05%. Similar models were constructed for the situations "Absorption of drilling or grouting mortar" and "Stucking of drilling tools". After learning the neural network, the recognition error was 4.89% and 7.26%. Thus, for all three pre-emergency situations considered, the average recognition error was about 6% [12].

Conclusion
The final values of the weight coefficients differ insignificantly (the deviation of each coefficient does not exceed 5% of its average value), despite the different initial values. Similar results were obtained in the study of two other pre-emergency situations. The results of the study allow us to conclude that the solution obtained is stable.
Delivery in real time of the necessary technological and geological information to the office of the oil and gas production enterprise and management solutions for monitoring objects will give the following advantages: • Ability to serve highly qualified personnel, both applied and IT directions.
• The ability to accumulate in one place all the necessary information: operational, planned, data on similar wells. The solution of the task of development, implementation, adjustment and subsequent operation of the "Neural network analyzer of drilling anomalies" as an integral part of the corporate information system will require the combined efforts of large oil and gas companies, mathematicians and system technicians specializing in this direction.