Calibration method and storage medium
Through the recursive calibration method, the recursive search and fit of the minimum approaching straight line and effective segmented points are solved, and the accuracy of the existing current calibration method is achieved, and the stability of the battery management system is achieved.
Patent Information
- Application Number
- CN202411488096.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-10-23
AI Technical Summary
There is room for improvement in accuracy in existing current calibration methods, especially in multi-stage one-dimensional linear combination and curve fitting, which increases the MCU operation complexity and processing time, but may not necessarily provide results that are better than multi-stage one-dimensional linear combination.
A recursive calibration method is adopted to set the sampling points, determine the minimum approaching straight line, find the effective segmentation point, and fit it multiple times until the final straight line on the polyline segment is obtained, reducing the gap with the theoretical standard curve image.
It improves the accuracy of current calibration, reduces errors, and the obtained theoretical standard curve image of the polyline segment is closer to the output source, improving the current measurement accuracy and abnormal detection efficiency of the battery management system.
Smart Images

Figure CN119693465A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent information processing technology, and in particular to a calibration method. Background Art
[0002] The Battery Management System (BMS) is a key part of modern battery technology and is widely used in electric vehicles, energy storage systems, portable electronic devices and other fields. The current calibration method is an important method in the battery management system. The calibration method can help calibrate the current measurement device of the BMS battery management system, thereby ensuring that the current measurement device can accurately monitor and display the actual value of the battery pack current, and can also improve the efficiency of the BMS battery management system in detecting abnormal conditions, such as battery overcharging, over-discharging and other abnormal conditions, thereby preventing battery damage and safety hazards. For example, when the current exceeds the set threshold, the BMS can trigger an alarm or take protective measures to maintain the stability of the battery pack.
[0003] For current calibration, the numerical values under different current segments are generally converted into actual values using different proportional coefficients in a segmented manner; usually the proportional coefficients calculated under different op amp gains are different. In actual applications, the same gain is often used with the same coefficient. Using the same coefficient will result in a simpler fitting of a combination of multiple one-dimensional straight lines, as well as a more complex sampling and more curve fitting. However, the curve fitting method is not conducive to production, and will also increase the complexity of MCU calculations and processing time, and may not necessarily fit a result better than the result of a combination of multiple one-dimensional straight lines. Therefore, in practice, one-dimensional straight line fitting is more widely used. In one-dimensional straight line fitting, the commonly used calculation formula is y=kx+b, where y is the actual current value, and x is the current value obtained by ADC collected by MCU and calculated by sampling resistors, etc.; in order to reduce the error in calculating k and b, the sampling is generally carried out using the values as close as possible to the starting and ending positions of the current segment, and then the corresponding k and b are calculated. Although the existing current calibration method can also calibrate the current, there is still room for improvement in accuracy. Summary of the invention
[0004] The advantage of the present application is that it provides a calibration method, which can calibrate the current more accurately compared with the existing calibration methods.
[0005] Based on this, in order to achieve at least one of the above advantages or other advantages and purposes of the present application, the present application provides a calibration method, comprising the following steps:
[0006] S1: Setting sampling points, and collecting corresponding detection data for the output source according to the sampling points;
[0007] S2: performing fitting according to the detection data to determine the minimum approximate straight line of the detection data, and determining the starting point and the ending point according to the minimum approximate straight line, the preset X-axis coordinate X1 of the initial point, and the X-axis coordinate X2 of the ending point;
[0008] S3: searching for valid segmentation points according to the minimum approximate straight line and the sampling points, searching for a sampling point whose distance A1 from the minimum approximate straight line is the largest and whose distance A1 is ≥ a preset segmentation threshold A among the sampling points, if not found, searching for a sampling point whose relative error B1 is ≥ a preset relative error threshold B and which is farthest from the minimum approximate straight line among the sampling points, the found sampling point is a valid segmentation point, and the segmentation threshold A and the relative error threshold B are set according to samples actually sampled multiple times in advance;
[0009] S4: performing fitting according to the starting point, the ending point, the valid segmentation point and the detection data, respectively obtaining the minimum approximate straight line between the starting point, the ending point and the valid segmentation point, and determining the broken line segment of the detection data;
[0010] S5: Detect whether the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3. If not less than 3, detect whether there is no valid segmentation point on each minimum approximate straight line in the broken line segment. If there is a valid segmentation point, repeat steps S3 and S4 until the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3 or there is no valid segmentation point on each minimum approximate straight line in the broken line segment, thereby obtaining a first final broken line segment;
[0011] S6: Calculate the slope of each minimum approximate straight line in the first final broken line segment and compare it with zero. If there is a minimum approximate straight line with a slope less than zero, refit the detection data of the minimum approximate straight line and the detection data of the minimum approximate straight line adjacent to the minimum approximate straight line to determine a new minimum approximate straight line, and obtain the second final broken line segment;
[0012] S7: Perform parameter inverse transformation on the expressions of each minimum approximate straight line in the second final broken line segment to obtain a relationship between the internal detection current feedback and the actual current.
[0013] With such a setting, compared with the solution that does not calculate the minimum approximate straight line, the solution provided in the present application adopts a recursive idea, by calculating the minimum approximate straight line, and with the help of the segmentation threshold A and the relative error threshold B set according to multiple pre-actual sampled samples, the obtained broken line segment can be closer to the theoretical standard curve image of the sampled output source.
[0014] According to an embodiment of the present application, the set sampling points include a first sampling point that conforms to a normal distribution and a second sampling point determined based on samples of multiple actual samplings.
[0015] In this way, setting the first sampling point that conforms to the normal distribution can make the sampling points reflect the approximate situation of their respective positions, and ultimately make the fitting results more realistic. Setting the second sampling point determined based on multiple actual sampling samples can make the positions of the subsequent effective segmentation points more reasonable. Compared with the solution of only setting the first sampling point that conforms to the normal distribution, this solution can reduce the error caused by calibration and improve accuracy.
[0016] According to an embodiment of the present application, the process of setting the second sampling point is specifically as follows: according to the positions of the segmentation points estimated by multiple pre-actually sampled samples, the second sampling point is set around the positions of the estimated segmentation points.
[0017] Such a setting can make the positions of the valid segmentation points to be searched subsequently more reasonable, thereby reducing the gap between the determined broken line and the theoretical standard curve image of the sampled output source, and improving the accuracy of sampling.
[0018] According to an embodiment of the present application, the fitting process is: according to the positions of the sampling points in the area, a straight line is calculated so that the sum of the squares of the distances from the sampling points in the area to the straight line is minimized, and the straight line is the minimum approximate straight line.
[0019] Compared with the scheme of directly determining the approaching straight line based on the two points farthest apart among the sampling points, this scheme determines the minimum approaching straight line based on all the sampling points in the area. The position of the obtained minimum approaching straight line is more reasonable, which improves the accuracy of calibration using the calibration method.
[0020] According to one embodiment of the present application, after S6, the following steps are further included:
[0021] S61: Compare the distance C1 between each sampling point and the minimum approximate straight line with the preset relative straight line deviation threshold C, and eliminate each sampling point whose distance C1 between each sampling point and the minimum approximate straight line is greater than the relative straight line deviation threshold C, and refit the detection data between two adjacent points in the starting point, the valid segmentation point, and the ending point in order from the starting point to the ending point to obtain each minimum approximate straight line and determine a new second final broken line segment, wherein the relative straight line deviation threshold C is: the allowable upper limit threshold of the distance between the sampling point and the minimum approximate straight line set according to the samples actually sampled multiple times in advance;
[0022] S62: Determine whether the distances C1 between each sampling point in the second final broken line segment and the minimum approximate straight line are all less than the relative straight line deviation threshold C; if not, repeat S61 until the distances C1 between each sampling point and the minimum approximate straight line are all less than the relative straight line deviation threshold C.
[0023] In such a setting, although the sampling points include the first sampling points that conform to the normal distribution and the second sampling points determined according to the samples actually sampled for multiple times, it does not exclude the situation that the positions of the set sampling points are unreasonable. Therefore, the above steps can screen the sampling points according to the preset relative straight line deviation threshold C, remove the sampling points with unreasonable settings, and then refit to determine the second final broken line segment that is closer to the theoretical standard curve image of the sampled output source, further improving the accuracy of calibration using the calibration method. In addition, based on the samples actually sampled for multiple times in advance, the samples actually sampled for multiple times in advance are analyzed to determine the relative straight line deviation threshold C, which can make the setting value of the relative straight line deviation threshold C more reasonable, prevent the occurrence of the situation that the sampling points with reasonable settings are removed or the sampling points with unreasonable settings are not removed, thereby further reducing the gap between the second final broken line segment and the theoretical standard curve image of the sampled output source, thereby making the provided calibration method more accurate.
[0024] According to an embodiment of the present application, the step S6 further includes the following steps: S63, detecting whether each minimum approximate straight line in the second final broken line segment passes through the zero point, and correcting the minimum approximate straight line passing through the zero point.
[0025] With such a setting, since the minimum approximate straight line obtained by fitting does not necessarily pass through all sampling points, the zero point position may not coincide with the actual zero point. Therefore, the minimum approximate straight line passing through the zero point can further reduce the gap between the second final broken line segment and the theoretical standard curve image of the sampled output source.
[0026] According to an embodiment of the present application, the process of correcting the minimum approximate straight line passing through the zero point uses a translation-to-zero method to correct the minimum approximate straight line passing through the zero point.
[0027] With such a setting, this scheme corrects the zero point by means of translation and zeroing, and obtains the zero point correction under controllable error. Compared with the scheme that does not use the translation and zeroing method but uses other zero point correction methods (such as manual correction), the scheme that uses the translation and zeroing method to correct the zero point is not only simple, fast and effective, but also can control the error within an acceptable range, thereby improving the reliability and accuracy of the calibration method.
[0028] According to one embodiment of the present application, in the process of executing S6, if the minimum approximation straight line that needs to be refitted is not the first minimum approximation straight line of the first final broken line segment, then it is refitted together with the previous minimum approximation straight line of the minimum approximation straight line that needs to be refitted; if the minimum approximation straight line that needs to be refitted is the first minimum approximation straight line of the first final broken line segment, then it is refitted together with the latter minimum approximation straight line of the minimum approximation straight line that needs to be refitted.
[0029] This arrangement avoids the situation where the minimum approximate straight line to be refitted is the first minimum approximate straight line of the first final broken line segment and cannot be refitted together with the previous minimum approximate straight line adjacent to it.
[0030] According to an embodiment of the present application, the S7 process is: treating the independent variables in the original expressions of each of the minimum approximation straight lines as dependent variables, performing formula transformation, and obtaining the relationship between the original independent variables and the original dependent variables.
[0031] With this setting, the expression of each minimum approximate straight line in the broken line segment obtained using the calibration method is the corresponding relationship between the actual current value (independent variable) feedback and the internal detection current (dependent variable). In practical applications, the internal detection current needs to transform this corresponding relationship into the relationship between the internal detection current value feedback and the actual current.
[0032] In another aspect of the present application, the present application further provides a storage medium, wherein the storage medium includes a stored program,
[0033] Wherein, when the program is running, the device where the storage medium is located is controlled to execute the above calibration method.
[0034] With such a configuration, the program stored in the storage medium can automatically perform complex tasks, reduce human intervention, thereby improving overall efficiency and ensuring the reliability and trustworthiness of operations. In addition, the program is repeatable and extensible, so that the same program can be repeatedly executed in different environments and at different times, and is easy to expand to meet new needs, thereby enhancing the adaptability and flexibility of the program. In addition, running the program can greatly optimize resource utilization and reduce manpower and error costs by automatically processing large amounts of data and tasks. Finally, the program is also traceable and secure, and can ensure the auditability and security of operations by recording and tracking each step of program execution, thereby reducing the risks brought by human operations.
[0035] Beneficial effect: The calibration method provided in the present application first collects detection data of the output source through the set sampling points, which lays the foundation for the subsequent fitting of the detection data to obtain the minimum approximate straight line, and then fits the detection data to obtain the minimum approximate straight line, and then determines the starting point and the ending point according to the minimum approximate straight line, the preset initial point X-axis coordinate X1 and the ending point X-axis coordinate X2, and then based on the idea of recursion, according to the preset segmentation threshold A and relative error threshold B, continuously determines the effective segmentation points and fits the detection data between the starting point, the ending point and the effective segmentation points to obtain the minimum approximate straight line, until the number of sampling points on each minimum approximate straight line is less than 3 or there are no effective segmentation points on each minimum approximate straight line in the broken line segment, thereby obtaining the first final broken line segment, and then the first final broken line segment is corrected with a negative slope to obtain the second final broken line segment, thereby further reducing the gap between the obtained broken line segment and the theoretical standard curve image of the sampled output source, and finally the expression of each minimum approximate straight line is subjected to parameter inverse transformation to obtain the relationship between the internal detection current feedback and the actual current. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] 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.
[0037] Figure 1 A flow chart of a calibration method provided for one embodiment of the present application;
[0038] Figure 2 A flowchart of a calibration method provided for another embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present application, so the present application is not limited by the specific embodiments disclosed below.
[0040] Considering that the existing calibration method can be used for calibration, there is still room for improvement in accuracy and there are certain errors. In order to solve this problem, the present application provides a calibration method, which has higher accuracy and smaller error than the existing calibration method.
[0041] For details, please refer to the attached Figure 1 An embodiment of the present application provides a calibration method, comprising the following steps:
[0042] S1: Setting sampling points, and collecting corresponding detection data for the output source according to the sampling points;
[0043] S2: performing fitting according to the detection data to determine the minimum approximate straight line of the detection data, and determining the starting point and the ending point according to the minimum approximate straight line, the preset X-axis coordinate X1 of the initial point, and the X-axis coordinate X2 of the ending point;
[0044] In particular, compared with the scheme of directly taking the two points farthest apart where the minimum approximation straight line intersects the sampling point as the starting point and the ending point, this scheme determines the starting point and the ending point according to the preset X-axis coordinate X1 of the initial point and the X-axis coordinate X2 of the ending point, so that the distance between the starting point and the ending point on the X-axis can be fixed, thereby preventing the situation where the minimum approximation straight line has no intersection with the sampling point, thereby preventing the starting point and the ending point from being determined.
[0045] S3: searching for valid segmentation points according to the minimum approximate straight line and the sampling points, searching for a sampling point whose distance A1 from the minimum approximate straight line is the largest and whose distance A1 is ≥ a preset segmentation threshold A among the sampling points, if not found, searching for a sampling point whose relative error B1 is ≥ a preset relative error threshold B and which is farthest from the minimum approximate straight line among the sampling points, the found sampling point is a valid segmentation point, and the segmentation threshold A and the relative error threshold B are set according to samples actually sampled multiple times in advance;
[0046] It should be noted that the sampling point whose distance A1 of the minimum approaching straight line is the largest and whose distance A1 ≥ the preset segmentation threshold A, and the sampling point whose relative error B1 ≥ the preset relative error threshold B and is farthest from the minimum approaching straight line are both regarded as valid segmentation points. In this embodiment, the priority of the former is greater than the latter, that is, if the sampling point whose distance A1 of the minimum approaching straight line is the largest and whose distance A1 ≥ the preset segmentation threshold A is found, the sampling point whose relative error B1 ≥ the preset relative error threshold B and is farthest from the minimum approaching straight line is not searched. However, in other embodiments of the present application, there are also embodiments in which the priority of the former is lower than the latter, that is, the sampling point whose relative error B1 ≥ the preset relative error threshold B and is farthest from the minimum approaching straight line is searched first, and if it is not found, the sampling point whose distance A1 of the minimum approaching straight line is the largest and whose distance A1 ≥ the preset segmentation threshold A is searched.
[0047] S4: performing fitting according to the starting point, the ending point, the valid segmentation point and the detection data, respectively obtaining the minimum approximate straight line between the starting point, the ending point and the valid segmentation point, and determining the broken line segment of the detection data;
[0048] S5: Detect whether the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3. If not less than 3, detect whether there is no valid segmentation point on each minimum approximate straight line in the broken line segment. If there is a valid segmentation point, repeat steps S3 and S4 until the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3 or there is no valid segmentation point on each minimum approximate straight line in the broken line segment, thereby obtaining a first final broken line segment;
[0049] S6: Calculate the slope of each minimum approximate straight line in the first final broken line segment and compare it with zero. If there is a minimum approximate straight line with a slope less than zero, refit the detection data of the minimum approximate straight line and the detection data of the minimum approximate straight line adjacent to the minimum approximate straight line to determine a new minimum approximate straight line, and obtain the second final broken line segment;
[0050] S7: Perform parameter inverse transformation on the expressions of each minimum approximate straight line in the second final broken line segment to obtain a relationship between the internal detection current feedback and the actual current.
[0051] In particular, the S5 uses a recursive algorithmic thinking to continuously search for valid segmentation points and recalculate each minimum approximate straight line until the number of sampling points on each minimum approximate straight line is less than 3 or there are no valid segmentation points on each minimum approximate straight line in the broken line segment, thereby obtaining the first final broken line segment.
[0052] In particular, the detection data is data obtained after the original data obtained after sampling the output source using the sampling points is filtered by Kalman, low-pass, sliding average or other filtering processes.
[0053] Specifically, the Kalman filter is an efficient recursive estimation algorithm based on a state space model, which is mainly used to estimate the state of a dynamic system. The basic idea is to update the state estimate at each time step using Bayesian theory by combining the system's prediction model and actual observation data. Kalman filtering assumes that both the system state and observation are noisy, and the noise is usually considered to be Gaussian distributed. The steps of Kalman filtering are mainly divided into two stages: prediction stage and update stage. Prediction stage: predict the next state based on the system's dynamic model and calculate the prediction covariance. Update stage: use the actual observation value to correct the predicted state, and calculate the Kalman gain to weigh the contribution of the predicted value and the actual observation value, so as to obtain a more accurate state estimate.
[0054] The low-pass filter is a filter that allows low-frequency signals to pass through while suppressing high-frequency signals. Its basic function is to remove high-frequency noise from the signal, thereby smoothing the signal and retaining important low-frequency components. Low-pass filtering can be achieved in many ways, including analog circuits (such as RC filters) and digital signal processing techniques.
[0055] The sliding average filter is a simple and effective smoothing technique, which is mainly used to reduce random noise and enhance the readability of the signal. The principle is to achieve smoothing by calculating the average value of the signal within a certain window length. The window can be of fixed size, and the common ones are simple sliding average and weighted sliding average. The simple sliding average: take the simple average of all data points in the window. Weighted sliding average: assign different weights to different data points in the window, usually the closer the distance to the current point, the greater the weight.
[0056] It is worth noting that compared with the solution that does not calculate the minimum approximate straight line, the solution provided in the present application adopts a recursive idea. By calculating the minimum approximate straight line and using the segmentation threshold A and the relative error threshold B set according to multiple pre-actual sampled samples, the obtained broken line segment can be closer to the theoretical standard curve image of the sampled output source.
[0057] In particular, in the calibration method provided in other embodiments of the present application, in S3, when the sampling point whose distance A1 from the minimum approximate straight line is the largest and the distance A1 ≥ the preset segmentation threshold A cannot be found among the sampling points, then the sampling point whose relative error B1 ≥ the preset relative error threshold B, whose distance A1 from the minimum approximate straight line is greater than the preset second segmentation threshold A2, and which is farthest from the minimum approximate straight line is searched among the sampling points, the found sampling point is a valid segmentation point, and the preset second segmentation threshold A2 is also set based on multiple samples actually sampled in advance.
[0058] In particular, the positions of the set sampling points are also set according to samples actually sampled multiple times in advance, and the number of sampling points for sampling each straight line segment constituting the polyline segment is guaranteed to be ≥3 as much as possible.
[0059] Optionally, the set sampling points include a first sampling point that conforms to a normal distribution and a second sampling point determined according to samples actually sampled multiple times.
[0060] It is worth noting that setting the first sampling point that conforms to the normal distribution can make the sampling points reflect the approximate situation of their respective positions and ultimately make the fitting results more realistic. Setting the second sampling point determined based on multiple actual sampling samples can make the positions of the subsequent effective segmentation points more reasonable. Compared with the solution of only setting the first sampling point that conforms to the normal distribution, this solution can reduce the error caused by calibration and improve accuracy.
[0061] Optionally, the process of setting the second sampling point is specifically as follows: according to the positions of the segmentation points estimated from multiple pre-actually sampled samples, the second sampling point is set around the positions of the estimated segmentation points. This setting can make the positions of the valid segmentation points subsequently searched more reasonable, thereby reducing the gap between the determined broken line segment and the theoretical standard curve image of the sampled output source, thereby improving the sampling accuracy.
[0062] Optionally, the fitting process is: according to the positions of the sampling points in the area, a straight line is calculated so that the sum of the squares of the distances from the sampling points in the area to the straight line is minimized, and the straight line is the minimum approximate straight line.
[0063] It is worth noting that compared with the solution of directly determining the approaching straight line based on the two points farthest apart among the sampling points, this solution determines the minimum approaching straight line based on all the sampling points in the area. The position of the obtained minimum approaching straight line is more reasonable, which improves the accuracy of calibration using the calibration method.
[0064] In particular, the above fitting process is implemented based on the least squares method, which is a mathematical optimization technique that finds a set of parameters through calculation so that the sum of squared errors between the model determined by this set of parameters and the actual observed data is minimized.
[0065] Alternatively, if Figure 2 As shown, in another embodiment of the present application, the calibration method further includes the following steps after S6:
[0066] S61: Compare the distance C1 between each sampling point and the minimum approximate straight line with the preset relative straight line deviation threshold C, and eliminate each sampling point whose distance C1 between each sampling point and the minimum approximate straight line is greater than the relative straight line deviation threshold C, and refit the detection data between two adjacent points in the starting point, the valid segmentation point, and the ending point in order from the starting point to the ending point to obtain each minimum approximate straight line and determine a new second final broken line segment, wherein the relative straight line deviation threshold C is: the allowable upper limit threshold of the distance between the sampling point and the minimum approximate straight line set according to the samples actually sampled multiple times in advance;
[0067] S62: Determine whether the distances C1 between each sampling point in the second final broken line segment and the minimum approximate straight line are all less than the relative straight line deviation threshold C; if not, repeat S61 until the distances C1 between each sampling point and the minimum approximate straight line are all less than the relative straight line deviation threshold C.
[0068] It is worth noting that, although the sampling points include a first sampling point that conforms to a normal distribution and a second sampling point determined based on samples actually sampled multiple times, it is not ruled out that the positions of the set sampling points are unreasonable. Therefore, the above steps can screen the sampling points according to a preset relative straight line deviation threshold C, eliminate sampling points with unreasonable positions, and thus re-fit to determine the second final broken line segment of the theoretical standard curve image that is closer to the sampled output source, thereby further improving the accuracy of calibration using the calibration method.
[0069] In particular, in another embodiment of the present application, after eliminating each sampling point whose distance C1 from the minimum approximation straight line is greater than the relative straight line deviation threshold C, each minimum approximation straight line is not refitted according to the detection data between the starting point, the end point, and the effective segmentation point to determine the new second final broken line segment. Instead, the new minimum approximation straight line is obtained by fitting according to the remaining detection data. The remaining detection data is the detection data collected from the minimum approximation straight line originally corresponding to the eliminated sampling point, excluding the eliminated sampling point. This will cause a problem: the positions of the two effective segmentation points that intersect the minimum approximation straight line that needs to be refitted and the two minimum approximation straight lines that are originally adjacent to the minimum approximation straight line that needs to be refitted may need to be re-determined. In this embodiment, the Schmitt trigger function implemented by the software algorithm is used to solve the intersection point of the two intersecting straight lines, and the intersection point is the new effective segmentation point.
[0070] It is worth noting that based on multiple pre-sampled samples, multiple pre-sampled samples are analyzed to obtain the relative straight line deviation threshold C, which can make the setting value of the relative straight line deviation threshold C more reasonable, prevent the elimination of reasonably set sampling points or the failure to eliminate unreasonable sampling points, improve the robustness of the fitting, and further reduce the gap between the second final broken line segment and the theoretical standard curve image of the sampled output source, thereby making the provided calibration method more accurate.
[0071] In particular, the minimum approximate straight line obtained by fitting by the least squares method may have a zero point offset problem, so the zero point needs to be corrected to further improve the accuracy of the calibration method provided. Therefore, in the calibration method provided in another embodiment of the present application, Figure 2 As shown, after S62, the following steps are also included: S63, detecting whether each minimum approximate straight line in the second final broken line segment passes through the zero point, and correcting the minimum approximate straight line passing through the zero point.
[0072] It is worth noting that since the minimum approximate straight line obtained by fitting does not necessarily pass through all sampling points, the zero point position may not coincide with the actual zero point. Therefore, the minimum approximate straight line passing through the zero point can further reduce the gap between the second final broken line segment and the theoretical standard curve image of the sampled output source.
[0073] Optionally, the process of correcting the minimum approximate straight line passing through the zero point uses a translation-to-zero method to correct the minimum approximate straight line passing through the zero point.
[0074] It is worth noting that this scheme corrects the zero point by means of translation and zeroing, and obtains the zero point correction under controllable error. Compared with the scheme that does not use the translation and zeroing method but uses other zero point correction methods (such as manual correction), the scheme that uses the translation and zeroing method to correct the zero point is not only simple, fast and effective, but also can control the error within an acceptable range, thereby improving the reliability and accuracy of the calibration method.
[0075] Optionally, in the process of executing S6, if the minimum approximation straight line that needs to be refitted is not the first minimum approximation straight line of the first final broken line segment, it is refitted together with the previous minimum approximation straight line of the minimum approximation straight line that needs to be refitted; if the minimum approximation straight line that needs to be refitted is the first minimum approximation straight line of the first final broken line segment, it is refitted together with the latter minimum approximation straight line of the minimum approximation straight line that needs to be refitted.
[0076] It is worth noting that, in the case where the minimum approximate straight line to be refitted is the first minimum approximate straight line of the first final broken line segment, it is not possible to refit it together with the previous minimum approximate straight line adjacent to it.
[0077] Optionally, the S7 process is: treating the independent variables in the original expressions of the respective minimum approximation straight lines as dependent variables, performing formula transformation, and obtaining the relationship between the original independent variables and the original dependent variables.
[0078] It is worth noting that the expression of each minimum approximate straight line in the broken line segment obtained by the calibration method is the corresponding relationship between the actual current value (independent variable) and the internal detection current (dependent variable), and for practical applications, the internal detection current needs to transform this corresponding relationship into the relationship between the internal detection current value and the actual current. For example, the original expression is: y = kx + b, and the new relationship obtained after the inverse transformation of the parameters is: x = y / kb / k.
[0079] In other embodiments of the present application, a computer program is provided, and running the computer program can execute the above-mentioned calibration method.
[0080] Other embodiments of the present application further provide a storage device, wherein the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above-mentioned calibration method.
[0081] It is worth noting that the program stored in the storage medium can automatically perform complex tasks, reduce human intervention, thereby improving overall efficiency and ensuring the reliability and trustworthiness of operations. In addition, the program is repeatable and extensible, so that the same program can be repeatedly executed in different environments and times, and is easy to expand to meet new needs, enhancing the adaptability and flexibility of the program. In addition, running the program can greatly optimize resource utilization and reduce manpower and error costs by automating the processing of large amounts of data and tasks. Finally, the program is also traceable and secure, and can ensure the auditability and security of operations by recording and tracking every step of the program execution, reducing the risks brought by human operations.
[0082] In other embodiments of the present application, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned calibration method when executing the computer program.
[0083] It is worth noting that the computer program is flexible and adaptable, so that the execution steps can be adjusted according to different inputs and conditions, so as to adapt to the ever-changing needs and technical environment, and maintain the advancement and practicality of the computer program. In addition, the architecture of the computer device allows the realization of multiple functions, so that the program in the memory can contain multiple functional modules, and the computer program can be executed by the processor to meet different application needs, thereby improving the function of the computer program and enhancing the integration of the computer device.
[0084] In other embodiments of the present application, a device is provided, which includes: a sampling module, a fitting module, a search module, a storage module, a detection module, a calculation module and an inverse transformation module.
[0085] The sampling module is used to set sampling points and collect corresponding detection data from the output source according to the sampling points;
[0086] The fitting module is used to perform fitting according to the detection data to determine the minimum approximate straight line of the detection data, and the two points farthest apart where the minimum approximate straight line intersects with the sampling points are the starting point and the end point;
[0087] The search module is used to search for valid segmentation points according to the minimum approximate straight line and the sampling points, and search for a sampling point whose distance A1 from the minimum approximate straight line is the largest and the distance A1 ≥ a preset segmentation threshold A among the sampling points. If no sampling point can be found, the sampling point whose relative error B1 ≥ a preset relative error threshold B and the farthest distance from the minimum approximate straight line is searched among the sampling points, and the found sampling point is a valid segmentation point;
[0088] The storage module is used to store the minimum approximate straight line;
[0089] The detection module is used to detect whether the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3, and if not less than 3, detect whether there is no valid segmentation point on each minimum approximate straight line in the broken line segment;
[0090] The calculation module is used to calculate the slope of each minimum approximate straight line in the first final broken line segment;
[0091] The inverse transformation module is used to perform parameter inverse transformation on the expressions of each minimum approximate straight line in the second final broken line segment to obtain a relationship between the internal detection current feedback and the actual current.
[0092] The sampling module, the fitting module, the searching module, the storage module, the detecting module, the calculating module and the inverse transforming module cooperate with each other to jointly execute the above calibration method.
[0093] It should be noted that when a component is referred to as being "fixed to" or "disposed on" another component, it may be directly on the other component or there may also be a central component. When a component is considered to be "connected to" another component, it may be directly connected to the other component or there may be a central component at the same time. The terms "vertical", "horizontal", "upper", "lower", "left", "right" and similar expressions used in the specification of this application are for illustrative purposes only and do not represent the only implementation method.
[0094] In addition, the terms "first" and "second" are used only for descriptive purposes and should not be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations 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 limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or equipment.
[0095] In the present application, unless otherwise clearly specified and limited, a first feature being “above” or “below” a second feature may mean that the first feature is directly in contact with the second feature, or the first feature and the second feature are indirectly in contact through an intermediate medium. Moreover, a first feature being “above”, “above” or “above” a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being “below”, “below” or “below” a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0096] Unless otherwise defined, all technical and scientific terms used in the specification of this application have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in the specification of this application includes any and all combinations of one or more related listed items.
[0097] The technical features of the above embodiments can be combined without changing the basic principles of the present application. 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.
[0098] The above 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 patent application. 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 scope of patent protection of the present application shall be subject to the attached claims.
Claims
1. A calibration method, characterized in that: The following steps are involved: S1: Setting sampling points, and collecting corresponding detection data for the output source according to the sampling points; S2: performing fitting according to the detection data to determine the minimum approximate straight line of the detection data, and determining the starting point and the ending point according to the minimum approximate straight line, the preset X-axis coordinate X1 of the initial point, and the X-axis coordinate X2 of the ending point; S3: searching for valid segmentation points according to the minimum approximate straight line and the sampling points, searching for a sampling point whose distance A1 from the minimum approximate straight line is the largest and whose distance A1 is ≥ a preset segmentation threshold A among the sampling points, if not found, searching for a sampling point whose relative error B1 is ≥ a preset relative error threshold B and which is farthest from the minimum approximate straight line among the sampling points, the found sampling point is a valid segmentation point, and the segmentation threshold A and the relative error threshold B are set according to samples actually sampled multiple times in advance; S4: performing fitting according to the starting point, the ending point, the valid segmentation point and the detection data, respectively obtaining the minimum approximate straight line between the starting point, the ending point and the valid segmentation point, and determining the broken line segment of the detection data; S5: Detect whether the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3. If not less than 3, detect whether there is no valid segmentation point on each minimum approximate straight line in the broken line segment. If there is a valid segmentation point, repeat steps S3 and S4 until the number of sampling points on each minimum approximate straight line in the broken line segment is less than 3 or there is no valid segmentation point on each minimum approximate straight line in the broken line segment, thereby obtaining a first final broken line segment; S6: Calculate the slope of each minimum approximate straight line in the first final broken line segment and compare it with zero. If there is a minimum approximate straight line with a slope less than zero, refit the detection data of the minimum approximate straight line and the detection data of the minimum approximate straight line adjacent to the minimum approximate straight line to determine a new minimum approximate straight line, and obtain the second final broken line segment; S7: Perform parameter inverse transformation on the expressions of each minimum approximate straight line in the second final broken line segment to obtain a relationship between the internal detection current feedback and the actual current.
2. The calibration method according to claim 1, characterized in that: The set sampling points include a first sampling point that conforms to a normal distribution and a second sampling point determined according to samples actually sampled multiple times.
3. The calibration method according to claim 2, characterized in that: The process of setting the second sampling point is specifically as follows: according to the positions of the segmentation points estimated by the samples actually sampled multiple times in advance, the second sampling point is set around the positions of the estimated segmentation points.
4. The calibration method according to claim 1, characterized in that: The fitting process is: According to the positions of the sampling points in the area, a straight line is calculated so that the sum of the squares of the distances from the sampling points in the area to the straight line is minimized, and the straight line is the minimum approximate straight line.
5. The calibration method according to claim 1, characterized in that: The step S6 further includes the following steps: S61: Compare the distance C1 between each sampling point and the minimum approximate straight line with the preset relative straight line deviation threshold C, and eliminate each sampling point whose distance C1 between each sampling point and the minimum approximate straight line is greater than the relative straight line deviation threshold C, and refit the detection data between two adjacent points in the starting point, the valid segmentation point, and the ending point in order from the starting point to the ending point to obtain each minimum approximate straight line and determine a new second final broken line segment, wherein the relative straight line deviation threshold C is: the allowable upper limit threshold of the distance between the sampling point and the minimum approximate straight line set according to the samples actually sampled multiple times in advance; S62: Determine whether the distances C1 between each sampling point in the second final broken line segment and the minimum approximate straight line are all less than the relative straight line deviation threshold C; if not, repeat S61 until the distances C1 between each sampling point and the minimum approximate straight line are all less than the relative straight line deviation threshold C.
6. The calibration method according to claim 1, characterized in that: The step S6 also includes the following steps: S63, detecting whether each minimum approximate straight line in the second final broken line segment passes through the zero point, and correcting the minimum approximate straight line that passes through the zero point.
7. The calibration method according to claim 6, characterized in that: The process of correcting the minimum approximate straight line passing through the zero point uses a translation zeroing method to correct the minimum approximate straight line passing through the zero point.
8. The calibration method according to claim 1, characterized in that: During the execution of S6, if the minimum approximation straight line that needs to be refitted is not the first minimum approximation straight line of the first final broken line segment, it is refitted together with the previous minimum approximation straight line of the minimum approximation straight line that needs to be refitted; if the minimum approximation straight line that needs to be refitted is the first minimum approximation straight line of the first final broken line segment, it is refitted together with the latter minimum approximation straight line of the minimum approximation straight line that needs to be refitted.
9. The calibration method according to claim 1, characterized in that: The process of S7 is: treating the independent variables in the expressions of the original minimum approximation straight lines as dependent variables, performing formula transformation, and obtaining the relationship between the original independent variables and the original dependent variables.
10. A storage medium, characterized in that: The storage medium includes a stored program, Wherein, when the program is running, the device where the storage medium is located is controlled to execute the calibration method described in any one of claims 1 to 9.
Citation Information
Patent Citations
Online adaptive segmentation algorithm suitable for power curve of living electrical appliance
CN109857978A
Signal impact response cluster information acquisition method and device, equipment and storage medium
CN110071882A
Superconducting cyclotron induction coil measuring equipment calibration method based on permanent magnet
CN117192463A
Methods for determining a fitting model for a signal, reconstructing a signal and devices thereof
US20210275113A1