Filtering method and system for hand pulse generator
Through the two-time filtering method, including first-order low-pass filtering and weighted average filtering, the problem of insufficient smoothness and dynamic responsiveness of handwheel velocity signals in the prior art is solved, and the smooth follow-up of axis motion is achieved.
Patent Information
- Application Number
- CN202411645676.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-07
AI Technical Summary
The existing filtering methods cannot effectively smooth the handwheel speed signal, resulting in heavy jitter and noise when the shaft moves, or the shaft cannot respond to the handwheel start and stop in time.
Two-time filtering methods are used: firstly, the high-frequency signal is eliminated through the first-order low-pass filtering algorithm, and then the signal is further smoothed through the weighted average filtering algorithm.
The effective smoothing and dynamic response of the handwheel speed signal is achieved, ensuring that the shaft can smoothly follow the movement of the hand-crank pulse generator.
Smart Images

Figure CN119577335A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of filtering output signals of a hand-cranked pulse generator, in particular to a filtering method and system for a hand-cranked pulse generator. Background Art
[0002] The hand-cranked pulse generator (hereinafter referred to as the handwheel) is an essential control component in the friction stir solid phase additive CNC system. It has functions such as axis selection, speed ratio selection, and roller pulse generation. The handwheel is often used to control the fast or slow movement of each axis individually in manual mode. When the handwheel is shaken, the axis will move with it. The axis generally uses the speed to follow the handwheel pulse speed. Due to the discreteness and low frequency of the pulse, the CNC system will experience large fluctuations in the speed generated by the handwheel, and the fluctuations are discrete. If the axis directly follows the pulse speed, it will cause severe jitter and be uncontrollable, so it is necessary to effectively filter the high-frequency signal of the handwheel speed.
[0003] However, although the general low-pass filter algorithm can filter out the high-frequency signal of the handwheel speed, it is difficult to balance the signal smoothness and dynamic responsiveness, resulting in large jitter and noise when the axis moves, or the axis cannot respond to the start and stop of the handwheel in time. Other methods such as the sliding window filter algorithm are more sensitive to outliers and cannot reflect the real scene of a person shaking the handwheel.
[0004] In summary, the existing filtering method for handwheels cannot guarantee the acquisition of smooth handwheel speed values with good dynamic response, resulting in the inability of the axis to smoothly follow the operation. Therefore, it is necessary to propose an improved filtering algorithm so that the handwheel speed has a good smoothing effect and fast response, ensuring the smooth following of the axis. Summary of the invention
[0005] To this end, the technical problem to be solved by the present invention is to overcome the problem that the filtering method in the prior art cannot guarantee the acquisition of a smooth handwheel speed value with good dynamic response, resulting in the axis being unable to smoothly follow the operation.
[0006] In order to solve the above technical problems, the present invention provides a filtering method for a hand-cranked pulse generator, comprising:
[0007] Step S1: filtering the handwheel pulse speed signal generated by the hand-cranked pulse generator for the first time by using a first-order low-pass filtering algorithm to eliminate high-frequency signals;
[0008] Step S2: Perform a second filtering on the handwheel pulse speed signal after the first filtering to smooth the signal.
[0009] In one embodiment of the present invention, in step S1, the hand wheel pulse speed signal generated by the hand crank pulse generator is filtered by a first-order low-pass filtering algorithm, and the formula is:
[0010] ;
[0011] In the formula, is the filter coefficient, is the current pulse speed sampling value, is the last speed output value, It is the current speed output value during the first filtering.
[0012] In one embodiment of the present invention, the filter coefficients in the first-order low-pass filter algorithm are satisfy: .
[0013] In one embodiment of the present invention, the method of performing a second filtering on the handwheel pulse speed signal after the first filtering in step S2 comprises:
[0014] The speed signal after the first filtering is filtered for the second time using weighted average, the formula is:
[0015] ;
[0016] In the formula, the output of the first filter is As , Indicates The velocity value after the first filtering; For the sampling process discrete calculation points, is the weighted average filter window. The weight of the input value, is the weighted average filter window size, It is the current speed output value during the second filtering.
[0017] In one embodiment of the present invention, when performing the second filtering using weighted averaging, satisfy:
[0018] ;
[0019] In the formula, is the weighted average filter window size, is a natural constant.
[0020] In one embodiment of the present invention, the weighted average filter window The value is 250.
[0021] In order to solve the above technical problems, the present invention provides a filtering system for a hand-cranked pulse generator, comprising:
[0022] The first filtering module is used to perform the first filtering on the handwheel pulse speed signal generated by the hand-cranked pulse generator through a first-order low-pass filtering algorithm to eliminate high-frequency signals;
[0023] The second filtering module is used to perform a second filtering on the handwheel pulse speed signal after the first filtering to smooth the signal.
[0024] To solve the above technical problems, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned filtering method for a hand-cranked pulse generator when executing the computer program.
[0025] In order to solve the above technical problems, the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the filtering method for a hand-cranked pulse generator as described above are implemented.
[0026] In order to solve the above technical problem, the present invention provides a computer program product, including a computer program, which implements the steps of the above filtering method for a hand-cranked pulse generator when executed by a processor.
[0027] The above technical solution of the present invention has the following advantages compared with the prior art:
[0028] Compared with a single filtering algorithm, the filtering method for a hand-cranked pulse generator of the present invention can effectively eliminate the high-frequency signal of the handwheel speed and make the speed signal smoother, so that the axis can follow the hand-cranked pulse generator to run more smoothly;
[0029] The present invention improves the weight of the weighted average filtering algorithm. Compared with the average weight and linear weight distribution, the normalized bell-shaped weight distribution constructed by the present invention is more suitable for the filtering method of the hand-cranked pulse generator proposed in the present invention. The speed waveform after filtering is smoother and has strong practicality. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to make the contents of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings.
[0031] Figure 1 is a flow chart of the method of the present invention;
[0032] Figure 2 It is a time domain and frequency spectrum comparison diagram of the original speed of the hand-cranked pulse generator and the first-order low-pass filtering algorithm in the embodiment of the present invention;
[0033] Figure 3 is a normalized bell-shaped weight distribution diagram in an embodiment of the present invention;
[0034] Figure 4 It is a time domain and frequency domain comparison diagram of the hand-cranked pulse generator before and after weighted average filtering in an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0036] Embodiment 1
[0037] Reference Figure 1 As shown, the present invention relates to a filtering method for a hand-cranked pulse generator, comprising:
[0038] Step S1: filtering the handwheel pulse speed signal generated by the hand-cranked pulse generator for the first time by using a first-order low-pass filtering algorithm to eliminate high-frequency signals;
[0039] Step S2: Perform a second filtering on the handwheel pulse speed signal after the first filtering to smooth the signal.
[0040] Compared with a single filtering algorithm, the filtering method for a hand-cranked pulse generator described in the present invention can effectively eliminate the high-frequency signal of the handwheel speed and make the speed signal smoother, so that the axis can follow the hand-cranked pulse generator to run more smoothly; the present invention improves the weight of the weighted average filtering algorithm. Compared with the average weight and linear weight distribution, the normalized bell-shaped weight distribution constructed by this embodiment is more suitable for the filtering method of the hand-cranked pulse generator proposed in the present invention. The speed waveform after filtering is smoother and has strong practicality.
[0041] The following is a detailed introduction to this embodiment:
[0042] In this embodiment, the hand wheel pulse speed signal is first filtered using a first-order low-pass filtering algorithm (ie, the first filtering), and then the signal after the low-pass filtering is smoothed using a weighted average filtering algorithm (ie, the second filtering).
[0043] In step S1, the first-order low-pass filtering algorithm formula of this embodiment is as follows:
[0044] ;
[0045] In the formula, is the filter coefficient, is the current pulse speed sampling value, is the last speed output value, is the current speed output value at the first filtering. The handwheel encoder used in the present invention has 100 lines and is processed by quadruple frequency, so 400 pulses are generated when the handwheel rotates one circle. The sampling frequency of the system used in this embodiment is 1000Hz, which ensures that the speed signal after filtering has good dynamic response performance and effectively eliminates high-frequency signals. The time domain and frequency domain are as follows Figure 2 shown.
[0046] The filter coefficients in the first-order low-pass filter algorithm in this embodiment satisfy: .
[0047] It is not difficult to find that the first-order low-pass filter effectively suppresses the high-frequency signal amplitude, but the speed curve still has higher frequency items. This high-frequency fluctuation will cause jitter and abnormal noise when the shaft follows, and even cause shaft overload alarm due to large acceleration and deceleration. Therefore, this embodiment uses weighted average filtering on the speed signal after low-pass filtering to eliminate high-frequency fluctuation items.
[0048] In step S2, the weighted average filtering formula of this embodiment is as follows:
[0049] ;
[0050] In the formula, the output of the first filter is As , Indicates The velocity value after the first filtering; For the sampling process discrete calculation points, is the weighted average filter window. The weight of the input value, is the weighted average filter window size, It is the current speed output value during the second filtering.
[0051] It is worth mentioning that in this embodiment, the weight of the handwheel speed weighted average filtering algorithm is reconstructed, specifically by adopting a uniform bell-shaped distribution, weakening the weights of the head and tail input values, and the filtering effect presents better smoothness and dynamic responsiveness. satisfy:
[0052] ;
[0053] In the formula, is the weighted average filter window size, is a natural constant. After testing, it was found that the filter window is The filtering effect is better when the speed is 0.25 seconds, and the smoothness and dynamic responsiveness meet the control requirements of the friction stir solid phase additive machine tool. The normalized bell-shaped weight distribution diagram is as follows Figure 3 shown.
[0054] The comparison between the time domain and frequency domain images after weighted average filtering and before filtering is as follows: Figure 4 As shown. High-frequency noise has been almost eliminated, and the axis runs smoothly without abnormal noise. When the handwheel stops shaking, the axis continues to move forward at a small speed, but it does not affect the operator's operating habit of using the handwheel to control the axis.
[0055] Embodiment 2
[0056] This embodiment provides a filtering system for a hand-cranked pulse generator, comprising:
[0057] The first filtering module is used to perform the first filtering on the handwheel pulse speed signal generated by the hand-cranked pulse generator through a first-order low-pass filtering algorithm to eliminate high-frequency signals;
[0058] The second filtering module is used to perform a second filtering on the handwheel pulse speed signal after the first filtering to smooth the signal.
[0059] Embodiment 3
[0060] This embodiment 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 computer program, the steps of the filtering method for a hand-cranked pulse generator described in Embodiment 1 are implemented.
[0061] Embodiment 4
[0062] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the filtering method for a hand-cranked pulse generator described in the first embodiment are implemented.
[0063] Embodiment 5
[0064] A computer program product includes a computer program, which, when executed by a processor, implements the steps of the filtering method for a hand-cranked pulse generator described in embodiment 1.
[0065] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present application may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0066] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0067] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0068] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0069] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0070] Obviously, the above embodiments are merely examples for clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from these are still within the protection scope of the invention.
Claims
1. A filtering method for a hand-cranked pulse generator, characterized in that: include: Step S1: filtering the handwheel pulse speed signal generated by the hand-cranked pulse generator for the first time by using a first-order low-pass filtering algorithm to eliminate high-frequency signals; Step S2: Perform a second filtering on the handwheel pulse speed signal after the first filtering to smooth the signal.
2. The filtering method for a hand-cranked pulse generator according to claim 1, characterized in that: In step S1, the handwheel pulse speed signal generated by the hand-cranked pulse generator is filtered by a first-order low-pass filtering algorithm, and the formula is: ; In the formula, is the filter coefficient, is the current pulse speed sampling value, is the last speed output value, It is the current speed output value during the first filtering.
3. The filtering method for a hand-cranked pulse generator according to claim 1, characterized in that: The filter coefficients in the first-order low-pass filter algorithm satisfy: .
4. The filtering method for a hand-cranked pulse generator according to claim 2, characterized in that: The method for performing a second filtering on the handwheel pulse speed signal after the first filtering in step S2 comprises: The speed signal after the first filtering is filtered for the second time using weighted average, the formula is: ; In the formula, the output of the first filter is As , Indicates The velocity value after the first filtering; For the sampling process discrete calculation points, is the weighted average filter window. The weight of the input value, is the weighted average filter window size, It is the current speed output value during the second filtering.
5. The filtering method for a hand-cranked pulse generator according to claim 4, characterized in that: When using weighted averaging for the second filtering, satisfy: ; In the formula, is the weighted average filter window size, is a natural constant.
6. The filtering method for a hand-cranked pulse generator according to claim 4, characterized in that: The weighted average filter window The value is 250.
7. A filter system for a hand-cranked pulse generator, characterized in that: include: The first filtering module is used to perform the first filtering on the handwheel pulse speed signal generated by the hand-cranked pulse generator through a first-order low-pass filtering algorithm to eliminate high-frequency signals; The second filtering module is used to perform a second filtering on the handwheel pulse speed signal after the first filtering to smooth the signal.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the filtering method for a hand-cranked pulse generator as claimed in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the filtering method for a hand-cranked pulse generator as claimed in any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the filtering method for a hand-cranked pulse generator described in any one of claims 1 to 6 are implemented.