Oil and gas well yield prediction method and device based on sparrow search algorithm

The weight and threshold of the BP neural network are optimized through the sparrow search algorithm, and the problem of slow convergence speed of oil and gas well output prediction in the prior art is solved, and higher prediction accuracy and faster convergence speed are achieved.

CN120258181APending Publication Date: 2025-07-04CHINA PETROLEUM & CHEMICAL CORP +1
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202410011234.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing BP neural network has the problem of slow convergence speed and easy to fall into local optimal solutions in the prediction of oil and gas well output, resulting in low prediction accuracy.

Method used

The BP neural network is optimized by using the sparrow search algorithm. By initializing the weights and thresholds, the mechanisms of sparrow foraging and anti-predation behaviors are used to optimize the weights and thresholds of the neural network to achieve automatic optimization.

Benefits of technology

The accuracy of oil and gas well output prediction is improved, the cumbersome parameter adjustment process is avoided, and the convergence speed and prediction effect of the neural network are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120258181A_ABST
    Figure CN120258181A_ABST
Patent Text Reader

Abstract

The invention provides an oil and gas well yield prediction method and device based on a sparrow search algorithm, and relates to the technical field of oil and gas field development, and the method comprises the steps: obtaining geological parameters and development parameters of a target oil and gas well; the geological parameters and the development parameters serve as input, and the predicted yield of the target oil and gas well in the target time period is generated through a pre-trained oil and gas well yield prediction model; the oil and gas well yield prediction model is obtained by training a BP neural network and a sparrow search algorithm through historical geological parameters and development parameters of a target oil and gas well. The BP neural network is optimized based on the sparrow search algorithm, the problems that an existing BP neural network is low in convergence speed and prone to falling into a local optimal solution are solved, automatic optimization of the neural network weight and the threshold value is achieved, the tedious parameter adjusting process of a conventional neural network is avoided, and meanwhile the prediction precision of the oil and gas well yield is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of oil and gas field development, and specifically relates to a method for predicting the production of oil and gas wells based on the sparrow search algorithm, an apparatus for predicting the production of oil and gas wells based on the sparrow search algorithm, a computer-readable storage medium, and a terminal device. Background Art

[0002] The prediction of oil and gas well production is one of the important contents in the design of oil and gas reservoir development plans. The current production prediction methods can be divided into three categories: mechanism model production prediction methods, decline curve production prediction methods, and intelligent algorithm production prediction methods based on big data. In the field of unconventional oil and gas well production prediction, mechanism-based production prediction models are mostly established based on the dual-porosity theory. The dual-porosity theory assumes that a fractured oil and gas reservoir consists of a uniformly distributed matrix system and a natural fracture system. In 1945, Arps established exponential decline, hyperbolic decline, and harmonic decline models for predicting the production of oil and gas wells based on the decline law of oil wells. However, most of these models are applicable to the development of conventional oil and gas reservoirs to solve the seepage problems of unconventional oil and gas reservoirs.

[0003] At the same time, the above two types of methods are both established based on certain assumptions and cannot reflect the true formation seepage law 100%. To solve the defects of traditional prediction methods, technologies such as random forest algorithms, support vector machines, and artificial neural networks have been applied in the field of productivity prediction. In 2008, Ni Hongmei et al. used an artificial neural network for productivity prediction and established a three-layer BP neural network model. However, this neural network has problems such as slow convergence speed and low accuracy. To improve the convergence speed, in 2011, Li Chunsheng et al. optimized the loss function based on the BP neural network using the L-M (Levenberg-Marquardt) algorithm to accelerate convergence, but the weights and thresholds of the network were not optimized, and there were still problems with low convergence accuracy. In 2015, Ma Linmao optimized the BP neural network using a genetic algorithm to optimize the network weights, but the neural network still has problems such as slow convergence and getting stuck in local optima in data with strong volatility. Summary of the Invention

[0004] The purpose of the embodiments of the present application is to provide a method and apparatus for predicting the production of oil and gas wells based on the sparrow search algorithm to solve the above problems.

[0005] To achieve the above purpose, the first aspect of the present application provides a method for predicting the production of oil and gas wells based on the sparrow search algorithm, including:

[0006] Obtain the geological parameters and development parameters of the target oil and gas well;

[0007] Using the geological parameters and development parameters as inputs, the pre-trained oil and gas well production prediction model generates the predicted production of the target oil and gas well in the target time period;

[0008] The oil and gas well production prediction model is obtained by training a BP neural network and a sparrow search algorithm with the historical geological parameters and development parameters of the target oil and gas well.

[0009] Optionally, the training process of the oil and gas well production prediction model is as follows:

[0010] Obtain the historical geological parameters and development parameters of the target oil and gas well, and obtain the actual production corresponding to each historical geological parameter and development parameter;

[0011] Divide the obtained historical geological parameters and development parameters, and the actual production corresponding to each historical geological parameter and development parameter into a training set, a test set, and a validation set according to a preset ratio;

[0012] Train the BP neural network according to the training set and the sparrow search algorithm to obtain a training model;

[0013] Verify the training model according to the validation set to obtain a verification model;

[0014] Test the verification model according to the test set to obtain an oil and gas well production prediction model.

[0015] Optionally, the geological parameters include: porosity, permeability, formation thickness, and crude oil viscosity;

[0016] The development parameters include: horizontal well length, number of artificial fractures, artificial fracture radius, gas well production, production time, daily production duration of the gas well, oil pressure, and casing pressure.

[0017] Optionally, the training of the BP neural network according to the training set and the sparrow search algorithm to obtain a training model includes:

[0018] Determine the number of input layer and output layer nodes of the BP neural network according to the historical geological parameters and development parameters in the training set, and the actual production corresponding to the historical geological parameters and development parameters;

[0019] Determine the number of hidden layer nodes of the BP neural network according to a preset empirical formula;

[0020] Initialize the weights and thresholds of the BP neural network;

[0021] Optimize the weights and thresholds of the BP neural network through the sparrow search algorithm;

[0022] Train the BP neural network based on the historical geological parameters and development parameters in the training set, as well as the actual production corresponding to the historical geological parameters and development parameters, obtain the error between the predicted output value and the expected output value of the BP neural network, and update the weights and thresholds of the BP neural network through backpropagation until the mean absolute percentage error between the predicted output value and the expected output value is less than the preset error threshold, thus obtaining the training model.

[0023] Optionally, optimize the weights and thresholds of the BP neural network through the sparrow search algorithm, including:

[0024] S100. Initialize the sparrow population parameters, where the sparrow population parameters include population size, iteration number threshold, proportion of discoverers in the population, proportion of joiners, and proportion of vigilant ones;

[0025] S200. Calculate the fitness value of each sparrow individual;

[0026] S300. Based on the fitness values of the sparrow individuals, update the positions of the discoverers through the discoverer position update function, update the positions of the joiners through the joiner position update function, and update the positions of the vigilant ones through the vigilant position update function to determine the current optimal position of the sparrow individuals;

[0027] S400. Determine whether the current iteration number has reached the iteration number threshold. If so, use the current optimal position of the sparrow individuals as the optimal weights and thresholds of the BP neural network; otherwise, execute step S200.

[0028] Optionally, the discoverer position update function is:

[0029]

[0030] Where represents the j - th dimension position of the i - th sparrow individual in the (t + 1) - th generation, t is the current iteration number, j = 1, 2, 3, …, d, d is the dimension value, X i,j is the j - th dimension position of the i - th sparrow individual in the t - th generation, iter max is the maximum iteration number, Q is a random number following the standard normal distribution, α ∈ (0, 1], L represents a 1×d matrix, R2 is the early warning value, and ST is the safety value;

[0031] The joiner position update function is:

[0032]

[0033] Where represents the position of the individual with the best fitness value in the (t + 1) - th generation population, X worstrepresents the individual with the worst fitness value of the current individual. A represents a 1×d matrix, where each element is randomly assigned 1 or -1, and A + = A T (AA T ) -1 , where n is the number of individuals in the sparrow population;

[0034] The update function of the vigilant position is as follows:

[0035]

[0036] where, is the global optimal position in the t-th generation, β is a random number following a standard normal distribution with mean and variance of 0 and 1 respectively, K ∈ [-1, 1], ε is a small constant, f i represents the fitness value of the current population individuals, f g and f w represent the current global optimal and worst individual fitness values respectively.

[0037] Optionally, the preset empirical formula is:

[0038]

[0039] where, m is the number of input layer nodes, n is the number of output layer nodes, and a is an integer between 1 and 10.

[0040] In the second aspect of the present application, there is provided an oil and gas well production prediction device based on the sparrow search algorithm, including:

[0041] A data acquisition module configured to acquire the geological parameters and development parameters of the target oil and gas well;

[0042] A production prediction module configured to use the geological parameters and development parameters as inputs and generate the predicted production of the target oil and gas well in the target time period through a pre-trained oil and gas well production prediction model;

[0043] The oil and gas well production prediction model is obtained by training a BP neural network and the sparrow search algorithm with the historical geological parameters and development parameters of the target oil and gas well.

[0044] In the third aspect of the present application, there is provided a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to execute the oil and gas well production prediction method based on the sparrow search algorithm as described above.

[0045] In a fourth aspect of the present application, a terminal device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned oil and gas well production prediction method based on the sparrow search algorithm is implemented.

[0046] The embodiments provided in the present application have the following beneficial effects:

[0047] The present application optimizes the BP neural network based on the sparrow search algorithm, solves the problems existing in the existing BP neural network, such as slow convergence speed and easy to fall into local optimal solutions, realizes the automatic optimization of the weights and thresholds of the neural network, avoids the cumbersome parameter adjustment process of the conventional neural network, and at the same time improves the prediction accuracy of the oil and gas well production.

[0048] Other features and advantages of the embodiments or implementation manners of the present application will be described in detail in the subsequent specific implementation manners section. Description of the Drawings

[0049] The drawings are used to provide a further understanding of the embodiments of the present application, and constitute a part of the specification, and are used to explain the embodiments of the present application together with the following specific implementation manners, but do not constitute a limitation to the embodiments of the present application. In the drawings:

[0050] Figure 1 Schematically shows a method flow chart of the oil and gas well production prediction method based on the sparrow search algorithm according to the implementation manner of the present application;

[0051] Figure 2 Schematically shows a schematic diagram of the BP neural network optimization logic according to the implementation manner of the present application;

[0052] Figure 3 Schematically shows a comparison schematic diagram of the production prediction effect before the sparrow search algorithm optimization according to the implementation manner of the present application;

[0053] Figure 4 Schematically shows a comparison schematic diagram of the production prediction effect after the sparrow search algorithm optimization according to the implementation manner of the present application;

[0054] Figure 5 Schematically shows a schematic block diagram of the oil and gas well production prediction device based on the sparrow search algorithm according to the implementation manner of the present application;

[0055] Figure 6 Schematically shows a schematic diagram of the structure of a terminal device according to the implementation manner of the present application.

[0056] Description of the Reference Numerals

[0057] 10 - Terminal device, 100 - Processor, 101 - Memory, 102 - Computer program. Detailed implementation manners

[0058] The following further describes in detail the specific implementation manners of the embodiments of the present application with reference to the accompanying drawings. It should be understood that the specific implementation manners described herein are only for explaining and illustrating the embodiments of the present application, and are not used to limit the embodiments of the present application.

[0059] To solve the above problems, as Figure 1 shown, a method for predicting the production of oil and gas wells based on the sparrow search algorithm is provided in the first aspect of the present application, including: obtaining the geological parameters and development parameters of the target oil and gas well; taking the geological parameters and development parameters as inputs, and generating the predicted production of the target oil and gas well in the target time period through a pre-trained oil and gas well production prediction model; the oil and gas well production prediction model is obtained by training a BP neural network and a sparrow search algorithm with the historical geological parameters and development parameters of the target oil and gas well.

[0060] In this way, the present application optimizes the BP neural network based on the sparrow search algorithm, solves the problems of slow convergence speed and easy falling into local optimal solutions existing in the existing BP neural network, realizes the automatic optimization of the weights and thresholds of the neural network, avoids the cumbersome parameter adjustment process of the conventional neural network, and at the same time improves the prediction accuracy of the production of oil and gas wells.

[0061] Among them, the geological parameters include: porosity, permeability, formation thickness, and crude oil viscosity; the development parameters include: horizontal well length, number of artificial fractures, radius of artificial fractures, gas well production, production time, daily production duration of the gas well, oil pressure, and casing pressure.

[0062] Specifically, the training process of the oil and gas well production prediction model of the present application is as follows:

[0063] Step 1: Obtain the historical geological parameters and development parameters of the target oil and gas well, and obtain the actual production corresponding to each historical geological parameter and development parameter. It can be understood that the historical geological parameters and development parameters of the target oil and gas well can be the geological parameters and development parameters in a certain historical period; for example, the geological parameters and development parameters in the preset historical period, and the actual production corresponding to each historical geological parameter and development parameter can be directly used as the final training data; or, the selection of historical geological parameters and development parameters can be obtained through the following method:

[0064] Obtain the geological parameters and development parameters in the preset historical period, and the actual production corresponding to each historical geological parameter and development parameter.

[0065] Calculate the average value of all historical actual production volumes, calculate the difference between each historical actual production volume and this average value, and use the historical geological parameters and development parameters corresponding to the historical actual production volumes with the absolute value of the difference between the historical actual production volume and this average value being less than the first difference threshold as the first training data to form the first training data set; use the historical geological parameters and development parameters corresponding to the historical actual production volumes with the absolute value of the difference between the historical actual production volume and this average value being not less than the first difference threshold and less than the second difference threshold as the second training data to form the second training data set; use the historical geological parameters and development parameters corresponding to the historical actual production volumes with the absolute value of the difference between the historical actual production volume and this average value being not less than the second difference threshold as the third training data to form the third training data set, where the first difference threshold is less than the second difference threshold; randomly select the historical geological parameters and development parameters in the first training data set, the second training data set, and the third training data set according to a preset ratio as the final training data. For example, if the preset ratio is that the ratio of the first training data set, the second training data set, and the third training data set is 1:1:1, then in the final training data set, the ratio of the training data from the first training data set, the second training data set, and the third training data set is 1:1:1 until the obtained training data reaches the quantity requirement.

[0066] Step 2: Divide the obtained historical geological parameters and development parameters, and the actual production volumes corresponding to each historical geological parameter and development parameter into a training set, a test set, and a validation set according to a preset ratio. For example, use 70% of the obtained data as the training set, 20% as the cross-validation set, and 10% as the test set, and perform normalization processing on the data;

[0067] Step 3: Train the BP neural network based on the training set and the sparrow search algorithm to obtain a training model. Among them, the activation function can preferably be the Tansig activation function and the Trainlm training function, and the BP neural network is a single-layer BP neural network; among them, the predicted values of the BP neural network under different activation functions are shown in Table 1. It can be seen that the prediction effect is the best when the activation function of the input layer is selected as the hyperbolic tangent S-shaped transfer function (Tansig). Therefore, the activation function can preferably be Tansig;

[0068] Activation function Logsid Tansig Purelin Mean absolute percentage error, % 16.87% 8.93% 17.41%

[0069] Table 1

[0070] When the activation function is Tansig, the prediction accuracy of the BP network under different training functions is shown in Table 2. It can be seen that the prediction effect is the best when the training function is Trainlm (L-M algorithm). Therefore, the training function is preferably Trainlm;

[0071] Training function Traingd Trainrp Trainbfg Trainlm Mean absolute percentage error, % 21.59% 47.56% 14.33% 9.37%

[0072] Table 2

[0073] Step 4: Verify the trained model based on the validation set to obtain a verified model;

[0074] Step 5: Test the verified model based on the test set to obtain an oil and gas well production prediction model.

[0075] Among them, training the BP neural network based on the training set and the sparrow search algorithm to obtain a training model, including:

[0076] Determine the number of nodes in the input layer and output layer of the BP neural network according to the historical geological parameters and development parameters in the training set, and the actual production corresponding to the historical geological parameters and development parameters. For example, in this application, there are 12 historical geological parameters and development parameters in total, so the number of nodes in the input layer is 12, and the output is the predicted production, so the number of nodes in the output layer is 1;

[0077] Determine the number of nodes in the hidden layer of the BP neural network according to a preset empirical formula, where the preset empirical formula is: Among them, m is the number of nodes in the input layer, n is the number of nodes in the output layer, and a is an integer between 1 and 10;

[0078] Among them, the number of neurons in the hidden layer of the single hidden layer network model is 7, the optimal number of nodes in the first hidden layer of the double hidden layer neural network model is 9, the optimal number of nodes in the second hidden layer is 5, and the optimal number of nodes in the first hidden layer of the triple hidden layer neural network is 8, the optimal number of nodes in the second hidden layer is 5, and the optimal number of nodes in the third hidden layer is 3; The model prediction results are shown in Table 3, and the results show that the prediction effect of the double hidden layer is better;

[0079] Evaluation criterion Double hidden layer Triple hidden layer Single hidden layer Mean absolute percentage error, % 7.77% 10.25% 14.93%

[0080] Table 3

[0081] Initialize the weights and thresholds of the BP neural network;

[0082] Optimize the weights and thresholds of the BP neural network through the sparrow search algorithm;

[0083] Train the BP neural network according to the historical geological parameters and development parameters in the training set, and the actual production corresponding to the historical geological parameters and development parameters, obtain the error between the predicted output value and the expected output value of the BP neural network, and update the weights and thresholds of the BP neural network through backpropagation until the mean absolute percentage error between the predicted output value and the expected output value is less than the preset error threshold to obtain a training model.

[0084] In this application, the mean absolute percentage error (MAPE) is used as an evaluation index for the prediction accuracy of the model. The mean absolute percentage error refers to the ratio of the absolute value of the error of all predicted values to the actual value. The closer its value is to 0, the more accurate the prediction. Among them, x i represents the true value, represents the predicted value, and m is the sample size.

[0085] As Figure 2 shown, in this application, the weights and thresholds of the BP neural network are optimized by the sparrow search algorithm, including:

[0086] S100. Initialize the sparrow population parameters. The sparrow population parameters include population size, iteration number threshold, proportion of discoverers in the population, proportion of joiners, and proportion of vigilant ones. In this application, it is preferred that the population size is 30, the maximum number of evolutionary generations, that is, the iteration number threshold, is set to 50, and the proportion of discoverers in the sparrow population is determined to be 70%, the proportion of joiners is 30%, and the proportion of vigilant ones is 20%;

[0087] S200. Calculate the fitness value of each sparrow individual;

[0088] S300. Based on the fitness value of the sparrow individual, update the position of the discoverer through the discoverer position update function, update the position of the joiner through the joiner position update function, and update the position of the vigilant one through the vigilant one position update function to determine the current optimal position of the sparrow individual;

[0089] S400. Judge whether the current iteration number reaches the iteration number threshold. If so, use the current optimal position of the sparrow individual as the optimal weights and thresholds of the BP neural network. Otherwise, execute step S200.

[0090] Among them, the population of n sparrows is represented by the matrix X as follows:

[0091]

[0092] The fitness function can be expressed as:

[0093]

[0094] Among them, F x is the sparrow population fitness value, f is the sparrow individual fitness value in the sparrow population, X is the population of n sparrows, n is the number of individuals in the sparrow population, and d is the position variable dimension of a single sparrow.

[0095] The Sparrow Search Algorithm (SSA) is a new swarm intelligence optimization algorithm proposed based on the foraging and anti-predation behaviors of sparrows. Its principle is as follows: Sparrows consist of three parts during the foraging process: discoverers, joiners, and early warning birds. In SSA, the discoverers with higher fitness will guide the population to search for and forage for food during the food search process. The joiners will follow the discoverers to forage in order to obtain higher fitness. When the sparrow population realizes danger, anti-predation behaviors will occur.

[0096] Specifically, after initializing the population of the sparrow search algorithm, in order to find the optimal sparrow individual fitness value and position, the position information of the discoverers is updated iteratively through the discoverer position update function. Among them, the discoverer position update function is:

[0097]

[0098] Among them, represents the j-th dimension position of the i-th sparrow individual in the (t + 1)-th generation. t is the current iteration number, j = 1, 2, 3, …, d, where d is the dimension value, X i,j is the j-th dimension position of the i-th sparrow individual in the t-th generation, iter max is the maximum number of iterations, Q is a random number obeying the standard normal distribution, α ∈ (0, 1], L represents a 1×d matrix, R2 is the early warning value, and ST is the safety value; when R2 < ST, it indicates that the foraging environment of the sparrow population is relatively safe and there is no predator invasion, and the discoverers can search for a wider range of food. When R2 ≥ ST, it indicates that some sparrows in the population have discovered the invasion of predators and at the same time issue warnings to other sparrows in the population. At this time, the entire sparrow population will quickly fly to a safe place to forage.

[0099] After updating the positions of the discoverers in the sparrow population, in order to increase the search accuracy, the positions of the sparrow joiners are iteratively updated according to the joiner position update function. The joiner position update function is:

[0100]

[0101] Among them, represents the position of the individual with the best fitness value in the (t + 1)-th generation population, X worst represents the individual with the worst current individual fitness value, A represents a 1×d matrix, where each element is randomly assigned 1 or -1, and A + = A T (AA T ) -1 , n is the number of individuals in the sparrow population; when i > n / 2, it indicates that the i-th joiner has no food and has a low fitness, and is in a hungry state and needs to fly to other places to forage to obtain higher energy; when i ≤ n / 2, it indicates that the i-th joiner will be at the current optimal position Xp Find a suitable location to forage in the nearby area.

[0102] Regarding problems such as the possibility of falling into local optimal solutions, the sparrow search algorithm introduces sentinels to help the algorithm find the optimal sparrow individuals and the best fitness value faster and more accurately. The position of the sparrow sentinels is iteratively updated according to the sentinel position update function, and the sentinel position update function is:

[0103]

[0104] Where, is the global optimal position in the t-th generation, β is a random number obeying a standard normal distribution with a mean and variance of 0 and 1 respectively, K ∈ [-1, 1], ε is a small constant, f i represents the fitness value of the current population individuals, f g and f w represent the current global optimal and worst individual fitness values respectively. When f i > f best , at this time, the sparrows are foraging at the edge of the population and are easily attacked by predators; when f i = f best , the sparrows in the middle of the population will realize the danger and will fly to the positions of other sparrows to forage in order to reduce the probability of being preyed on.

[0105] On this basis, the SSA is used to optimize the single-layer BP neural network, double-layer BP neural network, and three-layer BP neural network respectively. The population size of the sparrow algorithm is set to 30, and the maximum number of generations for population evolution is 50. Among them, the proportion of discoverers is set to 70%, and the proportion of sentinels is set to 20%. The best sparrow individuals optimized by the sparrow search algorithm are used as the weights and thresholds of the BP neural network to optimize the BP neural network. The evaluation results are shown in Table 4. After optimizing the weights and thresholds by the SSA, the prediction effect of the BP network model with double hidden layers is better.

[0106] Evaluation criterion SSA - double - layer BP SSA - triple - layer BP SSA - single - layer BP Mean absolute percentage error, % 4.60% 8.25% 10.76%

[0107] Table 4

[0108] The prediction effects of the double-layer BP model optimized by the sparrow search algorithm and the model not optimized by the sparrow search algorithm on the gas well productivity are as Figure 3 and Figure 4 shown. As Figure 3It can be seen that the BP neural network model without optimization by the sparrow search algorithm has a poor fitting result in the training stage, and the predicted values of the model in the learning stage are generally lower than the actual production values. This is because the selection of the weights and thresholds of the model without SSA optimization is random, and it is still difficult to directly use even if other hyperparameters of this model have been optimized. The model optimized by the sparrow algorithm has significantly better fitting effect in the training stage and test results in the test stage.

[0109] To further verify the practicability and stability of the SSA-BP neural network established in this application, this application uses the SSA-BP neural network, HongYuan model, and Arps model to predict the production capacity based on the actual production data of 20 tight gas wells in the Ordos Basin, and the prediction result errors are shown in Table 5.

[0110]

[0111] Table 5

[0112] It can be seen from this that when the prediction ratio is 10%, the average prediction days are 49.75 days. The mean absolute average percentage error of the SSA-BP model prediction is 3.97%, the mean absolute average percentage error of the HongYuan model prediction is 33.04%, and the mean absolute average percentage error of the Arps model prediction is 22.94%. When the prediction ratio is 20%, the average prediction days are 99.5 days, and the mean absolute average percentage error of the SSA-BP model prediction is 20.16%.

[0113] As Figure 5 shown, in the second aspect of this application, a device for predicting oil and gas well production based on the sparrow search algorithm is provided, including:

[0114] A data acquisition module configured to acquire the geological parameters and development parameters of the target oil and gas well;

[0115] A production prediction module configured to generate the predicted production of the target oil and gas well in the target time period by using the pre-trained oil and gas well production prediction model with the geological parameters and development parameters as inputs;

[0116] The oil and gas well production prediction model is obtained by training the BP neural network and the sparrow search algorithm with the historical geological parameters and development parameters of the target oil and gas well.

[0117] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above division of each functional unit and module is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application.

[0118] In the third aspect of this application, a computer-readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to execute the oil and gas well production prediction method based on the sparrow search algorithm as described above.

[0119] In the fourth aspect of this application, a terminal device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned oil and gas well production prediction method based on the sparrow search algorithm is implemented.

[0120] As Figure 6 shown is a schematic diagram of the terminal device provided by the embodiment of this application. As Figure 6 shown, the terminal device 10 of this embodiment includes: a processor 100, a memory 101, and a computer program 102 stored in the memory 101 and executable on the processor 100. When the processor 100 executes the computer program 102, the steps in the above method embodiments are implemented. Alternatively, when the processor 100 executes the computer program 102, the functions of each module / unit in the above device embodiments are implemented.

[0121] Exemplarily, the computer program 102 can be divided into one or more modules / units. One or more modules / units are stored in the memory 101 and executed by the processor 100 to complete this application. One or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program 102 in the terminal device 10.

[0122] The terminal device 10 can be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The terminal device 10 may include, but is not limited to, a processor 100 and a memory 101. Those skilled in the art can understand that Figure 6This is only an example of the terminal device 10, which does not constitute a limitation on the terminal device 10. It may include more or fewer components than those shown in the figure, or combine certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.

[0123] The processor 100 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0124] The memory 101 may be an internal storage unit of the terminal device 10, such as the hard disk or memory of the terminal device 10. The memory 101 may also be an external storage device of the terminal device 10, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the terminal device 10. Further, the memory 101 may also include both the internal storage unit and the external storage device of the terminal device 10. The memory 101 is used to store computer programs and other programs and data required by the terminal device 10. The memory 101 may also be used to temporarily store data that has been output or is to be output.

[0125] Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0126] It should also be noted that the term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the phrase "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.

[0127] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. An oil and gas well production prediction method based on the sparrow search algorithm, characterized in that Including: Obtain the geological parameters and development parameters of the target oil and gas well; Using the geological parameters and development parameters as inputs, the pre-trained oil and gas well production prediction model generates the predicted production of the target oil and gas well in the target time period; The oil and gas well production prediction model is obtained by training a BP neural network and a sparrow search algorithm with the historical geological parameters and development parameters of the target oil and gas well.

2. The oil and gas well production prediction method based on the sparrow search algorithm according to claim 1, wherein The training process of the oil and gas well production prediction model is as follows: Obtain the historical geological parameters and development parameters of the target oil and gas well, and obtain the actual production corresponding to each historical geological parameter and development parameter; Divide the obtained historical geological parameters and development parameters, and the actual production corresponding to each historical geological parameter and development parameter into a training set, a test set, and a validation set according to a preset ratio; Train the BP neural network based on the training set and the sparrow search algorithm to obtain a training model; Verify the training model based on the validation set to obtain a verification model; Test the verification model based on the test set to obtain an oil and gas well production prediction model.

3. The oil and gas well production prediction method based on the sparrow search algorithm according to claim 1, characterized in that The geological parameters include: porosity, permeability, formation thickness, and crude oil viscosity; The development parameters include: horizontal well length, number of artificial fractures, artificial fracture radius, gas well production, production time, daily production duration of the gas well, oil pressure, and casing pressure.

4. The oil and gas well production prediction method based on the sparrow search algorithm according to claim 2, wherein, The training of the BP neural network based on the training set and the sparrow search algorithm to obtain a training model includes: Determine the number of input layer and output layer nodes of the BP neural network based on the historical geological parameters and development parameters in the training set, and the actual production corresponding to the historical geological parameters and development parameters; Determine the number of hidden layer nodes of the BP neural network according to a preset empirical formula; Initialize the weights and thresholds of the BP neural network; Optimize the weights and thresholds of the BP neural network through the sparrow search algorithm; Train the BP neural network based on the historical geological parameters and development parameters in the training set, and the actual production corresponding to the historical geological parameters and development parameters, obtain the error between the predicted output value and the expected output value of the BP neural network, and update the weights and thresholds of the BP neural network through backpropagation until the mean absolute percentage error between the predicted output value and the expected output value is less than the preset error threshold to obtain the training model.

5. The oil and gas well production prediction method based on the sparrow search algorithm according to claim 4, characterized in that, Optimizing the weights and thresholds of the BP neural network through the sparrow search algorithm includes: S100. Initialize the sparrow population parameters, where the sparrow population parameters include population size, iteration number threshold, proportion of discoverers in the population, proportion of joiners, and proportion of vigilant ones; S200. Calculate the fitness value of each sparrow individual; S300. Based on the fitness value of the sparrow individual, update the position of the discoverer through the discoverer position update function, update the position of the joiner through the joiner position update function, and update the position of the vigilant one through the vigilant position update function to determine the current optimal position of the sparrow individual; S400. Determine whether the current iteration number has reached the iteration number threshold. If so, use the current optimal position of the sparrow individual as the optimal weights and thresholds of the BP neural network. Otherwise, execute step S200.

6. The oil and gas well production prediction method based on the sparrow search algorithm according to claim 5, characterized in that The discoverer position update function is: Among them, represents the j-th dimension position of the i-th sparrow individual in the (t + 1)-th generation, where t is the current iteration number, j = 1, 2, 3, …, d, d is the dimension value, and X i,j is the j-th dimension position of the i-th sparrow individual in the t-th generation, iter max is the maximum number of iterations, Q is a random number obeying the standard normal distribution, α ∈ (0, 1], L represents a 1×d matrix, R2 is the warning value, and ST is the safety value; The joiner position update function is as follows: Among them, represents the position of the individual with the best fitness value in the (t + 1)-th generation population, X worst represents the individual with the worst fitness value among the current individuals, A represents a 1×d matrix, where each element is randomly assigned 1 or -1, and A + = A T (AA T ) -1 , and n is the number of individuals in the sparrow population; The sentinel position update function is as follows: Among them, is the global optimal position in the t-th generation, β is a random number following a standard normal distribution with mean and variance of 0 and 1 respectively, K ∈ [-1, 1], ε is a small constant, f i represents the fitness value of the current population individuals, f g and f w represent the fitness values of the current global optimal and worst individuals respectively.

7. The oil and gas well production prediction method based on the sparrow search algorithm according to claim 4, wherein The preset empirical formula is as follows: Where m is the number of input layer nodes, n is the number of output layer nodes, and a is an integer between 1 and 10.

8. An oil and gas well production prediction device based on the sparrow search algorithm, characterized in that, It includes: A data acquisition module configured to acquire the geological parameters and development parameters of the target oil and gas well; A production prediction module configured to generate the predicted production of the target oil and gas well in the target time period by using the geological parameters and development parameters as inputs and through a pre-trained oil and gas well production prediction model; The oil and gas well production prediction model is obtained by training a BP neural network and a sparrow search algorithm with the historical geological parameters and development parameters of the target oil and gas well.

9. A computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to execute the oil and gas well production prediction method based on the sparrow search algorithm according to any one of claims 1-7.

10. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the oil and gas well production prediction method based on the sparrow search algorithm according to any one of claims 1-7.

Citation Information

Cited By

  • Environmental parameter evolution analysis method based on sparrow search algorithm optimization

    CN121412958A

  • Frozen soil zone thickness evolution analysis method based on sparrow search algorithm optimization

    CN121412959A

  • Artificial intelligence modeling analysis method for hydrate pilot production data set

    CN121598758A

  • A hydrate test production data set artificial intelligence modeling analysis method

    CN121598758B

  • Stratum temperature and pressure machine learning analysis method based on sparrow search algorithm optimization

    CN121661379A