A power supply calibration method based on least square quadratic polynomial fitting
The power supply calibration method based on least squares quadratic polynomial fitting solves the problems of increased data volume and high coding complexity caused by multi-interval calibration, and achieves efficient and accurate power supply calibration.
Patent Information
- Application Number
- CN202211156876.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-09-21
AI Technical Summary
Existing power supply calibration schemes require multiple calibration intervals when faced with linear errors, which increases the amount of data, reduces communication real-time performance and accuracy, and has high coding complexity, making efficient calibration difficult to achieve.
A power supply calibration method based on least squares quadratic polynomial fitting is adopted. The coefficients of the quadratic fitting curve are determined by minimizing the sum of squared errors, replacing multi-interval calibration and using a characteristic formula for error compensation.
The data volume is reduced, the encoding logic is simplified, the communication efficiency and calibration accuracy are improved, and the power supply accuracy requirements are met.
Smart Images

Figure CN115510373B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of computer and relates to a power supply calibration method based on least square method quadratic polynomial fitting. BACKGROUND
[0002] In the process flow of forming power supply, power supply data is acquired by ADC acquisition, and in the process of acquiring data, due to the existence of unadjusted error, gain error, linear error and the like, the current / voltage set by the user is inconsistent with the actual output of the hardware circuit.
[0003] The current calibration scheme is a multi-point calibration method: the input range is divided into different intervals, and the unadjusted error and gain error in each interval are compensated by the two-point calibration method to achieve the purpose of correcting errors. The division of multiple intervals utilizes the idea of "straight instead of curved", which reduces the linear error to a certain extent.
[0004] The compensation calculation process of the old scheme is as follows:
[0005] ① Two calibration points constitute a straight line, which is an interval, and the sampling values x L and x H at both ends of the interval and the actual output values y L and y H of the hardware circuit are obtained. x L represents the smaller sampling value of the calibration points at both ends of the straight line; x H represents the larger sampling value of the calibration points at both ends of the straight line; y L represents the smaller actual output value of the calibration points at both ends of the straight line; and y H represents the larger actual output value of the calibration points at both ends of the straight line.
[0006] ② The gain compensation k=(y H -y L ) / (x H -x L ) and the unadjusted compensation b=y L -x L ×k are calculated by using the equation y=kx+b and the known reference values (x L , y L ) and (x H , y H ).
[0007] ③ The obtained gain compensation and unadjusted compensation are applied to other input values in the interval to correct the interval. An interval has two calibration points at the beginning and the end, and the values between the two calibration points meet the requirements.
[0008] The single-interval compensation principle diagram is shown in Figure 1 .
[0009] In the ideal case, after calibration, according to the error function X' = K'Y + B' and the compensation function Y' = KX' + B, Y' = KKK'Y + KB' + B. When KKK' = 1, KB' + B = 0, at this time Y' = Y. After PID reciprocating adjustment, Y' gradually tends to X, and the deviation of X and Y' fluctuates around zero. At this time, Y' ≈ X, that is, Y ≈ X.
[0010] Wherein, X' represents the ADC sampling value, Y represents the actual output value of the hardware circuit, K' represents the slope of the error function, B' represents the intercept of the error function. Y' represents the output value (PID adjustment input value) of the ADC sampling value after compensation operation, K represents the slope of the compensation function, and B represents the intercept of the compensation function.
[0011] The multi-point calibration method has the following disadvantages:
[0012] 1. Under the influence of linear error, the multi-point calibration method needs to take multiple intervals to compensate for errors. As the measurement range increases, the calibration intervals inevitably increase. Reasonably selecting the calibration intervals and applying to different characteristic curves has become a big difficulty in improving the calibration accuracy.
[0013] 2. The increase of the calibration intervals first brings the increase of the data amount in the data transmission process, which has a certain influence on the real-time and accuracy of the communication between devices, and also occupies more data storage space of the device.
[0014] 3. Secondly, the amount of power supply lower computer code will undoubtedly increase, which directly increases the difficulty of coding, debugging and maintaining of software developers. More than that, the tedious judgment makes the processing time of each sampling and correction data longer. SUMMARY
[0015] Therefore, the purpose of the present application is to provide a power supply calibration method based on least square method quadratic polynomial fitting.
[0016] To achieve the above purpose, the present application provides the following technical scheme:
[0017] A power supply calibration method based on least square method quadratic polynomial fitting, the method comprising the following steps:
[0018] S1: set the quadratic fitting curve function as Y = aX 2 +bX + c, wherein a is the quadratic term power coefficient, b is the first order term power coefficient, c is the constant term coefficient, X represents the input value, and Y represents the output value;
[0019] S2: In the process flow of forming power supply, during calibration, several calibration points are known, and the sampling values and actual values of these calibration points have been determined. According to the least squares formula, the three coefficients a, b, and c are determined. These three coefficients are finally used to determine the quadratic fitting curve equation, i.e., the compensation function. At this time, under the same sampling value, the sum of the squares of the errors from the actual value of each calibration point to the fitting curve is minimized. At this time, the fitting curve is closer to the actual power supply characteristic curve, i.e., the characteristic function.
[0020] S3: After calibration, the error function X'=F(Y) and the compensation function Y'=G(X') show that Y'=G(F(Y)); it is considered that the compensation function and the error function after calibration are inverse functions of each other, that is, G(X)=F -1 (X), at this time Y'=Y; after PID reciprocating adjustment, Y' gradually tends to X, and the deviation between X and Y' fluctuates around zero; Y'≈X, that is, Y≈X, so that the hardware circuit outputs the value set by the user;
[0021] Where X' represents the analog-to-digital converter (ADC) sampling value; F represents the function mapping relationship from the actual value of the hardware circuit to the ADC sampling value; Y represents the actual value of the hardware circuit; Y' represents the proportional-integral-differential (PID) adjustment input value, that is, the value after ADC sampling compensation; G represents the compensation function mapping relationship; and X represents the set value.
[0022] Optionally, the number of calibration points is 5.
[0023] Optionally, the sampled value and the actual value are specifically:
[0024] The sampling value of calibration point 1 is 500, and the actual value is 831.4229;
[0025] The sampling value of calibration point 2 is 1000, and the actual value is 1357.3626;
[0026] The sampling value of calibration point 3 is 1500, and the actual value is 1493.4838;
[0027] The sampling value of calibration point 4 is 2000, and the actual value is 1760.4051;
[0028] The sampling value of calibration point 5 is 2500, and the actual value is 2135.3449;
[0029] Optionally, the derivation formulas of the three coefficients in the quadratic fitting curve equation are:
[0030]
[0031] N represents the total number of calibration points, i represents a calibration point, and i∈N.
[0032] The beneficial effect of the present invention is that: the quadratic fitting curve Y=aX 2 The +bX+c method replaces the multi-interval "straight line instead of curved line" approach in overall characteristics and effectively compensates for other errors. Regardless of the number of calibration intervals, the data volume remains constant throughout a calibration process, equivalent to only two sets of KB calibration parameters in traditional solutions, significantly reducing communication data volume. Furthermore, when the number of calibration points is extremely high, the complex multi-interval encoding logic can be replaced by a single characteristic formula, undoubtedly facilitating software coding, debugging, and maintenance.
[0033] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following description or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings, in which:
[0035] Figure 1 This is the flow chart of the principle of single interval error compensation of traditional KB value of power supply lower computer;
[0036] Figure 2 This is the flow chart of the full-scale compensation principle of the power supply lower computer quadratic polynomial fitting;
[0037] Figure 3 Schematic diagram of quadratic fitting and error of 5 calibration points;
[0038] Figure 4 This is a comparison chart of the communication protocol data volume of the new and old solutions;
[0039] Figure 5 To calibrate the host computer, a simple calibration flow chart is provided;
[0040] Figure 6 This is the accuracy verification diagram of the charging current calibrated by the quadratic fitting of power board 1;
[0041] Figure 7 This is the accuracy verification diagram of the charging current calibrated by the quadratic fitting of power board 2;
[0042] Figure 8 This is the accuracy verification diagram of the discharge current of the power board 1 quadratic fitting calibration;
[0043] Figure 9 This is the accuracy verification diagram of the discharge current of the power board 2 quadratic fitting calibration; DETAILED DESCRIPTION
[0044] The following describes the embodiments of the present invention by means of specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0045] Among them, the accompanying drawings are only for illustrative purposes and represent only schematic diagrams rather than actual pictures, and should not be understood as limiting the present invention. In order to better illustrate the embodiments of the present invention, some parts of the accompanying drawings may be omitted, enlarged or reduced, and do not represent the dimensions of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions may be omitted in the accompanying drawings.
[0046] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if there are terms such as "upper", "lower", "left", "right", "front", "back", etc. indicating directions or positional relationships, they are based on the directions or positional relationships shown in the drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0047] See also Figure 2 , which is the flow chart of the full-scale compensation principle of the power supply lower computer quadratic polynomial fitting.
[0048] Based on the principle of least squares method, quadratic fitting is performed on multiple calibration point data, and the optimal compensation function of calibration error is found by minimizing the sum of squares of errors.
[0049] The specific compensation process of the power supply lower computer is as follows:
[0050] After calibration, from X′=F(Y) and Y′=G(X′), we know that Y′=G(F(Y)). If the compensation function and the error function after calibration are inverse functions of each other, that is, G(X)=F -1 (X), at this time Y' = Y. After PID reciprocating adjustment, Y' gradually approaches X, and the deviation between X and Y' fluctuates around zero. At this time, Y' ≈ X, that is, Y ≈ X.
[0051] Since perfect compensation is impossible to achieve in practice, try to make the compensation curve as close to the actual characteristic curve as possible.
[0052] by Figure 3 For example, let the quadratic fitting curve Y=aX 2 +bX+c. Given five calibration points and the sampled and actual values at each of these five points, how can we determine the coefficients so that the sum of the squares of the errors from each calibration point to the fitted curve is minimized? Using the least squares formula, we can calculate the coefficients a, b, and c. This quadratic fitting curve will be as close to the actual power supply characteristic curve as possible.
[0053] Figure 3 The sampling values and actual values of each point are shown in the following table.
[0054] Figure 3 Sampling values at each point and actual values
[0055] Calibration points (N) Sample value (X) Actual value (Y) 1 500 831.4229 2 1000 1357.3626 3 1500 1493.4838 4 2000 1760.4051 5 2500 2135.3449
[0056] According to the least squares method, the derivation formula of the three coefficients in the quadratic fitting curve equation is:
[0057]
[0058] Substituting the tabular data into the equations, we can get
[0059] Formula 1:
[0060] 500 2 *(a*500 2 +b*500+c-831.4229)+1000 2 *(a*1000 2 +b*1000+c-1357.3626)+1500 2 *(a*1500 2 +b*1500+c-1493.4838)+2000 2 *(a*2000 2 +b*2000+c-1760.4051)+2500 2 *(a*2500 2 +b*2500+c-2135.3449)=0
[0061] Formula 2:
[0062] 500*(a*500 2 +b*500+c-831.4229)+1000*(a*1000 2 +b*1000+c-1357.3626)+1500*(a*1500 2+b*1500+c-1493.4838)+2000*(a*2000 2 +b*2000+c-1760.4051)+2500*(a*2500 2 +b*2500+c-2135.3449)=0
[0063] Formula 3:
[0064] (a*500 2 +b*500+c-831.4229)+(a*1000 2 +b*1000+c-1357.3626)+(a*1500 2 +b*1500+c-1493.4838)+(a*2000 2 +b*2000+c-1760.4051)+(a*2500 2 +b*2500+c-2135.3449)=0
[0065] Simplified,
[0066] Formula 1: 61187500000000*a+28125000000*b+13750000*c-25313082900=0
[0067] Formula 2: 28125000000*a+13750000*b+7500*c-12872472.2=0
[0068] Formula 3: 13750000*a+7500*b+5*c-7578.0193=0
[0069] The solution is: a≈-4.8914e-05, b≈0.74892, c≈526.7381.
[0070] So it can be determined Figure 3 The function of the quadratic fitting curve is Y=-4.8914e-05*X 2 +0.74892*X+526.7381, and Figure 3 consistent.
[0071] Figure 3 In the example, five calibration points are taken and a quadratic fit is performed. This figure shows the error from each calibration point to the fitting curve at the same sampling value, as well as the quadratic fitting curve drawn based on the minimum sum of squared errors.
[0072] Figure 4The left side shows the protocol using KB calibration (old solution), and the right side shows the protocol using quadratic fitting (new solution). Comparing the two left and right sides, we can see that the amount of data required for quadratic fitting is only equivalent to the amount of data required for two sets of calibration parameters using KB calibration.
[0073] Figure 5 It shows the simple process of calibrating the host computer from how to obtain the sampled values and actual values to how to calculate the quadratic fitting coefficients.
[0074] from Figure 6 As can be seen, after quadratic fitting calibration, the error range of 50 samples of the charge current of power board 1 at each sampling point between 0 and 100A is within 10mA, meaning the calibration accuracy meets 0.01%. The power supply accuracy requirement is 0.05%, so the calibration accuracy meets the requirement. The standard deviation of the 50 samples at each sampling point reflects the fluctuation range of the data at each sampling point. The smaller the value, the smaller the fluctuation range. A normal distribution of the standard deviations at all sampling points shows that the mean standard deviation of each sampling point in this system is around 0.0007. Other factors can cause the standard deviation to fluctuate around 0.0007.
[0075] from Figure 7 As can be seen, after quadratic fitting calibration, the error range of 50 samples of the charge current of Power Board 2 at each sampling point between 0 and 100 A is within 10 mA, meaning the calibration accuracy meets 0.01%. The power supply accuracy requirement is 0.05%, so the calibration accuracy meets the requirement. The standard deviation of the 50 samples at each sampling point reflects the range of data fluctuation at each sampling point; smaller values indicate smaller fluctuations. A normal distribution analysis of the standard deviations at all sampling points shows that the mean standard deviation for each sampling point in this system is approximately 0.0008. Other factors can cause the standard deviation to fluctuate around 0.0008.
[0076] from Figure 8 As can be seen, after quadratic fitting calibration, the error range for 50 samples of the discharge current of power board 1 at each sampling point between 0 and 100 A is within 10 mA, meaning the calibration accuracy meets 0.01%. The power supply accuracy requirement is 0.05%, so the calibration accuracy meets the requirement. The standard deviation of the 50 samples at each sampling point reflects the fluctuation range of the data at each sampling point. The smaller the value, the smaller the fluctuation range. A normal distribution of the standard deviations at all sampling points shows that the mean standard deviation for each sampling point in this system is around 0.0013. Other factors may cause the standard deviation to fluctuate around 0.0013.
[0077] from Figure 9As can be seen, after quadratic fitting calibration, the error range for 50 samples of the discharge current of Power Board 2 at each sampling point between 0 and 100 A is within 10 mA, meaning the calibration accuracy meets 0.01%. The power supply accuracy requirement is 0.05%, so the calibration accuracy meets the requirement. The standard deviation of the 50 samples at each sampling point reflects the fluctuation range of the data at each sampling point; smaller values indicate smaller fluctuations. A normal distribution analysis of the standard deviations at all sampling points shows that the mean standard deviation for each sampling point in this system is approximately 0.0013. Other factors can cause the standard deviation to fluctuate around 0.0013.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all be included in the scope of the claims of the present invention.
Claims
1. A power supply calibration method based on least squares quadratic polynomial fitting, characterized by: The method comprises the following steps: S1: Assume that the quadratic fitting curve function is Y=aX 2 +bX+c, where a is the power coefficient of the quadratic term, b is the power coefficient of the linear term, c is the constant term coefficient, X represents the input value, and Y represents the output value; S2: In the process flow of forming power supply, during calibration, several calibration points are known, and the sampling values and actual values of these calibration points have been determined. According to the least squares formula, the three coefficients a, b, and c are determined. These three coefficients are finally used to determine the quadratic fitting curve equation, i.e., the compensation function. At this time, under the same sampling value, the sum of the squares of the errors from the actual value of each calibration point to the fitting curve is minimized. At this time, the fitting curve is closer to the actual power supply characteristic curve, i.e., the characteristic function. The derivation formulas of the three coefficients in the quadratic fitting curve equation are: N represents the total number of calibration points, i represents a calibration point, i∈N; S3: After calibration, the error function X'=F(Y) and the compensation function Y'=G(X') show that Y'=G(F(Y)); it is considered that the compensation function and the error function after calibration are inverse functions of each other, that is, G(X)=F -1 (X), at this time Y'=Y; after PID reciprocating adjustment, Y' gradually tends to X, and the deviation between X and Y' fluctuates around zero; Y'≈X, that is, Y≈X, so that the hardware circuit outputs the value set by the user; Where X' represents the analog-to-digital converter (ADC) sampling value; F represents the function mapping relationship from the actual value of the hardware circuit to the ADC sampling value; Y represents the actual value of the hardware circuit; Y' represents the proportional-integral-differential (PID) adjustment input value, that is, the value after ADC sampling compensation; G represents the compensation function mapping relationship; and X represents the set value.
2. The power supply calibration method based on least squares quadratic polynomial fitting according to claim 1, characterized in that: The number of calibration points is 5.
3. The power supply calibration method based on least squares quadratic polynomial fitting according to claim 2, characterized in that: The sampled value and the actual value are specifically: The sampling value of calibration point 1 is 500, and the actual value is 831.4229; The sampling value of calibration point 2 is 1000, and the actual value is 1357.3626; The sampling value of calibration point 3 is 1500, and the actual value is 1493.4838; The sampling value of calibration point 4 is 2000, and the actual value is 1760.4051; The sample value of calibration point 5 is 2500, and the actual value is 2135.3449.
Citation Information
Patent Citations
Power supply calibration method and device, power supply system, electronic equipment and medium
CN114595421A