Speed measurement method, device, apparatus and storage medium

By utilizing high-frequency interruption and moving sliding window filtering techniques in speed measurement methods for industrial control motors, the problem of low speed measurement accuracy at low speeds has been solved, achieving higher accuracy and smoother speed measurement.

CN116256532BActive Publication Date: 2026-06-05SHENZHEN YAKO AUTOMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN YAKO AUTOMATION TECH CO LTD
Filing Date
2023-02-15
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing speed measurement methods have low accuracy at low speeds, resulting in large fluctuations in measurement results and poor speed stability.

Method used

By executing a high-frequency interrupt with a preset fixed period, the initial speed signal input from the outside is subjected to moving window mean filtering to obtain the target speed signal. When the interrupt count duration reaches the preset sampling period, it is determined whether the pulse of the target speed signal has been enabled and timed. If the enable timing has been enabled, it is determined whether there is a pulse within the preset sampling time threshold. The target speed is determined based on the locally stored enable timing value and the total number of pulses.

Benefits of technology

It improves the accuracy and stability of speed measurement, reduces fluctuations in measurement results, and enhances the accuracy of speed measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116256532B_ABST
    Figure CN116256532B_ABST
Patent Text Reader

Abstract

The application discloses a speed measurement method, device and equipment and a storage medium. The method comprises the following steps: performing a high-frequency interruption with a preset fixed period, and performing a moving sliding window mean filtering on an initial speed signal input from outside to obtain a target speed signal; enabling the target speed signal timing during a preset sampling period when an interruption counting duration reaches the preset sampling period, and judging whether a pulse of the target speed signal has been enabled timing when the interruption counting duration reaches the preset sampling period; if the pulse has been enabled timing, judging whether the target speed signal has a pulse within a preset sampling time threshold after the interruption counting duration reaches the preset sampling period; and if the pulse exists, determining the target speed based on a local stored enabled timing value and a total number of pulses. The application determines the speed by the enabled timing value and the total number of pulses when the preset sampling period is reached through the moving sliding window mean filtering on the speed signal input from outside, thereby improving the measurement accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial control motor technology, and in particular to a speed measurement method, device, equipment, and storage medium. Background Technology

[0002] Currently, in the industrial control field, speed calculation is essential to improve product performance. The most commonly used speed measurement method is the M-method. The M-method is simple in principle and can achieve good calculation accuracy and response speed when combined with a simple filtering algorithm. However, at low speeds, the M-method has low speed measurement accuracy and large fluctuations in the measurement results, resulting in poor stability of the measured speed.

[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main objective of this invention is to provide a speed measurement method, apparatus, device, and storage medium, aiming to solve the technical problem that the speed measurement accuracy of existing speed measurement methods is low, resulting in poor stability of the measured speed.

[0005] To achieve the above objectives, the present invention provides a speed measurement method, which includes the following steps:

[0006] Execute a high-frequency interrupt with a preset fixed period and perform moving window mean filtering on the initial speed signal input from the outside to obtain the target speed signal;

[0007] During the interruption counting period, the timing of the target speed signal is enabled, and when the interruption counting period reaches the preset sampling period, it is determined whether the timing of the pulse of the target speed signal has been enabled.

[0008] If enable timing has been performed, determine whether there is a pulse in the target speed signal after the interruption count duration reaches the preset sampling period and within the preset sampling time threshold.

[0009] If pulses exist, the target speed is determined based on the locally stored enable timing value and the total number of pulses.

[0010] Optionally, the step of performing a high-frequency interrupt with a preset fixed period and applying a moving sliding window mean filter to the externally input initial velocity signal to obtain the target velocity signal includes:

[0011] Execute a high-frequency interrupt with a preset fixed period, and receive the initial speed signal from an external input during the interrupt;

[0012] The signal is updated based on the initial velocity signal, wherein the signal update involves adding the initial velocity signal to the end of the signal sampling sequence and removing the signal corresponding to the beginning of the signal sampling sequence.

[0013] The mean of the updated velocity signal sequence is determined based on the length of the updated signal sampling sequence, and the mean of the updated velocity signal sequence is used as the target velocity signal.

[0014] Optionally, the step of determining the target speed based on the locally stored enable timing value and the total number of pulses if a pulse exists includes:

[0015] If a pulse exists, determine the current number of pulses of the target velocity signal;

[0016] Read the number of pulses stored locally, and determine the total number of pulses based on the number of pulses stored locally and the current number of pulses;

[0017] Read the locally stored enable timing value and determine the target speed based on the enable timing value and the total number of pulses. The enable timing value is the time between the first non-zero target speed signal collected within the preset sampling period and the first non-zero target speed signal after the interrupt count duration reaches the preset sampling period. The enable timing value is obtained by timing the effective pulse time timer.

[0018] Optionally, after the step of determining whether a pulse exists in the target velocity signal within a preset sampling time threshold after the interruption count duration has reached the preset sampling period if an enable timing has been performed, the method further includes:

[0019] If no pulse exists, the current enable timer value is incremented;

[0020] Determine whether the accumulated enable timing value reaches the sampling time threshold;

[0021] If the sampling time threshold is reached, the target speed is determined to be zero.

[0022] Optionally, after the step of determining whether the accumulated enable timing value has reached the sampling time threshold, the method further includes:

[0023] If the sampling time threshold is not reached, the process returns to the step of executing a high-frequency interrupt with a preset fixed period and performing moving window mean filtering on the initial speed signal input from the outside to obtain the target speed signal.

[0024] Optionally, after the steps of executing an interrupt with a preset fixed period and performing moving window mean filtering on the externally input initial velocity signal to obtain the target velocity signal, the method further includes:

[0025] If the interruption counting duration has not reached the preset sampling period, determine whether there is a pulse in the target speed signal;

[0026] If pulses exist, determine the number of pulses in the target velocity signal and update the locally stored number of pulses based on the number of pulses.

[0027] After the pulse count is updated, determine whether the pulses of the target velocity signal have been enabled and timed.

[0028] If enable timing has been performed, the current enable timing value is accumulated, and the locally stored enable timing value is updated based on the accumulated enable timing value. The enable timing value is obtained by timing by an effective pulse timer. After enabling timing for the target speed signal, the effective pulse timer will accumulate the enable timing value when each high-frequency interrupt occurs.

[0029] After the locally stored enable timing value is updated, the process returns to the step of executing the interrupt with a preset fixed period and performing moving window mean filtering on the externally input initial speed signal to obtain the target speed signal.

[0030] Optionally, after determining whether the pulses of the target velocity signal have been enabled for timing after the pulse number update is completed, the method further includes:

[0031] If the enable timing is not enabled, the locally stored enable timing value is initialized, and timing begins for the pulses of the target speed signal.

[0032] Furthermore, to achieve the above objectives, the present invention also proposes a speed measuring device, the device comprising:

[0033] The mean filtering module is used to execute a high-frequency interrupt with a preset fixed period and perform moving sliding window mean filtering on the initial speed signal input from the outside to obtain the target speed signal.

[0034] The enable timing module is used to enable timing of the target speed signal during the interruption counting period when the interruption counting period reaches the preset sampling period, and to determine whether timing of the pulse of the target speed signal has been enabled when the interruption counting period reaches the preset sampling period.

[0035] The pulse judgment module is used to determine whether there is a pulse in the target speed signal after the interruption count duration reaches the preset sampling period and within the preset sampling time threshold, if the enable timing has been performed.

[0036] The speed measurement module is used to determine the target speed based on the locally stored enable timing value and the total number of pulses if pulses are present.

[0037] Furthermore, to achieve the above objectives, the present invention also proposes a speed measuring device, the device comprising: a memory, a processor, and a speed measuring program stored in the memory and executable on the processor, the speed measuring program being configured to implement the steps of the speed measuring method described above.

[0038] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a speed measurement program, which, when executed by a processor, implements the steps of the speed measurement method described above.

[0039] This invention obtains a target speed signal by executing a high-frequency interrupt with a preset fixed period and applying a moving sliding window mean filter to the initial speed signal input from an external source. During the interrupt count period, timing of the target speed signal is enabled. When the interrupt count period reaches the preset sampling period, it is determined whether timing of pulses in the target speed signal has been enabled. If timing has been enabled, it is determined whether pulses exist in the target speed signal after the interrupt count period reaches the preset sampling period and within a preset sampling time threshold. If pulses exist, the target speed is determined based on the locally stored enable timing value and the total number of pulses. Because this invention executes periodic high-frequency interrupts and applies a moving sliding window mean filter to the externally input speed signal, determining the speed by the enable timing value and the total number of pulses when the interrupt duration reaches the preset sampling period, it effectively improves the speed measurement accuracy and increases the stability of the measured speed compared to existing speed measurement methods, which have lower accuracy. Attached Figure Description

[0040] Figure 1 This is a schematic diagram of the structure of the speed measurement device in the hardware operating environment involved in the embodiments of the present invention;

[0041] Figure 2 This is a flowchart illustrating the first embodiment of the speed measurement method of the present invention;

[0042] Figure 3 This is a flowchart illustrating the second embodiment of the speed measurement method of the present invention;

[0043] Figure 4 This is a flowchart illustrating the third embodiment of the speed measurement method of the present invention;

[0044] Figure 5 This is a structural block diagram of the first embodiment of the speed measuring device of the present invention.

[0045] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0046] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0047] Reference Figure 1 , Figure 1 This is a schematic diagram of the speed measurement device structure in the hardware operating environment involved in the embodiments of the present invention.

[0048] like Figure 1 As shown, the speed measurement device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk storage device. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0049] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the speed measuring device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0050] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a speed measurement program.

[0051] exist Figure 1 In the speed measurement device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the speed measurement device of the present invention can be set in the speed measurement device, and the speed measurement device calls the speed measurement program stored in the memory 1005 through the processor 1001 and executes the speed measurement method provided in the embodiment of the present invention.

[0052] This invention provides a speed measurement method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the speed measurement method of the present invention.

[0053] In this embodiment, the speed measurement method includes the following steps:

[0054] Step S10: Execute a high-frequency interrupt with a preset fixed period and perform moving window mean filtering on the initial speed signal input from the outside to obtain the target speed signal.

[0055] It should be noted that the execution subject of the method in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a mobile phone, tablet computer, or personal computer. It can also be other electronic devices that perform the same or similar functions, such as an encoder. The following description uses the speed measuring device (hereinafter referred to as the measuring device) to illustrate this embodiment and the following embodiments.

[0056] Understandably, the preset fixed period can be a period of high-frequency interruption at fixed intervals. For example, if the preset fixed period is 100us, then an interrupt will be performed every 100us.

[0057] It should be noted that the above interruption can be an action to stop the current operation, so as to receive a given speed signal from an external input, i.e., the initial speed signal, during the interruption.

[0058] Understandably, the initial velocity signal can be a high-frequency pulse signal emitted by a high-frequency pulse transmitter of known frequency.

[0059] In practical implementation, the measuring device can be preset to stop the current operation at fixed intervals. When each preset fixed interval is reached, the device will interrupt once and receive the initial velocity signal emitted by the external high-frequency pulse generator. Then, by performing sliding window mean filtering on the received initial velocity signal, a high-precision sampled velocity signal, i.e., the target velocity signal, can be obtained.

[0060] Furthermore, in order to improve the accuracy of the target velocity signal, in this embodiment, step S10 includes:

[0061] Step S101: Execute a high-frequency interrupt with a preset fixed period, and receive the initial speed signal from an external input during the interrupt.

[0062] In practice, the measuring device receives a high-frequency pulse signal, i.e., an initial velocity signal, from an external high-frequency pulse transmitter each time it executes an interruption with a preset fixed period. This preset fixed period can be consistent with the period for sampling the velocity to ensure the accuracy of the velocity measurement.

[0063] Step S102: Update the signal according to the initial velocity signal. The signal update is to add the initial velocity signal to the end of the signal sampling sequence and remove the signal corresponding to the beginning of the signal sampling sequence.

[0064] In a specific implementation, the measuring device can update the initial velocity signal. This update process can be the filtering process in the sliding window mean filtering, that is, adding the latest value of the received initial velocity signal to the end of a signal sampling sequence of a certain length, then removing the signal corresponding to the beginning of the signal sampling sequence, and finally using the updated signal sampling sequence as the updated velocity signal source.

[0065] It should be understood that the above signal sampling sequence may be a signal sequence obtained by the measuring device sampling at a fixed period, and the fixed period may be the period of the above high-frequency interrupt.

[0066] Step S103: Determine the mean of the updated velocity signal sequence based on the length of the updated signal sampling sequence, and use the mean of the updated velocity signal sequence as the target velocity signal.

[0067] In practice, the measuring device can determine the sum of each pulse in the updated velocity signal, then calculate the mean value based on the length of the signal sampling sequence, and use the signal corresponding to the mean value as the target velocity signal.

[0068] It should be understood that the mean can be determined using the following formula:

[0069] B0 = A0_SUMA0_Length

[0070] Where B0 is the average velocity, A0_SUM is the sum of the velocities corresponding to the signal sampling sequence, and A0_Length is the length of the signal sampling sequence.

[0071] It should be noted that by receiving the initial velocity signal from an external high-frequency pulse transmitter during high-frequency interruptions at preset fixed periods, updating the signal, and determining the average velocity, a high-precision target velocity signal can be obtained, thereby improving the accuracy of subsequent velocity measurements.

[0072] Step S20: Enable timing of the target speed signal during the interruption counting period when the interruption counting period reaches the preset sampling period, and determine whether timing of the pulse of the target speed signal has been enabled when the interruption counting period reaches the preset sampling period.

[0073] It should be noted that if the interruption counting time does not reach the preset sampling period, it means that the number of target speed signals obtained at this time is small and cannot accurately reflect the accurate speed of the motor under test. In this case, the number of pulses of the recorded speed signal is summed so that subsequent speed measurement can be performed when the interruption counting time reaches the preset sampling period, thereby improving the accuracy of speed measurement.

[0074] Understandably, the interrupt count duration can be the total time for executing the interrupt operation. The preset sampling period reflects the minimum period for each speed sampling calculation update. The enable timing value is triggered by the effective pulse time timer after receiving the enable signal. After enabling, it is incremented by one when the interrupt occurs in each fixed period, thus reflecting the effective time of receiving the entire target speed signal pulse. This enable signal can be the first non-zero target speed signal in each speed sampling calculation update period.

[0075] In its implementation, the measuring device enables timing of the target speed signal when the interruption counting duration reaches a preset sampling period. Each time a high-frequency interrupt of a preset fixed period occurs, a count is performed, and the speed sampling duration, i.e., the interruption counting duration, is determined based on the count value. Simultaneously, during the speed sampling duration reaching the preset sampling period, timing of the target speed signal is performed based on whether the target speed signal is zero. Then, it is determined whether the speed sampling duration has reached the preset sampling period. If it has, the final enable timing value is determined based on whether the first non-zero speed signal is received.

[0076] It should be understood that upon receiving the first non-zero target velocity signal, an enable signal can be triggered to enable timing of the pulses of the target velocity signal.

[0077] Step S30: If enable timing has been performed, determine whether there is a pulse in the target speed signal after the interruption count duration reaches the preset sampling period and within the preset sampling time threshold.

[0078] In the specific implementation, the measuring device detects that the effective pulse timer has been enabled, that is, the target speed signal has been enabled to time during the interruption counting period, and receives the pulse corresponding to the speed signal when the interruption counting period reaches the preset sampling period. Then, when the interruption counting period exceeds the preset sampling period but has not reached the sampling time threshold, it detects whether the currently received target signal is 0. If it is not 0, then there is a pulse.

[0079] It should be understood that since the target speed signal is obtained by filtering the initial speed signal using the moving sliding window mean, that is, one target speed signal can be obtained for each interruption, the number of target speed signals is a certain value or 0. When the pulse of the first non-zero target speed signal is received, the enable timer is triggered, thereby triggering the effective pulse time timer.

[0080] It should be noted that if the above effective pulse timer is not enabled when the interruption counting time reaches the preset sampling period, it means that the first pulse of the target speed signal has not been received yet, or the received target speed signal is incorrect. In this case, the target speed is judged to be zero, and the zero target speed is output.

[0081] Step S40: If a pulse exists, determine the target speed based on the locally stored enable timing value and the total number of pulses.

[0082] It should be noted that the enable timing value can be the timing value between the first non-zero target velocity signal and the last non-zero target velocity signal. This enable timing value can reflect the time value corresponding to the total number of target velocity signals collected.

[0083] Understandably, the total number of pulses can be the total number of pulses received from the target velocity signal.

[0084] In a practical implementation, the measuring device can read the locally stored enable timing value, which is the effective pulse duration value and the total number of pulses of the target speed signal, and calculate the speed based on the effective pulse duration value and the total number of pulses using a general speed calculation algorithm, such as the M / T method.

[0085] It should be noted that the M method can determine the speed based on the total number of pulses within a certain time period, and the certain time period can be determined by a preset sampling period. The T method can determine the speed by measuring the time interval between two pulses of the encoder, and the time interval between the two pulses can be determined by the effective pulse duration values ​​of any two non-zero target speed signals.

[0086] Understandably, at high speeds, the number of pulses within a given time is large, resulting in a smaller error in the total pulse count measurement. Therefore, the M-method can be used for speed measurement to reduce error. At low speeds, because the time interval between two pulses becomes longer, the number of external high-frequency pulses between two pulses is smaller. Therefore, the T-method can be used for speed measurement to reduce error.

[0087] This embodiment obtains the target speed signal by executing a high-frequency interrupt with a preset fixed period and applying a moving sliding window mean filter to the initial speed signal input from the outside. During the interrupt count duration reaching a preset sampling period, timing of the target speed signal is enabled. When the interrupt count duration reaches the preset sampling period, it is determined whether timing of pulses of the target speed signal has been enabled. If timing has been enabled, it is determined whether pulses exist in the target speed signal after the interrupt count duration reaches the preset sampling period and within a preset sampling time period threshold. If pulses exist, the target speed is determined based on the locally stored enable timing value and the total number of pulses. Because this embodiment executes periodic high-frequency interrupts and applies a moving sliding window mean filter to the externally input speed signal, determining the speed by the enable timing value and the total number of pulses when the interrupt duration reaches the preset sampling period, the speed measurement method of this embodiment effectively improves the speed measurement accuracy and increases the stability of the measured speed compared to existing speed measurement methods with lower accuracy.

[0088] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the speed measurement method of the present invention.

[0089] Based on the first embodiment described above, in this embodiment, step S40 includes:

[0090] Step S401: If a pulse exists, determine the current number of pulses of the target velocity signal.

[0091] It should be noted that the total number of pulses mentioned above may have errors, which may lead to inaccurate speed measurement. Therefore, in order to avoid the above errors and improve the accuracy of speed measurement, this embodiment is proposed.

[0092] It should be noted that the current pulse count can be the number of pulses of the target velocity signal received at this time.

[0093] In practice, the measuring device can accumulate and record the number of pulses of the target speed signal received in previous interruptions. When the target speed signal received in the current interruption is received, the current number of pulses of the target speed signal is determined so as to facilitate the determination of the total number of subsequent pulses.

[0094] Step S402: Read the number of pulses stored locally, and determine the total number of pulses based on the number of pulses stored locally and the current number of pulses.

[0095] It should be noted that the number of pulses stored locally above can be the number of pulses of the target speed signal received in previous interruptions.

[0096] In practice, the measuring device can read the number of pulses of the target speed signal received in previous interruptions stored locally, and add it to the current number of pulses to determine the total number of pulses, thus avoiding the problem of low speed measurement accuracy caused by missing the total number of pulses.

[0097] Step S403: Read the locally stored enable timing value, and determine the target speed based on the enable timing value and the total number of pulses. The enable timing value is the time between the first non-zero target speed signal collected within the preset sampling period and the first non-zero target speed signal after the interrupt count duration reaches the preset sampling period. The enable timing value is obtained by timing the effective pulse time timer.

[0098] In a specific implementation, the measuring device can determine the total time of all pulses of each received target velocity signal by using the above effective pulse duration value, and determine the target velocity based on the total time of all pulses and the total number of pulses determined above.

[0099] Furthermore, in order to filter out useless speeds and improve the flexibility of speed measurement, this embodiment further includes the following step after step S30:

[0100] S31: If no pulse exists, the current enable timing value is incremented.

[0101] It should be noted that the current enable timing value can be the timing value of the valid pulse time timer.

[0102] In practical implementation, the measuring device can time the effective pulse duration of the target speed signal when it does not receive a target speed signal of 0, indicating that no pulse was received during this interruption time, and continue to wait for a non-zero target speed signal.

[0103] S32: Determine whether the accumulated enable timing value has reached the sampling time threshold.

[0104] It should be noted that the sampling time threshold can be another preset maximum sampling period, which can be used to filter low-speed time values ​​and can be flexibly set by technicians according to their needs.

[0105] In a specific implementation, the measuring device judges the count value of the preset interruption that has been accumulated or recorded, that is, the timing value, to determine whether the value has reached the sampling time threshold, so as to determine whether it is necessary to filter the target speed signal at this time.

[0106] S33: If the sampling time threshold is reached, the target speed is determined to be zero.

[0107] In practical implementation, when the measuring device detects the count value of the aforementioned preset interruption, that is, when the timing value reaches the aforementioned sampling time threshold, it indicates that the measurement time has reached the threshold and there is no need to measure again. At this time, the measurement result with a speed of zero can be fed back to filter out the excessively low speed. Thus, by setting the sampling time threshold, that is, the maximum sampling period, the speed that needs to be filtered out can be filtered out, thereby improving the flexibility of speed measurement.

[0108] Furthermore, in this embodiment, after step S32, the method further includes:

[0109] Step S33': If the sampling time threshold is not reached, return to the step of executing the interrupt with a preset fixed period and performing moving window mean filtering on the initial speed signal input by the external input to obtain the target speed signal.

[0110] In a specific implementation, when the measuring device detects that the above-mentioned enable timing value, that is, the preset interrupt count value, has not reached the above-mentioned sampling time threshold, it indicates that the target speed signal at this time does not need to be filtered within the above-mentioned sampling time threshold, and the high-frequency interrupt operation can continue to be performed to measure the speed. That is, it returns to the step of executing the high-frequency interrupt with a preset fixed period and performing moving sliding window mean filtering on the initial speed signal input from the outside to obtain the target speed signal.

[0111] refer to Figure 4 , Figure 4 This is a flowchart illustrating the third embodiment of the speed measurement method of the present invention.

[0112] Based on the above embodiments, in this embodiment, after step S10, the method further includes:

[0113] Step S20': If the interruption counting duration has not reached the preset sampling period, determine whether there is a pulse in the target speed signal.

[0114] It should be noted that when the interruption duration has not reached the preset sampling period, the number of pulses of the target speed signal is not enough to obtain an accurate speed measurement value, that is, the speed sampling has not been completed. In order to avoid the fluctuation of the measurement result caused by the excessively high sampling frequency, this embodiment is proposed to reduce the fluctuation of the measurement result caused by the excessively high sampling frequency by setting a preset sampling period, thereby improving the accuracy of the set measurement.

[0115] In practical implementation, when the above-mentioned interruption duration is not reached by the preset sampling period, the measuring device can determine whether there is a target speed signal input or whether there is a pulse in the target speed signal by judging whether the target setting signal is zero, so as to avoid the inability to perform subsequent speed measurement if no pulse is received.

[0116] Step S30': If a pulse exists, determine the number of pulses in the target speed signal and update the locally stored number of pulses based on the number of pulses.

[0117] It should be noted that each interruption can obtain a target speed signal. If the target speed signal is not 0, that is, the target speed signal has pulses, the number of pulses is determined and accumulated with the number of pulses in the previous interruption, so as to facilitate the determination of the total number of pulses in the future.

[0118] In the specific implementation, when the measuring device detects that the target speed signal of this interruption is not 0, it determines the number of pulses and adds the number of pulses to the previously stored number of pulses, thereby updating the number of pulses stored locally.

[0119] It should be understood that if there is no pulse in the target speed signal, that is, the target speed signal is 0, the interrupt operation continues to be performed to receive the next target speed signal. That is, the process returns to the step of performing a high-frequency interrupt with a preset fixed period and performing moving window mean filtering on the externally input initial speed signal to obtain the target speed signal.

[0120] Step S40': After the pulse number update is completed, determine whether the pulse of the target speed signal has been enabled for timing.

[0121] In the specific implementation, after the measuring device updates the number of pulses stored locally, since the number of pulses can only be updated when there are pulses, if there are pulses, the target speed signal with pulses can be used as the enable signal for the effective pulse time timer to count. Conversely, if there are no pulses, the effective pulse time timer cannot count. Thus, whether the effective pulse time timer is enabled is determined by whether it counts.

[0122] Step S50': If enable timing has been performed, the current enable timing value is accumulated, and the locally stored enable timing value is updated based on the accumulated enable timing value. The enable timing value is obtained by timing by an effective pulse timer. After enabling timing the target speed signal, the effective pulse timer will accumulate the enable timing value when each high-frequency interrupt occurs.

[0123] It should be noted that the current enable timer value is the time of the pulse received during the last interruption of the target speed signal, and this current enable timer value is stored locally.

[0124] In a specific implementation, when the measuring device detects that the enabled effective pulse timer has started timing, it begins timing the pulses received at this time and adds the timing value to the locally stored enabled timing value to obtain a new enabled timing value, which is also a new effective pulse duration timing value, in order to complete the timing of the target speed signal pulse. The enabled timing value is obtained by timing the effective pulse timer. After enabling the timing of the target speed signal, the effective pulse timer will add the enabled timing value every time a high-frequency interrupt occurs.

[0125] Step S60': After the locally stored enable timing value is updated, return to the interrupt that executes the preset fixed period, and perform moving window mean filtering on the externally input initial speed signal to obtain the target speed signal.

[0126] In the specific implementation, after the above-mentioned enable timing value is updated, it indicates that the recording of the number of pulses and the time of receiving the pulses has been completed. Since the interrupt counting duration has not yet reached the preset sampling period, it is necessary to continue to receive the external initial speed signal. Therefore, it is necessary to return to the steps of executing the preset fixed period high-frequency interrupt and performing moving sliding window mean filtering on the external input initial speed signal to obtain the target speed signal, so as to increase the measurement efficiency and thus improve the accuracy of speed measurement.

[0127] Furthermore, in this embodiment, after step S40', the method further includes:

[0128] Step S50”: If the enable timing is not performed, initialize the locally stored enable timing value and start timing for the pulses of the target speed signal.

[0129] In the specific implementation, if the measuring device detects that the timing has not been enabled, it means that the non-zero target speed signal pulse received at this time is the signal that triggers the effective pulse time timer. At this time, the timing of the target speed signal pulse will start, and the locally stored enable timing value will be initialized to 1.

[0130] Furthermore, embodiments of the present invention also propose a storage medium storing a speed measurement program, which, when executed by a processor, implements the steps of the speed measurement method described above.

[0131] Reference Figure 5 , Figure 5 This is a structural block diagram of the first embodiment of the speed measuring device of the present invention.

[0132] like Figure 5 As shown, the speed measuring device proposed in this embodiment of the invention includes:

[0133] The mean filtering module 501 is used to execute a high-frequency interrupt with a preset fixed period and perform moving window mean filtering on the initial speed signal input from the outside to obtain the target speed signal.

[0134] The enable timing module 502 is used to enable timing of the target speed signal during the interruption counting period when the interruption counting period reaches the preset sampling period, and to determine whether timing of the pulse of the target speed signal has been enabled when the interruption counting period reaches the preset sampling period.

[0135] The pulse judgment module 503 is used to determine whether there is a pulse in the target speed signal after the interruption count duration reaches the preset sampling period and within the preset sampling time threshold, if the enable timing has been performed.

[0136] The speed measurement module 504 is used to determine the target speed based on the locally stored enable timing value and the total number of pulses if pulses are present.

[0137] This embodiment obtains the target speed signal by executing a high-frequency interrupt with a preset fixed period and applying a moving sliding window mean filter to the initial speed signal input from the outside. During the interrupt count duration reaching a preset sampling period, timing of the target speed signal is enabled. When the interrupt count duration reaches the preset sampling period, it is determined whether timing of pulses of the target speed signal has been enabled. If timing has been enabled, it is determined whether pulses exist in the target speed signal after the interrupt count duration reaches the preset sampling period and within a preset sampling time period threshold. If pulses exist, the target speed is determined based on the locally stored enable timing value and the total number of pulses. Because this embodiment executes periodic high-frequency interrupts and applies a moving sliding window mean filter to the externally input speed signal, determining the speed by the enable timing value and the total number of pulses when the interrupt duration reaches the preset sampling period, the speed measurement method of this embodiment effectively improves the speed measurement accuracy and increases the stability of the measured speed compared to existing speed measurement methods with lower accuracy.

[0138] Other embodiments or specific implementations of the speed measuring device of the present invention can be referred to the above-described method embodiments, and will not be repeated here.

[0139] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0140] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0141] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0142] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A speed measurement method, characterized in that, The speed measurement method includes the following steps: Execute a high-frequency interrupt with a preset fixed period and perform moving window mean filtering on the initial speed signal input from the outside to obtain the target speed signal; During the interruption counting period, the timing of the target speed signal is enabled, and when the interruption counting period reaches the preset sampling period, it is determined whether the timing of the pulse of the target speed signal has been enabled. If enable timing has been performed, determine whether there is a pulse in the target speed signal after the interruption count duration reaches the preset sampling period and within the preset sampling time threshold. If a pulse exists, the target speed is determined based on the locally stored enable timing value and the total number of pulses. The steps of executing a high-frequency interrupt with a preset fixed period and performing moving window mean filtering on the externally input initial velocity signal to obtain the target velocity signal include: Execute a high-frequency interrupt with a preset fixed period, and receive the initial speed signal from an external input during the interrupt; The signal is updated based on the initial velocity signal, wherein the signal update involves adding the initial velocity signal to the end of the signal sampling sequence and removing the signal corresponding to the beginning of the signal sampling sequence. The mean of the updated velocity signal sequence is determined based on the length of the updated signal sampling sequence, and the mean of the updated velocity signal sequence is used as the target velocity signal.

2. The speed measurement method as described in claim 1, characterized in that, The step of determining the target speed based on the locally stored enable timing value and the total number of pulses if pulses exist includes: If a pulse exists, determine the current number of pulses of the target velocity signal; Read the number of pulses stored locally, and determine the total number of pulses based on the number of pulses stored locally and the current number of pulses; Read the locally stored enable timing value and determine the target speed based on the enable timing value and the total number of pulses. The enable timing value is the time between the first non-zero target speed signal collected within the preset sampling period and the first non-zero target speed signal after the interrupt count duration reaches the preset sampling period. The enable timing value is obtained by timing the effective pulse time timer.

3. The speed measurement method as described in claim 1, characterized in that, If an enable timing has been performed, after determining whether a pulse exists in the target velocity signal within the preset sampling time threshold after the interruption count duration reaches the preset sampling period, the method further includes: If no pulse exists, the current enable timer value is incremented; Determine whether the accumulated enable timing value reaches the sampling time threshold; If the sampling time threshold is reached, the target speed is determined to be zero.

4. The speed measurement method as described in claim 3, characterized in that, After the step of determining whether the accumulated enable timing value has reached the sampling time threshold, the method further includes: If the sampling time threshold is not reached, the process returns to the step of executing a high-frequency interrupt with a preset fixed period and performing moving window mean filtering on the initial speed signal input from the outside to obtain the target speed signal.

5. The speed measurement method according to any one of claims 1 to 4, characterized in that, After the steps of executing an interrupt with a preset fixed period and performing moving window mean filtering on the externally input initial velocity signal to obtain the target velocity signal, the method further includes: If the interruption counting duration has not reached the preset sampling period, determine whether there is a pulse in the target speed signal; If pulses exist, determine the number of pulses in the target velocity signal and update the locally stored number of pulses based on the number of pulses. After the pulse count is updated, determine whether the pulses of the target velocity signal have been enabled and timed. If enable timing has been performed, the current enable timing value is accumulated, and the locally stored enable timing value is updated based on the accumulated enable timing value. The enable timing value is obtained by timing by an effective pulse timer. After enabling timing for the target speed signal, the effective pulse timer will accumulate the enable timing value when each high-frequency interrupt occurs. After the locally stored enable timing value is updated, the process returns to the step of executing the interrupt with a preset fixed period and performing moving window mean filtering on the externally input initial speed signal to obtain the target speed signal.

6. The speed measurement method as described in claim 5, characterized in that, After determining whether the pulses of the target velocity signal have been enabled for timing after the pulse number update is completed, the method further includes: If the enable timing is not enabled, the locally stored enable timing value is initialized, and timing begins for the pulses of the target speed signal.

7. A speed measuring device, characterized in that, The device includes: The mean filtering module is used to execute a high-frequency interrupt with a preset fixed period and perform moving sliding window mean filtering on the initial speed signal input from the outside to obtain the target speed signal. The enable timing module is used to enable timing of the target speed signal during the interruption counting period when the interruption counting period reaches the preset sampling period, and to determine whether timing of the pulse of the target speed signal has been enabled when the interruption counting period reaches the preset sampling period. The pulse judgment module is used to determine whether there is a pulse in the target speed signal after the interruption count duration reaches the preset sampling period and within the preset sampling time threshold, if the enable timing has been performed. The speed measurement module is used to determine the target speed based on the locally stored enable timing value and the total number of pulses if pulses are present. The mean filtering module is also used for: Execute a high-frequency interrupt with a preset fixed period, and receive the initial speed signal from an external input during the interrupt; The signal is updated based on the initial velocity signal, wherein the signal update involves adding the initial velocity signal to the end of the signal sampling sequence and removing the signal corresponding to the beginning of the signal sampling sequence. The mean of the updated velocity signal sequence is determined based on the length of the updated signal sampling sequence, and the mean of the updated velocity signal sequence is used as the target velocity signal.

8. A speed measuring device, characterized in that, The device includes: a memory, a processor, and a speed measurement program stored in the memory and executable on the processor, the speed measurement program being configured to implement the steps of the speed measurement method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium stores a speed measurement program, which, when executed by a processor, implements the steps of the speed measurement method as described in any one of claims 1 to 6.