A real-time discrimination and correction method for encoder interference false pulses of a numerical control system
By using a hierarchical processing architecture of FPGA and ARM and multi-constraint fusion discrimination technology, combined with dual reference models and Z-phase zero-position hard calibration, the accuracy and real-time problems of encoder pseudo-pulse discrimination in CNC systems are solved, achieving highly reliable pseudo-pulse correction and interference tracing, which is suitable for high-end CNC machine tools and industrial robots.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN DINGYUN SOFTWARE
- Filing Date
- 2026-04-13
- Publication Date
- 2026-06-12
Smart Images

Figure CN122194849A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of numerical control system adjustment and control technology, and in particular to a method and device for real-time identification and correction of encoder interference pseudo-pulses in numerical control systems. Background Technology
[0002] Multi-axis CNC systems are core control components of high-end CNC machine tools, industrial robots, and precision machining equipment. The position closed-loop feedback accuracy of the servo drive axes directly determines the overall machining accuracy and operational reliability. Incremental photoelectric encoders are widely used for position and speed detection of various servo axes in CNC systems due to their simple structure, high resolution, fast response speed, and moderate cost. Their output ABZ phase pulse signals provide real-time position feedback for the servo control system. However, in actual industrial operating environments, strong electromagnetic interference such as high-frequency carrier waves from frequency converters, shared transmission of servo power cables and encoder signal cables, poor machine tool grounding, electromagnetic radiation from welding and EDM equipment, and power grid fluctuations are unavoidable. This can lead to a large number of irregular pseudo-pulses mixed into the encoder output signal, mainly manifested as spike-type pseudo-pulses, pulse-missing pseudo-pulses, phase-shifted pseudo-pulses, and continuous clusters of pseudo-pulses. Pseudo-pulses directly cause position counting errors in the servo controller, speed loop fluctuations, and increased position loop tracking errors, resulting in machine tool vibration, poor machining texture, and out-of-tolerance contour accuracy. In severe cases, it can cause axis runaway, tool collision, workpiece scrap, or even equipment damage, causing huge losses to precision manufacturing production.
[0003] Currently, there are various compensation and filtering methods in existing technologies for encoder interference and pseudo-pulse processing, but they all have obvious defects and are difficult to meet the industrial application requirements of CNC systems for high real-time performance, high reliability, and high precision.
[0004] The invention patent CN103063237B, entitled "A Method and Device for Encoder Anti-interference," discloses an anti-interference scheme that compares the pulse frequency with the frequency converted from the target rotational speed. It employs a single threshold judgment and adaptive digital filtering to suppress interference. However, this method can only handle discrete spike interference with frequencies significantly deviating from the normal range. When the interference pulse frequency is close to the normal encoder pulse frequency, the judgment logic completely fails. Furthermore, this method only supports independent signal processing for a single axis, without incorporating kinematic constraints, making it unable to distinguish between real motion abrupt changes and interference abrupt changes. This leads to frequent misjudgments and missed judgments, and it cannot handle continuous pseudo-pulses, pulse loss, and phase shift faults, severely limiting its applicability.
[0005] Another invention patent, CN103575312B, entitled "A Method for De-jittering an Incremental Photoelectric Encoder for a Photoelectric Turntable," only addresses pulse signal edge jitter through delayed de-jitter processing, eliminating the jitter effect through delayed sampling and level confirmation. This method is functionally limited, only solving edge jitter problems caused by mechanical vibration or low-frequency interference. It is completely ineffective against spike pseudo-pulses, continuous pseudo-pulses, pulse loss, and phase synchronization offset caused by electromagnetic interference, which is most common in CNC systems. Furthermore, this method does not incorporate the multi-axis linkage characteristics of CNC systems, lacks motion constraint verification capabilities, has uncontrollable processing delays, and cannot meet the high real-time requirements of CNC system servo control (less than 200μs).
[0006] In addition to the two representative comparative documents mentioned above, existing encoder pseudo-pulse processing techniques generally suffer from the following insurmountable technical problems: First, all of them adopt a single-axis independent processing mode, completely ignoring the inherent kinematic constraints of multi-axis linkage in CNC systems. When the characteristics of the interference signal are highly similar to those of the normal pulse, the single-axis feature verification completely fails and cannot achieve reliable identification.
[0007] Second, it can only handle single or a small number of discrete pseudo-pulses, and is powerless in the face of continuous 3 to 10 pseudo-pulses caused by high-frequency interference in industrial sites. Simply relying on historical data to extrapolate and predict will lead to an exponential amplification of errors, causing servo control instability.
[0008] Third, the benchmark model uses offline one-time calibration, which does not take into account the pulse characteristic shift caused by long-term use and aging of the encoder, temperature drift, and load changes. In addition, there is no interference identification mechanism, and the benchmark model is easily contaminated by interference data, resulting in a continuous decline in the discrimination accuracy.
[0009] Fourth, it is impossible to balance real-time performance and discrimination accuracy. Complex machine learning or multi-feature fusion algorithms introduce a delay of more than 1ms, which destroys the stability of the servo loop; simple threshold filtering or hardware debouncing results in a false negative rate and a false negative rate of more than 30%, which is difficult to meet the requirements of precision machining.
[0010] Fifth, the common-mode synchronous offset scenario of AB phase signals is not considered. When interference acts on both A and B phases simultaneously, causing synchronous phase difference offset, the traditional quadrature phase verification completely fails and cannot distinguish between phase offset and actual motion change.
[0011] Sixth, the lack of a closed-loop elimination mechanism for cumulative errors means that even if the single pseudo-pulse correction is accurate, uncontrollable cumulative position errors will still occur after long-term operation, and the encoder's Z-phase zero-position signal is not fully utilized for periodic hard calibration.
[0012] Seventh, it only has passive correction function and no ability to record, count, trace and warn of interference events. It cannot locate the source of interference, optimize wiring and grounding on the factory site, and can only passively bear the quality loss caused by interference.
[0013] In summary, existing technologies cannot achieve highly reliable identification, hierarchical correction, self-calibration, and interference source tracing of encoder pseudo-pulses in CNC systems without increasing hardware costs or reducing system real-time performance, making them unsuitable for large-scale mass production deployments in factories. Therefore, this invention proposes a method and device for real-time identification and correction of encoder interference pseudo-pulses in CNC systems. It employs a layered FPGA and ARM processing architecture, multi-constraint fusion identification, hierarchical adaptive correction, dual-reference model self-updating, Z-phase zero-position hard calibration, and an integrated interference black box recording technology. This fundamentally solves all the shortcomings of existing technologies and meets the industrial application requirements of high real-time performance, high reliability, and high precision for CNC systems. Summary of the Invention
[0014] The purpose of this invention is to provide a method and device for real-time identification and correction of pseudo-pulses in encoders of CNC systems, which solves the technical problems in the prior art such as easy failure of pseudo-pulse identification, inability to handle continuous pseudo-pulses, easy drift of the reference model, contradiction between real-time performance and accuracy, uncontrollable cumulative error, and lack of interference tracing capability. Without increasing hardware costs or affecting the stability of the servo system, it realizes real-time identification, hierarchical correction, self-updating calibration and interference tracing of pseudo-pulses.
[0015] The technical solution adopted in this invention is as follows: A method for real-time identification and correction of encoder interference pseudo-pulses in a CNC system includes the following steps: A static multi-feature benchmark model of the encoder's normal pulse is pre-constructed, multi-axis linkage constraint boundaries are established based on the kinematic equations of the multi-axis linkage of the CNC system, and the look-ahead motion information of the G-code to be processed is pre-loaded. A hardware fast discrimination layer integrated in FPGA is used to perform preliminary filtering on the real-time acquired encoder ABZ phase pulse signal, remove obvious spike-type pseudo pulses, and output the preliminarily purified pulse signal to the ARM software fine discrimination layer. The software's fine-tuning layer extracts multi-dimensional feature parameters of the initial purified pulse signal, and sequentially performs static multi-feature benchmark comparison verification, single-axis dynamic constraint verification, multi-axis linkage constraint verification, and G-code look-ahead constraint verification. It then performs multi-constraint fusion confidence scoring on suspected pseudo-pulses, confirms the real pseudo-pulses, and marks their type and continuous length. Based on the type and continuous length of the pseudo-pulse, a corresponding graded correction strategy is adopted. The encoder Z-phase signal is used to perform zero-position hard calibration periodically and the dynamic reference model is automatically updated during the interference-free period. The corrected encoder position signal is output to the servo controller of the CNC system.
[0016] Preferably, the step of establishing multi-axis linkage constraint boundaries based on the kinematic equations of the multi-axis linkage of the CNC system includes: Based on the kinematic model of the machine tool, the theoretical proportional relationship between the position, velocity and acceleration of each axis during linkage machining is derived. By combining the mechanical error and servo tracking error of the machine tool, the allowable fluctuation range of motion parameters of each axis relative to the theoretical value is determined, and dynamic multi-axis linkage constraint boundaries are established. The encoder position signals of all other linked axes are acquired in real time, and the theoretical motion parameter range of the current axis is calculated. If the actual motion parameters of the current axis exceed the range, it is marked as a suspected spurious pulse.
[0017] Preferably, the preliminary filtering using a hardware fast discrimination layer integrated into the FPGA includes: Synchronous differential sampling of the ABZ phase pulse signal is performed at a sampling rate 8 times higher than the encoder's highest pulse frequency to accurately obtain the pulse rise time, fall time, and level duration. Signals with pulse widths less than the preset minimum normal pulse width (default 50ns) are directly marked as spike-type pseudo-pulses and discarded; Signals with pulse intervals smaller than the preset minimum normal pulse interval are marked as suspected spike-type pseudo-pulses, temporarily stored, and then sent to the software fine-tuning layer for secondary confirmation.
[0018] Preferably, the multi-constraint fusion confidence scoring of suspected spurious pulses includes: calculating the deviation scores of suspected spurious pulses in four dimensions: static multi-feature benchmark comparison, single-axis dynamic constraints, multi-axis linkage constraints, and G-code look-ahead constraints, with scores ranging from 0 to 1; and calculating the comprehensive confidence score based on the reliability weight coefficients assigned to each dimension, using the following formula: ; in, For multi-feature benchmark deviation score, The score is given for the deviation of the uniaxial dynamic constraint. The score is for the deviation of multi-axis linkage constraints. The deviation score for the look-ahead constraint of the G code; When the overall confidence score is ≥0.7, it is confirmed as a true pseudo-pulse.
[0019] Preferably, the step of adopting a corresponding hierarchical correction strategy based on the type and continuous length of the pseudo-pulse includes: For a single spike-type pseudo-pulse, the pulse is directly discarded and the cumulative value of the pulse counter is corrected simultaneously; For a single missing or offset pseudo-pulse, a quadratic polynomial prediction correction is performed based on the temporal characteristics of the first three consecutive normal pulses and the uniaxial dynamic model. For pseudo-pulses with a continuous length of ≤10, linear interpolation correction is performed by combining multi-axis linkage constraints and G-code look-ahead information; For pseudo-pulses with a continuous length of >10, the servo deceleration protection is triggered, and the machining is automatically resumed after the encoder position is calibrated using the most recent Z-phase signal.
[0020] Preferably, the step of periodically performing zero-position hard calibration using the encoder Z-phase signal and automatically updating the dynamic reference model during interference-free periods includes: Each time the encoder Z-phase signal is triggered, the encoder's cumulative position is forcibly reset to the Z-phase reference position, eliminating all cumulative errors; The characteristic parameters of all pulse signals identified as normal within the current Z-phase cycle are statistically analyzed, and their average value and standard deviation are calculated. If the deviation between the current statistical results and the static benchmark model is ≤5%, the current statistical results will be used to update the dynamic benchmark model for multi-feature benchmark comparison and verification in the next cycle. If the deviation is greater than 5%, an encoder fault warning will be triggered, prompting the operator to check the encoder status.
[0021] Preferably, the method further includes interfering with the black box function: Automatically record the occurrence time, axis number, machine coordinate, pseudo-pulse type, continuous length, and confidence score of all real pseudo-pulse events; Generate a heat map of interference during the processing, and mark the processing areas and time periods where interference occurs most frequently; When the number of interference events per unit time exceeds a preset threshold, an electromagnetic interference warning is triggered, prompting operators to check surrounding equipment.
[0022] A real-time detection and correction device for encoder interference pseudo-pulses in a CNC system includes: The preprocessing module is used to pre-build a static multi-feature reference model of the encoder's normal pulses, establish multi-axis linkage constraint boundaries, and preload the look-ahead motion information of the G-code to be processed. The hardware rapid identification module is integrated into the FPGA chip of the CNC system. It is used to perform preliminary filtering on the real-time acquired encoder ABZ phase pulse signal to remove obvious spike-type pseudo pulses. The software fine-tuning module runs in the ARM processor of the CNC system and is used to perform multi-constraint fusion verification and confidence scoring to identify real pseudo-pulses and mark their type and continuous length. The adaptive correction module is used to adopt a graded correction strategy based on the type and continuous length of the pseudo-pulse, use the Z-phase signal for zero-position calibration and reference model update, and output the corrected encoder position signal. The interference recording module is used to implement the interference black box function, generating interference reports and heat maps.
[0023] An electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the real-time identification and correction method for encoder interference pseudo-pulses in a numerical control system.
[0024] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned method for real-time identification and correction of encoder interference pseudo-pulses in a numerical control system.
[0025] The beneficial effects of this invention are: 1. It adopts an FPGA+ARM layered processing architecture, with hardware layer processing latency of less than 1μs and overall system latency of less than 100μs, which fully meets the high real-time requirements of CNC system servo control and does not affect system stability.
[0026] 2. It integrates single-axis features, single-axis dynamics, multi-axis linkage, and G-code look-ahead four-fold constraint verification, achieving an accuracy rate of 99.99%. It can still stably identify even in scenarios with strong electromagnetic interference and pseudo-pulse characteristics that are close to normal pulses.
[0027] 3. Supports graded correction strategies, capable of handling up to 20 consecutive pseudo-pulses, covering all types of interference in industrial settings, and solving the technical problem that existing technologies cannot handle continuous pseudo-pulses.
[0028] 4. It adopts a dual-model architecture of static and dynamic reference models, and automatically updates the dynamic reference only within the interference-free Z-phase period to avoid model contamination and drift, and adapts to encoder aging, temperature change and load fluctuation scenarios.
[0029] 5. Through the Z-phase zero-position hard calibration mechanism, the cumulative position is forcibly reset every time the Z-phase is triggered, completely eliminating the cumulative position error caused by pseudo-pulse correction and ensuring long-term operating accuracy.
[0030] 6. It has the functions of interference black box and heat map source tracing, which can automatically record interference events, statistically analyze interference distribution, and trigger early warnings to help quickly locate the interference source on site and realize the upgrade from passive correction to active prevention.
[0031] 7. It is implemented purely in software, without increasing any hardware costs. It can be directly integrated into the existing CNC system FPGA firmware and ARM control system, adaptable to mass production deployment in factories, and has extremely high engineering application value. Attached Figure Description
[0032] Figure 1 A flowchart of a method for real-time identification and correction of encoder interference pseudo-pulses in a CNC system provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the multi-constraint fusion confidence scoring logic provided in an embodiment of the present invention; Figure 3 This is a flowchart illustrating the execution of a graded correction strategy provided in an embodiment of the present invention. Figure 4 This is a schematic diagram of dual-reference model updating and Z-phase calibration provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of a real-time identification and correction device for encoder interference pseudo-pulses in a CNC system, provided in an embodiment of the present invention.
[0033] In the diagram, 100 is the preprocessing module; 200 is the hardware rapid identification module; 300 is the software fine identification module; 400 is the adaptive correction module; and 500 is the interference recording module. Detailed Implementation
[0034] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0035] The real-time identification and correction method for encoder interference pseudo-pulses in CNC systems proposed in this invention is based on a hierarchical architecture of high-speed FPGA hardware processing and fine-grained ARM software computation. It makes full use of the kinematic constraints of multi-axis linkage in CNC systems and the look-ahead information of G-code to achieve highly reliable identification, graded correction, self-calibration and interference source tracing of pseudo-pulses. The entire process does not increase hardware costs, does not affect the stability of the servo system, and does not introduce excessive delays, making it fully adaptable to large-scale mass production deployment in industrial settings.
[0036] like Figure 1-4 As shown, the real-time identification and correction method for encoder interference pseudo pulses in the CNC system includes the following steps: In step S101, a static multi-feature reference model of the encoder normal pulse is pre-constructed, a multi-axis linkage constraint boundary is established based on the multi-axis linkage kinematic equation of the CNC system, and the look-ahead motion information of the G code to be processed is pre-loaded.
[0037] Specifically, in the embodiments of the present invention, a preprocessing modeling operation is first performed to provide a benchmark and constraint conditions for subsequent pseudo-pulse discrimination and correction. Under the standard laboratory conditions of no electromagnetic interference, good grounding, and stable light source, a full-condition calibration is performed on the incremental photoelectric encoder supporting the target numerical control system, and the standard ABZ-phase pulse signals of the servo drive shaft within the range of rotational speed from 0 to 3000 r / min, acceleration from 0 to 2 g, and load from 0 to 150% of the rated load are collected. Six core characteristic parameters, namely single-pulse width, adjacent pulse interval, AB-phase phase difference, Z-phase pulse position accuracy, pulse count change rate, and pulse interval change rate, are extracted from the standard signals. Normal distribution statistical calculations are performed on each characteristic parameter to determine the upper and lower limits of the 99.7% confidence interval, forming a static multi-characteristic benchmark model. This model is used as the initial discrimination benchmark and is stored stably in the flash memory of the numerical control system for a long time.
[0038] Based on the dynamic equation of the servo drive shaft, the constraint relationship between the shaft motion state and the encoder pulse characteristics is derived, and the theoretical maximum and minimum values of the pulse frequency, pulse count change rate, and pulse interval change rate under different rotational speeds, accelerations, and load conditions are determined, establishing a single-axis dynamic constraint boundary for judging whether the single-axis pulse signal exceeds the physical limit of mechanical motion.
[0039] Based on the multi-axis linkage kinematic model of the numerical control system, according to the linkage trajectory planned by the G-code instruction, the theoretical proportional relationship between the positions, speeds, and accelerations of the linked axes is derived. Considering the actual error factors such as the mechanical clearance of the machine tool, the error of the lead screw, and the servo tracking error, the allowable fluctuation range of the motion parameters of each axis is set to form a dynamic multi-axis linkage constraint boundary. During the linked machining process, the normal encoder position signals of other linked axes are read in real time, and the theoretical position interval of the current axis is inversely deduced according to the linkage ratio. If the motion parameters calculated from the actual pulses of the current axis exceed this interval, it is directly determined as a suspected pseudo-pulse.
[0040] Meanwhile, the numerical control system preloads the next 100 lines of G-code instructions, extracts information such as the motion coordinates, feed speed, acceleration, and linkage relationship of each axis, and constructs a G-code look-ahead constraint library to provide a theoretical trajectory reference for subsequent pseudo-pulse discrimination and correction.
[0041] In step S102, the hardware fast discrimination layer integrated in the FPGA is used to preliminarily filter the real-time collected encoder ABZ-phase pulse signals,剔除 obvious spike-type pseudo-pulses, and output the preliminarily purified pulse signals to the ARM software fine discrimination layer.
[0042] Note: There is a wrong character "剔除" in the original Chinese text of step S102 which should be "filter out" in the English translation. It seems there is a mistake in the original Chinese content. I've translated it as best as I can based on the overall context.Specifically, this embodiment of the invention uses an FPGA chip to implement high-speed signal processing at the hardware level. Synchronous differential sampling of the ABZ phase pulse signal is performed at a sampling rate eight times the encoder's highest output pulse frequency, accurately capturing the rise time, fall time, level duration, and phase relationship of each pulse. A minimum normal pulse width is preset to 50ns. Signals with pulse widths less than 50ns are directly identified as high-frequency spike-type pseudo-pulses and directly rejected by the FPGA hardware, not participating in subsequent counting and processing. Signals with pulse intervals smaller than the theoretical minimum interval are marked as suspected spike-type pseudo-pulses, temporarily stored in the FPGA's internal buffer, and sent to the ARM software layer for secondary fine confirmation.
[0043] The FPGA hardware layer adopts a combinational logic and sequential logic design throughout, with a processing delay of less than 1μs. It can filter out more than 90% of high-frequency spike interference, significantly reducing the computational pressure on the ARM software layer, while ensuring the real-time requirements of the servo system.
[0044] In step S103, the software fine-tuning layer extracts multi-dimensional feature parameters of the preliminary purified pulse signal, and sequentially performs static multi-feature benchmark comparison verification, single-axis dynamic constraint verification, multi-axis linkage constraint verification and G-code look-ahead constraint verification. It performs multi-constraint fusion confidence scoring on suspected pseudo pulses, confirms real pseudo pulses and marks their type and continuous length.
[0045] Specifically, the ARM software fine-tuning layer receives the initial cleaned signal from the FPGA and extracts multi-dimensional feature parameters such as single pulse width, adjacent pulse interval, AB phase orthogonality error, pulse count change rate, and pulse interval change rate. The mathematical expressions for the AB phase orthogonality error and pulse count change rate are as follows: ; in, This indicates the orthogonality error of phases A and B; This represents the time difference between the rising edge of phase A pulse and the rising edge of the adjacent phase B pulse; This represents the theoretical period of a single pulse at the current encoder speed; Indicates the rate of change of pulse count; express The encoder pulse count at any given time; Indicates the sampling time interval.
[0046] Subsequently, a four-fold constraint verification is performed sequentially: First, the feature parameters are compared with the static multi-feature baseline model; if they exceed the confidence interval, they are marked as abnormal. Second, it is verified whether the single-axis dynamic constraint boundary is exceeded; if it exceeds the physical limit, it is marked as abnormal. Third, it is verified whether it conforms to the multi-axis linkage constraint boundary; if it is not coordinated with the motion of other axes, it is marked as abnormal. Fourth, it is verified whether it matches the theoretical trajectory of the G-code anterior pupil; if it deviates too much from the theoretical trajectory, it is marked as abnormal. If any verification fails, it is determined to be a suspected pseudo-pulse. A multi-constraint fusion confidence score is then applied to suspected pseudo-pulses, using the following formula: ; in, This represents the overall confidence score, ranging from 0 to 1; Indicates the score of multi-feature benchmark comparison; Indicates the score for uniaxial dynamic constraints; Indicates the score of multi-axis linkage constraints; This represents the G-code anterior pupil constraint score. The weighting coefficients are set based on on-site reliability, and their sum is 1. When the overall confidence score is... When a pulse is identified as a real pseudo-pulse, it is labeled as a spike-type, missing-type, or offset-type pulse based on its characteristics. At the same time, the number of pseudo-pulses is continuously counted to determine the continuous length.
[0047] Multi-axis linkage constraint verification is one of the core innovations of this invention. Even if the encoder signal of a certain axis is completely submerged by interference, the theoretical position of that axis can still be deduced by the signals of other normal linkage axes, thus achieving stable identification and completely solving the problem of single-axis isolated verification failure in the existing technology.
[0048] In step S104, a corresponding graded correction strategy is adopted according to the type and continuous length of the pseudo-pulse. The encoder Z-phase signal is used to perform zero-position hard calibration periodically and the dynamic reference model is automatically updated during the interference-free period.
[0049] Specifically, in this embodiment of the invention, graded correction is performed based on the type and continuous length of the pseudo-pulse: for a single spike-type pseudo-pulse, the pulse is directly removed and the cumulative value of the pulse counter is corrected simultaneously; for a single missing or offset pseudo-pulse, a compensation pulse or a corrected pulse edge is generated by using quadratic polynomial prediction based on the timing characteristics of the first three consecutive normal pulses and the single-axis dynamic model; for pseudo-pulses with a continuous length ≤ 10, linear interpolation correction is performed by combining multi-axis linkage constraints and G-code look-ahead information to ensure a smooth and continuous trajectory; for pseudo-pulses with a continuous length > 10, servo deceleration safety protection is triggered, and machining is automatically resumed after calibrating the position based on the most recent Z-phase zero position to avoid the risk of loss of control.
[0050] Simultaneously, Z-phase zero-position hard calibration and dual-reference model updates are performed: Each time the encoder's Z-phase signal is triggered, the pulse accumulation count is forcibly reset to the Z-phase reference position, completely eliminating accumulated position errors and ensuring long-term operational accuracy. The characteristic parameters of all normal pulses within the current Z-phase cycle are statistically analyzed, and the average and standard deviation are calculated. If the deviation from the static reference model is ≤5%, the dynamic reference model is updated using these statistical results for the next cycle. If the deviation is >5%, an encoder fault warning is triggered, prompting operators to check the encoder, cables, and connection status.
[0051] In step S105, the corrected encoder position signal is output to the CNC system servo controller, and the interference black box function is activated to record interference events, generate interference heat maps and early warnings.
[0052] Specifically, the corrected pulse signal is converted into a standard position signal, which is then output in real time to the servo position loop and speed loop controllers after low-delay digital filtering to ensure closed-loop control accuracy. Simultaneously, an interference black box function is activated to automatically record the occurrence time, axis number, machine tool coordinates, pseudo-pulse type, continuous length, and confidence score of each real and pseudo-pulse event, storing this information in the CNC system's local storage unit. The system periodically performs statistical analysis on the interference data, generating a machining process interference heatmap and marking the areas and time periods with the highest interference frequency. When the number of interference events per unit time exceeds a preset threshold, an audible and visual warning and interface prompts are triggered, guiding operators to investigate surrounding interference sources and optimize cable routing and grounding systems.
[0053] The following describes the effectiveness of the embodiments of the present invention using specific industrial test data. A five-axis vertical machining center of a certain model, equipped with a 23-bit incremental photoelectric encoder and a maximum feed speed of 2500 mm / min, was used for comparative testing under typical field conditions of strong inverter interference and shared cable transmission. The traditional single-axis filtering method had a pseudo-pulse miss rate of 12.3% and a machining contour error of 0.12 mm under continuous interference. The method of the present invention had a pseudo-pulse miss rate of <0.01%, a machining contour error of <3 μm, a total system processing delay of <98 μs, and could stably process up to 20 consecutive pseudo-pulses. It also exhibited no cumulative position error during long-term operation, demonstrating significant technical advantages.
[0054] The method of this invention is implemented entirely in software, without the need for additional hardware circuits. It can be directly integrated into the existing CNC system FPGA firmware and ARM main control program, supporting batch programming and mass production deployment, and fully meeting the needs of industrial applications in factories.
[0055] like Figure 5 As shown, the real-time identification and correction device 10 for encoder interference pseudo-pulse of the CNC system includes: a preprocessing module 100, a hardware rapid identification module 200, a software fine identification module 300, an adaptive correction module 400, and an interference recording module 500.
[0056] The preprocessing module 100 is used to pre-build a static multi-feature reference model of the encoder's normal pulses, establish multi-axis linkage constraint boundaries based on the kinematic equations of the multi-axis linkage of the CNC system, and preload the look-ahead motion information of the G-code to be processed. The preprocessing module 100 completes full-condition calibration, feature statistics, constraint modeling, and look-ahead data loading, providing reference data for the entire system.
[0057] The hardware rapid discrimination module 200 is integrated into the FPGA chip of the CNC system. It is used to perform 8-fold frequency synchronous differential sampling on the real-time acquired encoder ABZ phase pulse signal, eliminate spike-type pseudo-pulses with a pulse width of less than 50ns, mark suspected pseudo-pulses, and output a preliminary purification signal. The hardware rapid discrimination module 200 has low latency and high efficiency, and undertakes most of the preliminary filtering tasks of high-frequency interference.
[0058] The software fine discrimination module 300 runs on the ARM processor of the CNC system. It is used to extract multi-dimensional feature parameters, perform quadruple constraint verification, confirm the real pseudo pulses through multi-constraint fusion confidence scoring, and mark the pseudo pulse type and continuous length to achieve high-precision discrimination.
[0059] The adaptive correction module 400 is used to perform graded correction based on the pseudo-pulse type and continuous length, complete zero-position hard calibration using the Z-phase signal, update the dynamic reference model during interference-free periods, and output the corrected position signal to the servo controller.
[0060] The interference recording module 500 is used to realize the interference black box function, record all-dimensional information of interference events, generate interference heat map, trigger early warning when interference is excessive, and realize interference source tracing and proactive prevention.
[0061] The above modules work together, with clear data flow and closed-loop processing logic, to jointly realize the functions of real-time identification, correction, self-calibration and traceability of encoder pseudo pulses.
[0062] This invention also provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the real-time identification and correction method for encoder interference pseudo-pulses in the CNC system described in the preceding embodiments. The electronic device also includes a communication interface for data communication between the memory and the processor.
[0063] The electronic device in this embodiment of the invention can be directly integrated into the CNC system motherboard without additional hardware expansion, is compatible with existing mainstream CNC system hardware platforms, and is adapted to mass production requirements.
[0064] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the real-time identification and correction method for encoder interference pseudo-pulses in the CNC system described in the preceding embodiments.
[0065] This invention also provides a computer program product, including a computer program that, when executed, implements the real-time identification and correction method for encoder interference pseudo-pulses in the CNC system described in the foregoing embodiments.
[0066] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0067] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0068] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of the invention pertain.
[0069] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0070] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system.
[0071] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0072] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
[0073] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention, all of which should be included within the protection scope of the present invention.
Claims
1. A method for real-time identification and correction of encoder interference pseudo-pulses in a CNC system, characterized in that, Includes the following steps: A static multi-feature benchmark model of the encoder's normal pulse is pre-constructed, multi-axis linkage constraint boundaries are established based on the kinematic equations of the multi-axis linkage of the CNC system, and the look-ahead motion information of the G-code to be processed is pre-loaded. A hardware fast discrimination layer integrated in FPGA is used to perform preliminary filtering on the real-time acquired encoder ABZ phase pulse signal, remove obvious spike-type pseudo pulses, and output the preliminarily purified pulse signal to the ARM software fine discrimination layer. The software's fine-tuning layer extracts multi-dimensional feature parameters of the initial purified pulse signal, and sequentially performs static multi-feature benchmark comparison verification, single-axis dynamic constraint verification, multi-axis linkage constraint verification, and G-code look-ahead constraint verification. It then performs multi-constraint fusion confidence scoring on suspected pseudo-pulses, confirms the real pseudo-pulses, and marks their type and continuous length. Based on the type and continuous length of the pseudo-pulse, a corresponding graded correction strategy is adopted. The encoder Z-phase signal is used to perform zero-position hard calibration periodically and the dynamic reference model is automatically updated during the interference-free period. The corrected encoder position signal is output to the servo controller of the CNC system.
2. The method for real-time identification and correction of encoder interference pseudo-pulses in CNC systems according to claim 1, characterized in that, The establishment of multi-axis linkage constraint boundaries based on the kinematic equations of multi-axis linkage of CNC system includes: Based on the kinematic model of the machine tool, the theoretical proportional relationship between the position, velocity and acceleration of each axis during linkage machining is derived. By combining the mechanical error and servo tracking error of the machine tool, the allowable fluctuation range of motion parameters of each axis relative to the theoretical value is determined, and dynamic multi-axis linkage constraint boundaries are established. The encoder position signals of all other linked axes are acquired in real time, and the theoretical motion parameter range of the current axis is calculated. If the actual motion parameters of the current axis exceed the range, it is marked as a suspected spurious pulse.
3. The method for real-time identification and correction of encoder interference pseudo-pulses in CNC systems according to claim 1, characterized in that, The initial filtering process using a hardware-integrated fast discrimination layer on the FPGA includes: Synchronous differential sampling of the ABZ phase pulse signal is performed at a sampling rate 8 times higher than the encoder's highest pulse frequency to accurately obtain the pulse rise time, fall time, and level duration. Signals with pulse widths less than the preset minimum normal pulse width (default 50ns) are directly marked as spike-type pseudo-pulses and discarded; Signals with pulse intervals smaller than the preset minimum normal pulse interval are marked as suspected spike-type pseudo-pulses, temporarily stored, and then sent to the software fine-tuning layer for secondary confirmation.
4. The method for real-time identification and correction of encoder interference pseudo-pulses in CNC systems according to claim 1, characterized in that, The multi-constraint fusion confidence scoring of suspected spurious pulses includes: calculating the deviation scores of suspected spurious pulses in four dimensions: static multi-feature benchmark comparison, single-axis dynamic constraints, multi-axis linkage constraints, and G-code look-ahead constraints, with scores ranging from 0 to 1; and calculating the comprehensive confidence score based on the reliability weight coefficients assigned to each dimension, using the following formula: ; in, For multi-feature benchmark deviation score, The score is given for the deviation of the uniaxial dynamic constraint. The score is for the deviation of multi-axis linkage constraints. The deviation score for the look-ahead constraint of the G code; When the overall confidence score is ≥0.7, it is confirmed as a true pseudo-pulse.
5. The method for real-time identification and correction of encoder interference pseudo-pulses in a CNC system according to claim 1, characterized in that, The step of employing a graded correction strategy based on the type and continuous length of the pseudo-pulse includes: For a single spike-type pseudo-pulse, the pulse is directly discarded and the cumulative value of the pulse counter is corrected simultaneously; For a single missing or offset pseudo-pulse, a quadratic polynomial prediction correction is performed based on the temporal characteristics of the first three consecutive normal pulses and the uniaxial dynamic model. For pseudo-pulses with a continuous length of ≤10, linear interpolation correction is performed by combining multi-axis linkage constraints and G-code look-ahead information; For pseudo-pulses with a continuous length of >10, the servo deceleration protection is triggered, and the machining is automatically resumed after the encoder position is calibrated using the most recent Z-phase signal.
6. The method for real-time identification and correction of encoder interference pseudo-pulses in a CNC system according to claim 1, characterized in that, The method of periodically performing zero-position hard calibration using the encoder's Z-phase signal and automatically updating the dynamic reference model during interference-free periods includes: Each time the encoder Z-phase signal is triggered, the encoder's cumulative position is forcibly reset to the Z-phase reference position, eliminating all cumulative errors; The characteristic parameters of all pulse signals identified as normal within the current Z-phase cycle are statistically analyzed, and their average value and standard deviation are calculated. If the deviation between the current statistical results and the static benchmark model is ≤5%, the current statistical results will be used to update the dynamic benchmark model for multi-feature benchmark comparison and verification in the next cycle. If the deviation is greater than 5%, an encoder fault warning will be triggered, prompting the operator to check the encoder status.
7. The method for real-time identification and correction of encoder interference pseudo-pulses in CNC systems according to claim 1, characterized in that, This also includes interfering with the black box function: Automatically record the occurrence time, axis number, machine coordinate, pseudo-pulse type, continuous length, and confidence score of all real pseudo-pulse events; Generate a heat map of interference during the processing, and mark the processing areas and time periods where interference occurs most frequently; When the number of interference events per unit time exceeds a preset threshold, an electromagnetic interference warning is triggered, prompting operators to check surrounding equipment.
8. A real-time detection and correction device for encoder interference pseudo-pulses in a CNC system, characterized in that, include: The preprocessing module is used to pre-build a static multi-feature reference model of the encoder's normal pulses, establish multi-axis linkage constraint boundaries, and preload the look-ahead motion information of the G-code to be processed. The hardware rapid identification module is integrated into the FPGA chip of the CNC system. It is used to perform preliminary filtering on the real-time acquired encoder ABZ phase pulse signal to remove obvious spike-type pseudo pulses. The software fine-tuning module runs in the ARM processor of the CNC system and is used to perform multi-constraint fusion verification and confidence scoring to identify real pseudo-pulses and mark their type and continuous length. The adaptive correction module is used to adopt a graded correction strategy based on the type and continuous length of the pseudo-pulse, use the Z-phase signal for zero-position calibration and reference model update, and output the corrected encoder position signal. The interference recording module is used to implement the interference black box function, generating interference reports and heat maps.
9. An electronic device, characterized in that, include: The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the real-time identification and correction method for encoder interference pseudo-pulses in a CNC system as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the real-time identification and correction method for encoder interference pseudo-pulses in CNC systems as described in any one of claims 1-7.