A mixed crude oil viscosity prediction model training method, device and application method
Through the mixed crude oil degree prediction model trained using the XGBoost model, the problem of risk control and viscosity prediction lag in the existing technology of mixed crude oil pipelines is solved, high-precision and real-time viscosity prediction are achieved, and crude oil transportation efficiency is improved.
Patent Information
- Application Number
- CN202210353837.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-04-06
AI Technical Summary
The prior art is difficult to achieve risk control of mixed crude oil pipelines across the line and all periods, and it is unable to respond to changes in oil pipeline operating conditions in real time, resulting in a lag in viscosity prediction and high complexity.
By obtaining historical sample data sets, including physical properties monitoring data of component oils and pipeline operation parameters, a mixed crude oil viscosity prediction model is established using the XGBoost model training. The model can predict the viscosity of mixed crude oil in real-time online based on real-time data without the need for component oil viscosity.
The mixed crude oil viscosity prediction based on physical properties monitoring data and pipeline operation parameters is realized, which reduces the prediction complexity, improves crude oil transportation efficiency, and can respond to changes in pipeline operating conditions in real time.
Smart Images

Figure CN114898819B_ABST
Abstract
Description
Technical Field
[0001] This article relates to the field of oil and gas transportation, and in particular to a mixed crude oil viscosity prediction model training method, device and application method. Background Art
[0002] Pipeline mixed transportation is the main mode of transportation for imported oil and natural gas. For long-distance pipelines, mixed oil products with high viscosity will increase the friction along the pipeline during transportation, greatly increase the risk of pipeline operation, and may even cause the pipeline to stop. How to ensure the reliable operation of mixed crude oil pipelines has become an important issue related to economic development and social stability.
[0003] The existing technology transports crude oil by pipeline through manual sampling and laboratory measurement of the viscosity of mixed crude oil. This method cannot achieve risk control across the entire line and at all times, and cannot meet the changing conditions of the oil pipeline operating conditions.
[0004] Current technology also has semi-theoretical models based on thermodynamic theory to predict the viscosity of mixed crude oils, such as viscosity calculation models based on the equation of state or the corresponding state method, residual viscosity correlation equations, etc. However, the components of different crude oils vary greatly, and there are complex physical and chemical interactions between the components, making it impossible to make a complete explanation of the influencing mechanism of the fluidity of mixed crude oils.
[0005] The existing technology also includes calculations based on empirical models established according to the statistical laws of experimental data. When applying these models to calculate the viscosity of mixed crude oil, it is necessary to know the viscosity of each component oil; when using some models that introduce nonlinear correction terms, it is also necessary to know the viscosity of each two components of crude oil mixed in equal proportions. For different models, their experimental data come from oil products within a certain range, and their applicability to predictions of other oil products cannot be fully determined. In addition, the viscosity of the component oil needs to be obtained through experimental measurement, and the amount of laboratory measurement data required is huge, and the viscosity measured in the laboratory cannot reflect the changes in pipeline flow parameters in real time.
[0006] In view of the current problems of lagging prediction of mixed oil viscosity and complex process of obtaining crude oil viscosity, a mixed crude oil viscosity prediction model training method, device and application method are needed. Summary of the invention
[0007] In order to solve the above problems of the prior art, the embodiments of this article provide a mixed crude oil viscosity prediction model training method, device and application method.
[0008] The embodiment of the present invention provides a mixed crude oil viscosity prediction model training method, comprising: obtaining a training sample data set, wherein the training sample data set includes physical property monitoring data of historical sample component oils, operating parameters of a pipeline where the historical sample component oils are located, physical property monitoring data of historical sample mixed crude oils formed after the historical sample component oils are mixed, and operating parameters of the pipeline where the mixed crude oil is located; using the training sample data set to train an XGBoost initial model to determine a mixed crude oil viscosity prediction model.
[0009] According to one aspect of the embodiments of this document, the physical property monitoring data of the historical sample component oils include: the viscosity and density of the historical sample component oils; the pipeline operation parameters include pipeline pressure, pipeline temperature and flow rate in the pipeline; the physical property monitoring data of the historical sample mixed crude oils include the density of the historical sample mixed crude oils.
[0010] According to one aspect of the embodiment of this invention, using the training sample data set to train the XGBoost initial model to obtain the mixed crude oil viscosity prediction model includes: according to the sum of the prediction values of all decision trees in the XGBoost initial model for the training sample data set, establishing the objective function of the XGBoost initial model, the objective function is as follows: in, is the loss function of the XGBoost initial model, i is the number of the decision tree, y i represents the true value of the i-th decision tree, represents the predicted value of the i-th decision tree, k represents the number of decision trees, ∑ k Ω(f k ) is the sum of the regular penalty terms corresponding to the k decision trees in the initial model, Ω(f k ) is the regular penalty term corresponding to the kth tree; all decision trees in the objective function are segmented, the objective function is converted into an iterative formula for the leaf nodes of the decision tree, and a mixed crude oil viscosity prediction model is determined.
[0011] According to one aspect of the embodiments of this document, before all decision trees in the objective function are segmented, the objective function is processed as follows: the objective function is transformed using the following formula: in, is the loss function The first derivative of is the loss function The second derivative of is a deformation of the loss function, t represents the sequence number of the decision tree, f t (x i ) is the tth decision tree.
[0012] According to one aspect of the embodiments of this document, all decision trees in the objective function are segmented, and the objective function is converted into an iterative formula for leaf nodes of the decision tree, including: using the following formula to represent the regularized penalty term in the objective function: Among them, Ω(f t ) is the regular penalty term, f t is a decision tree that has been iterated t times, T is the number of leaf nodes, γ is the number of decision trees, λ is the score of the leaf node, and w j is the score of the branch j of the leaf node branch; by j Find the partial derivative and minimize the objective function: Among them, G j A leaf region g after the decision tree is divided i The sum of H j is all h in a leaf area after the decision tree is divided i The sum of g i is the loss function The first derivative of h i is the loss function The second-order derivative of; according to the gain partitioning method, the characteristics of the leaf nodes are divided, and the score value of the leaf nodes is calculated using the following formula: in, is the score value that can be obtained by not splitting the features of the leaf nodes, Represents the score value of the left subtree, Represents the score value of the right subtree; the gain partition formula L split Used to divide leaf nodes and calculate the score value of the leaf nodes, G L All g of the left branch after splitting the decision tree i The sum of G R All g for the right branch after splitting the decision tree i The sum of H L All h of the left branch after splitting the decision tree i The sum of H R All h of the right branches after splitting the decision tree i According to the score value of the leaf node, select the XGBoost model corresponding to the minimum value of the loss function result to determine the mixed crude oil viscosity prediction model.
[0013] According to one aspect of the embodiments of this document, the training sample data set further includes at least one ratio between component oils of historical samples.
[0014] The embodiments of the present invention also provide a mixed crude oil viscosity prediction method, which includes using a mixed crude oil viscosity prediction model: inputting at least one component oil into a pipeline for mixing to form a mixed crude oil; obtaining physical property monitoring data of the component oils, operating parameters of the pipeline where the component oils are located, physical property monitoring data of the mixed crude oil formed after the component oils are mixed, and operating parameters of the pipeline where the mixed crude oil is located; and predicting the viscosity of the mixed crude oil using the mixed crude oil viscosity prediction model based on the physical property monitoring data of the component oils, the operating parameters of the pipeline, the physical property monitoring data of the mixed crude oil, and the operating parameters of the pipeline where the mixed crude oil is located.
[0015] The embodiment of the present invention also provides a mixed crude oil viscosity prediction model training device, wherein the mixed crude oil is formed by inputting at least one component oil into a pipeline for mixing, and the device comprises: a training sample data set acquisition unit, used to acquire a training sample data set, wherein the training sample data set comprises physical property monitoring data of historical sample component oils, operating parameters of the pipeline where the historical sample component oils are located, physical property monitoring data of historical sample mixed crude oil formed after mixing the historical sample component oils, and operating parameters of the pipeline where the mixed crude oil is located; and a mixed crude oil viscosity prediction model determination unit, used to train an XGBoost initial model using the training sample data set to obtain a mixed crude oil viscosity prediction model.
[0016] The embodiments of the present invention further provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the computer program.
[0017] The embodiments of the present invention also provide a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the above method is implemented.
[0018] This solution is the first to establish a mixed crude oil viscosity prediction model based on physical property monitoring data and pipeline operation parameters. It can also predict the viscosity of the mixed crude oil in real time online based on the real-time data sent back by the sensor without the need for component oils. The prediction accuracy is high, which reduces the prediction complexity and improves the crude oil transportation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of this article or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of this article. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1It is a flow chart of a mixed crude oil viscosity prediction model training method according to an embodiment of this invention;
[0021] Figure 2 The figure is a flow chart of a method for determining a mixed crude oil viscosity prediction model according to an embodiment of the present invention;
[0022] Figure 3 The above is a flow chart of a method for converting an objective function into an iterative formula for leaf nodes of a decision tree according to an embodiment of the present invention;
[0023] Figure 4 This is a flow chart of a method for predicting the viscosity of mixed crude oil according to an embodiment of this invention;
[0024] Figure 5 The figure shows a structural schematic diagram of a mixed crude oil viscosity prediction model training device according to an embodiment of this invention;
[0025] Figure 6 The figure shows a specific structural schematic diagram of the mixed crude oil viscosity prediction model training device in the embodiment of this article;
[0026] Figure 7 Shown is a schematic diagram of a mixed crude oil viscosity prediction system according to an embodiment of this invention;
[0027] Figure 8 Shown is a schematic diagram of the structure of a computer device according to an embodiment of this invention.
[0028] Description of the accompanying symbols:
[0029] 501, training sample data set acquisition unit;
[0030] 502. Mixed crude oil viscosity prediction model determination unit;
[0031] 5021. Mixed crude oil viscosity prediction model training module;
[0032] 5022, objective function conversion module;
[0033] 802. Computer equipment;
[0034] 804, processor;
[0035] 806. Memory;
[0036] 808, driving mechanism;
[0037] 810, input / output module;
[0038] 812. Input device;
[0039] 814. Output device;
[0040] 816. Presentation equipment;
[0041] 818. Graphical user interface;
[0042] 820, network interface;
[0043] 822, communication link;
[0044] 824. Communication bus. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0047] This specification provides method operation steps as described in the embodiments or flow charts, but more or fewer operation steps may be included based on routine or non-creative work. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the system or device product is executed in practice, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel.
[0048] It should be noted that the mixed crude oil viscosity prediction model training method and application method in this article can be used in the field of oil and gas exploration, and can also be used in fields other than the field of oil and gas exploration. This article does not limit the application field of the mixed crude oil viscosity prediction model training method and application method.
[0049] like Figure 1 The flowchart of a mixed crude oil viscosity prediction model training method according to an embodiment of the present invention is shown, which specifically includes the following steps:
[0050] Step 101, obtaining a training sample data set, wherein the training sample data set includes physical property monitoring data of historical sample component oils, operating parameters of pipelines where the historical sample component oils are located, physical property monitoring data of historical sample mixed crude oils formed after mixing the historical sample component oils, and operating parameters of pipelines where the mixed crude oils are located.
[0051] In the field of oil and gas exploration technology, the pipeline mixed transportation process requires accurate knowledge of the viscosity of the mixed crude oil. Normally, a mixed crude oil can be obtained by mixing multiple crude oils with different components in a certain proportion. In the present application, the model can be trained through the physical property parameters of multiple component crude oils to further predict the viscosity of the mixed crude oil. Specifically, the model is trained using a training sample data set. In some embodiments of the present specification, the physical property monitoring data of the historical sample component oils in the training sample data set, the operating parameters of the pipeline where the historical sample component oils are located, the physical property monitoring data of the historical sample mixed crude oil formed after the historical sample component oils are mixed, and the operating parameters of the pipeline where the mixed crude oil is located are detected and acquired by a viscosity prediction system, and the viscosity prediction system can be seen Figure 7 describe.
[0052] In some embodiments of the present specification, the physical property monitoring data of the historical sample component oils include: the viscosity and density of the historical sample component oils; the pipeline operation parameters include pipeline pressure, pipeline temperature and flow rate in the pipeline; the physical property monitoring data of the historical sample mixed crude oils include the density of the historical sample mixed crude oils. For example, as shown in Table 1, the historical sample component oils include oil product 1, oil product 2, oil product 3 and oil product 4, and the physical property monitoring data of the historical sample component oils are: the viscosity and density of oil product 1 are: 20 to 80 mPa·s at 15°C, and the density is 855 to 875 kg / m3 at 20°C; the viscosity and density of oil product 2 are: 10 to 250 mPa·s at 15°C, and the density is 830 to 890 kg / m3 at 20°C; the viscosity and density of oil product 3 are: 5 to 450 mPa·s at 15°C, and the density is 800 to 860 kg / m3 at 20°C; the viscosity and density of oil product 4 are: 5 to 500 mPa·s at 15°C, and the density is 810 to 870 kg / m3 at 20°C.
[0053] In this step, the historical sample component oil includes at least one component oil. Each component oil is transported by a separate pipeline and output after mixing in the first station oil tank. Therefore, the training sample data set also includes the operating parameters of the pipeline where the historical sample component oil is located. Furthermore, the operating parameters of the pipeline where the historical sample component oil is located are the operating parameters of the pipeline for transporting crude oil A, the operating parameters of the pipeline for transporting crude oil B, and the operating parameters of the pipeline for transporting crude oil C. In some embodiments of the present specification, the operating parameters of the pipeline include the pressure in the pipeline, the temperature of the pipeline, the flow rate in the pipeline, etc. For example, as shown in Table 1, the temperature of the pipeline for transporting oil product 1 is 9.0 to 48.2°C, the pipeline pressure is 0.1 to 0.23Mpa, and the pipeline flow rate is 199.3 to 2131m 3 / h; the temperature of the pipeline for transporting oil product 2 is 5.6 to 34.1°C, the pipeline pressure is 0.09 to 7.77Mpa, and the pipeline flow rate is 17 to 1399.2m 3 / h; the temperature of the pipeline for transporting oil product 3 is 8.3 to 25.7°C, the pipeline pressure is 0.23 to 5.3Mpa, and the pipeline flow rate is 52 to 1658m 3 / h; the temperature of the pipeline for transporting oil product 4 is 7.5 to 26.7°C, the pipeline pressure is 0.03 to 2.5Mpa, and the pipeline flow rate is 10 to 2591m 3 / h.
[0054] Table 1 Some training sample data sets
[0055]
[0056] In some embodiments of the present specification, the physical property monitoring data of the historical sample mixed crude oil formed after the historical sample component oils are mixed include the viscosity and density of the mixed crude oil; the parameters of the pipeline where the mixed crude oil is located include the pipeline temperature, the pressure in the pipeline and the flow rate in the pipeline.
[0057] In some embodiments of the present specification, the training sample data set further includes at least one ratio between the historical sample component oils. For example, the ratio between oil product 1, oil product 2, oil product 3, and oil product 4 is 1:2:1:1, or the ratio between oil product 1, oil product 2, oil product 3, and oil product 4 is 1:3:1:4, etc. In some embodiments of the present specification, the ratio between the historical sample components can be preset or adjusted according to actual conditions. The present application does not limit the ratio value between the historical sample component oils.
[0058] Step 102, using the training sample data set to train the XGBoost initial model, to determine the mixed crude oil viscosity prediction model. In this step, the XGBoost model is a decision tree ensemble model, and the sum of the prediction values of each decision tree in the K decision trees for the training sample data set is used as the prediction of the training sample data set in the XGBoost model.
[0059] In this step, the physical property monitoring data of the historical sample component oils, the operating parameters of the pipelines where the historical sample component oils are located, the physical property monitoring data of the historical sample mixed crude oils formed after the historical sample component oils are mixed, and the operating parameters of the pipelines where the mixed crude oils are located are used to train the XGBoost model to obtain a trained mixed crude oil viscosity prediction model.
[0060] like Figure 2 The above is a flow chart of a method for determining a mixed crude oil viscosity prediction model according to an embodiment of this invention. The method specifically includes the following steps:
[0061] Step 201, based on the sum of the predicted values of all decision trees in the XGBoost initial model for the training sample data set, establish the objective function of the XGBoost initial model, the objective function is as follows: in, is the loss function of the XGBoost initial model, Represents the predicted value of the model, y i represents the category label of the i-th sample, k represents the number of decision trees, ∑ k Ω(f k ) is the sum of the regular penalty terms corresponding to the k decision trees in the initial model, Ω(f k ) is the regular penalty term corresponding to the k-th decision tree, f k Represents the model of the k-th decision tree.
[0062] In this step, the XGBoost initial model is a decision tree-based model, which takes the sum of the prediction values of all decision trees for the training sample data set as the final output result of the initial model. By constructing the input and output layers of the XGBoost model, the weight parameters of the XGBoost model are initialized, and the first decision tree in the XGBoost model is trained according to the initialized weight parameters. After the training is completed, the weight parameters are updated according to the objective function, and a new round of decision tree training is performed. Modeling stops when the sum of the weights of all training samples is less than the set threshold or the number of iterations reaches the set value. Among them, the XGBoost initial model is represented by the following formula:
[0063]
[0064] F={f(x)=w q(x)}(q:R m →T,w∈R T ) (2), where is the model prediction value of the XGBoost model; x i is the i-th sample; f k is the model of the kth decision tree; F is the space of the decision tree; m is the number of features; T is the number of leaf nodes in each decision tree; q is the score of each decision tree structure mapping each training sample to the corresponding leaf node, and w q(x) Represents the set of scores of all leaf nodes of decision tree q.
[0065] By using the regularization method to control overfitting in the above formula (1), the objective function of the XGBoost initial model can be established as:
[0066] in, is the loss function term, is the training error of the model. The loss function term is a differentiable convex function; ∑ k Ω(f k ) is the complexity function of the initial model, and is also the penalty term of the initial model, which represents the sum of the complexity of each decision tree in the k trees in the initial model. The purpose of this term is to control the complexity of the XGBoost initial model and prevent the model from overfitting. In some other embodiments of this specification, the reduction coefficient can be introduced into the XGBoost model to reduce the impact of each decision tree and leaf node on the result to prevent the model from overfitting.
[0067] Step 202: segment all decision trees in the objective function, convert the objective function into an iterative formula for leaf nodes of the decision tree, and determine a mixed crude oil viscosity prediction model.
[0068] In some embodiments of the present specification, before all decision trees in the objective function are segmented, the objective function is processed as follows: the objective function is transformed using the following formula: in, is the loss function The first derivative of is the loss function The second-order derivative of . For a detailed description of the deformation of the objective function, see Figure 3 describe.
[0069] In some embodiments of the present specification, by converting the objective function into an iterative formula for leaf nodes, and then using a greedy algorithm to iteratively split from a single leaf node to add nodes to the decision tree in the model, all possible divisions of all features in the model can be listed to find the optimal split point, and further determine the mixed crude oil viscosity prediction model with the best prediction effect.
[0070] Figure 3 The flowchart of a method for converting an objective function into an iterative formula for leaf nodes of a decision tree is shown in the embodiment of this article. The method specifically includes the following steps:
[0071] Step 301, using the following formula to represent the regularized penalty term in the objective function: Where T is the number of leaf nodes, γ is the number of decision trees, λ is the score of the leaf node, and w j is the score of the branch j of the leaf node branch. In some embodiments of the present specification, the regular penalty term is transformed to obtain the following formula:
[0072]
[0073] Among them, T is the penalty coefficient of the leaf node in a decision tree; γ is the regularization penalty term, the more leaf nodes there are, the greater the penalty; λ is the regularization coefficient of the leaf node weight of the decision tree, which is the L2 norm square of the score w of the leaf node, which is equivalent to adding L2 smoothing to the score of each leaf node, in order to avoid overfitting during model training.
[0074] In some embodiments of this specification, the model is learned by additive training, the original model is kept unchanged, and a new function f is added each time a new training is performed. i (x i ) is added to the original model to minimize the value of the objective function. The objective function formulas for round 0, round 1, round 2, and round t are as follows:
[0075]
[0076] The square error is further used to transform the objective function (4) into the following form:
[0077]
[0078] The core goal of further using Taylor's formula for approximate expansion is to simplify the objective function and extract the constant term to obtain the expansion formula of the objective function (4) as follows:
[0079]
[0080] Among them, g i for is the first-order derivative of the loss function; h i for is the second-order derivative of the loss function.
[0081] In this step, the instance set I of leaf node j is defined j ={i|q(x i )=j}(9), rewrite the iterative formula (8) about the decision tree model, and obtain the iterative formula about the leaf node of the decision tree, as shown below:
[0082]
[0083] Find the score w of branch j of the leaf node branch of the decision tree j , find w j After that, w of each decision tree j In some embodiments of this specification, in order to obtain the optimal w j The value of , the objective function that needs to be minimized.
[0084] Step 302, by adjusting w in the regular penalty term j Find the partial derivative and minimize the objective function: Where T is the number of leaf nodes, γ is the number of decision trees, λ is the score of the leaf node, G j A leaf region g after the decision tree is divided i The sum of H j is all h in a leaf area after the decision tree is divided i The sum of g i is the loss function The first derivative of h i is the loss function The second derivative of .
[0085] In this step, the leaf node of the above formula is iterated and the w in formula (10) is j Find the partial derivative and set it to 0.
[0086] Get w j The partial derivative of for:
[0087] Let w j is equal to 0, and defines get
[0088]
[0089] Will Substituting into the objective function formula (10), the formula of the minimized objective function is:
[0090] Among them, G j It is the sum of all g in a leaf area after the decision tree is divided, which is the first-order derivative; H j It is the sum of all h in a leaf area after the decision tree is divided, which is the second-order derivative.
[0091] Step 303: divide the features of the leaf nodes according to the gain division method, and calculate the score value of the leaf node according to the following formula: in, is the score value that can be obtained by not splitting the features of the leaf nodes, Represents the score value of the left subtree, Represents the score value of the right subtree; the gain partition formula L split Used to divide leaf nodes and calculate the score value of the leaf nodes.
[0092] In some embodiments of this specification, the loss function after splitting the node is:
[0093]
[0094] Step 304, according to the score value of the leaf node, select the XGBoost model corresponding to the minimum value of the loss function result, and determine the mixed crude oil viscosity prediction model. In this step, according to the loss function (10) after the node segmentation in step 303, a greedy algorithm is used to list all the possible division results of the k trees in the initial model, and select the optimal segmentation point from the k decision trees. Specifically, a greedy algorithm is used to start from a single leaf node and iteratively split to add nodes to the corresponding decision tree. Starting from a tree depth of 0, all the features of each leaf node of each tree are traversed, such as density, viscosity, etc., and then for a certain feature, the score values of the leaf nodes corresponding to the feature are sorted using formula (13), and then the feature is linearly scanned to determine the best segmentation point. Finally, after all features are segmented, the gain L is selected. split The highest division method is used. Then the tree corresponding to the minimum value of the loss function is determined, and the trained XGBoost model is further determined, which is the mixed crude oil viscosity prediction model.
[0095] Figure 4 The flowchart of a method for predicting mixed crude oil in the embodiment of this article is shown. The method specifically includes the following steps:
[0096] Step 401, at least one component oil is input into a pipeline to be mixed to form a mixed crude oil. In this step, at least one component oil is transported from different pipelines to the first station pipeline, and mixed in the first station pipeline to form a mixed crude oil. For example, component oil 1, component oil 2, component oil 3, and component oil 4 are input into the pipeline to form a mixed crude oil. Among them, these four component oils have different properties, densities, and viscosities.
[0097] Step 402, obtaining the physical property monitoring data of the component oils, the operating parameters of the pipeline where the component oils are located, the physical property monitoring data of the mixed crude oil formed after the component oils are mixed, and the operating parameters of the pipeline where the mixed crude oil is located.
[0098] In some embodiments of the present specification, the monitoring sensor is used to monitor and obtain the physical property monitoring data of the component oil, including: one of the density and viscosity of the component oil or any combination thereof. The monitoring sensor is used to monitor and obtain the physical property monitoring data of the mixed crude oil after the component oils are mixed, including: one of the density and viscosity of the mixed crude oil or any combination thereof. In some embodiments of the present specification, the proportion of the incoming oil can also be obtained.
[0099] For example, the density and viscosity of the incoming oil (i.e., the component oil mentioned above), the density of the external oil (i.e., the mixed crude oil mentioned above), the ratio of multiple incoming oils, the operating parameters of the pipeline where the incoming oil is located, the density of the external oil and the operating parameters of the pipeline where the external oil is located are obtained as inputs to the mixed crude oil viscosity prediction model. For another example, the viscosity of the incoming oil, the density of the mixed crude oil, the ratio of the incoming oil, the operating parameters of the pipeline where the incoming oil is located, the density of the external oil and the operating parameters of the pipeline where the external oil is located are obtained as inputs to the mixed crude oil viscosity prediction model. For another example, the density of the incoming oil, the ratio of the incoming oil, the operating parameters of the pipeline where the incoming oil is located, the density of the external oil and the operating parameters of the pipeline where the external oil is located are obtained as inputs to the mixed crude oil viscosity prediction model.
[0100] In some embodiments of the present specification, when the input features of the mixed crude oil viscosity prediction model are the viscosity of the component oils and the component oil ratios, the average absolute error of the predicted mixed oil viscosity results is 4.1 mPa·s. As can be seen from Table 2, when the input features of the mixed crude oil viscosity prediction model are the viscosity of the incoming oil, the incoming oil ratio, and the operating parameters of the incoming oil transportation pipeline and the external oil transportation pipeline, the average absolute error of the predicted mixed oil viscosity results is 3.4 mPa·s. Therefore, using the operating parameters of the incoming oil and external oil transportation pipelines as the input features of the mixed crude oil viscosity prediction model has a significant improvement in the effect of the model predicting the viscosity of the external oil.
[0101] As shown in Table 2, when the input characteristics of the mixed crude oil viscosity prediction model include the viscosity and density of the component oils, the density of the external oil, the ratio of the incoming oil and the operating parameters of the transportation pipeline, the prediction accuracy of the model is higher, and the average absolute error of the mixed oil viscosity results predicted by the model can reach 1.7 mPa·s; when the input characteristics of the mixed crude oil viscosity prediction model do not include the viscosity of the incoming oil, the average absolute error of the model can also reach 2.2 mPa·s, realizing the viscosity prediction of the mixed crude oil; when the input characteristics of the mixed crude oil viscosity prediction model include the density of the incoming oil, the ratio of the incoming oil and the operating parameters of the transportation pipeline, the prediction of the mixed oil can also be realized, and the average absolute error of the predicted mixed oil viscosity results is 3.2 mPa·s.
[0102] Table 2 Viscosity prediction results corresponding to different model inputs
[0103]
[0104]
[0105] It can be seen that the mixed crude oil viscosity prediction model in this specification uses the physical property parameters of the component oils, the operating parameters of the pipelines where the component oils are located, the physical property monitoring data of the mixed crude oil, and the operating parameters of the pipelines where the mixed crude oil is located, and has a good model prediction effect.
[0106] Step 403, based on the physical property monitoring data of the component oils, the operating parameters of the pipeline, the physical property monitoring data of the mixed crude oil and the operating parameters of the pipeline where the mixed crude oil is located, the viscosity of the mixed crude oil is predicted using the mixed crude oil viscosity prediction model. Figure 2 The mixed crude oil viscosity prediction model described above is used to input the data in step 402 into the mixed crude oil viscosity prediction model to predict the mixed crude oil viscosity.
[0107] like Figure 5 The figure shows a schematic diagram of the structure of a mixed crude oil viscosity prediction model training device in an embodiment of the present invention. In this figure, the basic structure of the mixed crude oil viscosity prediction model training device is described. The functional units and modules therein can be implemented in software, or in general chips or specific chips to achieve mixed crude oil viscosity prediction. The device specifically includes:
[0108] The training sample data set acquisition unit 501 is used to acquire a training sample data set, wherein the training sample data set includes physical property monitoring data of historical sample component oils, operating parameters of pipelines where the historical sample component oils are located, physical property monitoring data of historical sample mixed crude oils formed after the historical sample component oils are mixed, and operating parameters of pipelines where the mixed crude oils are located;
[0109] The mixed crude oil viscosity prediction model determination unit 502 is used to train the XGBoost initial model using the training sample data set to obtain the mixed crude oil viscosity prediction model.
[0110] This solution is the first to establish a mixed crude oil viscosity prediction model based on physical property monitoring data and pipeline operation parameters. It can also predict the viscosity of mixed crude oil composed of multiple component oils in real time online based on real-time data sent back by sensors, without the need for component oil viscosities. The prediction accuracy is high, which reduces the prediction complexity and improves crude oil transportation efficiency.
[0111] As an embodiment of this article, you can also refer to Figure 6 The figure shows a specific structural schematic diagram of the mixed crude oil viscosity prediction model training device of this embodiment.
[0112] As an embodiment of this invention, the mixed crude oil viscosity prediction model determination unit 502 further includes:
[0113] The mixed crude oil viscosity prediction model training module 5021 is used to train the XGBoost initial model using the training sample data set;
[0114] The objective function conversion module 5022 is used to convert the objective function into an iterative formula for the leaf nodes of the decision tree.
[0115] like Figure 7 The figure shows a schematic diagram of a viscosity prediction system of an embodiment of this invention. It mainly describes the process of forming a mixed crude oil after the component oils are mixed in the pipeline. Among them, the component oils include at least one component oil. As shown in the figure, the component oils include oil product 1, oil product 2, oil product 3, and oil product 4. A monitoring sensor is arranged on each oil transportation pipeline, and the monitoring sensor can monitor the pipeline operation parameters of each oil transportation pipeline, and can also monitor the viscosity and density physical property data of each oil. Correspondingly, the component oils are mixed in the tank to form a mixed crude oil, and a SCADA monitoring sensor is arranged on the pipeline for the mixed crude oil to be output to the outside, and the SCADA monitoring sensor can monitor the pipeline operation parameters of the transportation pipeline where the mixed crude oil is located, and can also monitor the density and other physical property data of the mixed crude oil.
[0116] like Figure 8As shown, a computer device provided in an embodiment of the present invention, the computer device 802 may include one or more processors 804, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 802 may also include any memory 806, which is used to store any kind of information such as code, settings, data, etc. Non-restrictive, for example, the memory 806 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent a fixed or removable component of the computer device 802. In one case, when the processor 804 executes an associated instruction stored in any memory or a combination of memories, the computer device 802 may perform any operation of the associated instruction. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any memory, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.
[0117] The computer device 802 may also include an input / output module 810 (I / O) for receiving various inputs (via input devices 812) and for providing various outputs (via output devices 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input / output module 810 (I / O), the input device 812, and the output device 814 may not be included, and the computer device 802 may be used as a computer device in a network. The computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.
[0118] The communication link 822 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.
[0119] Corresponds to Figures 1 to 5 The method in this article also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are executed.
[0120] The embodiment of the present invention also provides a computer readable instruction, wherein when the processor executes the instruction, the program therein causes the processor to execute the following Figures 1 to 5The method shown.
[0121] It should be understood that in the various embodiments of this document, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.
[0122] It should also be understood that in the embodiments of this article, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0123] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this article.
[0124] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0125] In the several embodiments provided herein, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or can be electrical, mechanical or other forms of connection.
[0126] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this article.
[0127] In addition, each functional unit in each embodiment of this invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
[0128] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this article is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of this article. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0129] Specific embodiments are used in this article to illustrate the principles and implementation methods of this article. The description of the above embodiments is only used to help understand the methods and core ideas of this article. At the same time, for general technicians in this field, according to the ideas of this article, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on this article.
Claims
1. A mixed crude oil viscosity prediction model training method, characterized in that: The mixed crude oil is formed by inputting component oils into a pipeline and mixing them. The method comprises: Acquire a training sample data set, the training sample data set including physical property monitoring data of historical sample component oils, operating parameters of pipelines where the historical sample component oils are located, physical property monitoring data of historical sample mixed crude oils formed after the historical sample component oils are mixed, and operating parameters of pipelines where the mixed crude oils are located, wherein the physical property monitoring data of the historical sample component oils include: viscosity and density of the historical sample component oils; the operating parameters of the pipeline include pipeline pressure, pipeline temperature, and flow rate in the pipeline; the physical property monitoring data of the historical sample mixed crude oil include density of the historical sample mixed crude oil, and the training sample data set further includes at least one ratio between the historical sample component oils; The XGBoost initial model is trained using the training sample data set to determine the mixed crude oil viscosity prediction model, including: According to the sum of the predicted values of all decision trees in the XGBoost initial model for the training sample data set, the objective function of the XGBoost initial model is established, and the objective function is as follows: Among them, L(φ) is the objective function of the model, is the loss function of the XGBoost initial model, i is the number of the decision tree, y i represents the true value of the i-th decision tree, represents the predicted value of the i-th decision tree, k represents the number of decision trees, ∑ k Ω(f k ) is the sum of the regular penalty terms corresponding to the kth decision tree in the initial model, Ω(f k ) is the regular penalty term corresponding to the k-th decision tree; All decision trees in the objective function are segmented, the objective function is converted into an iterative formula for leaf nodes of the decision tree, and a mixed crude oil viscosity prediction model is determined, including: using the following formula to represent the regular penalty term in the objective function: Among them, Ω(f t ) is the regular penalty term, f t is a decision tree that has been iterated t times, T is the number of leaf nodes, γ is the number of decision trees, λ is the score of the leaf node, and w j is the score of branch j that is a leaf node branch; By adjusting w in the regular penalty term j Find the partial derivative and minimize the objective function: Among them, G j A leaf region g after the decision tree is divided i The sum of H j is all h in a leaf area after the decision tree is divided i The sum of g i is the loss function The first derivative of h i is the loss function The second derivative of According to the gain division method, the features of the leaf nodes are divided, and the score values of the leaf nodes are calculated according to the following formula: in, is the score value that can be obtained by not splitting the features of the leaf nodes, Represents the score value of the left subtree, Represents the score value of the right subtree; the gain partition formula L split Used to divide leaf nodes and calculate the score value of the leaf nodes. GL is all g of the left branch after the decision tree is split. i The sum of G R All g for the right branch after splitting the decision tree i The sum of H L All h of the left branch after splitting the decision tree i The sum of H R All h of the right branches after splitting the decision tree i sum; According to the score value of the leaf node, select the XGBoost model corresponding to the minimum value of the loss function result to determine the mixed crude oil viscosity prediction model; Before all decision trees in the objective function are segmented, the objective function is processed as follows: The objective function is transformed using the following formula: in, is the loss function The first derivative of is the loss function The second derivative of is a deformation of the loss function, t represents the sequence number of the decision tree, f t (x i ) is the tth decision tree.
2. A mixed crude oil viscosity prediction application method, characterized in that: The method comprises using the mixed crude oil viscosity prediction model described in claim 1: The component oils are fed into the pipeline for mixing to form mixed crude oil; Acquiring physical property monitoring data of the component oils, operating parameters of the pipelines where the component oils are located, physical property monitoring data of the mixed crude oil formed after the component oils are mixed, and operating parameters of the pipelines where the mixed crude oil is located; The viscosity of the mixed crude oil is predicted using the mixed crude oil viscosity prediction model according to the physical property monitoring data of the component oils, the operating parameters of the pipeline, the physical property monitoring data of the mixed crude oil and the operating parameters of the pipeline where the mixed crude oil is located.
3. A mixed crude oil viscosity prediction model training device, characterized in that: The mixed crude oil is formed by inputting component oils into a pipeline and mixing them. The device comprises: A training sample data set acquisition unit is used to acquire a training sample data set, wherein the training sample data set includes physical property monitoring data of historical sample component oils, operating parameters of pipelines where the historical sample component oils are located, physical property monitoring data of historical sample mixed crude oils formed after the historical sample component oils are mixed, and operating parameters of pipelines where the mixed crude oils are located, wherein the physical property monitoring data of the historical sample component oils include: viscosity and density of the historical sample component oils; the operating parameters of the pipeline include pipeline pressure, pipeline temperature, and flow rate in the pipeline; the physical property monitoring data of the historical sample mixed crude oil include density of the historical sample mixed crude oil, and the training sample data set further includes a ratio between the historical sample component oils; The mixed crude oil viscosity prediction model determination unit is used to train the XGBoost initial model using the training sample data set to obtain the mixed crude oil viscosity prediction model, including: According to the sum of the predicted values of all decision trees in the XGBoost initial model for the training sample data set, the objective function of the XGBoost initial model is established, and the objective function is as follows: Among them, L(φ) is the objective function of the model, is the loss function of the XGBoost initial model, i is the number of the decision tree, y i represents the true value of the i-th decision tree, represents the predicted value of the i-th decision tree, k represents the number of decision trees, ∑ k Ω(f k ) is the sum of the regular penalty terms corresponding to the kth decision tree in the initial model, Ω(f k ) is the regular penalty term corresponding to the k-th decision tree; All decision trees in the objective function are segmented, the objective function is converted into an iterative formula for leaf nodes of the decision tree, and a mixed crude oil viscosity prediction model is determined, including: using the following formula to represent the regular penalty term in the objective function: Among them, Ω(f t ) is the regular penalty term, f t is a decision tree that has been iterated t times, T is the number of leaf nodes, γ is the number of decision trees, λ is the score of the leaf node, and w j is the score of branch j that is a leaf node branch; By adjusting w in the regular penalty term j Find the partial derivative and minimize the objective function: Among them, G j A leaf region g after the decision tree is divided i The sum of H j is all h in a leaf area after the decision tree is divided i The sum of g i is the loss function The first derivative of h i is the loss function The second derivative of According to the gain division method, the features of the leaf nodes are divided, and the score values of the leaf nodes are calculated according to the following formula: in, is the score value that can be obtained by not splitting the features of the leaf nodes, Represents the score value of the left subtree, Represents the score value of the right subtree; the gain partition formula L split Used to divide leaf nodes and calculate the score value of the leaf nodes, G L All g of the left branch after splitting the decision tree i The sum of G R All g for the right branch after splitting the decision tree i The sum of H L All h of the left branch after splitting the decision tree i The sum of H R All h of the right branches after splitting the decision tree i sum; According to the score value of the leaf node, select the XGBoost model corresponding to the minimum value of the loss function result to determine the mixed crude oil viscosity prediction model; Before all decision trees in the objective function are segmented, the objective function is processed as follows: The objective function is transformed using the following formula: in, is the loss function The first derivative of is the loss function The second derivative of is a deformation of the loss function, t represents the sequence number of the decision tree, f t (x i ) is the tth decision tree.
4. A computer 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, the method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
Method and system for determining total viscosity-temperature curve of crude oil
CN111898088A
Method and apparatus for rheology property measurements of drilling fluids in real-time
WO2021050418A2