Method and device for calculating solid phase content of oil-based drilling fluid
By combining BP neural network and genetic algorithm, a relationship model between oil-based drilling fluid parameters and solid content was established, which solved the problems of long cycle and high risk of traditional detection methods and realized rapid and accurate calculation of solid content.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DAQING DRILLING ENGINEERING CO LTD
- Filing Date
- 2024-11-04
- Publication Date
- 2026-05-08
AI Technical Summary
Existing methods for detecting the solid content of oil-based drilling fluids involve long experimental cycles, complex operating procedures, and the risk of high-temperature burns.
By combining BP neural network and genetic algorithm, a relationship model between oil-based drilling fluid parameters and solid content is established. The solid content is then calculated using computer artificial intelligence, which simplifies the operation process and reduces safety risks.
It achieves simplicity and accuracy in calculating solid content, has a short detection cycle, eliminates the risk of high-temperature burns, improves the maintenance efficiency of oil-based drilling fluids, and has a model fitting error of only 3.11%.
Smart Images

Figure CN121997688A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of oil-based drilling fluid technology, and in particular to a method and apparatus for calculating the solid content of oil-based drilling fluid. Background Technology
[0002] Currently, the solid content of oil-based drilling fluids is typically determined using a solid content analyzer according to the method specified in the national standard GB / T 16783.2 Field Testing of Drilling Fluids for Petroleum and Natural Gas Industry Part 2: Oil-based Drilling Fluids. This instrument heats a known volume of oil-based drilling fluid sample in a distiller, causing the liquid phase components to evaporate, condense, and be collected in a graduated cylinder to obtain the volume fraction of the liquid phase in the sample. The solid content in the sample is then calculated. This method has drawbacks such as a long experimental cycle, complex operation procedures, and the risk of burns from high temperatures during the experiment. Summary of the Invention
[0003] This invention addresses the problems of long experimental testing cycles and complex operation procedures in traditional methods for detecting the solid content of oil-based drilling fluids, providing a method for calculating the solid content of oil-based drilling fluids. This method offers advantages such as a short calculation cycle and simple operation procedures, reducing experimental testing safety risks and improving the efficiency of on-site oil-based drilling fluid maintenance. This invention also provides a device for calculating the solid content of oil-based drilling fluids.
[0004] The present invention solves its problems through the following technical solution:
[0005] The primary objective of this invention is to provide a method for calculating the solid content of oil-based drilling fluids, comprising the following steps:
[0006] S1: Collect multiple sets of field drilling data of oil-based drilling fluid and conduct correlation analysis of oil-based drilling fluid parameters;
[0007] S2: Establish a neural network dataset sample; divide the sample into a training set and a test set;
[0008] S3: Construct a BP neural network model and train the constructed BP neural network model;
[0009] S4: Integrate the genetic algorithm into the BP neural network to construct a BP neural network with the genetic algorithm, thus preventing the BP neural network from encountering local optima during training.
[0010] S5: Using a trained BP neural network model, establish a method for calculating the solid content of oil-based drilling fluids.
[0011] Furthermore, the parameters that are highly correlated with the solid content are funnel viscosity, initial shear force, final shear force, reading at 600 rpm, reading at 300 rpm, reading at 200 rpm, reading at 100 rpm, reading at 6 rpm, reading at 3 rpm, dynamic shear force, plastic viscosity, and demulsification voltage.
[0012] Furthermore, the method for conducting correlation analysis of oil-based drilling fluid parameters in S1 is as follows: using software, the Pearson correlation coefficient between the solid content and other drilling fluid parameters in the collected actual drilling data is analyzed, and data with high correlation to solid content are selected and used together with the solid content parameter as data samples for the next step of dividing the input set and output set.
[0013] Furthermore, the software used is SPSS analysis software.
[0014] Furthermore, the training set mentioned in step S2 is used to train the model to establish the functional relationship between the input set and the output set, and the test set is used to detect the accuracy of the model.
[0015] Furthermore, in step S2, the ratio of the training set to the test set is 3:1.
[0016] Furthermore, the method for constructing the BP neural network model in step S3 is as follows:
[0017] Import the input and output sets using the software, and set up a three-layer neural network structure including an input layer, hidden layers, and an output layer. Set parameters such as the number of hidden nodes, the maximum number of iterations, the error threshold, and the learning rate. Input the divided dataset into the model and perform pre-computation using the training and test sets. Based on the fitting results between the output set and the real data, gradually refine and optimize the model parameters to achieve the optimal values for parameters such as the number of hidden nodes, the maximum number of iterations, the error threshold, and the learning rate, thereby maximizing the model's accuracy. At this point, the BP neural network model is complete.
[0018] Furthermore, the software used was MATLAB.
[0019] Furthermore, step S4 integrates the genetic algorithm into the BP neural network to construct a BP neural network incorporating the genetic algorithm. Specific methods include:
[0020] S41: Encoding: Use binary encoding to encode the weights and thresholds of the BP neural network to form individuals in the genetic algorithm. The weights and thresholds represent chromosomes in the individuals.
[0021] S42: Initialize the population: Randomly generate a certain number of individuals as the initial population. Each individual represents a possible combination of weights and thresholds of a BP neural network.
[0022] S43: Fitness Evaluation: The error of the BP neural network training set is used as the fitness function to evaluate the quality of each individual.
[0023] S44: Selection operation: Select individuals based on their fitness value. Individuals with higher fitness have a greater probability of being selected to participate in subsequent crossover and mutation operations.
[0024] S45: Crossover operation: Simulates the genetic recombination process in organisms, exchanging parts of chromosomes between two individuals to generate a new individual.
[0025] S46: Mutation Operation: Randomly altering certain chromosomes in individuals, i.e., making small random adjustments to weights and thresholds to increase population diversity.
[0026] S47: Generate a new population: The individuals generated after selection, crossover and mutation operations are combined into a new population, replacing some or all of the individuals in the old population, thus completing the weight and threshold optimization of the BP neural network.
[0027] Furthermore, the method for evaluating the merits of each individual in step S43 includes:
[0028] The fitness value in the genetic algorithm is used to evaluate the quality of individuals in the population; the error of the training set of the BP neural network is used as the fitness value of the individual, and the probability of each individual being selected is calculated based on the fitness value; the probability of each individual being selected is random, but the higher the fitness value, the greater the probability of being selected; the selected individuals can undergo subsequent crossover, mutation and other operations to form new individuals.
[0029] Furthermore, step S5 utilizes the trained BP neural network model to establish a method for calculating the solid content of oil-based drilling fluids as follows:
[0030] The optimized weight thresholds using a genetic algorithm are reassigned to the BP neural network for model training. If the fitting error calculated by the BP neural network model exceeds the preset maximum allowable error, the weight thresholds are updated and iterative calculations continue until the error reaches the allowable range, at which point the calculation stops, and the solid content calculation model is established. Input oil-based drilling fluid parameters, and the model can automatically calculate the corresponding solid content based on the mapping relationship.
[0031] Furthermore, step S5 combines the trained BP neural network model to complete the operation interface design, encapsulates and packages the model to facilitate repeated use of model parameters, and performs calculations of the solid content of oil-based drilling fluid.
[0032] The second objective of this invention is to provide a device for calculating the solid content of oil-based drilling fluids, comprising:
[0033] The data acquisition unit is used to collect multiple sets of field drilling data of oil-based drilling fluid and to conduct correlation analysis of oil-based drilling fluid parameters.
[0034] Establish dataset sample units to create neural network dataset samples; divide the samples into training and test sets;
[0035] The first building unit is used to build a BP neural network model and train the built BP neural network model.
[0036] The second building unit is used to integrate the genetic algorithm into the BP neural network, and to build a BP neural network with the genetic algorithm to prevent the BP neural network from reaching local optima during training.
[0037] A solids content calculation unit is established to utilize a trained BP neural network model to develop a method for calculating the solids content of oil-based drilling fluids.
[0038] Compared with the above-mentioned background technology, the present invention has the following beneficial effects:
[0039] This method for calculating the solid content of oil-based drilling fluids establishes the relationship between rheology and solid content, and then uses rheological data to calculate the solid content value, without including experimental procedures. Therefore, compared with existing methods for detecting the solid content of oil-based drilling fluids, it has advantages such as simple operation, short detection cycle, and no risk of high-temperature burns. Furthermore, the model established by this method has a fitting error of only 3.11%, demonstrating high calculation accuracy and significantly improving the efficiency of on-site oil-based drilling fluid maintenance.
[0040] This invention combines the BP neural network algorithm from the field of computer artificial intelligence with oil-based drilling fluid technology in the field of oil and gas extraction, improving the efficiency of oil-based drilling fluid performance testing and reducing the risks associated with experiments. During the parameter screening stage, the collected data is analyzed to remove useless data, thereby improving the accuracy of the model. In the BP neural network training process, a genetic algorithm is incorporated to compensate for the BP neural network's tendency to get trapped in local optima, improving the training effect and more accurately calculating the solid content of oil-based drilling fluids. Attached Figure Description
[0041] Figure 1 This is a data correlation analysis diagram of an embodiment of the present invention;
[0042] Figure 2 This is a diagram of the BP neural network structure according to an embodiment of the present invention;
[0043] Figure 3 This is a roadmap for optimizing a backpropagation neural network using a genetic algorithm, as described in an embodiment of the present invention.
[0044] Figure 4This is a diagram showing the neural network training and fitting results of an embodiment of the present invention;
[0045] Figure 5 This is a diagram of the solid content calculation operation interface according to an embodiment of the present invention;
[0046] Figure 6 This is a flowchart of the method for calculating the solid content of oil-based drilling fluid based on a BP neural network, as described in this invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0048] like Figure 6 As shown, this invention discloses a method for calculating the solid content of oil-based drilling fluids based on a BP neural network. This method mainly includes the following steps: on-site acquisition of oil-based drilling fluid parameters, correlation analysis of oil-based drilling fluid parameters, establishment of a neural network dataset, partitioning of the training and testing sets, construction of the BP neural network structure, optimization of BP neural network weight thresholds, model establishment, user interface design, and model packaging. Specifically, it includes the following steps:
[0049] S1: Collect multiple sets of field drilling data of oil-based drilling fluid and conduct correlation analysis of oil-based drilling fluid parameters;
[0050] The parameters that are highly correlated with the solid content are funnel viscosity, initial shear force, final shear force, reading at 600 rpm, reading at 300 rpm, reading at 200 rpm, reading at 100 rpm, reading at 6 rpm, reading at 3 rpm, dynamic shear force, plastic viscosity, and demulsification voltage.
[0051] The method for conducting correlation analysis of oil-based drilling fluid parameters in S1 is as follows: using SPSS analysis software, the Pearson correlation coefficient between the solid content and other drilling fluid parameters in the collected actual drilling data is analyzed, and data with high correlation to solid content are selected and used together with the solid content parameter as data samples for the next step of dividing the input set and output set.
[0052] S2: Establish a neural network dataset sample; divide the sample into a training set and a test set;
[0053] The training set is used to train the model to establish the functional relationship between the input set and the output set, and the test set is used to detect the accuracy of the model.
[0054] The ratio of the training set to the test set is 3:1.
[0055] S3: Construct a BP neural network model and train the constructed BP neural network model; specific methods include:
[0056] Use MATLAB software to import the input and output sets, and set up a three-layer neural network structure containing an input layer, a hidden layer, and an output layer.
[0057] Set parameters such as the number of hidden nodes, maximum number of iterations, error threshold, and learning rate, input the divided dataset into the model, and perform pre-computation using the training and test sets;
[0058] Based on the fitting results between the output set and the real data, the model parameters are gradually improved and optimized to bring the number of hidden nodes, the maximum number of iterations, the error threshold, and the learning rate to their optimal values, so as to improve the accuracy of the model as much as possible. At this point, the BP neural network model is established.
[0059] S4: Integrate the genetic algorithm into the BP neural network to construct a BP neural network incorporating the genetic algorithm;
[0060] Genetic algorithms mainly include steps such as population fitness calculation, selection, crossover, and mutation. Utilizing the global search and optimization capabilities of genetic algorithms, the initial weight thresholds of the backpropagation (BP) neural network are optimized, mitigating the problem of BP neural networks easily getting trapped in local minima during training and increasing the probability of finding the optimal solution. The initial weight thresholds of the BP neural network are encoded to generate individuals in the genetic algorithm, and the error of the BP neural network training set is used as the fitness function to evaluate the quality of each individual. The higher the fitness value of an individual, the greater the probability of it being selected to participate in subsequent crossover and mutation, generating new individuals. The above steps are iteratively repeated until the individuals in the new population meet preset conditions. Finally, the chromosomes of the new population individuals, i.e., the weight thresholds optimized by the genetic algorithm, are assigned as the optimal weight thresholds to the BP neural network for calculation.
[0061] Specific methods include:
[0062] S41: Encoding: Use binary encoding to encode the weights and thresholds of the BP neural network to form individuals in the genetic algorithm. The weights and thresholds represent chromosomes in the individuals.
[0063] S42: Initialize the population: Randomly generate a certain number of individuals as the initial population, each individual representing a possible combination of BP neural network weights and thresholds;
[0064] S43: Fitness Evaluation: The error of the BP neural network training set is used as the fitness function to evaluate the quality of each individual.
[0065] The fitness value in a genetic algorithm is used to evaluate the quality of individuals in the population. The error of the BP neural network training set is used as the fitness value of each individual, and the probability of each individual being selected is calculated based on the fitness value. The probability of each individual being selected is random, but the higher the fitness value, the greater the probability of selection. Selected individuals can undergo subsequent operations such as crossover and mutation to form new individuals.
[0066] S44: Selection operation: Select individuals based on their fitness value. Individuals with higher fitness have a greater probability of being selected to participate in subsequent crossover and mutation operations.
[0067] S45: Crossover operation: Simulates the genetic recombination process in organisms, exchanging parts of chromosomes between two individuals to generate a new individual;
[0068] S46: Mutation operation: Randomly alter certain chromosomes in an individual, i.e., make small random adjustments to weights and thresholds to increase population diversity;
[0069] S47: Generate a new population: The individuals generated after selection, crossover and mutation operations are combined into a new population, replacing some or all of the individuals in the old population, thus completing the weight and threshold optimization of the BP neural network.
[0070] S5: Using a trained BP neural network model, establish a method for calculating the solid content of oil-based drilling fluids. Specific methods include:
[0071] The optimized weight thresholds, obtained using a genetic algorithm, are reassigned to the BP neural network for model training. If the fitting error calculated by the BP neural network model exceeds the preset maximum allowable error, the weight thresholds are updated, and iterative calculations continue until the error falls within the allowable range. At this point, the calculation stops, and the solids content calculation model is complete. Inputting oil-based drilling fluid parameters allows the model to automatically calculate the corresponding solids content based on the mapping relationship.
[0072] By combining the trained BP neural network model, the user interface design is completed, and the model is packaged to facilitate repeated use of model parameters for calculating the solid content of oil-based drilling fluids.
[0073] The present invention also provides a device for calculating the solid content of oil-based drilling fluid, comprising:
[0074] The data acquisition unit is used to collect multiple sets of field drilling data of oil-based drilling fluid and to conduct correlation analysis of oil-based drilling fluid parameters.
[0075] Establish dataset sample units to create neural network dataset samples; divide the samples into training and test sets;
[0076] The first building unit is used to build a BP neural network model and train the built BP neural network model.
[0077] The second building unit is used to integrate the genetic algorithm into the BP neural network, and to build a BP neural network with the genetic algorithm to prevent the BP neural network from reaching local optima during training.
[0078] A solids content calculation unit is established to utilize a trained BP neural network model to develop a method for calculating the solids content of oil-based drilling fluids.
[0079] Example 1
[0080] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings, using a field example from Daqing Oilfield.
[0081] When a well in the Daqing Oilfield is being drilled, samples of the oil-based drilling fluid involved in the circulation are taken. The drilling fluid properties are tested according to relevant testing standards, including: funnel viscosity, initial shear force, final shear force, readings at 600 rpm, 300 rpm, 200 rpm, 100 rpm, 6 rpm, and 3 rpm, dynamic shear force, plastic viscosity, and demulsification voltage. These parameters are then input into a model to calculate the solids content of the oil-based drilling fluid sample.
[0082] The method for calculating the solid content of oil-based drilling fluid using a BP neural network mainly includes the following steps: on-site acquisition of oil-based drilling fluid parameters, correlation analysis of oil-based drilling fluid parameters, establishment of neural network dataset samples, partitioning of training and testing sets, construction of the BP neural network structure, optimization of BP neural network weight thresholds, model establishment, design of the user interface, and model packaging. Specifically, it includes the following steps:
[0083] Step 1: Collect multiple sets of field drilling data for oil-based drilling fluids and conduct correlation analysis of oil-based drilling fluid parameters.
[0084] First, actual drilling data of oil-based drilling fluid was collected from the field and imported into analysis software. Correlation analysis was performed on the solids content and other parameters to select parameters with high correlation to solids content for model calculation, thus reducing interference from useless data. The correlation analysis results are shown in Appendix 1 and Appendix 2. Figure 1 .
[0085] Table 1 shows the Sig value analysis results between oil-based drilling fluid rheological properties and solid content. The Sig value is commonly used in statistical significance testing; it's an indicator of whether a certain statistical quantity in the data is sufficiently significant. The closer the Sig value is to 0, the stronger the statistical significance between the data. In this correlation analysis, the Sig value for the solid content of the oil-based drilling fluid and the data on funnel viscosity, initial shear force, final shear force, and demulsification voltage was 0, indicating statistical significance.
[0086] Table 1. Analysis of sig value data
[0087]
[0088] Figure 1 The results show the correlation between data such as the rheological properties of oil-based drilling fluid and the solid content. The larger the correlation value, the stronger the correlation between the data. As can be seen from the figure, the correlation between the solid content of oil-based drilling fluid and data such as the 600 rpm reading, 300 rpm reading, and final shear force is greater than 0.3, indicating a strong correlation.
[0089] Step 2: Use the filtered data as the input set and the solid content as the output set for neural network model calculation.
[0090] The dataset is divided into a training set and a test set in a 3:1 ratio. The training set is used for the model to calculate the functional relationship between the input set and the output set, while the test set is used to test the model's calculation error.
[0091] Step 3: Build a BP neural network and train the constructed BP neural network model.
[0092] Set up a three-layer neural network structure including an input layer, hidden layers, and an output layer, and determine an appropriate number of neurons. See the appendix for the BP neural network structure. Figure 2 .
[0093] Step 4: Integrate the genetic algorithm into the BP neural network
[0094] By incorporating genetic algorithms, the weight thresholds of the BP neural network are re-encoded to form a genetic algorithm biological population. This simulates population evolution, optimizes the weight thresholds of the BP neural network, and prevents the neural network from getting stuck in local optima in the gradient descent method, which would affect the accuracy of model calculation.
[0095] The specific process of integrating genetic algorithms into backpropagation neural networks includes:
[0096] 41. First, determine the BP neural network structure, set the key parameters, and establish the BP neural network model.
[0097] 42. Encode the weights and thresholds of the BP neural network using binary encoding to form individuals in the genetic algorithm. The weights and thresholds represent chromosomes within each individual. Randomly generate a certain number of individuals as the initial population, with each individual representing a possible combination of BP neural network weights and thresholds.
[0098] 43. Use the error of the initial BP neural network training set as the fitness value. The higher the individual fitness value, the better the individual is and the greater the probability of being selected.
[0099] 44. Select individuals based on their fitness values. Individuals with higher fitness values have a greater probability of being selected to participate in subsequent crossover and mutation operations.
[0100] 45. Simulate the gene recombination process in organisms by exchanging parts of the chromosomes of two individuals to generate a new individual.
[0101] 46. Randomly alter certain chromosomes within individuals, i.e., make small random adjustments to weights and thresholds, to increase population diversity.
[0102] 47. After selection, crossover and mutation operations, the individuals generated are used to form a new population, replacing some or all of the individuals in the old population, and the fitness values of the individuals in the new population are evaluated.
[0103] 48. If the fitness value reaches the preset target, the chromosome of the new population individual, that is, the weight threshold optimized by the genetic algorithm, is used as the optimal weight threshold and assigned to the BP neural network for calculation.
[0104] 49. If the fitting error calculated by the BP neural network model is greater than the preset maximum allowable error, the weight threshold is updated and the iterative calculation continues until the error reaches the allowable range, at which point the calculation stops. At this point, the solid content calculation model is complete.
[0105] See the genetic algorithm optimization BP neural network technology route. Figure 3 . Figure 3 The technical roadmap for optimizing BP neural networks using genetic algorithms is as follows: BP neural networks are mainly used to build a correlation model between the solid content and rheological properties of oil-based drilling fluids, and mainly include steps such as weight threshold assignment, error calculation, and weight threshold update; genetic algorithms are mainly used to improve the training effect of BP neural networks, and mainly include steps such as population fitness calculation, selection, crossover, and mutation.
[0106] Step 5: Using the trained BP neural network model, establish a method for calculating the solid content of oil-based drilling fluids.
[0107] Based on the fitting results of the test set, the model parameters were repeatedly adjusted to make the model calculation results match the test set as closely as possible. The fitting results of the test set are shown below. Figure 4 . Figure 4 The overall fitting error for this neural network training was 3.11%, indicating that the model has high accuracy.
[0108] The user interface design was completed, and the model was packaged for easy reuse of model parameters to calculate the solid content of oil-based drilling fluids. The neural network model user interface is shown below. Figure 5 .
[0109] Figure 5 This is a diagram of the interface for calculating solids content. To allow for repeated use of the established model, an interface was designed to encapsulate the model. Users simply need to input oil-based drilling fluid data into the interface to calculate the solids content value.
[0110] The above-described method for calculating the solid content of oil-based drilling fluids is illustrated in this specification's embodiments, which also propose a device for calculating the solid content of oil-based drilling fluids. This device may include the following units:
[0111] The data acquisition unit is used to collect multiple sets of field drilling data of oil-based drilling fluid and to conduct correlation analysis of oil-based drilling fluid parameters.
[0112] Establish dataset sample units to create neural network dataset samples; divide the samples into training and test sets;
[0113] The first building unit is used to build a BP neural network model and train the built BP neural network model.
[0114] The second building unit is used to integrate the genetic algorithm into the BP neural network, and to build a BP neural network with the genetic algorithm to prevent the BP neural network from reaching local optima during training.
[0115] A solids content calculation unit is established to utilize a trained BP neural network model to develop a method for calculating the solids content of oil-based drilling fluids.
[0116] In some embodiments, the functions or modules of the apparatus provided in the present invention can be used to execute the method described in the above embodiments of the oil-based drilling fluid solid content calculation method. The specific implementation can be referred to the description of the above embodiments of the oil-based drilling fluid solid content calculation method, which will not be repeated here for the sake of brevity.
[0117] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the implementation methods of the present invention, and should be understood that the scope of protection of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of the present invention.
Claims
1. A method for calculating the solid content of oil-based drilling fluid, characterized in that: Includes the following steps: S1: Collect multiple sets of field drilling data of oil-based drilling fluid and conduct correlation analysis of oil-based drilling fluid parameters; S2: Create a neural network dataset sample; divide the data sample into a training set and a test set; S3: Construct a BP neural network model and train the constructed BP neural network model; S4: Integrate the genetic algorithm into the BP neural network to construct a BP neural network with the genetic algorithm, thus preventing the BP neural network from encountering local optima during training. S5: Using a trained BP neural network model, establish a method for calculating the solid content of oil-based drilling fluids.
2. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: The parameters that are highly correlated with the solid content are funnel viscosity, initial shear force, final shear force, reading at 600 rpm, reading at 300 rpm, reading at 200 rpm, reading at 100 rpm, reading at 6 rpm, reading at 3 rpm, dynamic shear force, plastic viscosity, and demulsification voltage.
3. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: The method for conducting correlation analysis of oil-based drilling fluid parameters in S1 is as follows: using software, the Pearson correlation coefficient between the solid content and other drilling fluid parameters in the collected actual drilling data is analyzed, and data with high correlation to solid content are selected and used together with the solid content parameter as data samples for the next step of dividing the input set and output set.
4. The method for calculating the solid content of oil-based drilling fluid according to claim 3, characterized in that: The software used is SPSS analysis software.
5. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: The training set mentioned in step S2 is used to train the model to establish the functional relationship between the input set and the output set, and the test set is used to detect the accuracy of the model.
6. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: In step S2, the ratio of the training set to the test set is 3:
1.
7. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: The method for constructing the BP neural network model in step S3 is as follows: Import the input and output sets using software, and set up a three-layer neural network structure including an input layer, a hidden layer, and an output layer. Set parameters such as the number of hidden nodes, maximum number of iterations, error threshold, and learning rate, input the divided dataset into the model, and perform pre-computation using the training and test sets; Based on the fitting results between the output set and the real data, the model parameters are gradually improved and optimized to achieve the optimal values for parameters such as the number of hidden nodes, the maximum number of iterations, the error threshold, and the learning rate, thus completing the establishment of the BP neural network model.
8. The method for calculating the solid content of oil-based drilling fluid according to claim 7, characterized in that: The software used is MATLAB.
9. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: S4 integrates the genetic algorithm into the BP neural network to construct a BP neural network incorporating the genetic algorithm. The specific method includes the following steps: S41: Encoding: Use binary encoding to encode the weights and thresholds of the BP neural network to form individuals in the genetic algorithm. The weights and thresholds represent chromosomes in the individuals. S42: Initialize the population: Randomly generate a certain number of individuals as the initial population, each individual representing a possible combination of BP neural network weights and thresholds; S43: Fitness Evaluation: The error of the BP neural network training set is used as the fitness function to evaluate the quality of each individual. S44: Selection operation: Select individuals based on their fitness value. Individuals with higher fitness have a greater probability of being selected to participate in subsequent crossover and mutation operations. S45: Crossover operation: Simulates the genetic recombination process in organisms, exchanging parts of chromosomes between two individuals to generate a new individual; S46: Mutation operation: Randomly alter certain chromosomes in an individual, i.e., make small random adjustments to weights and thresholds to increase population diversity; S47: Generate a new population: The individuals generated after selection, crossover and mutation operations are combined into a new population, replacing some or all of the individuals in the old population, thus completing the weight and threshold optimization of the BP neural network.
10. The method for calculating the solid content of oil-based drilling fluid according to claim 9, characterized in that: The method for evaluating the merits of each individual in step S43 is as follows: The fitness value in the genetic algorithm is used to evaluate the quality of individuals in the population; the error of the training set of the BP neural network is used as the fitness value of the individual, and the probability of each individual being selected is calculated based on the fitness value; the probability of each individual being selected is random, but the higher the fitness value, the greater the probability of being selected; the selected individuals can undergo subsequent crossover, mutation and other operations to form new individuals.
11. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: Step S5 utilizes a trained BP neural network model to establish a method for calculating the solid content of oil-based drilling fluids as follows: The weight thresholds optimized using the genetic algorithm are reassigned to the BP neural network, and model training is carried out. If the fitting error calculated by the BP neural network model is greater than the preset maximum allowable error, the weight thresholds are updated and iterative calculation is continued until the error reaches the allowable range, at which point the calculation stops, and the solid content calculation model is established. By inputting oil-based drilling fluid parameters, the model can automatically calculate the corresponding solid content based on the mapping relationship.
12. The method for calculating the solid content of oil-based drilling fluid according to claim 1, characterized in that: Step S5 combines the trained BP neural network model to complete the operation interface design, encapsulates and packages the model to facilitate repeated use of model parameters, and performs calculations of the solid content of oil-based drilling fluids.
13. A device for calculating the solid content of oil-based drilling fluid, characterized in that, include: The data acquisition unit is used to collect multiple sets of field drilling data of oil-based drilling fluid and to conduct correlation analysis of oil-based drilling fluid parameters. Establish dataset sample units for building neural network dataset samples; The samples are divided into a training set and a test set; The first building unit is used to build a BP neural network model and train the built BP neural network model. The second building unit is used to integrate the genetic algorithm into the BP neural network, and to build a BP neural network with the genetic algorithm to prevent the BP neural network from reaching local optima during training. A solids content calculation unit is established to utilize a trained BP neural network model to develop a method for calculating the solids content of oil-based drilling fluids.