Encoder speed measurement eccentricity error suppression method
By constructing the sampling pulse number and time queues, dynamic compensation and adjusting the sampling timing, combining the whole-week pulse number constraints and moving averages, the problems of encoder installation eccentricity and non-whole-week pulse counting in the PLC system are solved, and the stability and real-time improvement of speed measurement are achieved.
Patent Information
- Application Number
- CN202510754665.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-08-12
AI Technical Summary
The periodic fluctuations in the speed measurement caused by the eccentricity of the encoder installation and the cumulative error caused by the cutoff of the non-period pulse count of the PLC system affect the speed control accuracy of the cold-end line control system.
By constructing the sampling pulse number and sampling time queues, dynamic compensation adjusts the sampling timing, combining the pulse number constraints and moving averages throughout the week, data updates are used to calculate the average frequency to obtain the accurate delivery speed.
Effectively eliminate the periodic fluctuations in the speed measurement caused by the eccentricity of the encoder installation, suppress the non-periodic pulse cut-off error of the PLC system, improve the stability and real-time performance of the speed measurement, and reduce the concentricity requirements of the encoder installation and the annealing roller.
Smart Images

Figure CN120468459A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of encoder speed measurement, and in particular to a method for suppressing eccentricity errors in encoder speed measurement. Background Art
[0002] In the cold-end wire control system of a glass production line, an encoder is typically used to monitor the linear speed of the conveyor rollers at the end of the annealing lehr in real time, and this speed is used to control the operating speed of the cold-end conveyor rollers. Because the outer diameter of the annealing lehr conveyor roller shaft is generally larger than the inner diameter of the encoder sleeve, the existing technology often uses a reducer sleeve installation method: the reducer sleeve is first fixed to the annealing roller shaft, and then the encoder is installed on the sleeve. However, this installation method is prone to eccentricity between the encoder and the roller shaft due to machining or assembly errors. Eccentricity causes periodic fluctuations in the encoder output pulse signal, resulting in regular errors in the speed measurement results, seriously affecting the speed control accuracy of the wire control system.
[0003] To alleviate this problem, traditional solutions typically employ increasing the number of samples (for example, taking 20-30 samples at a 500ms sampling period) and applying a moving average to smooth the data and suppress fluctuations. However, this approach only reduces noise at a statistical level and cannot fundamentally eliminate the uneven pulse distribution caused by eccentricity. Specifically, eccentricity causes the encoder's output pulse count to fluctuate at the same rotation angle. The moving average method cannot correct this periodic deviation; it can only reduce the amplitude of the fluctuation.
[0004] With the industry's demand for technological upgrades, how to accurately and stably track the conveying speed of the annealing rollers is a technical issue that needs to be studied in the cold-end wire control system. Among them, making full use of the constant number of pulses in the encoder is a method to improve speed measurement technology. However, the practical application of this method faces significant challenges: the cold-end wire control system is based on PLC control and needs to rely on its high-speed counting module to collect the number of pulses in real time. Due to the PLC's cyclic scanning mechanism and the discreteness of pulse counting, there are technical difficulties in strictly fixing the pulse count to an integer number. If non-integer pulses are directly intercepted, the measurement start and end points will cause cumulative offsets over the running time, and the effect of fully utilizing the constant number of pulses in the encoder will not be achieved. Summary of the Invention
[0005] In order to solve the problems in the prior art of speed measurement periodic fluctuations caused by encoder installation eccentricity and cumulative errors caused by non-integer pulse counting truncation in the PLC system, the present invention proposes a method for suppressing encoder speed measurement eccentricity errors.
[0006] The specific technical solution is as follows: A method for suppressing eccentricity error in encoder speed measurement, comprising:
[0007] Based on the array, a sampling pulse number queue and a sampling duration queue are constructed. The pulse number of the encoder is constrained. The pulse count and the time required from the sampling start point to the sampling end point are stored in the sampling pulse number array PLS_VLU[0..SMP_NUM-1] and the sampling duration array TIM_VLU[0..SMP_NUM-1] respectively.
[0008] Dynamic compensation adjusts the sampling timing to control the encoder angular position corresponding to the sampling start point and the sampling end point to continuously maintain the encoder angular position corresponding to the first sampling start point, avoiding the defect of uneven pulse distribution caused by eccentricity and resulting in speed measurement error;
[0009] Based on the first-in-first-out principle, the sampling pulse number queue and the sampling duration queue are moved averaged. The total number of sampling pulses and the total sampling duration are periodically updated. Only a fixed number of sampling values are stored in the array. The moving average of the fixed number of sampling values is then performed. The sliding window mechanism and moving average improve the speed measurement stability.
[0010] The average frequency Freq_AVG is obtained based on the total number of sampling pulses PLS_ALL and the total sampling time TIM_ALL, and the conveying speed encoder_speed is calculated in combination with the annealing roller diameter.
[0011] Furthermore, the sampling pulse number queue and the sampling duration queue are specifically:
[0012] The element positions of the sampling pulse number queue correspond to the element positions of the sampling duration queue one by one, and the order is consistent. The entry, exit and migration of elements of the two queues are carried out synchronously.
[0013] After the latest sample value is queued, the real-time sampling times AVG_IX is increased by 1;
[0014] When the real-time sampling times AVG_IX is greater than the fixed sampling times SMP_NUM, that is, when the queue is full, the first element in the queue is dequeued, and the queue elements are migrated in turn, leaving the tail of the queue waiting for the latest sample value to be queued. The greater the real-time sampling times AVG_IX, the more stable the calculated transmission speed encoder_speed, but the real-time performance will be reduced. To balance stability and real-time performance, the fixed sampling times SMP_NUM is preferably set to 2-5;
[0015] After the first sample value that enters the queue is dequeued, the real-time sampling times AVG_IX decreases by 1.
[0016] Furthermore, it also includes constructing the relationship between the number of sampling pulses, sampling time and encoder angular position, as well as the relationship between the number of sampling pulses, sampling time and conveying speed through the PLC system;
[0017] The encoder pulse count uses the high-speed counting module of the PLC system. The count value is a cyclic count from 0 to 2147483647. When the maximum value is reversed, the pulse count difference is compensated to a positive value. The encoder uses an incremental encoder.
[0018] Furthermore, the sampling pulse number is the difference between the pulse count value Puls read from the high-speed counting module at the sampling end point and the sampling start point of the PLC system, which is equal to the difference PLS_DIF between the current pulse count at the sampling end point and the last sampling pulse count;
[0019] The sampling duration is the cumulative value of the actual execution time TM_DIF of each cycle of the PLC system from the sampling start point to the sampling end point, which is equal to the current sampling duration TIM_ADD at the sampling end point.
[0020] The encoder angular position at the first sampling starting point is the reference zero point. The pulse count value Puls read from the high-speed counting module at this moment is recorded as the last sampling pulse count value LST_PLS. Thereafter, at each sampling end point, the last sampling pulse count value LST_PLS is updated to the pulse count value Puls at the sampling end point.
[0021] The first sampling starting point is the pulse count value corresponding to the moment when the PLC system starts the first sampling.
[0022] Furthermore, the number of sampling pulses is constrained by the number of pulses in a whole cycle, and the sampling timing is adjusted through dynamic compensation so that the difference between the angular position of the encoder corresponding to the sampling end point and the angular position of the reference zero point is less than the angular displacement of the encoder within one cycle scanning period of the PLC system;
[0023] The sampling time varies with the angular velocity of the encoder and is inversely proportional to the speed. That is, the faster the transmission speed, the shorter the sampling time, and the slower the transmission speed, the longer the sampling time.
[0024] Furthermore, the sampling end point is determined by judging the relationship between the number of sampling pulses and the number of pulse comparisons.
[0025] The end point of this sampling is the starting point of the next sampling.
[0026] Furthermore, the dynamic compensation adjustment sampling timing includes:
[0027] When the number of sampling pulses is greater than or equal to the number of pulse comparisons, the sampling ends and the end point of the sampling is recorded as the pulse count value at this moment;
[0028] When the number of sampling pulses is greater than the number of pulse comparisons, the difference PLS_OFF between the number of sampling pulses and the number of pulse comparisons is calculated, and the number of pulse comparisons is corrected for determining the position of the end point of the next sampling.
[0029] Furthermore, the pulse comparison number includes:
[0030] The pulse comparison number PLS_CMPS of the first sampling is the number of pulses in a full cycle of the encoder. The more pulses in a full cycle of the encoder, the higher the resolution of the encoder. The encoder with a full cycle pulse number greater than or equal to 4096 is preferred.
[0031] The pulse comparison number of subsequent sampling is the corrected pulse comparison number.
[0032] Furthermore, the total number of sampling pulses and the total sampling time are specifically:
[0033] The total number of sampling pulses PLS_ALL is obtained by accumulating the latest sampling values. When an element is dequeued from the sampling pulse queue, the corresponding element value is deducted from the total number of sampling pulses.
[0034] The total sampling duration TIM_ALL is obtained by accumulating the latest sampling values. When an element is dequeued from the sampling duration queue, the corresponding element value is deducted from the total sampling duration.
[0035] Furthermore, the average frequency includes:
[0036] When the sampling pulse number and sampling time complete the first sampling, the average frequency is calculated. The average frequency at this time is the average frequency within a sampling period.
[0037] When the sampling pulse number and sampling duration complete multiple samplings, the average frequency at this time is the average frequency within multiple sampling periods;
[0038] When the real-time sampling number AVG_IX is greater than or equal to the fixed sampling number SMP_NUM, the average frequency Freq_AVG at this time is the average frequency within the fixed number of sampling periods.
[0039] The above technical solution has the following advantages or technical effects:
[0040] 1. This invention, through a dynamic deviation compensation mechanism and full-cycle pulse count constraint, can, in principle, eliminate the periodic fluctuations in speed measurement caused by encoder installation eccentricity. This avoids the drawback of the traditional moving average method, which can only smooth data but cannot correct the fundamental error, and reduces the requirements for the concentricity of the encoder installation and the annealing roller.
[0041] 2. This invention adjusts the sampling timing through dynamic compensation, which can effectively suppress the cumulative error caused by non-integer pulse truncation in the PLC system, solve the problem of measurement starting point offset over time, and improve long-term speed measurement stability.
[0042] 3. The present invention adopts queue management and sliding window mechanism, and realizes fast update by retaining the data of the latest fixed number of sampling periods. It can improve stability by using moving average while ensuring real-time performance.
[0043] 4. The present invention can deal with the numerical overflow problem of the high-speed counting module through automatic correction of pulse overflow, ensuring the continuity and reliability of pulse difference calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of the method of the present invention;
[0045] Figure 2 is a dynamic compensation flow chart of the present invention;
[0046] Figure 3 It is a stack management flow chart of the present invention. DETAILED DESCRIPTION
[0047] In order to make the technical solution of the present invention clearer, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0048] like Figure 1 As shown, a method for suppressing eccentricity errors in encoder speed measurement includes: establishing a sampling pulse number array PLS_VLU[0..2] and a sampling duration array TIM_VLU[0..2], which are respectively used to store sampling pulse number queue element values and sampling duration queue element values; dynamically compensating and adjusting the sampling timing so that the encoder angular position corresponding to the sampling start point and the sampling end point is continuously maintained near the encoder angular position corresponding to the first sampling start point; continuously performing queue management to keep only three sampling values stored in the array, thereby performing a moving average of the three sampling values; and obtaining an average frequency Freq_AVG from the total sampling pulse number PLS_ALL and the total sampling duration TIM_ALL, and calculating the conveying speed encoder_speed in combination with the annealing roller diameter.
[0049] As an optional embodiment, the fixed sampling number is 3, and the number of full-cycle pulses of the selected incremental encoder is 4096.
[0050] Initialize the sampling pulse number array PLS_VLU[0.. 2] and the sampling duration array TIM_VLU[0.. 2], clear the difference between the sampling pulse number and the pulse comparison number PLS_OFF, the real-time sampling number AVG_IX, the current sampling duration TIM_ADD, the total number of sampling pulses PLS_ALL, the total sampling duration TIM_ALL, and the average frequency Freq_AVG.
[0051] The PLC system's high-speed counting module performs cyclic sampling and continuously reads the current pulse count value, Puls. The time difference between each cycle is calculated based on the PLC system time value read each cycle. This difference is used as the actual execution time for each cycle, recorded as the PLC cycle scan single time, TM_DIF, in milliseconds. This time difference is derived from the current PLC system time and the previous PLC system time. After sampling begins, the current pulse count value, Puls, is assigned to the last sampled pulse count value, LST_PLS. The difference between the current and last sampled pulse counts, PLS_DIF, is calculated using the following formula: PLS_DIF = Puls - LST_PLS. The initial pulse count difference, PLS_DIF, is 0. The current sampling duration, TIM_ADD, is then accumulated and calculated by adding the PLC cycle scan single time, TM_DIF, using the following formula: TIM_ADD = TIM_ADD + TM_DIF.
[0052] When the difference PLS_DIF between the current pulse count and the last sampled pulse count is greater than or equal to the pulse comparison number 4096 of the first sampling, the PLS_DIF value at this moment is stored in the first element PLS_VLU[0] of the sampling pulse number array, and the TIM_ADD value at this moment is stored in the first element TIM_VLU[0] of the sampling duration array. At this point, the first sampling is completed. Whenever a sampling is completed, the total number of sampled pulses PLS_ALL is updated. The formula is as follows: PLS_ALL= PLS_ALL+PLS_DIF. At the same time, the total sampling duration TIM_ALL is updated. The formula is as follows: TIM_ALL= TIM_ALL+TIM_ADD.
[0053] Using the number of pulses in a whole cycle as a constraint, dynamically compensate and adjust the sampling timing, continuously perform sampling, and perform queue management. The total number of sampling pulses PLS_ALL and the total sampling time TIM_ALL are updated, and the transmission speed encoder_speed is calculated. The details are as follows.
[0054] like Figure 2 As shown, dynamic compensation adjustment sampling timing includes:
[0055] When an overflow is detected for the current pulse count value, the pulse count difference value PLS_DIF is corrected. This correction includes determining whether the pulse count difference value PLS_DIF is less than zero. Since the high-speed counting module's count value ranges from 0 to 2147483647, if so, it indicates a maximum value rollover. The pulse count difference value PLS_DIF is then compensated to a positive value using the following formula: PLS_DIF = PLS_DIF + 2147483647. If not, the next judgment is executed. This automatic pulse overflow correction algorithm ensures the continuity and reliability of pulse difference calculation.
[0056] Determine the relationship between the pulse count difference PLS_DIF and the corrected pulse comparison number. The corrected pulse comparison number is calculated by the first pulse comparison number 4096 and the difference PLS_OFF between the sampling pulse number and the pulse comparison number: PLS_DIF>=4096-PLS_OFF.
[0057] When the pulse count difference PLS_DIF is greater than or equal to the corrected pulse comparison count, the pulse count difference PLS_DIF is assigned to the element PLS_VLU[AVG_IX] in the sampling pulse count array corresponding to the real-time sampling count value, and the current sampling duration TIM_ADD is assigned to the element TIM_VLU[AVG_IX] in the sampling duration array corresponding to the real-time sampling count value. Dynamic compensation adjusts the sampling timing to suppress the cumulative error caused by non-integer pulse truncation in the PLC system.
[0058] Update the last sampled pulse count value, LST_PLS, and the current sampling duration, TIM_ADD, where LST_PLS = Puls. Clear TIM_ADD and calculate the difference, PLS_OFF, between the number of sampled pulses and the number of pulse comparisons using the following formula: PLS_OFF = PLS_DIF + PLS_OFF - 4096. By iteratively correcting PLS_OFF, the measurement starting point is relatively fixed, addressing the cumulative offset problem.
[0059] Returns the calculated pulse count difference PLS_DIF and accumulates the current sampling duration TIM_ADD.
[0060] After updating the total number of sampling pulses PLS_ALL and the total sampling time TIM_ALL, the method further includes: calculating the average frequency Freq_AVG. The average frequency Freq_AVG is calculated based on the total number of sampling pulses PLS_ALL and the total sampling time TIM_ALL. The formula is as follows: Freq_AVG=PLS_ALL / TIM_ALL.
[0061] like Figure 3 As shown, after calculating the average frequency Freq_AVG, the following further includes: updating the real-time sampling times AVG_IX according to each sampling cycle, and when entering a new cycle, the real-time sampling times AVG_IX+1, and the formula is as follows: AVG_IX=AVG_IX+1.
[0062] Determine whether the real-time sampling times AVG_IX is greater than 3: If so, the total number of sampling pulses PLS_ALL is deducted from the element value PLS_VLU[0] first stored in the sampling pulse number array PLS_VLU[0..2], and the formula is as follows: PLS_ALL=PLS_ALL-PLS_VLU[0]; the total sampling time TIM_ALL is deducted from the element value TIM_VLU[0] first stored in the sampling time array TIM_VLU[0..2], and the formula is as follows: TIM_ALL=TIM_ALL-TIM_VLU[0].
[0063] Move the sampling pulse number array elements, move the elements in the sampling pulse number array PLS_VLU[0.. 2] forward one position in sequence, clear the last element PLS_VLU[ 2 ] to zero, and implement sampling pulse number queue management based on the array;
[0064] Move the sampling duration array elements, shift the elements in the sampling duration array TIM_VLU[0..2] forward one position one by one, clear the last element TIM_VLU[2] to zero, and implement sampling duration queue management based on the array;
[0065] Through the above steps, after the fourth value is sampled, the first value is removed from the array. Subsequent sampling is performed, using the first-in, first-out principle to keep only three sample values in the array. This is used to perform a moving average of the three sample values (three revolutions). This sliding window mechanism and moving average improve speed measurement stability.
[0066] The real-time sampling times AVG_IX are reduced by one: AVG_IX=AVG_IX-1, and the judgment program is returned.
[0067] The conveying speed encoder_speed of the annealing roller measured by the encoder is calculated from the average frequency Freq_AVG and the diameter of the annealing roller. The formula is as follows: encoder_speed=Freq_AVG*297*3.1416 / 4096*3600, where 297 is the diameter of the annealing roller in mm, 3.1416 is the value of pi, 4096 is the number of pulses in a full circle of the encoder, 3600 is the unit conversion coefficient, and the unit of the conveying speed encoder_speed is m / h.
[0068] The present invention combines a dynamic deviation compensation mechanism with integer pulse number constraints, combined with queue management, to effectively suppress the periodic fluctuations in speed measurement caused by encoder installation eccentricity, eliminate the cumulative error caused by non-integer pulse truncation in the PLC system, and achieve accurate and stable real-time speed calculation.
[0069] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. A method for suppressing eccentricity error in encoder speed measurement, characterized in that: include: Based on the array, a sampling pulse number queue and a sampling duration queue are constructed. The pulse count and the required time obtained from the sampling start point to the sampling end point are stored in the sampling pulse number array and the sampling duration array respectively, with the encoder pulse number in a full cycle as the constraint. Dynamic compensation adjusts the sampling timing to control the encoder angular position corresponding to the sampling start point and the sampling end point to continuously maintain the encoder angular position corresponding to the first sampling start point; Based on the first-in-first-out principle, the sampling pulse number queue and the sampling duration queue are moved averaged, and the total number of sampling pulses and the total sampling duration are periodically updated; The average frequency is obtained based on the sum of the number of sampling pulses and the total sampling time, and the conveying speed is calculated based on the annealing roller diameter.
2. The method for suppressing eccentricity error in encoder speed measurement according to claim 1, characterized in that: The sampling pulse number queue and sampling duration queue are specifically: The element positions of the sampling pulse number queue correspond to the element positions of the sampling duration queue one by one, and the order is consistent. The entry, exit and migration of elements of the two queues are carried out synchronously. After the latest sampling value is queued, the real-time sampling times are increased by 1; When the real-time sampling number is greater than the fixed sampling number, the element that entered the queue first is dequeued, and the queue elements are migrated in turn, leaving the tail of the queue empty and waiting for the latest sample value to enter the queue; After the first sample value that enters the queue is dequeued, the real-time sampling count is reduced by 1.
3. The method for suppressing eccentricity error in encoder speed measurement according to claim 1 or 2, characterized in that: It also includes constructing the relationship between the number of sampling pulses, sampling duration and encoder angular position through the PLC system, as well as the relationship between the number of sampling pulses, sampling duration and conveying speed; The encoder pulse counting adopts the high-speed counting module of the PLC system.
4. The method for suppressing eccentricity error in encoder speed measurement according to claim 3, characterized in that: The sampling pulse number is the difference between the pulse count value read from the high-speed counting module at the sampling end point and the sampling start point of the PLC system; The sampling time is the cumulative value of the actual execution time of each cycle of the PLC system from the sampling start point to the sampling end point; The first sampling starting point is the pulse count value corresponding to the moment when the PLC system starts the first sampling. The encoder angular position at the first sampling starting point is the reference zero point.
5. The method for suppressing eccentricity error in encoder speed measurement according to claim 4, characterized in that: The number of sampling pulses is constrained by the number of pulses in a whole cycle, and the sampling timing is adjusted through dynamic compensation so that the difference between the encoder angular position corresponding to the sampling end point and the angular position of the reference zero point is less than the angular displacement of the encoder within one cycle scanning period of the PLC system; The sampling duration changes with the encoder angular velocity and is inversely proportional to it.
6. The method for suppressing eccentricity error in encoder speed measurement according to claim 2, characterized in that: The sampling end point is determined by judging the relationship between the number of sampling pulses and the number of pulse comparisons. The end point of this sampling is the starting point of the next sampling.
7. The method for suppressing eccentricity error in encoder speed measurement according to claim 6, characterized in that: The dynamic compensation adjustment sampling timing includes: When the number of sampling pulses is greater than or equal to the number of pulse comparisons, the sampling ends and the end point of the sampling is recorded as the pulse count value at this moment; When the number of sampling pulses is greater than the number of pulse comparisons, the difference between the number of sampling pulses and the number of pulse comparisons is calculated, and the pulse comparison number is corrected for determining the end point of the next sampling.
8. The method for suppressing eccentricity error in encoder speed measurement according to claim 6 or 7, characterized in that: The pulse comparison number includes: The number of pulse comparisons for the first sampling is the number of pulses in a full cycle of the encoder; The pulse comparison number of subsequent sampling is the corrected pulse comparison number.
9. The method for suppressing eccentricity error in encoder speed measurement according to claim 1 or 2, characterized in that: The total number of sampling pulses and the total sampling time are specifically: The total number of sampling pulses is obtained by accumulating the latest sampling values. When an element is removed from the sampling pulse queue, the corresponding element value is deducted from the total number of sampling pulses. The total sampling duration is obtained by accumulating the latest sampling values. When an element is dequeued from the sampling duration queue, the corresponding element value is deducted from the total sampling duration.
10. The method for suppressing eccentricity error in encoder speed measurement according to claim 1 or 2, characterized in that: The average frequencies include: When the sampling pulse number and sampling time complete the first sampling, the average frequency is calculated. The average frequency at this moment is the average frequency within a sampling period. When the number of sampling pulses and the sampling duration complete multiple samplings, the average frequency at this moment is the average frequency within multiple sampling periods; When the real-time sampling times are greater than or equal to the fixed sampling times, the average frequency at this moment is the average frequency within the fixed number of sampling cycles.