Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 7, No. 2, 2023 136 Overflow Intelligent Early Warning System Based on BP Neural Networks Yi Yang1, 2, Xin Wang2, Juanxia Liu2 1School of civil engineering and geomatics, Southwest Petroleum University, China 2China France Bohai Geoservices Co., Ltd. Abstract: Overflow is one of the most serious drilling accidents that affect the safety of drilling construction. The analysis of integrated logging parameters and the judgement of overflow situation in China still remain in the stage of "manual judgement" and "threshold warning". Based on this, we propose the method of combining the real time measurement information of comprehensive logging instrument with artificial intelligence technology, and design a BP neural network based intelligent early warning software system using SQL Server 2008 database management platform and C# program development language. Through the experimental test, the system runs well, the timeliness of overflow early warning is good, the accuracy of early warning results is high, and it can meet the needs of field application, and it can provide effective technical support for the field overflow early warning, and it has a better prospect of field application. Keywords: Overflow warning, Integrated logger, BP neural network. 1. Introduction Overflow is one of the most serious drilling accidents that affect the safety of drilling construction[1]. If some kind of alarm or warning can be given at the early stage of overflow, it is of great significance for preventing and controlling the development of overflow, preventing blowout or even blowout out of control, and minimising losses. At present, the foreign research trend in overflow early warning is, on the basis of the existing overflow detection equipment, constantly explore new overflow detection equipment, and combined with the cutting-edge artificial intelligence technology, explore new, able to carry out automated, intelligent comprehensive analysis and judgement of the measurement information overflow intelligent early warning methods. The intelligent early warning methods used abroad mainly include the early overflow warning method based on Bayesian decision framework[2], the overflow warning method based on fully connected network[3][4][5] and the overflow warning method based on long and short- term memory network[6][7] and so on. In recent years, domestic researchers have also begun to try to introduce some artificial intelligence methods for overflow early warning, Sun Ting proposed a data-driven real-time identification method for drilling conditions based on support vector machine, established several intelligent identification models, and verified the accuracy of the models by using the logging data of four wells, and the identification results are basically consistent with the actual working conditions[8]. Shi Xiaoyan used a data-driven machine learning algorithm- random forest method to make real-time identification judgement on overflow and leakage[9]. Tu Siyu proposed an intelligent identification and classification study of abnormal working conditions in the downhole environment based on the use of deep learning methods. By analysing the main influencing factors of normal operation and operation of equipment, a data set of abnormal working conditions in downhole environment was constructed, and based on the InceptionResnet V2 model using the layer freezing method, the fully-connected model was re-trained, and experimental comparative analysis was carried out through different migration strategies[10].Gao Xiaorong designed and developed an intelligent diagnosis and processing system for downhole complex situations and accidents based on instance reasoning technology based on the cognition and decision- making process of drilling experts when downhole complex situations and downhole accidents occur[11]. Compared with foreign countries, the domestic research on overflow intelligent early warning started later, although the domestic overflow intelligent early warning has also done a certain amount of research work, but the domestic application of integrated logging instrument for overflow early warning method basically stays in the "artificial judgement" and "threshold warning" stage. However, the domestic method of applying integrated logger for overflow warning basically stays in the stage of "manual judgement" and "threshold warning". There is a lack of corresponding and mature overflow intelligent early warning system based on real-time measurement information of integrated logger, which greatly limits the application of integrated logger in overflow early warning. Therefore, this paper proposes an overflow intelligent early warning method that combines the real-time measurement information of comprehensive logger with artificial intelligence technology. Based on SQL Server 2008 database management platform and C# programme development language, the overflow intelligent early warning software system based on BP neural network is completed. 2. Study of Overflow Characterisation Parameters and Their Characterisation Laws From the analysis of the mechanism of overflow occurrence, it can be seen that when overflow occurs, due to the continuous influx of formation fluids into the wellbore, the bottomhole pressure is smaller than the formation pressure, causing changes in pump pressure and mud outlet flow rate. At the same time, mud parameters such as drilling fluid temperature, density, conductivity, mud pool volume, and 137 engineering parameters such as pumping speed, suspended weight, and drilling speed, will also change. Therefore, through real-time monitoring of the changes in these drilling parameters, it is possible to timely determine whether formation fluid intrusion has occurred downhole, and real- time overflow warning can be achieved. Through a review of the literature [12]-[17] and a large amount of information from the field, the characterisation parameters that are closely related to overflow and their characterisation laws are finally summarised as shown in Table 1. Table 1. Overflow warning characterisation parameters and characterisation patterns overflow characterisation parameters overflow characterisation laws note standpipe pressure varying wave jump change drill time lower null pool volume raise null export drilling fluid flow rate raise relative to inlet drilling fluid flow export drilling fluid conductivity varying relative to inlet drilling fluid export drilling fluid density lower relative to inlet drilling fluid density export drilling fluid temperature raise relative to inlet fluid temperature aerometric total hydrocarbon varying no change in pure water intrusion C1 component content varying no change in pure water intrusion 3. Intelligent Early Warning Model for Overflow Based on BP Neural Network To change the traditional overflow early warning method based on manual judgment and threshold warning, it is necessary to comprehensively use information acquisition technology, computer technology, artificial intelligence technology, etc. to carry out automated and intelligent comprehensive analysis and comprehensive judgement on the real-time measurement information of comprehensive logger, so as to realize the overflow intelligent early warning. The flow of overflow intelligent early warning based on real-time measurement information of comprehensive logger is shown in Figure 1. Where X1-Xn represents the change amount of overflow characterisation parameters that can reflect the change of overflow characterisation parameters. BP neural Network Overflow Intelligent Modelling X1 X2 Xn Low overflow potential ... overflow High overflow potential non-overflow Figure 1. Overflow intelligent warning process The BP neural network takes the overflow characterisation parameter changes as input, i.e., the input vector is X = (X1, X2, X3, X4, X5, X6, X7, X8, X9); the two outputs of overflow and non-overflow anomalies are taken as the output parameters of the BP neural network, i.e., the output vector is Y = (Y1, Y2); Sigmoid-type excitation function is selected for the hidden layer, and linear-type excitation function is selected for the output layer. 4. Overflow Intelligent Early Warning System Development and Implementation The design of the overflow intelligent warning software system supporting the integrated logging instrument is based on the overflow intelligent warning model, real-time data acquisition system and database system, which can complete the seamless connection with the integrated logging instrument and realise the data acquisition of the real-time measurement data of the integrated logging instrument, the real-time monitoring and the intelligent warning in one software system. Each software function module is independent of each other, but also organically combined together. 4.1. Overall system architecture design The overflow intelligent warning software system supporting the integrated logging instrument is mainly composed of real-time data acquisition module, real-time monitoring module, database management module and overflow real-time intelligent warning module. The overall framework of the system is shown in Figure 2. 138 Integrated logging instrument supporting overflow intelligent warning system Real-time data acquisition module Real-time monitoring module Database management module Overflow Intelligent Warning Module Integrated logger real- time measurement data acquisition BP Neural Network Early Warning Model Integrated Logger Package Overflow Intelligence Early Warning System Database Real-time monitoring of integrated logging data Intelligent early warning real- time monitoring Well base data management Integrated logging data management Intelligent Early Warning Data Management Intelligent Early Warning Knowledge Database Management Figure 2. Overall system framework Among them, the real-time data acquisition module mainly completes the real-time acquisition of the real-time measurement data of the integrated logging instrument, and then realises the seamless connection between the overflow intelligent warning module and the integrated logging instrument; the real-time monitoring module is mainly responsible for the real-time updating and displaying of the real-time acquisition data and the real-time warning results; the database management module is mainly responsible for well basic data management, integrated logging data management, real-time intelligent warning data management and intelligent warning knowledge base data management, etc. The intelligent warning model establishment module is mainly responsible for the establishment of overflow intelligent warning model based on BP neural network. 4.2. System operation architecture design The overflow intelligent warning system supporting the integrated logging instrument is centred on the database of overflow intelligent warning system built on the SQL Server database platform, real-time measurement data of the integrated logging instrument is collected in real time through the data acquisition system and the real-time collected data is stored in the SQL Server database in real time.Through the client equipped with overflow intelligent warning system to complete the real-time collection of data management, overflow warning data management, real-time monitoring of data collection, real-time overflow intelligent warning based on BP neural network and other functions. The system operation architecture is shown in Figure 3. Integrated loggers measure data in real time Data Acquisition System database server Overflow Intelligent Early Warning System Database Basic data management system management Real-time data collection management Overflow warning data management Real-time monitoring of data acquisition Intelligent warning of overflow based on BP neural network client SQL2008 database platform Figure 3. System operation architecture 4.3. System Logical Architecture Design Through the demand analysis and research on the overflow intelligent warning software system supporting the integrated logging instrument, the logical architecture of the designed 139 overflow intelligent warning system supporting the integrated logging instrument includes the following: real-time data acquisition module, integrated logging data real-time monitoring module, integrated logging data history viewing module, database management module, overflow intelligent warning module, and overflow intelligent warning model building module. This section only shows the overflow intelligent warning module based on BP neural network, and the logical architecture of this module is shown in Figure 4. BP Neural Network Intelligent Early Warning Model Neural Network Sample Creation Neural Network Sample Selection Neural network training Neural network testing Figure 4. Overflow intelligent warning model module 4.4. System Data Architecture Design The data architecture of the integrated logger supporting overflow intelligent warning system designed in this paper mainly takes SQL Server database management platform as the data management and storage medium. It mainly consists of four parts: system basic database, real-time acquisition database, warning knowledge base and warning result base. The data architecture of the overflow intelligent warning system for integrated logger is shown in Figure 5. Engineering (real-time/ full metre) data Real-time acquisition of databases database server Overflow Intelligent Advance Overflow Intelligent Pre-Alarm System Database SQL2008 database platform Mud (real-time/whole metre) data Aerometric (real-time/ whole metre) data Early Warning Results Library Early warning results and analysed data Neural Networks Knowledge Base Early warning knowledge baseWell Basic Information Basic database Geological stratification data Figure 5. System Data architecture 4.5. Implementation of Overflow Intelligent Early Warning Module Based on BP Neural Networks The BP neural network based overflow intelligent early warning model building module is designed and developed to complete the production of training samples and test samples, BP neural network training and testing, as well as saving the weights and threshold matrices that meet the test requirements, etc. The sample data are mainly imported from database and Excel, and the weights and threshold matrices are saved in .txt files.The main interface of BP neural network training, the sample selection interface, and the error convergence curves are shown in Fig. 6~Fig. 8, respectively. Figure 6. Main interface of BP neural network training 140 Figure 7. Sample selection interface Figure 8. BP neural network training convergence curve interface 5. Field Application of Overflow Intelligent Early Warning System in YY Well of XX Oilfield XX oilfield YY well is a development well, which has overflow situation due to gas intrusion at 2568.6m-2610.1m, meanwhile, the neighbouring well YYS well also has gas intrusion at 2560.7m-2601.2m depth. Therefore, in this paper, the comprehensive logging data of the 2568.6m-2610.1m well section of YY well is selected as the base data, and the data of the 2560.7m-2601.2m well section of YYS well is selected as the sample data, to test the application of the overflow intelligent early warning system based on BP neural network. Before the system test, the sample data set and test sample data set were preferably produced by applying the comprehensive logging data of the 2560.7m-2601.2m well section of YYS well, respectively. According to the BP neural network-based overflow intelligent warning model building process described in this paper, the weights and threshold matrices of this well section were obtained, so as to establish the overflow intelligent warning knowledge base applicable to this well section. After establishing the knowledge base, the comprehensive logging data of well section 2568.6m- 2610.1m of well YY was input into the overflow intelligent warning model for the calculation of the overflow warning results.The basic data of the comprehensive logging data of well section 2568.6m-2610.1m of well YY and its calculation results, as well as the results of the testing of the overflow intelligent warning software system are shown in Tables 2 and 3 as well as in Figs. 9, 10, and 11, respectively. 141 Table 2. Partial measured composite logging data for well YY No. standpipe pressure (MPa) drilling time (min/m) pool volume (m3) entrance flow (L/s) outlet flow (L/s) inlet conductivity ( s/m) outlet conductivity (s/m) inlet density (g/cm3) 1 9.599 10.2 241.2 15.7 15.8 0.56 0.52 1.21 2 10.253 10.2 241.5 15.8 15.9 0.55 0.51 1.20 ...... ...... ...... ...... ...... ...... ...... ...... ...... 10 10.548 9.9 247.8 15.8 16.4 0.56 0.45 1.21 11 11.33 9.9 247.8 15.8 16.4 0.56 0.44 1.20 12 10.264 9.9 248 15.7 16.5 0.56 0.43 1.20 ...... ...... ...... ...... ...... ...... ...... ...... ...... 34 10.264 5.7 254.2 15.7 17.1 0.57 0.37 1.20 35 11.33 9.7 254.3 15.8 17.2 0.56 0.35 1.21 Table 3. Some measured comprehensive logging data and spillage warning test results for well YY No. outlet density (g/cm3) inlet temperature (°C) outlet temperature (°C) aeronautics total hydrocarbon (ppm) C1 (ppm) BP neural network output early warning result reality circumstances 1 1.18 30.26 31.64 36633 23650 (0.8933,0.1377) overflow overflow 2 1.17 30.26 32.26 43345 34482 (0.8394,0.0436) overflow overflow ...... ...... ...... ...... ...... ...... ...... ...... ...... 10 1.15 30.25 33.28 68557 56683 (0.4293,0.7456) non-overflow overflow 11 1.15 30.26 33.26 71726 64683 (0.7005,0.0707) overflow overflow 12 1.15 30.26 33.63 76865 67140 (0.7434,0.0831) overflow overflow ...... ...... ...... ...... ...... ...... ...... ...... ...... 34 1.14 30.26 35.75 89323 78546 (0.3840,0.6336) non-overflow overflow 35 1.14 30.25 35.98 92445 80277 (0.9091,0.0467) overflow overflow Figure 9. YY Well Overflow Intelligent Early Warning System Test Results1 142 Figure 10. YY Well Overflow Intelligent Early Warning System Test Results2 Figure 11. YY Well Overflow Intelligent Early Warning System Test Results3 Table 3 shows that the accuracy of the BP neural network- based overflow intelligent warning system in the 2568.6m- 2610.1m section of well YY is 91.43%, which can meet the requirements of field application. 6. Conclusions This paper completes the design and development of overflow intelligent warning module based on BP neural network according to the field application requirements of integrated logging instrument supporting overflow intelligent warning system and the analysis of the establishment process of overflow intelligent warning model. After the application test of integrated logging data of YY wells in XX oilfield, it is shown that the module has good stability and accuracy, and it is able to provide effective technical support for the on-site overflow warning, and it has good field application prospect. References [1] ZhangHe, LiQiyin, ZhangLuzhi, et al. Intelligent Early warning technology for drilling well overflow based on fuzzy expert system[J]. Journal of Southwest Petroleum University(Science & Technology Edition), 2016, 38(02): 169- 175. [2] Nhat D M, Venkatesan R, Khan F. Data-driven Bayesian network model for early kick detection in industrial drilling process[J]. Process Safety and Eenvironmental Protection, 2020, 138: 130-138. 143 [3] Abbas A K, Rushdi S, Alsaba M.Modeling rate of penetration for deviated wells using artificial neural network[C]. Abu Dhabi International Petroleum Exhibition and Conference, Abu Dhabi, 2018. [4] Mohammad D, Lohrasb F, Mostafa S. Performance assessment of rotary drilling using non-linear multiple regression analysis and multilayer perceptron neural network[J]. Bulletin of Engineering Geology and the Environment, 2019, 78(3): 1501- 1513. [5] Somadina M, Ramachandran V, Faisal K. Supervised data- driven approach to early kick detection during drilling operation[J]. Journal of Petroleum Science and Engineering, 2020, 192: 107324. [6] Yin q s, Yang j, Tyagi M, et al. Downhole quantitative evaluation of gas kick during deepwater drilling with deep learning using pilot-scale rig data[J]. Journal of Petroleum Science and Engineering, 2022, 208: 109136. [7] Osarogiagbon, Augustine, Muojeke, et al. A new methodology for kick detection during petroleum drilling using long short- term memory recurrent neural network[J]. Transactions of The Institution of Chemical Engineers. Process Safety and Environmental Protection, Part B, 2020, 142: 126-137. [8] SunTing, ZhaoYin, YangJin et al. Real-time Intelligent identification of drilling conditions based on support vector machines[J]. Petroleum Drilling Techniques, 2019, 47(05): 28- 33. [9] ShiXiaoyan, ZhouYingcao, ZhaoLiping et al. Research on real- time judgement method of spillage based on random forests[J]. Drilling and Production Technology, 2020, 43(01): 9-12+7. [10] TuSiyu, PengPingan, JangYuanjian. Research on intelligent recognition technology of abnormal working conditions in downhole environment based on deep learning[J]. Journal of Safety Science and Technology, 2018, 14(11): 58-63. [11] Gao Xiaorong, Xu Yingzhuo, Li Qi. CBR-based intelligent diagnosis and processing system for underground complex situations and accidents[J]. Computer Application Research, 2008, 25(5): 1446-1449. [12] SiMenghan, Research on real-time early warning method of drilling overflow[D]. Southwest Petroleum University, 2017. [13] Jiang Yong, Bai Shengping, Zhao Shubin et al. Application of integrated logging technology on drilling engineering[J]. Oil Drilling Process, 2009, 9(add 2): 79-82. [14] HanJunwei, YangHongman, ZhangJunyang. Accurate spillage detection study and field application in northwest work zone[J]. Mud Logging Engineering, 2017, 28(03): 69-74. [15] TangYongqiang. Research on early overflow rapid warning technology and system design[D]. Southwest Petroleum University, 2019. [16] WangYuhao. Research and implementation of complex early warning algorithm for spillage in drilling processes[D]. University Of Electronic Science And Technology Of China, 2022. [17] Zhang Jide, Zhang Yonggang, Han Guosheng et al. Application of drilling fluid recording parameters in drilling engineering anomaly forecasting[J]. c Engineering Recording, 2010, 9(3): 39-43.