A method for online identification of encoder signal parameters based on least squares
By using the least squares method to identify encoder signal parameters online, the problem of limited encoder decoding accuracy is solved. This achieves efficient and low-resource-consumption accurate signal parameter identification, improving the encoder's measurement accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, the decoding accuracy of encoder signal parameters is limited, the offline calibration process is cumbersome and costly, and the real-time gradient descent method relies on a high-computing-power platform and has poor parameter robustness.
The least squares method is used to identify encoder signal parameters online. By constructing a matrix containing signal square terms and cross terms, the least squares method is used to solve for the optimal signal amplitude, reference, and phase difference, avoiding iterative search and gradient descent parameter adjustment, and realizing online real-time calculation.
It improves encoder decoding accuracy, reduces computational resource consumption, enhances the robustness and accuracy of parameter identification, and meets flexible computational needs for different accuracy requirements.
Smart Images

Figure SMS_7 
Figure SMS_20 
Figure SMS_21
Abstract
Description
Technical Field
[0001] This invention relates to the field of encoder signal processing technology, and specifically to a method for online identification of encoder signal parameters based on the least squares method. Background Technology
[0002] Encoders require a set of orthogonal sine and cosine signals, and angle values can be decoded by taking the arctangent transform. Generally, the amplitude, reference, and phase of the two measured sine and cosine signals will deviate, affecting the encoder's decoding accuracy. To address this issue, existing technologies typically employ the following two methods to identify encoder signal parameters.
[0003] Method 1, Offline Calibration: This method extracts calibration parameters from offline data. It involves extracting raw measurement data, calculating each signal offline, and estimating the signal amplitude and reference value using the maximum and minimum values within each signal cycle. Fitting two signals together yields their phase deviation. After offline data acquisition, this data is stored in the encoder chip and can be directly used during angle calculations. However, this method suffers from several drawbacks. Parameters require offline calculation, necessitating a calibration process for data extraction. Furthermore, the calculated amplitude, reference value, and phase difference are approximate values for one cycle of the original signal. Therefore, the calibration process is cumbersome, and only approximate data for a single cycle can be obtained, resulting in limited accuracy.
[0004] Method 2, Real-time Gradient Descent: On a platform with sufficient computing power, two phase signals can be observed in real time using OPD (Observer PhaseDetector). In each sampling period, the approximate signal amplitude, reference, and phase can be calculated iteratively through gradient descent. This method relies on a high-computing-power platform, has poor parameter robustness, requires dynamic adjustment of gradient descent parameters, and is difficult to control costs. Summary of the Invention
[0005] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method for online identification of encoder signal parameters based on the least squares method. This method obtains the optimal signal amplitude, reference, and phase difference within a certain interval near the current measurement position using the least squares method; optimizes the encoder sampling signal, improves encoder measurement accuracy, and enhances encoder decoding accuracy by performing optimal calculations on the amplitude, reference, and phase of two signals. Compared to the first method used in the prior art, this invention does not require a dedicated calibration process to acquire data. It selects the fitting region for signal amplitude, reference, and phase difference by controlling the amount of data involved in the least squares calculation, allowing for free selection of the target region and improving fitting accuracy. Compared to the second method used in the prior art, this invention packages nonlinear terms into intermediate values, first transforming it into a linear least squares problem, and then using the calculated optimal intermediate values to inversely calculate the signal amplitude, reference, and phase difference. It eliminates the need to handle gradient descent iterative search and adjustment of gradient descent parameters, thus solving the problems of limited accuracy in offline calibration methods and high cost in real-time gradient descent methods in the prior art.
[0006] To achieve the above and other related objectives, the present invention provides a method for online identification of encoder signal parameters based on the least squares method, comprising the following steps:
[0007] S1. Obtain the two quadrature signals theoretically output by the encoder. and ;
[0008] S2. The rotation angle of the encoder is calculated by performing arctangent calculation on the two data streams. ;
[0009] S3. Real-time acquisition of the two quadrature signals actually output by the encoder. and ;
[0010] S4. Construct a matrix containing the signal square term and the cross term. This includes deriving the equation of the ellipse by combining trigonometric identities and neglecting noise:
[0011]
[0012]
[0013] In the formula, to As intermediate variables, respectively, and the parameters to be determined. , , , and Related;
[0014] The trigonometric identities include trigonometric function formulas. Trigonometric function sum-product formula ;
[0015] The intermediate variable to The calculation formula is:
[0016]
[0017]
[0018]
[0019]
[0020]
[0021] The matrix The form is:
[0022]
[0023] Where matrix U is an n×5 matrix, n represents the number of signal groups participating in the least squares calculation, and the i-th row of matrix U contains the two signals sampled at time i and their quadratic terms:
[0024]
[0025]
[0026]
[0027] S5. Solving for the optimal intermediate variable using the least squares method. The formula is:
[0028]
[0029] Obtain the optimal vector That is, the optimal intermediate variable was obtained. , , , , ;
[0030] S6. Based on intermediate variables Inverse signal amplitude , and phase difference ;
[0031] S7, obtained through the solution , , Construct a linear equation in two variables and solve the benchmark equation. and By fitting , , , Quickly identify encoder signal parameters.
[0032] In one embodiment of the present invention, in step S1, the encoder theoretically outputs two orthogonal signals. and The calculation formula is:
[0033]
[0034]
[0035] In the formula, The encoder rotation angle, As the first signal in theory, This is the theoretical second signal. and The phase difference is 90°.
[0036] In one embodiment of the present invention, in step S2, the rotation angle of the encoder is... The solution formula is:
[0037] .
[0038] In one embodiment of the present invention, in step S3, the encoder actually outputs two orthogonal signals. and The calculation formula is:
[0039]
[0040]
[0041] In the formula, This is the actual amplitude of the first signal. As the actual reference for the first signal, The measurement noise for the first signal; This is the actual amplitude of the second signal. This serves as the actual reference for the second signal. The measurement noise for the second signal; This is the actual measurement signal for the first channel. This is the actual measurement signal for the second channel.
[0042] In one embodiment of the present invention, in step S6, the... , , Substitute intermediate variables to The optimal solution is obtained by inverse solution in the calculation formula. , , :
[0043]
[0044]
[0045] .
[0046] In one embodiment of the present invention, in step S7, the solved... , , Substitution and Construct a linear equation in two variables and solve it to obtain the baseline. and Through benchmark and Quickly identify encoder signal parameters.
[0047] As described above, the method for online identification of encoder signal parameters based on the least squares method of the present invention has the following beneficial effects:
[0048] This invention can perform real-time calculations at the sensor chip level, obtaining the optimal signal amplitude, reference, and phase difference within a range near the current measurement position using least squares. Compared to Method 1 in the prior art, this invention does not require a dedicated calibration process to acquire data. It selects the fitting region for signal amplitude, reference, and phase difference by controlling the amount of data involved in the least squares calculation, allowing for free selection of the target region and improving fitting accuracy. Compared to Method 2 in the prior art, this invention packages nonlinear terms into intermediate values, first transforming it into a linear least squares problem, and then using the calculated optimal intermediate values to inversely calculate the signal amplitude, reference, and phase difference. It eliminates the need to handle gradient descent iterative search and adjust gradient descent parameters. Furthermore, this invention only uses the measured signal and its quadratic terms as input during the calculation process, and the solution process only uses a small number of square root operations and the solution of a system of quadratic equations, resulting in lower computational resource consumption.
[0049] This invention eliminates the need for offline calibration, enabling real-time online calculation and dynamic adjustment of the amount of data involved in the calculation. For example, when calculating a region D or half of the encoder covered by 100 data sets, the number of signal sets n can be adjusted to 50 or 100 sets to meet different precision calculation requirements. Linearization avoids iterative searches, requiring only matrix operations and simple algebraic operations, resulting in low resource consumption and high computational efficiency. Furthermore, this invention utilizes the global optimality of the least squares method to reduce noise interference, improve parameter identification accuracy, and exhibit strong robustness. This invention can optimize encoder sampling signals, improving encoder measurement accuracy. By performing optimal calculations on the amplitude, reference, and phase of two signals, it can improve encoder decoding accuracy. Detailed Implementation
[0050] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification.
[0051] This invention provides a method for online identification of encoder signal parameters based on the least squares method, comprising the following steps:
[0052] S1. Obtain the two quadrature signals theoretically output by the encoder. and In this step, and The calculation formula is:
[0053]
[0054]
[0055] In the formula, The encoder rotation angle, As the first signal in theory, This is the theoretical second signal. and The phase difference is 90°.
[0056] S2. The rotation angle of the encoder is calculated by performing arctangent calculation on the two data streams. In this step, the encoder's rotation angle The solution formula is:
[0057]
[0058] S3. Real-time acquisition of the two quadrature signals actually output by the encoder. and , and To ignore the minor effects of higher harmonics, the encoder actually outputs two quadrature signals; in this step, the encoder actually outputs two quadrature signals... and The calculation formula is:
[0059]
[0060]
[0061] In the formula, This is the actual amplitude of the first signal. As the actual reference for the first signal, The measurement noise for the first signal; This is the actual amplitude of the second signal. This serves as the actual reference for the second signal. The measurement noise for the second signal; This is the actual measurement signal for the first channel. This is the actual measurement signal from the second channel. The measurement noise from the first channel signal... Measurement noise of the first signal It is generally believed that noise follows a Gaussian distribution with an expected value of 0, and during normal measurements, it is mostly negligible white noise, i.e. and All are 0.
[0062] S4. Construct a matrix containing the signal square term and the cross term. In this step, a matrix containing signal square terms and cross terms is constructed. This includes deriving the equation of the ellipse by combining trigonometric identities and neglecting noise:
[0063]
[0064]
[0065] In the formula, to As intermediate variables, respectively, and the parameters to be determined. , , , and Related.
[0066] The trigonometric identities include trigonometric function formulas. Trigonometric function sum-product formula .
[0067] The intermediate variable to The calculation formula is:
[0068]
[0069]
[0070]
[0071]
[0072]
[0073] The matrix The form is:
[0074]
[0075] Here, matrix U is an n×5 matrix, where n represents the number of signal groups participating in the least squares calculation. The number of signal groups n can also be dynamically adjusted as needed. For example, if 100 data groups currently cover a region D of the encoder, and to achieve the calculation of the entire region D... , , , and For online measurements, 100 sets of signals can be used for least squares; if you want to measure the parameters of half a region online, only 50 sets of data are needed, simply by adjusting the dimensions of matrix U. The i-th row of matrix U contains the two signals sampled at time i and their quadratic terms:
[0076]
[0077]
[0078]
[0079] S5. Solving for the optimal intermediate variable using the least squares method. In this step, the least squares method is used to find the optimal intermediate variable. The formula is:
[0080]
[0081] Obtain the optimal vector That is, the optimal intermediate variable was obtained. , , , , .
[0082] S6. Based on intermediate variables Inverse signal amplitude , and phase difference In this step, , , Substitute intermediate variables to The optimal solution is obtained by inverse solution in the calculation formula. , , :
[0083]
[0084]
[0085]
[0086] S7, obtained through the solution , , Construct a linear equation in two variables and solve the benchmark equation. and By fitting , , , Quickly identify the encoder's signal parameters; specifically, the parameters obtained in step 6... , , Substitution and Construct a linear equation in two variables and solve it to obtain the baseline. and As can be seen from step 3, This is the actual amplitude of the first signal. As the actual reference for the first signal, This is the actual amplitude of the second signal. As the actual reference for the second signal, the two orthogonal signals actually output by the encoder are fitted. and optimal amplitude , , benchmark and phase difference It can quickly identify the signal parameters of the encoder and improve the encoder decoding accuracy.
[0087] This invention can perform real-time calculations at the sensor chip level, obtaining the optimal signal amplitude, reference, and phase difference within a range near the current measurement position using least squares. Compared to Method 1 in the prior art, this invention does not require a dedicated calibration process to acquire data. It selects the fitting region for signal amplitude, reference, and phase difference by controlling the amount of data involved in the least squares calculation, allowing for free selection of the target region and improving fitting accuracy. Compared to Method 2 in the prior art, this invention packages nonlinear terms into intermediate values, first transforming it into a linear least squares problem, and then using the calculated optimal intermediate values to inversely calculate the signal amplitude, reference, and phase difference. It eliminates the need to handle gradient descent iterative search and adjust gradient descent parameters. Furthermore, this invention only uses the measured signal and its quadratic terms as input during the calculation process, and the solution process only uses a small number of square root operations and the solution of a system of quadratic equations, resulting in lower computational resource consumption.
[0088] In summary, this invention eliminates the need for offline calibration, enabling real-time online calculation and dynamic adjustment of the amount of data involved in the computation. For example, when calculating a region D or half of the encoder covered by 100 data sets, the number of signal sets n can be adjusted to 50 or 100 sets to meet different precision requirements. Linearization avoids iterative searches, requiring only matrix operations and simple algebraic calculations, resulting in low resource consumption and high computational efficiency. Furthermore, this invention utilizes the global optimality of the least squares method to reduce noise interference, improve parameter identification accuracy, and exhibit strong robustness. This invention can optimize encoder sampling signals, improving encoder measurement accuracy. By optimally calculating the amplitude, reference, and phase of two signals, it can improve encoder decoding accuracy. Therefore, this invention effectively overcomes the various shortcomings of existing technologies and possesses high industrial application value.
[0089] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method for online identification of parameters of an encoder signal based on least squares, characterized in that, The method comprises the following steps: S1, obtaining two quadrature signals of the encoder theoretical output and ; S2, the two-way data inverse tangent operation, to solve the encoder rotation angle ; S3, real-time acquisition of two-way orthogonal signals actually output by the encoder and ; S4, Constructing the matrix containing signal square terms and cross terms Including the identity of the trigonometric function, ignoring the noise after the derivation of the elliptic equation: wherein to are intermediate variables associated with the parameters , , , and to be determined, respectively; The trigonometric identities include trigonometric formulas trigonometric sum and difference formulas ; The intermediate variable To The calculation formula is: The matrix is of the form: Wherein, the matrix U is an n*5 matrix, n represents the number of signal groups participating in the least square calculation, and the i-th row of the matrix U is the two-way signal and its quadratic term sampled at the i-th moment: S5. Solving the optimal intermediate variable by least square method The formula is: obtaining the optimal vector i.e. the optimal intermediate variable is obtained , , , , ; S6. According to the intermediate variable inverse signal amplitude , and phase difference ; S7, by solving the , , constructing a binary linear equation, solving the reference and , by fitting , , , quickly identifying the signal parameters of the encoder.
2. The method for online identification of parameters of an encoder signal based on least squares of claim 1, characterized in that, In the S1 step, the two quadrature signals of the encoder theory output and The calculation formula is: wherein is the encoder rotation angle, is the theoretical first path signal, is the theoretical second path signal, and the phase difference between the first and second path signals is 90°.
3. The method for online identification of parameters of an encoder signal based on least squares of claim 2, characterized in that, In the S2 step, the rotation angle of the encoder The solution formula is: 。 4. The method for online identification of parameters of an encoder signal based on least squares according to claim 3, characterized in that In the S3 step, the two quadrature signals actually output by the encoder and The calculation formula is: wherein is the actual amplitude of the first signal, is the actual reference of the first signal, is the measurement noise of the first signal; is the actual amplitude of the second signal, is the actual reference of the second signal, is the measurement noise of the second signal; is the actual measurement signal of the first path, is the actual measurement signal of the second path.
5. The method for online identification of parameters of an encoder signal based on least squares of claim 1, wherein, In step S6, the , , is substituted into the calculation formula of the intermediate variable to to obtain the optimal , , . 。 6. The method for online identification of parameters of an encoder signal based on least squares of claim 5, characterized in that, In step S7, the solved , , are substituted into and to construct a binary linear equation, and the reference and are solved to quickly identify the signal parameters of the encoder through the reference and .
Citation Information
Patent Citations
High-precision rotary transformer decoding method based on parameter identification
CN111045323A
Incremental optical encoder scribing and subdivision error compensation method
CN116295118A