Metal corrosion rate prediction method, device, computer equipment and storage medium
By acquiring multiple data of different corrosion durations under simulated corrosion environments and optimizing the gray prediction model using genetic algorithms, the problem of low prediction accuracy of the gray prediction model in the prior art is solved, and a more accurate prediction of metal corrosion rate is achieved.
Patent Information
- Application Number
- CN202111673443.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-12-31
AI Technical Summary
In the prior art, when the gray prediction model is used for metal life prediction, the prediction accuracy is low because the modeling parameters are single and a variety of factors affecting the corrosion rate of metal are not fully considered.
By obtaining multiple data of different corrosion durations under simulated corrosion environments, the original gray prediction model is constructed, and the model parameters are adjusted using genetic algorithms, and the modeling parameters are optimized to build the target gray prediction model, thereby predicting the corrosion rate of metals.
The accuracy of metal corrosion rate prediction is improved, and the prediction results are more accurate, and the corrosion rate of metal can be predicted more accurately.
Smart Images

Figure CN114154762B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of metal life assessment, and in particular to a metal corrosion rate prediction method, device, computer equipment and storage medium. Background Art
[0002] With the development of metal smelting technology, alloy metals are increasingly used in aerospace, transportation, energy transmission, agricultural production, and daily life. Especially in the field of aerospace, alloy metals are widely used in the main load-bearing structures of aircraft, such as the bulkheads, wing beams, skins, and brackets of landing gears, due to their high strength, low density, and high toughness. With the advancement of science and technology, my country's exploration of the ocean has also deepened step by step. Therefore, the service time of aviation equipment in the marine atmosphere environment is getting longer and longer. The increase in the service time in the marine atmosphere environment also means that aviation equipment needs to withstand harsh marine atmospheric conditions such as high salt spray, high humidity, high temperature, and strong solar radiation for a long time. This also makes the metal of aviation equipment extremely susceptible to corrosion. Once the metal of aviation equipment is corroded and the parts fail, it may cause significant losses to personnel and property. Therefore, how to accurately predict the life of metals is a problem that needs to be solved at present.
[0003] In traditional technology, the life of metal is predicted by grey prediction model. However, the grey prediction model in traditional technology has a single modeling parameter, which is determined only according to the historical life of the metal, resulting in low prediction accuracy. Summary of the invention
[0004] Based on this, it is necessary to provide a metal corrosion rate prediction method, device, computer equipment and storage medium that can optimize the modeling parameters of the gray prediction model and build a more accurate gray prediction model to predict the life of the metal in response to the above technical problems.
[0005] A method for predicting metal corrosion rate, the method comprising: obtaining a plurality of corrosion data corresponding to a plurality of different corrosion durations of a metal to be predicted under a simulated corrosion environment; constructing an original grey prediction model based on the plurality of corrosion data, the original grey prediction model comprising two original parameters; predicting a corrosion prediction value of the metal to be predicted at each corrosion duration based on the original grey prediction model; adjusting the two original parameters in the original grey prediction model using a genetic algorithm based on the corrosion data and the corrosion prediction value of the same corrosion duration to obtain a target grey prediction model, and determining the corrosion rate of the metal to be predicted based on the target grey prediction model.
[0006] In one of the embodiments, based on the corrosion data and the corrosion prediction value of the same corrosion duration, a genetic algorithm is used to adjust two parameters in the original gray prediction model to obtain a target gray prediction model, including: obtaining a preset fitness function, wherein the fitness function is used to obtain the fitness function value corresponding to the corrosion data and the corrosion prediction value; using a genetic algorithm to adjust the two original parameters to obtain a transition gray prediction model; according to the fitness function, adjusting the transition gray prediction model until a target gray prediction model is determined; wherein the target corrosion prediction value determined based on the target gray prediction model and the fitness function value corresponding to the corrosion data are less than a preset threshold.
[0007] In one embodiment, the method of using a genetic algorithm to adjust the two original parameters to obtain a transitional gray prediction model includes: generating a corresponding genetic algorithm population according to the two original parameters, the population including a plurality of individuals; screening the plurality of individuals according to the fitness of each individual through a roulette wheel selection algorithm to obtain a first population composed of screened individuals; linearly combining the individuals in the first population through an arithmetic crossover algorithm to obtain a second population; adjusting the gene values of the individuals in the second population through a uniform mutation algorithm to determine two transitional parameters; and constructing a transitional gray prediction model according to the two transitional parameters.
[0008] In one of the embodiments, constructing the original gray prediction model based on the multiple corrosion data includes: performing logarithmic transformation on each of the corrosion data to obtain multiple transformed corrosion data; determining multiple smoothness corresponding to the multiple transformed corrosion data; if the multiple smoothness are all within a preset range, constructing the original gray prediction model based on the multiple transformed corrosion data.
[0009] In one of the embodiments, constructing the original gray prediction model based on multiple corrosion data also includes: if at least one of the smoothness is not within a preset range, preprocessing the transformed corrosion data until multiple smoothness are within the preset range, and then constructing the original gray prediction model based on the preprocessed transformed corrosion data.
[0010] In one of the embodiments, the method further includes: obtaining a transformed corrosion prediction value predicted by an original grey prediction model constructed based on a plurality of the transformed corrosion data; performing a corresponding exponential transformation on the transformed corrosion prediction value according to the logarithmic transformation method to determine the corrosion prediction value.
[0011] In one of the embodiments, the method further includes: determining the posterior difference ratio and the small error probability of the target gray prediction model based on each of the corrosion data and the target corrosion prediction value predicted based on the target gray prediction model; and determining the model accuracy level of the target gray prediction model based on the posterior difference ratio and the small error probability.
[0012] A metal corrosion rate prediction device, comprising:
[0013] A data acquisition module, used to acquire a plurality of corrosion data corresponding to a plurality of different corrosion durations of the metal to be predicted in a simulated corrosion environment;
[0014] A model building module, used for building an original grey prediction model according to the plurality of corrosion data, wherein the original grey prediction model includes two original parameters;
[0015] A prediction value acquisition module, used for predicting the corrosion prediction value of the metal to be predicted at each corrosion duration based on the original grey prediction model;
[0016] The rate determination module is used to adjust the two original parameters in the original grey prediction model using a genetic algorithm according to the corrosion data and the corrosion prediction value of the same corrosion duration, obtain a target grey prediction model, and determine the corrosion rate of the metal to be predicted based on the target grey prediction model.
[0017] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program: obtaining a plurality of corrosion data corresponding to a plurality of different corrosion durations of a metal to be predicted in a simulated corrosion environment; constructing an original grey prediction model according to the plurality of corrosion data, wherein the original grey prediction model comprises two original parameters; predicting a corrosion prediction value of the metal to be predicted at each corrosion duration based on the original grey prediction model; adjusting the two original parameters in the original grey prediction model using a genetic algorithm according to the corrosion data and the corrosion prediction value of the same corrosion duration to obtain a target grey prediction model, and determining the corrosion rate of the metal to be predicted based on the target grey prediction model.
[0018] A computer-readable storage medium stores a computer program, which implements the following steps when executed by a processor: obtaining a plurality of corrosion data corresponding to a plurality of different corrosion durations of a metal to be predicted in a simulated corrosion environment; constructing an original grey prediction model based on the plurality of corrosion data, wherein the original grey prediction model includes two original parameters; predicting a corrosion prediction value of the metal to be predicted at each corrosion duration based on the original grey prediction model; adjusting the two original parameters in the original grey prediction model using a genetic algorithm based on the corrosion data and the corrosion prediction value of the same corrosion duration to obtain a target grey prediction model, and determining the corrosion rate of the metal to be predicted based on the target grey prediction model.
[0019] The above-mentioned metal corrosion rate prediction method, device, computer equipment and storage medium. This prediction method can place the metal to be predicted in a simulated corrosion environment, obtain the corrosion data of the metal to be predicted at different corrosion durations, and construct an original gray prediction model based on multiple corrosion data. Based on the original gray prediction model, the corrosion prediction value of the metal to be predicted at each corrosion duration corresponding to the experimental value is obtained. Based on the corrosion data and corrosion prediction value of the same corrosion duration as a reference, a genetic algorithm is used to adjust the two parameters in the gray prediction model to obtain a target gray prediction model, and then based on the target gray prediction model, the metal to be predicted is predicted to obtain a new corrosion prediction value, so that the corrosion rate of the metal to be predicted can be predicted. Since the two modeling parameters in the target gray prediction model are based on the experimental values of the corrosion data and the corrosion prediction values obtained by the original gray prediction model, and then optimized by the genetic algorithm, the prediction accuracy of the target gray prediction model is higher and the prediction results obtained are more accurate. Therefore, the corrosion rate of the metal can be predicted more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A flowchart of a method for predicting metal corrosion rate in one embodiment;
[0022] Figure 2 is a flow chart of a method for determining a target grey prediction model in one embodiment;
[0023] Figure 3 A schematic diagram of a flow chart of an optimization method of a genetic algorithm in one embodiment;
[0024] Figure 4 is a schematic flow chart of a method for optimizing smoothness in one embodiment;
[0025] Figure 5 A schematic flow chart of a method for optimizing and restoring smoothness in one embodiment;
[0026] Figure 6 A schematic diagram of a flow chart of a method for determining model accuracy in one embodiment;
[0027] Figure 7 A bar chart showing predicted values of metals to be predicted in one embodiment;
[0028] Figure 8 is a structural diagram of a metal corrosion rate prediction device in one embodiment;
[0029] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0030] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0032] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" etc. specify the presence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof.
[0033] As described in the background technology, the grey prediction model in the prior art has the problem of low prediction accuracy. The inventors have found that the reason for this problem is that the grey prediction model in the prior art is constructed only based on the historical life of the metal, and the modeling parameters are single, while there are many factors that affect the metal corrosion rate in practice, and the modeling parameters are not optimized according to the actual data, so the prediction accuracy is not high.
[0034] Based on the above reasons, the present invention provides a metal corrosion rate prediction method, device, computer equipment and storage medium that can optimize the modeling parameters of the grey prediction model and construct a more accurate grey prediction model to predict the life of the metal.
[0035] In one embodiment, Figure 1 As shown, a method for predicting metal corrosion rate is provided, the method comprising:
[0036] Step S100, obtaining a plurality of corrosion data corresponding to a plurality of different corrosion durations of the metal to be predicted in a simulated corrosion environment.
[0037] Specifically, a metal sample is obtained, and according to the requirements of "Removal of Corrosion Products on Corrosion Test Specimens of Metals and Alloys", the metal sample is derusted in accordance with the national standard GB / T 16545-1996 / ISO 8407:199. The derusting method is as follows: the derusting liquid used is a 1000mL solution of 50mL phosphoric acid + 20g chromium trioxide + distilled water. The metal sample is immersed in the solution for 10 minutes at a temperature of 85°C until the rust layer is completely removed. At the same time, an uncorroded sample is used to correct the corrosion of the sample by the derusting liquid. The derusted sample is cleaned with distilled water, wiped with anhydrous ethanol, and then blown dry with cold air, placed in a drying oven to dry, and weighed with an electronic balance after drying (accurate to 0.001mg). The weight of the metal sample after derusting is compared with the weight before the corrosion experiment to obtain corrosion data.
[0038] The corrosion data is then calculated using the following formula:
[0039]
[0040] Where V is the corrosion data of the sample metal, W0 is the initial mass of the sample metal, and W t is the mass of the sample metal at the current corrosion time, and A is the surface area of the sample metal.
[0041] Exemplarily, the corrosion data of the sample metals are shown in the following table.
[0042] Table 1. Corrosion data table.
[0043]
[0044] Step S120: constructing an original grey prediction model according to the plurality of corrosion data, wherein the original grey prediction model includes two original parameters.
[0045] Specifically, the differential equation of the grey prediction model is established:
[0046]
[0047] Among them, X (0) (j) is the corrosion data of the jth corrosion duration, α is the first modeling parameter, β is the second modeling parameter, and n is the number of weight loss data of the metal to be predicted.
[0048] Then, through the least squares method, according to the differential equation of the grey prediction model, the matrix equations of the two modeling parameters are determined:
[0049] [α,β] T =(B T B) -1 B T Y
[0050] Among them, α is a modeling parameter, β is another modeling parameter, Among them, X (0) (j) is the corrosion data of the jth corrosion duration, X (0) (n) is the corrosion data of the nth corrosion duration.
[0051] Substituting the above modeling parameter matrix into the differential equation of the grey prediction model, we can get the following formula:
[0052]
[0053] in, in, is the corrosion prediction value of the jth corrosion duration, α is the first modeling parameter, β is the second modeling parameter, and n is the number of weight loss data of the metal to be predicted.
[0054] Then substitute the following formula into the above formula to restore:
[0055]
[0056] The final formula of the grey prediction model is as follows:
[0057]
[0058] in, is the corrosion prediction value corresponding to the kth corrosion duration, x (0) (1) is the corrosion data corresponding to the first corrosion duration, e is the natural logarithm, α is the first modeling parameter, β is the second modeling parameter, k = 1, 2, 3...
[0059] Step S140, based on the original grey prediction model, predicting the corrosion prediction value of the metal to be predicted at each corrosion duration.
[0060] Specifically, different corrosion durations k are substituted into the above formula to determine the corrosion prediction value under each corrosion duration.
[0061] Step S160, according to the corrosion data and corrosion prediction value of the same corrosion duration, a genetic algorithm is used to adjust two original parameters in the original grey prediction model to obtain a target grey prediction model, and based on the target grey prediction model, the corrosion rate of the metal to be predicted is determined.
[0062] Specifically, after using the target grey prediction model to predict the corrosion prediction value of each corrosion duration of the metal to be predicted, the corrosion rate, that is, the change in the corrosion prediction value per unit time, can be determined based on each corrosion prediction value and time.
[0063] In this embodiment, the metal to be predicted is first placed in a simulated corrosion environment to obtain corrosion data of the metal to be predicted at different corrosion durations. Thus, the experimental value of the corrosion data of the metal to be predicted is determined, which provides a basis and data support for subsequent predictions. Then, based on multiple corrosion data, the original gray prediction model is constructed, so that a gray prediction model in traditional technology is constructed only based on the historical experimental values of the corrosion data, but the prediction accuracy of the gray prediction model is not high. Then, based on the original gray prediction model, the corrosion prediction value of the metal to be predicted under each corrosion duration corresponding to the experimental value is obtained. Then, based on the corrosion data and corrosion prediction value of the same corrosion duration as a reference, the genetic algorithm is used to adjust the two parameters in the gray prediction model to obtain the target gray prediction model, and then based on the target gray prediction model, the metal to be predicted is predicted to obtain a new corrosion prediction value, so that the corrosion rate of the metal to be predicted can be predicted. Since the two modeling parameters in the target gray prediction model are based on the experimental values of the corrosion data and the corrosion prediction values obtained by the original gray prediction model, and then optimized by the genetic algorithm, the prediction accuracy of the target gray prediction model is higher and the prediction result obtained is more accurate. Thus, the corrosion rate of the metal can be predicted more accurately.
[0064] In one embodiment, Figure 2 As shown, step S160 includes:
[0065] Step S200, obtaining a preset fitness function, wherein the fitness function is used to obtain fitness function values corresponding to corrosion data and corrosion prediction values.
[0066] Exemplarily, the formula of the fitness function is as follows:
[0067]
[0068] Among them, F is the fitness function value, is the corrosion prediction value, X (0)(i) is the corrosion data of the i-th corrosion duration.
[0069] Step S220: using a genetic algorithm to adjust two original parameters to obtain a transitional grey prediction model.
[0070] Exemplarily, the two original parameters are input as variables into the genetic algorithm toolbox of matlab (commercial mathematical software produced by MathWorks, USA) software as individuals of the population, the initial population size is set, the selection operator is set, the crossover operator is set, and the mutation operator is set, and then the genetic algorithm toolbox is run to obtain the optimized parameters.
[0071] Step S240: adjusting the transition grey prediction model according to the fitness function until the target grey prediction model is determined.
[0072] For example, the corrosion data and corrosion prediction value of the same corrosion duration are substituted into the following fitness formula to determine the fitness function value:
[0073]
[0074] Among them, F is the fitness function value, is the corrosion prediction value, X (0) (i) is the corrosion data of the i-th corrosion duration.
[0075] Based on the fitness function value obtained above as a reference, the parameters in the transition gray prediction model are continuously adjusted. According to the parameters adjusted each time, the predicted value and corrosion data predicted by the constructed gray prediction model are re-substituted into the fitness formula above, and the determined fitness function value will become smaller and smaller until it is lower than the preset value. At this time, the transition gray prediction model is determined to meet the standard and is used as the target gray prediction model.
[0076] Specifically, the target corrosion prediction value determined based on the target grey prediction model and the fitness function value corresponding to the corrosion data are less than a preset threshold.
[0077] In this embodiment, the fitness function value is determined by combining the corrosion data and the corrosion prediction value through the preset fitness function. And according to the fitness function value as a reference value, the genetic algorithm is used to adjust the two original parameters to obtain a transitional gray prediction model. The genetic algorithm is repeatedly used to adjust the modeling parameters until the target gray prediction model is obtained, that is, the gray prediction model is optimized. The parameters in the target gray prediction model are the target parameters obtained after the original parameters are adjusted by the genetic algorithm for multiple times.
[0078] In one embodiment, Figure 3 As shown, step S220 includes:
[0079] Step S300, generating a corresponding genetic algorithm population according to two original parameters, the population including a plurality of individuals.
[0080] Specifically, the two parameters are encoded with real numbers and converted into the form of chromosomes, that is, the two parameters are converted into the form of gene codes, so as to facilitate the processing by the genetic algorithm. The two parameters are then input as variables into the genetic algorithm toolbox of MATLAB, and the population size is set to 200.
[0081] Step S320, screening multiple individuals according to the fitness of each individual through a roulette wheel selection algorithm to obtain a first population consisting of screened individuals.
[0082] Specifically, genetic operators include selection operators, crossover operators, and mutation operators.
[0083] Genetic algorithms use selection operators to select individuals in a group in a certain way, so that individuals with high fitness are likely to be inherited to the next generation, so that the fitness values of individuals in the group are constantly approaching the optimal solution. Common selection operators include roulette selection, random competition selection, optimal preservation strategy and exclusion selection. In the roulette selection method, the higher the fitness value, the greater the possibility of being selected and the greater the probability of entering the next generation; random competition selection is basically the same as roulette selection. In random competition selection, a pair of individuals are selected each time according to the roulette selection mechanism, and then the two individuals are allowed to compete, and the one with high fitness is selected, and this is repeated until the selection is full; in the optimal preservation strategy, the individual with the highest fitness in the current group does not participate in the crossover and mutation operations, but is used to replace the individual with the lowest fitness in the current generation group after crossover and mutation operations; in the exclusion selection method, the newly generated offspring replaces or excludes similar old parent individuals. The formula of the roulette selection algorithm is as follows:
[0084] f i = k / F i
[0085]
[0086] Among them, F i is the fitness value of the ith individual; k is the coefficient; N is the number of individuals in the population. i is the probability that the ith individual is selected.
[0087] The selection operator in this step adopts the roulette selection algorithm, because in the roulette selection algorithm, individuals with high fitness have a high probability of being selected, and individuals with low fitness also have a chance of being selected. This selection method improves the diversity of the population, thereby improving the global search capability of the genetic algorithm.
[0088] Step S340: linearly combine the individuals in the first population using an arithmetic crossover algorithm to obtain a second population.
[0089] The genetic algorithm uses the crossover operator to exchange some of the genes of two matching individuals in a certain way, thereby forming two new individuals, which determines the global search capability of the genetic algorithm. Commonly used crossover operators include single-point crossover, two-point crossover, multi-point crossover and arithmetic crossover. Single-point crossover means that only one crossover point is randomly set in the individual code string, and then the two paired individuals are exchanged at this point; two-point crossover and multi-point crossover mean that two crossover points are randomly set in the individual code string, and then partial gene exchange is performed; arithmetic crossover means that two new individuals are generated by the linear composition of two individuals.
[0090] Assume that on two chromosomes If an arithmetic crossover is performed between them, the two new individuals generated after the crossover operation are:
[0091]
[0092] Among them, a and b are random constants between 0 and 1. for The next generation of individuals, for the next generation of individuals.
[0093] The crossover operator in this step uses arithmetic crossover because it is more suitable for processing individuals represented by floating point coding (real coding), and individuals in genetic algorithms use entity coding. One of the important characteristics of using arithmetic crossover is that it can ensure that the offspring generated by the crossover does not exceed the value range of the chromosome.
[0094] Step S360, adjusting the gene values of individuals in the second population by a uniform mutation algorithm to determine two transition parameters.
[0095] Genetic algorithms use mutation operators to replace parts of an individual's gene code with corresponding parts of other gene codes in a certain way, thereby forming a new individual. This can avoid the loss of certain information caused by selection and crossover operations, and ensure the effectiveness of the genetic algorithm. Common mutation operators include basic bit mutation, uniform mutation, boundary mutation, and Gaussian approximate mutation. Basic bit mutation refers to the mutation of the values of a certain bit or several gene loci randomly specified with a mutation probability in the individual code string; uniform mutation refers to replacing the original gene values of each gene locus in the individual code string with a random number that conforms to a uniform distribution within a certain range with a smaller probability; boundary mutation refers to randomly taking one of the two corresponding boundary gene values of a gene locus to replace the original gene value; Gaussian approximate mutation refers to performing a mutation operation using a random number that conforms to a normal distribution to replace the original gene value. Suppose that the uniform mutation algorithm is used to modify the jth gene a of the ith individual. ij To mutate, the mutation formula is as follows:
[0096]
[0097] Among them, b ij for a ij The jth gene of the ith individual after uniform mutation, a max is the maximum value of the gene, a min is the minimum value of the gene, r is a random number between 0 and 1, G max is the maximum number of iterations.
[0098] Exemplarily, the genetic algorithm toolkit in the mathematical software matlab of MathWorks, USA, is used to set the fitness function as:
[0099]
[0100] Among them, F is the fitness function value, is the corrosion prediction value, X (0) (i) is the corrosion data of the ith corrosion duration. Set the input variables to two modeling parameters. Input population size is 200, the selection operator is set to compass selection method, the mutation operator is set to uniform mutation, the crossover operator uses arithmetic crossover, and the rest are default settings. Then run the genetic algorithm toolkit, and get two new modeling parameters each time you run it. Then use the new modeling parameters to rebuild the grey prediction model in the above way, get a new set of predicted values for the metal to be predicted, and substitute them into the fitness function to update the fitness value. If the fitness value is higher than the preset threshold, then input the current two modeling parameters into the genetic algorithm toolkit for optimization until the fitness value is lower than the preset threshold.
[0101] The mutation operator in this step adopts uniform mutation, because uniform mutation is particularly suitable for the primary operation stage of the genetic algorithm. It allows the search point to move freely in the entire search space, increasing the diversity of the population, thereby improving the global search capability of the genetic algorithm.
[0102] Step S380: construct a transition gray prediction model according to the two transition parameters.
[0103] Specifically, after constructing the first-level transition gray prediction model, the first-level transition gray prediction model is used to determine the corresponding fitness function value. If it is higher than the preset threshold, the transition parameters are repeated with the above steps to obtain the second-level transition parameters, and the second-level gray prediction model is constructed. Then, the fitness function value corresponding to the second-level gray prediction model is determined to be lower than the preset threshold. In this way, a multi-level transition gray prediction model is constructed until the fitness function value corresponding to a certain level of transition gray prediction model is lower than the preset threshold, and then the process stops.
[0104] In this embodiment, two original parameters are optimized by genetic algorithm, and the problem solving process is converted into a process similar to the selection, crossover, and mutation of chromosome genes in biological evolution by mathematical means and computer simulation operation. The establishment of genetic algorithm solves the problem of searching for the optimal solution of the calculation model very well, and the parameters of the gray prediction model are a process of seeking the optimal solution, thereby determining the optimal modeling parameters and constructing a target gray prediction model with higher prediction accuracy.
[0105] In one embodiment, Figure 4 As shown, step S120 includes:
[0106] Step S400, performing logarithmic transformation on each corrosion data to obtain a plurality of transformed corrosion data.
[0107] Exemplarily, the corrosion data is logarithmically transformed according to the following formula:
[0108] x (0) (k) = lnX (0) (k), (k=1,2,…)
[0109] Among them, x (0) (k) is the transformed corrosion data, X (0) (k) is the corrosion data corresponding to the kth corrosion duration, and ln is the natural logarithm.
[0110] Alternatively, the corrosion data can be log-transformed according to the following formula:
[0111] x (0) (k) = lgX (0) (k), (k=1,2,…)
[0112] Among them, x (0) (k) is the transformed corrosion data, X (0) (k) is the corrosion data corresponding to the kth corrosion duration, and lg is the logarithm with base 10.
[0113] Step S420, determining multiple smoothness corresponding to the multiple transformed erosion data.
[0114] Exemplarily, the smoothness is determined according to the following formula:
[0115]
[0116] Among them, σ(k) is the smoothness of the transformed corrosion data corresponding to the kth corrosion duration, x (0) (k-1) is the transformed corrosion data corresponding to the (k-1)th corrosion duration, x (0) (k) is the transformed corrosion data corresponding to the kth corrosion duration, where k = 1, 2, ...
[0117] Step S440: if the multiple smoothnesses are within the preset range, construct an original grey prediction model according to the multiple transformed erosion data.
[0118] Exemplarily, the preset range of smoothness is (e -2 / n+1 e 2 / n+1 )where n is the number of transformed corrosion data.
[0119] Step S460, if at least one smoothness is not within the preset range, preprocess the transformed erosion data until multiple smoothness are within the preset range, and then construct the original grey prediction model based on the preprocessed transformed erosion data.
[0120] Exemplarily, the preprocessing is to use an appropriate constant to perform a translation transformation on the transformed erosion data so that each smoothness is within a preset range, for example, each transformed erosion data is added with 0.0003. If the preprocessing is performed by translation, the transformed erosion data finally obtained must be subtracted by 0.0003 for restoration.
[0121] In this embodiment, by performing logarithmic transformation on the corrosion data, the smoothness of the corrosion data is improved without changing the growth trend of the original sequence of the corrosion data, thereby improving the prediction result and making the constructed grey prediction model more accurate.
[0122] Exemplarily, the smoothness is shown in the following table.
[0123] Table 2, Smoothness.
[0124] k Smoothness 2 0.4980 3 0.7567 4 0.7911 5 0.8554 6 0.6631
[0125] From the data in Table 2, we can see that the smoothness value σ(k) of the original data does not all satisfy σ(k)∈(0.7515,1.3307). Therefore, we need to smooth the original data. The present invention uses an appropriate constant c for translation transformation, that is, x (0) (k) = X (0) (k)+0.0003,(k=1,2,…,n).
[0126] In one embodiment, Figure 5 As shown, the metal corrosion rate prediction method also includes:
[0127] Step S500, obtaining a transformed corrosion prediction value predicted by an original grey prediction model constructed according to a plurality of transformed corrosion data.
[0128] Specifically, the original grey prediction model constructed according to a plurality of transformed corrosion data is used to predict the metal to be predicted, and the transformed corrosion prediction value is obtained.
[0129] Step S520, performing a corresponding exponential transformation on the transformed corrosion prediction value according to a logarithmic transformation method to determine the corrosion prediction value.
[0130] For example, after the logarithmic transformation, the final transformed corrosion prediction value needs to be restored by the corresponding exponential transformation. For example, if the natural logarithm transformation is performed, the predicted value is restored by the following formula to obtain the actual predicted value:
[0131]
[0132] in, is the corrosion prediction value of the final k-th corrosion duration, is the transformed corrosion prediction value of the kth corrosion duration, and e is the natural logarithm.
[0133] If a logarithmic transformation with base 10 is performed, the predicted value can be restored using the following formula to obtain the actual predicted value:
[0134]
[0135] in, is the corrosion prediction value of the final k-th corrosion duration, is the transformed corrosion prediction value of the kth corrosion duration.
[0136] In one embodiment, Figure 6 As shown, the metal corrosion rate prediction method also includes:
[0137] Step S600, determining the posterior difference ratio and small error probability of the target grey prediction model according to each corrosion data and the target corrosion prediction value predicted by the target grey prediction model.
[0138] Specifically, the residual value of the corrosion data of the metal to be predicted with different corrosion durations is determined by the following formula:
[0139]
[0140] Among them, ε(i) is the residual value of the corrosion data of the metal to be predicted for the i-th corrosion duration, X (0) (i) is the corrosion data of the i-th corrosion duration, is the target corrosion prediction value of the final i-th corrosion duration, and n is the number of corrosion data of the metal to be predicted.
[0141] The residual mean of the corrosion data of the metal to be predicted is determined by the following formula:
[0142]
[0143] in, is the residual mean of the corrosion data of the metal to be predicted, n is the number of corrosion data of the metal to be predicted, and ε(i) is the residual value of the corrosion data of the metal to be predicted for the i-th corrosion duration.
[0144] The standard mean value of the corrosion data of the metal to be predicted is determined by the following formula:
[0145]
[0146] in, is the mean value of the corrosion data of the metal to be predicted, n is the number of corrosion data of the metal to be predicted, X (0) (i) is the corrosion data of the metal to be predicted for the i-th corrosion duration.
[0147] The standard deviation of the corrosion data of the metal to be predicted is determined by the following formula:
[0148]
[0149] Among them, S1 is the standard deviation of the corrosion data of the metal to be predicted, X (0) (i) is the corrosion data of the metal to be predicted with the i-th corrosion duration, is the mean of the corrosion data of the metal to be predicted, and n is the number of corrosion data of the metal to be predicted.
[0150] The residual standard deviation of the corrosion data of the metal to be predicted is determined by the following formula:
[0151]
[0152] Among them, S2 is the residual standard deviation of the corrosion data of the metal to be predicted, is the residual mean of the corrosion data of the metal to be predicted, n is the number of corrosion data of the metal to be predicted, and ε(i) is the residual value of the corrosion data of the metal to be predicted for the i-th corrosion duration.
[0153] The posterior difference ratio of the grey prediction model is determined by the following formula:
[0154]
[0155] Among them, C is the posterior difference ratio of the grey prediction model, S1 is the standard deviation of the corrosion data of the metal to be predicted, and S2 is the residual standard deviation of the corrosion data of the metal to be predicted.
[0156] The small error probability of the grey prediction model is determined by the following formula:
[0157]
[0158] Among them, P is the small error probability of the grey prediction model, S1 is the standard deviation of the corrosion data of the metal to be predicted, is the residual mean of the corrosion data of the metal to be predicted, and ε(i) is the residual value of the corrosion data of the metal to be predicted for the i-th corrosion duration.
[0159] Step S620, determining the model accuracy level of the target grey prediction model according to the posterior difference ratio and the small error probability.
[0160] Specifically, the smaller the posterior difference ratio of the grey prediction model, the better. The smaller the posterior difference ratio of the grey prediction model, the larger the standard deviation of the standard value of the weight loss data of the metal to be predicted, and the smaller the residual standard deviation of the weight loss data of the metal to be predicted, indicating that the standard value of the weight loss data of the metal to be predicted has a large degree of dispersion, and the residual dispersion of the weight loss data of the metal to be predicted is small. Therefore, the smaller the posterior difference ratio, it means that although the original data is very discrete, the difference between the calculated value obtained by this grey prediction model and the actual value is not very discrete, so the prediction effect of this grey prediction model is better.
[0161] Specifically, the larger the small error probability of the grey prediction model, the better. The larger the small error probability of the grey prediction model, the more points there are where the difference between the residual and the mean value of the residual is less than the given value 0.6745S1, which means that the distribution of the predicted values is more uniform, so the prediction effect of the grey prediction model is good.
[0162] Specifically, the accuracy of the grey prediction model is determined through the following table:
[0163] Table 3. Grey prediction model accuracy classification table.
[0164]
[0165] The accuracy level of the model is equal to the higher level of the level corresponding to the small error probability and the level corresponding to the posterior difference ratio. For example, if the accuracy corresponding to the small error probability is level one and the accuracy corresponding to the posterior difference ratio is level two, then the accuracy of the grey prediction model is level two.
[0166] In this embodiment, the posterior difference ratio and the small error probability of the target grey prediction model are calculated, and then the model accuracy level of the target grey prediction model is determined based on the posterior difference ratio and the small error probability, thereby quantitatively rating the accuracy of the target grey prediction model.
[0167] For example, the data table example is shown in Table 4 below.
[0168] Table 4. Overall data table.
[0169]
[0170] For example, Figure 7 As shown, Figure 7 The curves are the actual value of the metal to be predicted, the predicted value of the original grey prediction model, and the predicted value of the target grey prediction model. It can be seen from the figure that the target grey prediction model, that is, the grey prediction model optimized using the method of the present application, obtains a data curve that is closer to the actual data curve.
[0171] It should be understood that although Figure 1-Figure 6 The steps in the flowchart are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of the steps, and the steps can be executed in other orders. Moreover, Figure 1-Figure 6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed in the same corrosion time, but can be performed at different corrosion times. The execution order of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0172] In one embodiment, Figure 8 As shown, a metal corrosion rate prediction device is provided, comprising: a data acquisition module 801, a model building module 802, a prediction value acquisition module 803 and a rate determination module 804, wherein:
[0173] The data acquisition module 801 is used to acquire a plurality of corrosion data corresponding to a plurality of different corrosion durations of the metal to be predicted in a simulated corrosion environment.
[0174] The model building module 802 is used to build an original grey prediction model according to a plurality of corrosion data, and the original grey prediction model includes two original parameters.
[0175] The prediction value acquisition module 803 is used to predict the corrosion prediction value of the metal to be predicted at each corrosion duration based on the original grey prediction model.
[0176] The rate determination module 804 is used to adjust two original parameters in the original grey prediction model using a genetic algorithm according to the corrosion data and corrosion prediction value of the same corrosion duration, obtain a target grey prediction model, and determine the corrosion rate of the metal to be predicted based on the target grey prediction model.
[0177] For the specific limitations of the metal corrosion rate prediction device, please refer to the limitations of the metal corrosion rate prediction method above, which will not be repeated here. The various modules in the above-mentioned metal corrosion rate prediction device can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0178] In one embodiment, a computer device is provided, wherein the internal structure diagram of the computer device can be as follows: Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a metal corrosion rate prediction method is implemented.
[0179] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0180] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0181] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0182] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0183] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0184] In the description of this specification, the description with reference to the terms "some embodiments", "other embodiments", "ideal embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic descriptions of the above terms do not necessarily refer to the same embodiment or example.
[0185] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0186] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for predicting metal corrosion rate, It is characterized in that The method comprises: Acquire multiple corrosion data corresponding to multiple different corrosion durations of the metal to be predicted in a simulated corrosion environment; According to the plurality of corrosion data, an original grey prediction model is constructed, wherein the original grey prediction model includes two original parameters; Based on the original grey prediction model, predicting the corrosion prediction value of the metal to be predicted at each corrosion duration; According to the corrosion data and the corrosion prediction value of the same corrosion duration, a genetic algorithm is used to adjust two original parameters in the original grey prediction model to obtain a target grey prediction model, and based on the target grey prediction model, the corrosion rate of the metal to be predicted is determined; The method of using a genetic algorithm to adjust two parameters in the original grey prediction model to obtain a target grey prediction model includes: Obtaining a preset fitness function, wherein the fitness function is used to obtain fitness function values corresponding to the corrosion data and the corrosion prediction value; The two original parameters are adjusted by using a genetic algorithm to obtain a transitional grey prediction model; According to the fitness function, the transition gray prediction model is adjusted until the target gray prediction model is determined; wherein the target corrosion prediction value determined based on the target gray prediction model and the fitness function value corresponding to the corrosion data are less than a preset threshold, and the formula of the gray prediction model is as follows: in, is the corrosion prediction value corresponding to the kth corrosion duration, x (0) (1) is the corrosion data corresponding to the first corrosion duration, e is the natural logarithm, α is the first modeling parameter, β is the second modeling parameter, k=1, 2, 3..., wherein the two parameters of the grey prediction model include the first modeling parameter α and the second modeling parameter β.
2. The method according to claim 1, It is characterized in that The method of using a genetic algorithm to adjust the two original parameters to obtain a transitional grey prediction model includes: According to the two original parameters, a corresponding genetic algorithm population is generated, wherein the population includes a plurality of individuals; The plurality of individuals are screened according to the fitness of each of the individuals by a roulette wheel selection algorithm to obtain a first population consisting of screened individuals; Performing linear combination of individuals in the first population by using an arithmetic crossover algorithm to obtain a second population; Adjusting the gene values of individuals in the second population by a uniform mutation algorithm to determine two transition parameters; A transition grey prediction model is constructed according to the two transition parameters.
3. The method according to claim 1, It is characterized in that The method further comprises: after using the target grey prediction model to predict the corrosion prediction value of each corrosion duration of the metal to be predicted, determining the corrosion rate according to each corrosion prediction value and time.
4. The method according to claim 1, It is characterized in that The method of constructing an original grey prediction model according to the plurality of corrosion data comprises: Performing logarithmic transformation on each of the corrosion data to obtain a plurality of transformed corrosion data; determining a plurality of smoothnesses corresponding to a plurality of the transformed erosion data; If the plurality of smoothnesses are within a preset range, an original grey prediction model is constructed according to the plurality of transformed corrosion data.
5. The method according to claim 4, It is characterized in that The constructing of the original grey prediction model according to the plurality of corrosion data further comprises: If at least one of the smoothness is not within the preset range, the transformed erosion data is preprocessed until multiple smoothness are within the preset range, and then the original grey prediction model is constructed based on the preprocessed transformed erosion data.
6. The method according to claim 4, It is characterized in that The method further comprises: Obtaining a transformed corrosion prediction value predicted by an original grey prediction model constructed based on the plurality of transformed corrosion data; According to the logarithmic transformation method, the transformed corrosion prediction value is subjected to a corresponding exponential transformation to determine the corrosion prediction value.
7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: Determine the posterior difference ratio and the small error probability of the target grey prediction model according to each of the corrosion data and the target corrosion prediction value predicted by the target grey prediction model; The model accuracy level of the target grey prediction model is determined according to the posterior difference ratio and the small error probability.
8. A metal corrosion rate prediction device, It is characterized in that The device comprises: A data acquisition module, used to acquire a plurality of corrosion data corresponding to a plurality of different corrosion durations of the metal to be predicted in a simulated corrosion environment; A model building module, used for building an original grey prediction model according to the plurality of corrosion data, wherein the original grey prediction model includes two original parameters; A prediction value acquisition module, used for predicting the corrosion prediction value of the metal to be predicted at each corrosion duration based on the original grey prediction model; A rate determination module, for adjusting two original parameters in the original grey prediction model using a genetic algorithm according to the corrosion data and the corrosion prediction value of the same corrosion duration, obtaining a target grey prediction model, and determining the corrosion rate of the metal to be predicted based on the target grey prediction model; The rate determination module is also used for: Obtaining a preset fitness function, wherein the fitness function is used to obtain fitness function values corresponding to the corrosion data and the corrosion prediction value; The two original parameters are adjusted by using a genetic algorithm to obtain a transitional grey prediction model; According to the fitness function, the transition gray prediction model is adjusted until the target gray prediction model is determined; wherein the target corrosion prediction value determined based on the target gray prediction model and the fitness function value corresponding to the corrosion data are less than a preset threshold, and the formula of the gray prediction model is as follows: in, is the corrosion prediction value corresponding to the kth corrosion duration, x (0) (1) is the corrosion data corresponding to the first corrosion duration, e is the natural logarithm, α is the first modeling parameter, β is the second modeling parameter, k=1, 2, 3..., wherein the two parameters of the grey prediction model include the first modeling parameter α and the second modeling parameter β.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Metal material marine environment corrosion data prediction system and method
CN116307174A
