Turbine flowmeter instrument coefficient fitting method for optimizing genetic algorithm

By optimizing the genetic algorithm, combining the display error method and the genetic algorithm, the weight allocation and constraints are used to solve the problems of local optimality and overfitting in the calculation of the instrument coefficient of the turbine flowmeter, achieving higher accuracy and stability.

CN120216858APending Publication Date: 2025-06-27HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510261271.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The existing turbine flowmeter instrument coefficient calculation methods may lead to local optimal solutions, and there is a problem of excessive relative error in calibration and verification data, resulting in overfitting.

Method used

Using the method of optimizing genetic algorithm, firstly, the fit coefficient is obtained using the least squares method based on the indicator error, the weight is estimated through the deviation, different weights are assigned to different data, and the global random search ability of the genetic algorithm is used to find the optimal fit coefficient and add corresponding constraints to avoid overfitting.

Benefits of technology

A more stable and balanced instrument coefficient calculation is achieved, reducing the relative error of points with relatively large errors in the calibration data, and improving the accuracy and stability of the verification data, ensuring the overall accuracy of the calibration and verification data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216858A_ABST
    Figure CN120216858A_ABST
Patent Text Reader

Abstract

The invention relates to a turbine flowmeter instrument coefficient fitting method for optimizing a genetic algorithm. Firstly, different weights are distributed to different data through the square of a deviation value, then the indication error absolute value of each verification flow point is multiplied by the minimum weight to serve as a target function for optimization, corresponding constraint conditions are added, the relative error of the flow point with the large relative error in the calibration data is reduced, and meanwhile the relative error of the flow point with the large relative error in the calibration data is reduced. The precision and stability of the flow point in the verification data are improved as much as possible, and the overall fitting precision of calibration and verification results is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of instrument coefficient calculation of flow meters, and particularly relates to a method for fitting the instrument coefficient of a turbine flow meter by optimizing a genetic algorithm. Background Art

[0002] In industrial production processes and international trade, the measurement and control of fluid flow cannot be avoided. Flow meters are widely used in multiple industries, such as oil and gas, environmental protection, pharmaceuticals, HVAC, aerospace, urban power, and industrial boilers. Common flow meters include turbine flow meters, Venturi tube flow meters, ultrasonic flow meters, electromagnetic flow meters, and vortex street flow meters. To measure the flow of liquids in different environments and conditions, scientists have invented flow sensors with different principles, such as impeller type, volumetric type, velocity type, and differential pressure type.

[0003] A turbine flow meter is a velocity type flow meter, which has the characteristics of convenient installation and maintenance, high measurement accuracy, wide measurement range, good repeatability, and high pressure resistance. It mainly consists of a pipeline, an impeller and an induction coil, a front guide body, a rear guide body, and a bearing. Its working principle is: when the fluid passes through the pipeline, a driving torque is generated, and at the same time, the frictional torque, electromagnetic resistance torque, and fluid force torque are overcome to make the impeller rotate. The blades cut the magnetic field lines generated by the electromagnet, changing the magnetic flux of the sensing coil, and a pulsating potential signal will be induced in the coil. The frequency of this pulsating signal is proportional to the liquid flow velocity. The instrument coefficient k can be obtained by dividing the frequency of the signal by the liquid flow velocity. Within the linear range of the sensor, the corresponding instrument coefficient k and the liquid flow velocity can be approximately a fixed straight line.

[0004] Before leaving the factory, the flow meter needs to be calibrated to obtain the optimal instrument coefficient of the sensor. Common methods for calculating the instrument coefficient include the least squares method, the fixed-point correction method, and the average instrument coefficient method, etc. Among them, the commonly used least squares methods include the least squares method based on absolute error and the least squares method based on relative error (hereinafter simply referred to as the indication error method). With the improvement of computer capabilities, meta-heuristic algorithms such as genetic algorithms have developed rapidly. Traditional methods may fall into local optimal solutions, while meta-heuristic algorithms adopt different strategies and operations. For example, genetic algorithms generate new solutions through crossover and mutation, which can effectively avoid local optima, maintain the diversity of the search space, and through the design of the fitness function, enable it to evaluate the quality of solutions according to the target performance index, guide the search process to develop in a better direction, and obtain a better instrument coefficient.

[0005] Perform n calibrations on the turbine sensor to obtain n pairs of observed data (x1, y1), (x2, y2), …, (x n , y n ), where x i represents the measured value, and y iRepresents the standard value, i = 1, 2, ..., n, and the fitting function is:

[0006]

[0007] Where k and b are fitting coefficients obtained through the instrument coefficient calculation method;

[0008] 1) Least squares method based on indication error

[0009] The least squares method based on relative error (hereinafter referred to as the indication error method) finds the optimal coefficients of the fitting function by minimizing the sum of squares of relative errors. It is through the objective function: The optimal coefficients k and b are determined when taking the minimum.

[0010] 2) Least squares method based on genetic algorithm

[0011] The least squares method based on genetic algorithm (hereinafter referred to as the ordinary genetic algorithm) is different from the indication error method that finds the optimal coefficients by minimizing the sum of squares of the overall relative error. It comprehensively considers the relative errors of each flow point and is oriented to minimize the relative error of each measurement point. It is through the objective function The optimal coefficients k and b are determined when taking the minimum.

[0012] For turbine flowmeters, using the instrument coefficient solved by the least squares method based on indication error, although it makes the sum of squares of the overall relative error minimum, it may cause the relative error of individual verification flow points to be too large. And using the least squares method based on genetic algorithm, with the minimum absolute value of the relative error of each verification flow point as the optimization goal, tries to make the maximum relative error of the flow point with the largest relative error smaller as much as possible. However, blindly reducing the maximum relative error of the flow point with the largest relative error may cause overfitting of the data at this flow point, resulting in a relatively large relative error at this flow point in the corresponding verification result. Summary of the Invention

[0013] To overcome the deficiencies of the above methods, the present invention proposes a method for fitting the instrument coefficient of a turbine flowmeter by optimizing the genetic algorithm. First, the fitting coefficients are obtained using the least squares method based on the indication error. Based on these fitting coefficients, the deviation of the calibration data is calculated, and the weights are estimated based on the deviation. Different weights are assigned to different data, and the objective function is to minimize the product of the absolute value of the relative error of each verification data and its weight. Through the global random search ability of the genetic algorithm, the optimal fitting coefficients are found. To ensure the accuracy of the calibration data and avoid overfitting, corresponding constraint conditions are added, higher weights are assigned to better data, and a more balanced and stable instrument coefficient is obtained. While reducing the relative error of the flow points with too large relative errors in the calibration data, the accuracy and stability of the flow points in the verification data are improved as much as possible, thereby improving the overall accuracy of the calibration and verification data.

[0014] To achieve the above object, the present invention adopts the following technical solutions:

[0015] The present invention provides a method for fitting the instrument coefficient of a turbine flowmeter by optimizing the genetic algorithm, and the specific steps are as follows:

[0016] Step 1: According to the verification regulation of the turbine flowmeter, for a flowmeter with an accuracy class of 0.5% and a corresponding range ratio not greater than 1:20, the verification should include q min , q1, 0.4q max , q max Four flow points, where q min Is the lower limit of the flow measurement range, q1 is between q min And 0.4q max , q max Is the upper limit of the flow measurement range. Collect the water flow calibration experiment data of each verification flow point, and convert the pulse number, volume, and time obtained from the experiment into the standard flow velocity y i And the measured flow velocity x i .

[0017] Step 2: Fit the standard flow velocity y i And the measured flow velocity x i In the calibration data by the least squares method based on the indication error to obtain the corresponding fitting coefficients (k1, b1), and subtract the estimated value obtained from the fitting coefficients (k1, b1) from the standard value y i To obtain the residual Δ Of each calibration data (x i , y i ) as: i As follows:

[0018]

[0019] Among them, The estimated value is obtained from the coefficients (k1, b1) obtained by the least squares method of indication error, and is obtained by the formula Obtained;

[0020] Theoretically speaking, the weight w i Should be independent of the single measurement value y i And is related to the uncertainty σ of the observed quantity i There is the following formula:

[0021]

[0022] The square of the deviation can be directly used To replace the corresponding uncertainty To construct the weight, convert the corresponding residual square to the corresponding weight w i , and perform normalization processing on the obtained weight:

[0023]

[0024] Among them, λ is the lower bound value of the weight, select the median value of the deviation, and obtain it from the formula Obtained, to prevent a certain observed quantity y i Coincidentally or close to the model function, in which case it will be assigned too high a weight.

[0025] Step 3: Select appropriate genetic algorithm initialization parameters, and use the ordinary genetic algorithm to fit the standard flow rate y i And the measured flow rate x i In the calibration experiment data, to obtain the corresponding fitting parameter group (k2, b2).

[0026] Step 4: Use the instrument coefficient fitting method based on weighted optimization of the genetic algorithm objective function to fit the standard flow rate y i And the measured flow rate x i In the calibration experiment data, the specific steps are as follows:

[0027] ⑴ Select appropriate genetic algorithm initialization parameters according to the problem, and set the initialization parameter of the constant term b3 in the fitting coefficient to |b3| < |b2|.

[0028] ⑵ Determine the fitness function of the algorithm

[0029] The weighted objective function J3 is oriented to minimize the product value of the relative error of the calibration data and the weight. The reciprocal of the objective function J3 can be selected as the corresponding fitness function to ensure that individuals with higher fitness function values are more likely to be selected. The specific form of the corresponding fitness function F is:

[0030]

[0031] At the same time, considering that the flowmeter itself is a high-precision measurement, in order to avoid overfitting, corresponding constraint conditions are added. When the constraint conditions are met, the fitness function F is calculated using the weighted objective function J3. When the conditions are not met, the objective function J2 of the ordinary genetic algorithm is used as J3 to calculate the value of the fitness function F. The specific form of the weighted objective function J3 is as follows:

[0032]

[0033] The corresponding constraint conditions are:

[0034] i J2 < 0.25%, J3 < J2 + 0.10%

[0035] ii 0.25% < J2 < 0.35%, J3 < J2 + 0.08%

[0036] iii 0.35% < J2 < 0.4%, J3 < J2 + 0.06%

[0037] iv 0.4% < J2 < 0.5%, J3 < 0.5%

[0038] Among them, J3 is the maximum value of the absolute value of the relative error carried by the child in the population after weighting, and J2 is the maximum value of the absolute value of the relative error obtained by the fitting coefficients (k2, b2) finally obtained by the ordinary genetic algorithm;

[0039] ⑶ Initialize the selected population range, encode the objective function, and loop to calculate the fitness function F and other steps.

[0040] Step Five: The population is iteratively operated until the preset number of times is reached, and the final fitting parameters (k3, b3) are obtained. According to the formula Calculate the final fitting result.

[0041] The fitting method of the instrument coefficient by weighted optimization of the genetic algorithm objective function in Step Four:

[0042] First, initialize the population according to the set initialization parameters, where the initialization parameter b3 is set to |b3| < |b2|. Then calculate the objective function J3 after weighted optimization of the objective function, and obtain the fitness of each individual in the population through the fitness function F. Select individuals by fitness. The selected individuals will undergo crossover and mutation phenomena similar to those on chromosomes in nature, and the population is updated through crossover and mutation operations. After multiple population iterations, until the number of population iterations reaches the set value, the result obtained at this time is the optimal fitting coefficient (k3, b3).

[0043] Among them, chromosome crossover is to select two individuals and exchange a part of their genes, while mutation is to randomly change some bits in the individual genes to introduce new genetic variations and prevent the algorithm from falling into a local optimal solution.

[0044] The beneficial effects brought by the technical solution provided by the present invention are at least as follows:

[0045] ⑴ The present invention proposes a method for fitting the instrument coefficient of a turbine flowmeter by optimizing the genetic algorithm. Considering that good data and bad data have different effects on the final fitting result, different weights are assigned through the square of the deviation value, and different constraint conditions are used according to the value J2 of the fitting result of the ordinary genetic algorithm. While reducing the points with relatively large relative errors in the calibration data, overfitting is avoided, and the random global search ability of meta-heuristic algorithms such as genetic algorithms is fully utilized to obtain a more stable and balanced instrument coefficient. When ensuring a relatively high accuracy of the calibration result, the accuracy and stability of the verification result are improved.

[0046] ⑵ The present invention can measure the instrument coefficient under actual working conditions, especially in the case of relatively few calibration data and a wide distribution of flow ranges. While ensuring accuracy, overfitting is avoided, a more balanced and stable instrument coefficient is obtained, so that each calibration result is not much different from the previous one, and the performance of the flowmeter itself is fully exerted, improving the accuracy and stability of the flowmeter in measuring the flow rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 is the flowchart of the weight calculation of the present invention;

[0048] Figure 2 is the overall flowchart of a method for fitting the instrument coefficient of a turbine flowmeter by optimizing the genetic algorithm;

[0049] Figure 3 is the absolute value result of the relative error of the calibration data of three fitting methods;

[0050] Figure 4 is the absolute value result of the relative error of the verification data of three fitting methods; DETAILED DESCRIPTION OF THE INVENTION

[0051] The present invention conducts a water flow calibration experiment on a turbine flowmeter. The calibration device mainly consists of a water pump, a pressure stabilizing tank, a ball valve, a meter under test, a standard meter, a timer, a flow rate regulator, a pneumatic commutator, a calibration bucket, a pneumatic valve, and a water tank.

[0052] The meter under test is calibrated using the calibration device. By reading the volume of the calibration bucket and the time displayed by the timer, the standard flow rate y i is calculated, and at the same time, the pulse number recorded by an external acquisition card and the time are used to calculate the measured flow rate x i .

[0053] The water flow calibration process of the present invention will be specifically described below.

[0054] Taking the calibration experiment and verification experiment of the standard range section of the DN15 turbine flowmeter as an example, the calibration steps and effects of the present invention are described. For water flow calibration, according to the flow points that must be selected as stipulated in the turbine flowmeter verification regulation, flow points of 0.6 m 3 / h, 1.2 m 3 / h, 2.4 m 3 / h, and 6.0 m 3 / h are respectively selected, and each flow point is verified three times by the volumetric method. The specific experimental steps are as follows:

[0055] (1) According to the turbine flowmeter verification regulation, complete preparatory work such as preheating and flow stabilization;

[0056] (2) Adjust the glass rotor to adjust the flow velocity to near the first flow point of 0.6 m 3 / h and stabilize for a period of time;

[0057] (3) Start the water flow calibration experiment, and sequentially verify the data at the flow points of 0.6 m 3 / h, 1.2 m 3 / h, 2.4 m 3 / h, and 6.0 m 3 / h and record them in a table. Each flow point is repeatedly verified three times, and this set of experimental data is calibration data;

[0058] (4) Process the calibration data offline through matlab, and respectively obtain the fitting coefficients between the standard flow velocity y i and the measured flow rate x i by using the indication error method, the ordinary genetic algorithm, and the method of the present invention patent. The calculation results are respectively (k1, b1) = (1.02450, -0.00364), (k2, b2) = (1.02449, -0.00422), and (k3, b3) = (1.02394, -0.00206);

[0059] (5) Fill the above fitting coefficients into the calibration data table, and the calibration results corresponding to different fitting algorithms can be obtained. Obtain the absolute value of the relative error of the corresponding results, and arrange them in the order from the small flow point to the large flow point. Every three data are for one flow point, and the corresponding results are as Figure 3 shown;

[0060] ⑹ Conduct the water flow calibration experiment on the above four flow points again and process the data. This set of experimental data is verification data. Fill the previously obtained indication errors, fitting coefficients (k1, b1), (k2, b2), and (k3) of the ordinary genetic algorithm and the method of this invention patent into the table respectively to obtain the verification results, and conduct the same processing according to the steps in (5). The corresponding results are as Figure 4 shown;

[0061] ⑺ It can be seen from Figure 3 that the maximum relative error obtained by the genetic algorithm in the calibration data is 0.134%, and the maximum relative error obtained by the method of this invention patent is 0.194%. The precision is maintained within 0.2%. It can be seen from Figure 4 that the maximum relative error obtained by the method of this invention patent in the verification data is 0.270%, while the maximum relative error of the corresponding ordinary genetic algorithm is 0.429% which is greater than the maximum relative error of 0.380% of the indication error method, indicating that the corresponding ordinary genetic algorithm overfits the data of the first flow point, resulting in a worse precision of the verification data at this flow point than that of the indication error method. However, through the method of this invention patent, the maximum relative error in the verification result is 0.270% which is less than 0.380% of the indication error method;

[0062] Taking into account the calibration data and the verification data comprehensively, the maximum relative error of the indication error method is 0.380%, the maximum relative error of the genetic algorithm is 0.429%, and the maximum relative error of the method of weighted optimization of the genetic algorithm objective function is 0.270%, ensuring that the precision of both the calibration data and the verification data is within the range of 0.3%, demonstrating the superiority of this invention.

Claims

1. A turbine flowmeter instrument coefficient fitting method based on optimized genetic algorithm, characterized in that: The following steps are involved: S1: Collect calibration data and convert it into the corresponding standard flow rate y i and the measured flow rate x i ; S2: Fit the standard flow rate and measured flow rate in the calibration data by the least square method based on the indication error to obtain the corresponding fitting coefficient (k1, b1). The residual Δ of each calibration data is obtained by subtracting the difference between the corresponding standard value and the estimated value obtained by the coefficient of the indication error. i for: in, It is an estimated value obtained by the coefficient (k1, b1) obtained by the least square method of indication error, according to the formula get; Theoretically, the optimal weighted value w i There are as follows: Considering that the amount of data required for fitting the turbine flowmeter is small, the square of the deviation is used Instead of the corresponding uncertainty To construct the weights, convert the corresponding residuals into the corresponding weights w i , and normalize the obtained weights: Among them, λ is the corresponding lower bound of the weight, and the median value of the deviation is selected, according to the formula To obtain, is to prevent a certain observation y i When it happens to be or is close to the model function, a high weight will be assigned to the observation; S3: Select appropriate genetic algorithm initialization parameters and use the common genetic algorithm to calibrate the standard flow rate y in the experimental data i and the measured flow rate x i Perform fitting to obtain the corresponding fitting parameter group (k2, b2); S4: Use the optimized genetic algorithm turbine flowmeter instrument coefficient fitting method to fit the standard flow rate and measured flow rate in the calibration experimental data. The specific steps are as follows: 1) Select appropriate genetic algorithm initialization parameters according to the problem, and set the initialization parameter of the constant term b3 in the fitting coefficient to |b3|<|b2|; 2) Determine the fitness function of the algorithm The weighted objective function J3 is obtained by minimizing the product of the absolute value of the relative error of the calibration data and the weight. The inverse of the weighted objective function J3 can be selected as the corresponding fitness function to ensure that individuals with higher fitness function values ​​are more likely to be selected. The specific form of the corresponding fitness function F is: At the same time, considering that the flow meter itself is a high-precision measurement, in order to avoid overfitting, the corresponding constraints are added. When the constraints are met, the weighted objective function J3 is used to calculate the value of the fitness function F. When the constraints are not met, the objective function J2 of the ordinary genetic algorithm is used as J3 to calculate the value of the fitness function F. The specific form of the weighted objective function J3 is: The corresponding constraints are: i J2<0.25%,J3 <J2+0.10% ii 0.25%<J2<0.35%,J3 <J2+0.08% iii 0.35%<J2<0.4%,J3 <J2+0.06% iv 0.4%<J2<0.5%, J3<0.5% Among them, J3 is the maximum value of the absolute value of the weighted relative error obtained by the parameter carried by the offspring in the population, and J2 is the maximum value of the absolute value of the relative error obtained by the fitting coefficient (k2, b2) finally obtained by the ordinary genetic algorithm; 3) Initialize the selected population range, encode the objective function, and cyclically calculate the fitness function; S5: The population performs iterative operations until the preset number of times is reached and the final fitting parameters (k3, b3) are obtained according to the formula Calculate the final fitting results.

2. The turbine flowmeter instrument coefficient fitting method of optimizing genetic algorithm as described in claim 1, characterized in that: The population is initialized according to the set initialization parameters, where the initialization parameter b3 is set to |b3|<|b2|; then the weighted objective function J3 is calculated, and the fitness of each individual in the population is obtained through the fitness function F. Individuals are selected based on the fitness, and individuals with higher fitness are more likely to be selected for crossover and mutation operations until the number of population iterations reaches the set value. The result obtained at this time is the optimal fit coefficient (k3, b3).