A rotational speed measurement method, apparatus, device and medium

By performing AD sampling and sample segmentation on the speed sensor signal, the speed value is calculated by obtaining the single sample attribute, which solves the problem of excessive resource consumption at low speed pulse frequency, and achieves resource saving and improved system stability.

CN117607483BActive Publication Date: 2026-06-26TANGZHI SCI & TECH HUNAN DEV CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TANGZHI SCI & TECH HUNAN DEV CO LTD
Filing Date
2023-11-22
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

The current speed measurement process consumes a lot of memory and processor resources when processing low-speed pulse frequencies, leading to instability in the embedded environment.

Method used

By performing AD sampling on the speed pulse signal transmitted by the speed sensor, a digital speed signal is obtained, which is then divided into a preset number of samples. The individual sample attributes of each sample are obtained, and the current speed value is calculated using the sample length and its attributes, thus avoiding direct calculation using the original speed pulse frequency.

Benefits of technology

It reduces computational load, saves memory and processor resources, solves the resource consumption problem at low-speed pulse frequencies, and improves system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117607483B_ABST
    Figure CN117607483B_ABST
Patent Text Reader

Abstract

The application discloses a rotating speed measurement method and device, equipment and medium, and relates to the technical field of rotating speed measurement. According to a preset sampling frequency, the rotating speed pulse signal transmitted by the rotating speed sensor is AD sampled to obtain a rotating speed digital signal; the rotating speed digital signal is sequentially divided into a preset number of samples; the single-sample attributes corresponding to each sample are acquired respectively; and the current rotating speed value is determined according to the sample length of each sample and the single-sample attribute corresponding to each sample. It can be known that, by AD sampling the rotating speed pulse signal transmitted by the rotating speed sensor, dividing the obtained rotating speed digital signal into samples, and calculating the current rotating speed value by using the single-sample attribute of each sample, the original rotating speed pulse frequency data is avoided to be used for rotating speed calculation, so that the calculation amount is greatly reduced, and the memory and processor resources are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of rotational speed measurement technology, and in particular to a rotational speed measurement method, device, equipment, and medium. Background Technology

[0002] Currently, the rotational speed of rotating components is mainly measured using speed sensors and speed measuring devices. The speed sensor detects the current rotational speed of the component and converts it into a speed pulse signal; the speed measuring device acquires the speed pulse signal from the speed sensor, calculates the frequency of the speed pulse, and then calculates the current rotational speed of the component. In other words, speed measurement primarily involves measuring the current speed pulse frequency of the rotating component.

[0003] However, when the rotational speed pulse frequency of the measured rotating component is relatively low, such as 0.5Hz, the system needs to process at least 2 seconds of signal data each time in order to collect data for a complete rotation cycle to calculate the rotational speed. This will consume a lot of memory and processor resources in an embedded environment, which is detrimental to system stability.

[0004] Given the above problems, how to solve the problem of the current speed measurement process consuming too much memory and processor resources when processing low speed pulse frequencies is an urgent issue for technicians in this field. Summary of the Invention

[0005] The purpose of this application is to provide a speed measurement method, apparatus, device, and medium to solve the problem that current speed measurement processes consume a lot of memory and processor resources when processing low-speed pulse frequencies.

[0006] To solve the above-mentioned technical problems, this application provides a method for measuring rotational speed, comprising:

[0007] The rotational speed pulse signal transmitted by the rotational speed sensor is subjected to AD sampling according to a preset sampling frequency to obtain a digital rotational speed signal; wherein, the digital rotational speed signal contains multiple sampling points;

[0008] The digital speed signal is sequentially divided into a preset number of samples;

[0009] Each sample is assigned a single-sample attribute; wherein the single-sample attribute includes the level change information of the digital rotation speed signal.

[0010] The current rotational speed value is determined based on the sample length of each sample and its corresponding single-sample attribute.

[0011] Preferably, dividing the digital rotation speed signal into a preset number of samples includes:

[0012] Obtain the minimum rotational speed pulse frequency and the preset single sample length;

[0013] The digital speed signal is divided into the preset number of samples according to the minimum speed pulse frequency and the preset single sample length to obtain a comprehensive analysis interval;

[0014] Each sampling point in each sample within the comprehensive analysis interval is numbered sequentially.

[0015] Preferably, obtaining the single-sample attribute corresponding to the sample includes:

[0016] Obtain the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge.

[0017] Preferably, obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge includes:

[0018] The sampling point number corresponding to the first rising edge and the sampling point number corresponding to the last rising edge in the sample are initialized to preset values, and the number of rising edges is initialized to 0.

[0019] The state of the current sampling point in the sample is obtained, and the state of the previous sampling point corresponding to the current sampling point is obtained; wherein, the state of the sampling point includes a low level state and a high level state; when the current sampling point is obtained for the first time in the sample, the current sampling point is the first sampling point;

[0020] Based on the state of the current sampling point and the state of the previous sampling point, determine whether the current sampling point is a rising edge;

[0021] If the current sampling point is not a rising edge, then the next sampling point in the sample is obtained as the current sampling point, and the process returns to the step of obtaining the state of the current sampling point in the sample;

[0022] If the current sampling point is a rising edge, then determine whether the number of the sampling point corresponding to the first rising edge is a preset value;

[0023] If the number of the sampling point corresponding to the first rising edge is the preset value, then the number of the sampling point corresponding to the first rising edge and the number of the sampling point corresponding to the last rising edge are set to the number of the current sampling point, and the number of rising edges is incremented by 1;

[0024] If the number of the sampling point corresponding to the first rising edge is not the preset value, then the number of the sampling point corresponding to the last rising edge is set to the number of the current sampling point, and the number of rising edges is incremented by 1;

[0025] Obtain the next sampling point in the sample as the current sampling point, and return to the step of obtaining the state of the current sampling point in the sample, until all sampling points in the sample have been traversed.

[0026] Preferably, obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge includes:

[0027] The sampling point number corresponding to the first rising edge and the sampling point number corresponding to the last rising edge in the sample are both initialized to -1, and the number of rising edges is initialized to 0.

[0028] Obtain the state of the first sampling point in the sample, and assign the state of the first sampling point to the state flag bit; wherein, the state flag bit represents the state of the previous sampling point corresponding to the current sampling point;

[0029] Initialize the current loop count to 1;

[0030] Determine whether the current loop count is less than the sample length of the sample;

[0031] If the current loop count is less than the sample length of the sample, then determine whether the state of the sampling point numbered with the current loop count is different from the state flag bit, and the state flag bit is 0;

[0032] If the state of the sampling point numbered at the current loop number is different from the state flag bit, and the state flag bit is 0, then determine whether the number of the sampling point corresponding to the first rising edge is -1;

[0033] If the number of the sampling point corresponding to the first rising edge is not -1, then the number of the sampling point corresponding to the last rising edge is set to the current loop count, and the number of rising edges is incremented by 1;

[0034] If the number of the sampling point corresponding to the first rising edge is -1, then the number of the sampling point corresponding to the first rising edge is set to the current loop count, the number of the sampling point corresponding to the last rising edge is set to the current loop count, and the number of rising edges is incremented by 1;

[0035] If the state of the sampling point numbered at the current loop number is the same as the state flag bit, and / or the state flag bit is not 0, then the state flag bit is set to the state of the sampling point numbered at the current loop number, and the current loop number is incremented by 1;

[0036] Return to the step of determining whether the current loop count is less than the sample length of the sample;

[0037] If the current loop count is not less than the sample length of the sample, then the process of obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge ends.

[0038] Preferably, determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute includes:

[0039] The total number of valid pulses within the comprehensive analysis interval is obtained based on the single-sample attributes of each sample; wherein, the comprehensive analysis interval includes all the samples.

[0040] The number of sampling points analyzed for each sample is obtained respectively;

[0041] The number of sampling points analyzed for each sample is summed to obtain the number of sampling points analyzed for the comprehensive analysis interval.

[0042] The current rotational speed value is determined based on the number of effective pulses, the preset sampling frequency, the number of sampling points analyzed in the comprehensive analysis interval, and the number of teeth of the rotational speed sensor.

[0043] Preferably, the step of obtaining the number of sampling points for each sample includes:

[0044] The difference between the sample length of the first sample in all the samples and the number of the sampling point corresponding to the first rising edge is obtained to obtain the number of sampling points analyzed for the first sample.

[0045] Obtain the number of the sampling point corresponding to the last rising edge of the last sample in all the samples, so as to obtain the number of sampling points analyzed for the last sample;

[0046] Obtain the sample length of each of the remaining samples in all the samples to obtain the number of sampling points analyzed for each of the remaining samples.

[0047] Preferably, before determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute, and after obtaining the single-sample attribute corresponding to each sample, the method further includes:

[0048] Write each of the single-sample attributes within the comprehensive analysis interval into the attribute cache area;

[0049] The maximum number of attribute caches in the attribute cache area is adapted to the number of samples in the comprehensive analysis area.

[0050] Preferably, determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute includes:

[0051] Determine whether the single-sample attribute in the attribute cache is full;

[0052] If the single-sample attribute in the attribute cache is not full, then the current rotation speed value is set to 0, and the process ends.

[0053] If the single-sample attribute in the attribute buffer is full, then the number of rising edges in the comprehensive analysis interval and the number of sampling points analyzed in the comprehensive analysis interval are both set to 0;

[0054] Traverse the attribute cache area and determine whether the traversal of the attribute cache area has been completed;

[0055] If the attribute cache has not been fully traversed, then the single-sample attribute in the attribute cache is retrieved;

[0056] Determine whether the single-sample attribute is the first single-sample attribute in the attribute cache;

[0057] If it is confirmed to be the first single-sample attribute, then obtain the first difference between the sample length and the number of the sampling point corresponding to the first rising edge in the single-sample attribute, sum the number of sampling point analyses in the comprehensive analysis interval with the first difference to update the number of sampling point analyses in the comprehensive analysis interval; sum the number of rising edges in the comprehensive analysis interval with the number of rising edges in the single-sample attribute to update the number of rising edges in the comprehensive analysis interval.

[0058] If it is confirmed that it is not the first single-sample attribute, then determine whether the single-sample attribute is the last single-sample attribute in the attribute cache.

[0059] If it is confirmed to be the last single-sample attribute, then the number of sampling points analyzed in the comprehensive analysis interval is summed with the number of the sampling point corresponding to the last rising edge in the single-sample attribute to update the number of sampling points analyzed in the comprehensive analysis interval; the number of rising edges in the comprehensive analysis interval is summed with the number of rising edges in the single-sample attribute to update the number of rising edges in the comprehensive analysis interval.

[0060] If it is confirmed that it is not the last single sample attribute, then the number of sampling point analyses in the comprehensive analysis interval is summed with the sample length to update the number of sampling point analyses in the comprehensive analysis interval; the number of rising edges in the comprehensive analysis interval is summed with the number of rising edges in the single sample attribute to update the number of rising edges in the comprehensive analysis interval.

[0061] Return to the step of determining whether the attribute cache has been completely traversed;

[0062] If the attribute cache traversal is completed, then obtain the second difference between the number of rising edges minus 1 in the comprehensive analysis interval, and obtain the first quotient between the number of sample points analyzed in the comprehensive analysis interval and the preset sampling frequency; obtain the second quotient between the second difference and the first quotient to obtain the rotational speed pulse frequency;

[0063] The current rotational speed value is determined based on the rotational speed pulse frequency.

[0064] Preferably, writing each of the single-sample attributes within the comprehensive analysis interval into the attribute cache includes:

[0065] Determine whether the number of single-sample attributes in the attribute cache has reached the maximum number of attribute caches;

[0066] If not, the single-sample attribute is written into the attribute cache area;

[0067] If so, delete the single-sample attribute with the longest write time in the attribute cache, and write the single-sample attribute into the attribute cache.

[0068] To address the aforementioned technical problems, this application also provides a speed measuring device, comprising:

[0069] The sampling module is used to perform AD sampling on the speed pulse signal transmitted by the speed sensor according to a preset sampling frequency to obtain a digital speed signal; wherein, the digital speed signal contains multiple sampling points;

[0070] The processing module is used to divide the digital speed signal into a preset number of samples sequentially;

[0071] The acquisition module is used to acquire the single-sample attributes corresponding to each of the samples respectively; wherein, the single-sample attributes include the level change information of the digital speed signal;

[0072] The determination module is used to determine the current rotational speed value based on the sample length of each sample and its corresponding single sample attribute.

[0073] To address the aforementioned technical problems, this application also provides a speed measuring device, comprising:

[0074] Memory, used to store computer programs;

[0075] A processor is used to implement the steps of the above-described rotational speed measurement method when executing the computer program.

[0076] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned rotational speed measurement method.

[0077] The speed measurement method provided in this application specifically involves performing AD sampling on the speed pulse signal transmitted by the speed sensor at a preset sampling frequency to obtain a digital speed signal. This digital speed signal contains multiple sampling points. The digital speed signal is then divided into a preset number of samples. The single-sample attribute corresponding to each sample is obtained. This single-sample attribute includes information about the level change of the digital speed signal. The current speed value is determined based on the sample length of each sample and its corresponding single-sample attribute. Therefore, this scheme avoids using the original speed pulse frequency data for speed calculation by performing AD sampling on the speed pulse signal transmitted by the speed sensor, dividing the sampled digital speed signal into samples, and using the single-sample attribute of each sample to calculate the current speed value. This eliminates the limitation of low speed pulse frequencies, significantly reduces computational load, and saves memory and processor resources.

[0078] In addition, this application also provides a speed measuring device, equipment and medium, with the same effect as above. Attached Figure Description

[0079] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0080] Figure 1 A flowchart illustrating a rotational speed measurement method provided in this application embodiment;

[0081] Figure 2 A schematic diagram of the digital speed signal provided in an embodiment of this application;

[0082] Figure 3 A schematic diagram of a sample provided in an embodiment of this application;

[0083] Figure 4 A schematic diagram illustrating single-sample analysis provided in an embodiment of this application;

[0084] Figure 5 A schematic diagram of the comprehensive analysis interval provided for embodiments of this application;

[0085] Figure 6 A flowchart for obtaining single-sample attributes is provided in an embodiment of this application;

[0086] Figure 7 Another flowchart for obtaining single-sample attributes provided in this application embodiment;

[0087] Figure 8 A schematic diagram of the attribute cache area provided in the embodiments of this application;

[0088] Figure 9 This is a schematic diagram illustrating the writing of the attribute cache area provided in an embodiment of this application;

[0089] Figure 10 A flowchart of a comprehensive analysis process provided for embodiments of this application;

[0090] Figure 11 A schematic diagram of a speed measuring device provided in an embodiment of this application;

[0091] Figure 12 This is a schematic diagram of a rotational speed measuring device provided in an embodiment of this application. Detailed Implementation

[0092] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0093] The core of this application is to provide a speed measurement method, device, equipment, and medium to solve the problem that current speed measurement processes consume a lot of memory and processor resources when processing low-speed pulse frequencies.

[0094] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0095] Currently, the rotational speed of rotating components is mainly measured using speed sensors and speed measuring devices. The speed sensor detects the current rotational speed of the component and converts it into speed pulse signals. The speed measuring device acquires these pulse signals and calculates their frequency (in Hz, indicating the number of pulses per second). Since a rotating component generates a fixed number of pulse signals per revolution (let's assume this value is B), the rotational speed can be calculated based on the pulse frequency, as follows:

[0096] (Speed ​​pulse frequency / B)×60;

[0097] In other words, speed measurement mainly involves measuring the current speed pulse frequency of the rotating component.

[0098] However, when the rotational speed pulse frequency of the rotating component being measured is relatively low, such as 0.5Hz, the system needs to process signal data for at least 2 seconds each time in order to collect data for a complete rotation cycle to calculate the rotational speed. This will consume a lot of memory and processor resources in an embedded environment, which is detrimental to system stability. In view of the above problems, this application provides a rotational speed measurement method to solve the problem of current rotational speed measurement processes consuming a lot of memory and processor resources when processing low rotational speed pulse frequencies.

[0099] Figure 1 This is a flowchart illustrating a rotational speed measurement method provided in an embodiment of this application. Figure 1 As shown, the method includes:

[0100] S10: Perform AD sampling on the speed pulse signal transmitted by the speed sensor according to the preset sampling frequency to obtain the speed digital signal.

[0101] The digital speed signal contains multiple sampling points.

[0102] Specifically, during the rotational speed measurement of the rotating component, the speed sensor senses the current rotational speed of the rotating component and converts it into a speed pulse signal. In this embodiment, the speed pulse signal transmitted by the speed sensor is subjected to AD sampling at a preset sampling frequency to convert the analog signal into a digital signal, thereby obtaining a digital speed signal containing multiple sampling points.

[0103] It is understood that the preset sampling frequency can be specified during the scheme design as needed, and this embodiment does not impose any restrictions on the preset sampling frequency. For example, a sampling frequency of 250kHz can be used for sampling; in this case, 250,000 sampling points will be generated per second.

[0104] Figure 2 This is a schematic diagram of the digital speed signal provided in an embodiment of this application. Figure 2 As shown, each sample point is a 0 or 1 digit. 0 represents a low level, and 1 represents a high level. Therefore, the digital signal of rotational speed composed of these sample points is displayed as a square wave. The point where the signal changes from low to high is called the rising edge.

[0105] It is important to note that in a digital speed signal, the number of valid pulses is the number of rising edges minus one. For example, Figure 2 If there are 5 rising edges, then the number of valid pulses is 4. Furthermore, since a preset sampling frequency is used, the time elapsed in the current interval can be calculated based on the number of sampling points within the interval. For example, Figure 2 The sampling frequency is 250kHz. The interval formed by StartP and EndP includes 50,000 sampling points; therefore, the time elapsed in this interval is 0.2s (50,000 / 250,000); and the interval contains 4 valid pulses. Figure 2 The pulse frequency for medium speed is 20Hz (4 / 0.2).

[0106] S11: Divide the digital speed signal into a preset number of samples.

[0107] Since the digital speed signal generated by the AD converter is continuous and uninterrupted, to facilitate analysis and reduce the consumption of memory and processor resources, the read digital speed signal is further organized and divided into samples. It should be noted that the number of sampling points in a sample is its sample length. In this embodiment, there is no restriction on the sample length; they can be the same or different, depending on the specific implementation.

[0108] Figure 3 This is a schematic diagram of a sample provided in an embodiment of this application. For example... Figure 3 As shown, the digital speed signal is divided into 5 samples, all of which have the same sample length. For example, if each sample contains 50,000 sampling points, then when sampling at a sampling frequency of 250kHz, a sample is generated every 0.2s.

[0109] It should be noted that since the generation of the digital speed signal is continuous, the samples will also be continuously divided until the speed measurement stops. Furthermore, this embodiment does not limit the preset number of samples; it depends on the specific implementation.

[0110] S12: Obtain the individual sample attributes corresponding to each sample.

[0111] Among them, the single-sample attribute contains information on the level change of the digital speed signal.

[0112] Furthermore, after obtaining multiple samples, it is necessary to perform single-sample analysis on each sample to obtain single-sample attributes, which can then be used for subsequent rotational speed calculation. Specifically, the single-sample attributes include the level change information of the digital rotational speed signal; since the digital rotational speed signal is a square wave signal, its level change information can be rising edge information and / or falling edge information. This embodiment does not limit the specific content included in the single-sample attributes; it depends on the specific implementation.

[0113] S13: Determine the current rotation speed value based on the sample length of each sample and its corresponding single sample attribute.

[0114] Finally, after obtaining the individual sample attributes of each sample, the current rotational speed value is determined by combining the sample length of each sample. Because the calculation of the current rotational speed value utilizes the individual sample attributes of each sample, it avoids using the original rotational speed pulse frequency data for rotational speed calculation, greatly reducing the consumption of system resources. This embodiment does not limit the specific process for obtaining the current rotational speed value; it depends on the specific implementation situation.

[0115] In this embodiment, the rotational speed pulse signal transmitted by the rotational speed sensor is subjected to AD sampling according to a preset sampling frequency to obtain a digital rotational speed signal. The digital rotational speed signal contains multiple sampling points. The digital rotational speed signal is then divided into a preset number of samples. The single-sample attribute corresponding to each sample is obtained. The single-sample attribute contains information about the level change of the digital rotational speed signal. The current rotational speed value is determined based on the sample length of each sample and its corresponding single-sample attribute. Therefore, the above scheme avoids using the original rotational speed pulse frequency data for rotational speed calculation by performing AD sampling on the rotational speed pulse signal transmitted by the rotational speed sensor, dividing the sampled digital rotational speed signal into samples, and using the single-sample attribute of each sample to calculate the current rotational speed value. This avoids the limitation of low-frequency rotational speed pulses, greatly reduces the computational load, and saves memory and processor resources.

[0116] Based on the above embodiments, in some embodiments, dividing the digital speed signal into a preset number of samples includes:

[0117] S110: Obtain the minimum rotational speed pulse frequency and preset single sample length.

[0118] S111: Divide the digital speed signal into a preset number of samples according to the lowest speed pulse frequency and the preset single sample length to obtain the comprehensive analysis interval.

[0119] S112: Number each sampling point in each sample within the comprehensive analysis interval in sequence.

[0120] In practical implementation, to determine the preset number of samples, the minimum rotational speed pulse frequency and the preset single-sample length can be obtained. The digital rotational speed signal can then be further divided into a preset number of samples based on these parameters to obtain a comprehensive analysis interval. For example, assuming the minimum rotational speed pulse frequency is 0.5Hz, one rotational cycle is 2s; when the preset single-sample length is 100ms, a total of 2s / 100ms = 20 samples are needed. These 20 samples together constitute the comprehensive analysis interval, and subsequent rotational speed measurements will be performed based on the information from each sample within this interval.

[0121] It is important to note that the minimum rotational speed pulse frequency and the preset single-sample length are known quantities obtained beforehand. Furthermore, after obtaining the samples, each sampling point within each sample needs to be numbered sequentially. Figure 3 For example, in the diagram, SP represents the sample start point number, and EP represents the sample end point number. When the number of sampling points in the sample is 10,000, SP is 0 and EP is 9,999 (10,000-1); when the number of sampling points in the sample is 50,000, SP is 0 and EP is 49,999 (50,000-1). This facilitates the subsequent acquisition of individual sample attributes.

[0122] In this embodiment, the digital speed signal is divided into a preset number of samples by acquiring and dividing it into a preset number of samples according to the lowest speed pulse frequency and the preset single sample length; at the same time, each sampling point in each sample is numbered sequentially to facilitate the acquisition of the single sample attributes of each sample in the subsequent process.

[0123] Based on the above embodiments, in some embodiments, obtaining the single-sample attribute corresponding to the sample includes:

[0124] S120: Obtain the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge.

[0125] In some embodiments, in order to obtain the single-sample attribute corresponding to the sample, the number of rising edges num, the number of the sampling point corresponding to the first rising edge Sindex, and the number of the sampling point corresponding to the last rising edge Eindex are specifically obtained in the sample, so as to facilitate the subsequent calculation of the current rotational speed value.

[0126] Figure 4 This is a schematic diagram of single-sample analysis provided in an embodiment of this application. Figure 5 This is a schematic diagram of the comprehensive analysis interval provided for an embodiment of this application. For example... Figure 4 and Figure 5As shown, when N equals 1, single-sample analysis was performed on 5 sample data points within the comprehensive analysis interval. Specifically, the number of rising edges (num), the sampling point number (Sindex) corresponding to the first rising edge, and the sampling point number (Eindex) corresponding to the last rising edge were obtained for each sample. Samples 1, 3, 4, and 5 each had 2 rising edges, while sample 2 had 3. In this embodiment, the specific process for obtaining the number of rising edges, the sampling point number corresponding to the first rising edge, and the sampling point number corresponding to the last rising edge is not limited and depends on the specific implementation.

[0127] It should be noted that this embodiment provides a single-sample attribute based on rising edge information. In some embodiments, falling edge information can also be used as a single-sample attribute, for example, obtaining the number of falling edges in the sample, the number of the sampling point corresponding to the first falling edge, and the number of the sampling point corresponding to the last falling edge, so as to be used for subsequent calculation of the current rotational speed value. This embodiment does not impose any restrictions.

[0128] Figure 6 This is a flowchart for obtaining single-sample attributes, provided as an embodiment of this application. Based on the above embodiments, in some embodiments, such as… Figure 6 As shown, obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge includes:

[0129] S121: Initialize the number of the sampling point corresponding to the first rising edge and the number of the sampling point corresponding to the last rising edge in the sample to the preset value, and initialize the number of rising edges to 0.

[0130] S122: Obtain the state of the current sampling point in the sample, and obtain the state of the previous sampling point corresponding to the current sampling point.

[0131] The state of the sampling point includes a low level state and a high level state; when the current sampling point is first acquired in the sample, the current sampling point is the first sampling point.

[0132] S123: Determine whether the current sampling point is a rising edge based on the state of the current sampling point and the state of the previous sampling point; if not, proceed to step S124; if yes, proceed to step S125.

[0133] S124: Obtain the next sampling point in the sample as the current sampling point, and return to step S122;

[0134] S125: Determine whether the number of the sampling point corresponding to the first rising edge is a preset value; if the number of the sampling point corresponding to the first rising edge is a preset value, proceed to step S126; if the number of the sampling point corresponding to the first rising edge is not a preset value, proceed to step S127.

[0135] S126: Set the number of the sampling point corresponding to the first rising edge and the number of the sampling point corresponding to the last rising edge to the number of the current sampling point, and increment the number of rising edges by 1.

[0136] S127: Set the number of the sampling point corresponding to the last rising edge to the number of the current sampling point, and increment the number of rising edges by 1.

[0137] Return to step S124 until all sampling points in the sample have been traversed.

[0138] In practical implementation, to obtain the single-sample attributes corresponding to a sample, namely the sampling point number Sindex corresponding to the first rising edge, the sampling point number Eindex corresponding to the last rising edge, and the number of rising edges num, it is first necessary to initialize the single-sample attributes. The sampling point numbers Sindex corresponding to the first rising edge and Eindex corresponding to the last rising edge are set to preset values, and the number of rising edges num is initialized to 0. It should be noted that this embodiment does not impose restrictions on the preset values; they are determined based on the specific implementation.

[0139] Furthermore, a sampling point is selected in the sample as the current sampling point. The state of the current sampling point in the sample is obtained, as well as the state of the previous sampling point corresponding to the current sampling point. It can be understood that the number of the previous sampling point is earlier than the number of the current sampling point. The state of the sampling point includes 0 and 1. It is important to note that when the current sampling point is first obtained in the sample, it is the first sampling point, that is, the sampling point with the earliest number among all sampling points.

[0140] To determine the position of the rising edge in the sample, the state of the current sampling point and the state of the previous sampling point are used to determine whether the current sampling point is a rising edge. The state of the sampling point includes a low level state and a high level state. Specifically, the low level state is 0 and the high level state is 1. Therefore, if the state of the previous sampling point is 0 and the state of the current sampling point is 1, the current sampling point is considered to be a rising edge; otherwise, the current sampling point is considered not to be a rising edge. If it is determined that the current sampling point is not a rising edge, the next sampling point in the sample is obtained as the current sampling point, and the process returns to step S122 to re-obtain the state of the current sampling point and the state of the previous sampling point corresponding to the current sampling point, thereby performing a new round of judgment.

[0141] If the current sampling point is confirmed to be a rising edge, it is necessary to determine whether it is the first or the last rising edge. In practice, it is further determined whether the sampling point number corresponding to the first rising edge is a preset value. If the sampling point number corresponding to the first rising edge is a preset value, it means that the sampling point number corresponding to the first rising edge has not been updated before, and the current sampling point is the first confirmed rising edge. Therefore, the current sampling point is confirmed to be the first rising edge, and it can also be considered to be the last rising edge. Therefore, the sampling point number Sindex corresponding to the first rising edge and the sampling point number Eindex corresponding to the last rising edge are further set to the current sampling point number, and the number of rising edges num is incremented by 1.

[0142] If the sampling point number corresponding to the first rising edge is not a preset value, it means that the sampling point number corresponding to the first rising edge has been updated previously, and the current sampling point is not the first confirmed rising edge. Therefore, the current sampling point is confirmed as the last rising edge. Thus, the sampling point number Eindex corresponding to the last rising edge is set to the current sampling point number, and the number of rising edges num is incremented by 1.

[0143] After that, return to step S124, obtain the next sampling point in the sample as the current sampling point for a new round of judgment, until all sampling points in the sample are traversed, thereby obtaining the single sample attribute of the sample.

[0144] Figure 7 This is another flowchart for obtaining single-sample attributes provided in an embodiment of this application. Based on the above embodiments, in some embodiments, the software operation logic for actually executing the rotation speed measurement method of this application is incorporated, such as... Figure 7 As shown, the specific process for obtaining single-sample attributes is as follows:

[0145] S150: Initialize the number of the sampling point corresponding to the first rising edge and the number of the sampling point corresponding to the last rising edge in the sample to -1, and initialize the number of rising edges to 0.

[0146] S151: Obtain the state of the first sampling point in the sample and assign the state of the first sampling point to the state flag bit.

[0147] The status flag indicates the status of the previous sampling point corresponding to the current sampling point.

[0148] S152: Initialize the current loop count to 1.

[0149] S153: Determine if the current loop count is less than the sample length; if yes, proceed to step S154; if no, end the process of obtaining the number of rising edges, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge in the sample.

[0150] S154: Determine whether the state of the sampling point numbered for the current loop count is different from the state flag bit, and whether the state flag bit is 0. If yes, proceed to step S155; otherwise, proceed to step S158.

[0151] S155: Determine whether the number of the sampling point corresponding to the first rising edge is -1; if not, proceed to step S156; if yes, proceed to step S157.

[0152] S156: Set the number of the sampling point corresponding to the last rising edge to the current loop count, and increment the number of rising edges by 1.

[0153] S157: Set the number of the sampling point corresponding to the first rising edge to the current loop count, set the number of the sampling point corresponding to the last rising edge to the current loop count, and increment the number of rising edges by 1.

[0154] S158: Set the status flag to the status of the sampling point numbered with the current loop count, and increment the current loop count by 1;

[0155] Return to step S153 and check again whether the current loop count is less than the sample length of the sample. Continue until the current loop count is not less than the sample length of the sample, and then traverse all sampling points in the sample to obtain the single sample attribute of the sample.

[0156] Specifically, first, the sampling point number Sindex corresponding to the first rising edge and the sampling point number Eindex corresponding to the last rising edge in the sample are both initialized to -1, and the number of rising edges num is initialized to 0. The state of the first sampling point in the sample is obtained and assigned to the state flag prestatus. It is important to note that the state flag prestatus represents the state of the previous sampling point corresponding to the current sampling point. The current loop count i is initialized to 1.

[0157] Further determine if the current loop count i is less than the sample length. If not, confirm that the number of rising edges num, the sampling point number Sindex corresponding to the first rising edge, and the sampling point number Eindex corresponding to the last rising edge have been obtained, and end the acquisition process. If yes, the acquisition process is not complete, and it is necessary to determine whether the state of the sampling point numbered i at the current loop count is different from the state flag prestatus, and whether the state flag prestatus is 0.

[0158] If the state of the sampling point numbered i in the current loop count is different from the state flag prestatus, and the state flag prestatus is 0, then check if the sampling point number Sindex corresponding to the first rising edge is -1. If the sampling point number Sindex corresponding to the first rising edge is not -1, then set the sampling point number Eindex corresponding to the last rising edge to the current loop count i, and increment the number of rising edges num by 1. If the sampling point number Sindex corresponding to the first rising edge is -1, then set the sampling point number Sindex corresponding to the first rising edge to the current loop count i, set the sampling point number Eindex corresponding to the last rising edge to the current loop count i, and increment the number of rising edges num by 1.

[0159] If the state of the sampling point numbered i in the current loop count is the same as the state flag prestatus, and / or the state flag prestatus is not 0, then the state flag prestatus is set to the state of the sampling point numbered i in the current loop count, and the current loop count i is incremented by 1.

[0160] At this point, the current iteration ends, and the loop returns to check again whether the current iteration count i is less than the sample length. This process continues until the current iteration count i is not less than the sample length, completing the traversal of all sampling points in the sample, thus obtaining the single-sample attribute of the sample.

[0161] Based on the above embodiments, in some embodiments, determining the current rotational speed value according to the sample length of each sample and its corresponding single-sample attribute includes:

[0162] S130: Obtain the total number of valid pulses within the comprehensive analysis interval based on the individual sample attributes of each sample.

[0163] The comprehensive analysis interval includes all samples.

[0164] S131: Obtain the number of sampling points analyzed for each sample.

[0165] S132: Sum the number of sampling points analyzed for each sample to obtain the number of sampling points analyzed for the comprehensive analysis interval.

[0166] S133: Determine the current rotational speed value based on the number of effective pulses, the preset sampling frequency, the number of sampling points analyzed in the comprehensive analysis interval, and the number of teeth of the rotational speed sensor.

[0167] like Figure 5As shown, the five samples together constitute the comprehensive analysis interval for the current rotational speed value. To obtain the current rotational speed value, the total number of valid pulses is first determined based on the individual sample attributes of each sample. It can be understood that since the number of rising edges (num) in the individual sample attributes of each sample is known, the number of valid pulses for each sample can be obtained by subtracting one from the number of rising edges (num). Further summing the number of valid pulses yields the total number of valid pulses within the comprehensive analysis interval.

[0168] Further, the number of sampling points for each sample is obtained separately. In some embodiments, to obtain the number of sampling points for each sample separately, the difference between the sample length of the first sample in all samples and the number of the sampling point corresponding to the first rising edge is obtained to obtain the number of sampling points for the first sample; the number of sampling points corresponding to the last rising edge of the last sample in all samples is obtained to obtain the number of sampling points for the last sample; and the sample length of each of the remaining samples in all samples is obtained to obtain the number of sampling points for each of the remaining samples.

[0169] by Figure 5 For example, sample N is the first sample in the comprehensive analysis interval, so the number of analysis points for sample N is the difference between the sample length of sample N and the sampling point number Sindex corresponding to the first rising edge of sample N. Sample N+4 is the last sample in the comprehensive analysis interval, so the number of analysis points for sample N+4 is the sampling point number Eindex corresponding to the last rising edge of sample N+4. Samples N+1 to N+3 are the remaining samples in the entire sample set, so the number of analysis points for samples N+1 to N+3 are respectively the corresponding sample lengths.

[0170] The number of analysis points for each sample is then summed to obtain the total number of analysis points for the comprehensive analysis interval. Finally, the current rotational speed is determined based on the number of effective pulses, the preset sampling frequency, the total number of analysis points for the comprehensive analysis interval, and the number of teeth on the speed sensor, as follows:

[0171] Current rotational speed value = (number of effective pulses in the comprehensive analysis interval × preset sampling frequency × 60) / (number of sampling points analyzed in the comprehensive analysis interval × number of teeth of the rotational speed sensor);

[0172] In this way, the current rotational speed value was calculated.

[0173] To better store the individual sample attributes for subsequent calculation of the current rotational speed value, based on the above embodiments, in some embodiments, before determining the current rotational speed value according to the sample length and corresponding individual sample attributes of each sample, after obtaining the individual sample attributes corresponding to each sample, the method further includes:

[0174] S14: Write the attributes of each single sample within the comprehensive analysis interval into the attribute cache area.

[0175] The maximum number of attribute caches in the attribute cache area is adapted to the number of samples in the comprehensive analysis area.

[0176] Figure 8 This is a schematic diagram of an attribute cache area provided in an embodiment of this application. For example... Figure 8 As shown, after performing single-sample analysis on the sample, the single-sample attributes within the comprehensive analysis interval are written from the write end to the attribute buffer. When calculating the current rotation speed value, the single-sample attributes stored in the attribute buffer are sequentially traversed from the read end.

[0177] It is important to note that the attribute cache has a maximum number of attributes that can be cached for a single sample attribute. This maximum number of attributes is matched to the number of samples in the comprehensive analysis area. In other words, the number of single-sample attributes in the attribute cache will not exceed the maximum number of attributes that can be cached. Therefore, in some embodiments, writing each single-sample attribute into the attribute cache includes:

[0178] S140: Determine whether the number of single-sample attributes in the attribute cache has reached the maximum number of attribute caches; if not, proceed to step S141; if yes, proceed to step S142.

[0179] S141: Write the single-sample attribute to the attribute cache.

[0180] S142: Delete the single-sample attribute with the longest write time in the attribute cache and write the single-sample attribute back to the attribute cache.

[0181] When writing each individual sample attribute to the attribute cache, it is necessary to determine whether the number of individual sample attributes in the attribute cache has reached the maximum number of attribute caches. If not, the individual sample attribute is written to the attribute cache. If so, the individual sample attribute with the longest writing time in the attribute cache is deleted, and the individual sample attribute is written to the attribute cache.

[0182] Figure 9 This is a schematic diagram illustrating the writing of the attribute cache area provided in an embodiment of this application. For example... Figure 9 As shown, the maximum number of attributes that can be cached in the attribute cache is 2. Initially, the attribute cache is empty. After writing attribute #1, it will store attribute #1. After writing attribute #2, it will store both attribute #1 and attribute #2; at this point, the attribute cache is full. After writing attribute #3, attribute #1 needs to be discarded, and then attribute #3 needs to be stored. At this point, the attribute cache will contain attribute #2 and attribute #3.

[0183] In addition, if for Figure 9The attribute buffer is traversed, reading the stored single-sample attributes sequentially from right to left. For example, after writing single-sample attribute number 3, traversing the attribute buffer will first read single-sample attribute number 2, and then read single-sample attribute number 3, thus satisfying the subsequent calculation of the current rotational speed value.

[0184] Figure 10 This is a flowchart illustrating a comprehensive analysis process provided for embodiments of this application. Based on the above embodiments, in some embodiments, the software operation logic for actually executing the rotational speed measurement method of this application is incorporated, such as... Figure 10 As shown, the process of determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute is as follows:

[0185] S160: Determine whether the single-sample attribute in the attribute cache is full; if not, proceed to step S161; if yes, proceed to step S162.

[0186] S161: Set the current speed value to 0 and end.

[0187] S162: Set the number of rising edges in the comprehensive analysis interval and the number of sampling points analyzed in the comprehensive analysis interval to 0.

[0188] S163: Traverse the attribute cache area and determine whether the attribute cache area has been traversed completely; if not, proceed to step S164; if yes, proceed to step S170.

[0189] S164: Retrieve a single-sample attribute from the attribute cache.

[0190] S165: Determine whether the single-sample attribute is the first single-sample attribute in the attribute cache; if yes, proceed to step S166; if no, proceed to step S167.

[0191] S166: Obtain the first difference between the sample length and the number of the sampling point corresponding to the first rising edge in the single sample attribute; sum the number of sampling point analyses in the comprehensive analysis interval with the first difference to update the number of sampling point analyses in the comprehensive analysis interval; sum the number of rising edges in the comprehensive analysis interval with the number of rising edges in the single sample attribute to update the number of rising edges in the comprehensive analysis interval.

[0192] S167: Determine whether the single-sample attribute is the last single-sample attribute in the attribute cache; if yes, proceed to step S168; if no, proceed to step S169.

[0193] S168: Sum the number of sample points analyzed in the comprehensive analysis interval with the number of the sample point corresponding to the last rising edge in the single sample attribute to update the number of sample points analyzed in the comprehensive analysis interval; sum the number of rising edges in the comprehensive analysis interval with the number of rising edges in the single sample attribute to update the number of rising edges in the comprehensive analysis interval.

[0194] S169: Sum the number of sample point analyses in the comprehensive analysis interval with the sample length to update the number of sample point analyses in the comprehensive analysis interval; sum the number of rising edges in the comprehensive analysis interval with the number of rising edges in the single sample attribute to update the number of rising edges in the comprehensive analysis interval.

[0195] Return to step S163.

[0196] S170: Obtain the second difference between the number of rising edges minus 1 in the comprehensive analysis interval, and obtain the first quotient between the number of sampling points analyzed in the comprehensive analysis interval and the preset sampling frequency; obtain the second quotient between the second difference and the first quotient to obtain the rotational speed pulse frequency.

[0197] S171: Determine the current speed value based on the speed pulse frequency and end.

[0198] Specifically, first, it is determined whether the single-sample attribute in the attribute buffer is full. If the single-sample attribute in the attribute buffer is not full, it means that there are not enough single-sample attributes in the attribute buffer to be used for speed measurement. In this case, the current speed value is set to 0, and the process ends. If the single-sample attribute in the attribute buffer is full, speed measurement is performed. First, the number of rising edges (edgeNum) and the number of sample points analyzed (pntCnt) in the comprehensive analysis interval are both set to 0. The attribute buffer is then traversed, and it is determined whether the traversal of the attribute buffer is complete.

[0199] If the attribute cache has not been fully traversed, retrieve the single-sample attribute from the attribute cache. Determine if the single-sample attribute is the first single-sample attribute in the attribute cache; if so, obtain the first difference between the sample length and the sampling point number Sindex corresponding to the first rising edge in the single-sample attribute, sum the number of sampling points pntCnt in the comprehensive analysis interval with the first difference to update the number of sampling points pntCnt in the comprehensive analysis interval; sum the number of rising edges edgeNum in the comprehensive analysis interval with the number of rising edges num in the single-sample attribute to update the number of rising edges edgeNum in the comprehensive analysis interval. If not, determine if the single-sample attribute is the last single-sample attribute in the attribute cache.

[0200] If the single-sample attribute is the last single-sample attribute in the attribute buffer, the number of sampling points analyzed in the comprehensive analysis interval, pntCnt, is summed with the number of the sampling point corresponding to the last rising edge in the single-sample attribute, Eindex, to update the number of sampling points analyzed in the comprehensive analysis interval, pntCnt; the number of rising edges in the comprehensive analysis interval, edgeNum, is summed with the number of rising edges in the single-sample attribute, num, to update the number of rising edges in the comprehensive analysis interval, edgeNum.

[0201] If a single-sample attribute is not the last single-sample attribute in the attribute cache, then the number of sample point analyses pntCnt in the comprehensive analysis interval is summed with the sample length to update the number of sample point analyses pntCnt in the comprehensive analysis interval; the number of rising edges edgeNum in the comprehensive analysis interval is summed with the number of rising edges num in the single-sample attribute to update the number of rising edges edgeNum in the comprehensive analysis interval.

[0202] Return to iterate through the property cache again and check if the property cache has been traversed completely.

[0203] If the attribute buffer traversal is complete, obtain the second difference (edgeNum - 1) between the number of rising edges in the comprehensive analysis interval, and obtain the first quotient between the number of sampled points analyzed (pntCnt) in the comprehensive analysis interval and the preset sampling frequency; obtain the second quotient between the second difference and the first quotient to obtain the rotational speed pulse frequency. Finally, determine the current rotational speed value based on the rotational speed pulse frequency, and the process ends.

[0204] In the above embodiments, the speed measurement method has been described in detail. This application also provides embodiments of the speed measurement device.

[0205] Figure 11 This is a schematic diagram of a speed measuring device provided in an embodiment of this application. Figure 11 As shown, the device includes:

[0206] The sampling module 10 is used to perform AD sampling on the speed pulse signal transmitted by the speed sensor according to the preset sampling frequency to obtain the speed digital signal; wherein the speed digital signal contains multiple sampling points.

[0207] The processing module 11 is used to divide the digital speed signal into a preset number of samples in sequence.

[0208] The acquisition module 12 is used to acquire the single-sample attributes corresponding to each sample; wherein, the single-sample attributes include the level change information of the digital speed signal.

[0209] The determination module 13 is used to determine the current rotational speed value based on the sample length of each sample and its corresponding single sample attribute.

[0210] In some embodiments, it also includes:

[0211] The write module is used to write the attributes of each individual sample into the attribute cache.

[0212] The attribute cache area is configured with a maximum number of attributes that can be cached for a single sample attribute.

[0213] In this embodiment, the speed measuring device includes a sampling module, a processing module, an acquisition module, and a determination module. The speed measuring device can implement all the steps of the above-described speed measurement method during operation. Specifically, it performs AD sampling on the speed pulse signal transmitted by the speed sensor according to a preset sampling frequency to obtain a digital speed signal; wherein the digital speed signal contains multiple sampling points; the digital speed signal is sequentially divided into a preset number of samples; the single-sample attribute corresponding to each sample is acquired; wherein the single-sample attribute contains the level change information of the digital speed signal; the current speed value is determined according to the sample length of each sample and its corresponding single-sample attribute. Therefore, the above scheme, by performing AD sampling on the speed pulse signal transmitted by the speed sensor, dividing the sampled digital speed signal into samples, and using the single-sample attribute of each sample to calculate the current speed value, avoids using the original speed pulse frequency data for speed calculation, thus avoiding the limitation of low speed pulse frequencies, greatly reducing the computational load, and saving memory and processor resources.

[0214] Figure 12 This is a schematic diagram of a speed measuring device provided in an embodiment of this application. Figure 12 As shown, the speed measuring device includes:

[0215] Memory 20 is used to store computer programs.

[0216] The processor 21 is used to execute a computer program to implement the steps of the rotational speed measurement method mentioned in the above embodiments.

[0217] The rotational speed measuring device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.

[0218] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0219] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the rotational speed measurement method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the rotational speed measurement method.

[0220] In some embodiments, the speed measuring device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0221] Those skilled in the art will understand that Figure 12 The structure shown does not constitute a limitation on the speed measuring device and may include more or fewer components than shown.

[0222] In this embodiment, the speed measuring device includes a memory and a processor. The memory stores a computer program. The processor executes the computer program to implement the steps of the speed measuring method mentioned in the above embodiment. Specifically, the speed pulse signal transmitted by the speed sensor is sampled by an analog-to-digital converter (AD) at a preset sampling frequency to obtain a digital speed signal; wherein the digital speed signal contains multiple sampling points; the digital speed signal is divided into a preset number of samples; the single-sample attribute corresponding to each sample is obtained; wherein the single-sample attribute contains the level change information of the digital speed signal; the current speed value is determined according to the sample length of each sample and its corresponding single-sample attribute. Therefore, the above scheme avoids using the original speed pulse frequency data for speed calculation by performing AD sampling on the speed pulse signal transmitted by the speed sensor, dividing the sampled digital speed signal into samples, and using the single-sample attribute of each sample to calculate the current speed value. This avoids the limitation of low speed pulse frequency, greatly reduces the computational load, and saves memory and processor resources.

[0223] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.

[0224] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0225] In this embodiment, a computer program is stored on a computer-readable storage medium. When the computer program is executed by a processor, it implements the steps described in the above method embodiment. Specifically, the rotational speed pulse signal transmitted by the rotational speed sensor is sampled by an analog-to-digital converter (AD) at a preset sampling frequency to obtain a digital rotational speed signal. The digital rotational speed signal contains multiple sampling points. The digital rotational speed signal is sequentially divided into a preset number of samples. The single-sample attribute corresponding to each sample is obtained. The single-sample attribute contains information about the level change of the digital rotational speed signal. The current rotational speed value is determined based on the sample length of each sample and its corresponding single-sample attribute. Therefore, the above scheme avoids using the original rotational speed pulse frequency data for rotational speed calculation by performing AD sampling on the rotational speed pulse signal transmitted by the rotational speed sensor, dividing the sampled digital rotational speed signal into samples, and using the single-sample attribute of each sample to calculate the current rotational speed value. This avoids the limitation of low-frequency rotational speed pulses, greatly reduces the computational load, and saves memory and processor resources.

[0226] The foregoing has provided a detailed description of a rotational speed measurement method, apparatus, device, and medium provided in this application. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0227] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for measuring rotational speed, characterized in that, include: The rotational speed pulse signal transmitted by the rotational speed sensor is subjected to AD sampling according to a preset sampling frequency to obtain a digital rotational speed signal; wherein, the digital rotational speed signal contains multiple sampling points; The digital speed signal is sequentially divided into a preset number of samples; Each sample is assigned a single-sample attribute; wherein the single-sample attribute includes the level change information of the digital rotation speed signal. The current rotational speed value is determined based on the sample length of each sample and its corresponding single-sample attribute; The step of dividing the digital speed signal into a preset number of samples includes: Obtain the minimum rotational speed pulse frequency and the preset single sample length; The digital speed signal is divided into the preset number of samples according to the minimum speed pulse frequency and the preset single sample length to obtain a comprehensive analysis interval; Each sampling point in each sample within the comprehensive analysis interval is numbered sequentially. Obtaining the single-sample attribute corresponding to the sample includes: Obtain the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge; The step of obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge includes: The sampling point number corresponding to the first rising edge and the sampling point number corresponding to the last rising edge in the sample are initialized to preset values, and the number of rising edges is initialized to 0. The state of the current sampling point in the sample is obtained, and the state of the previous sampling point corresponding to the current sampling point is obtained; wherein, the state of the sampling point includes a low level state and a high level state; when the current sampling point is obtained for the first time in the sample, the current sampling point is the first sampling point; Based on the state of the current sampling point and the state of the previous sampling point, determine whether the current sampling point is a rising edge; If the current sampling point is not a rising edge, then the next sampling point in the sample is obtained as the current sampling point, and the process returns to the step of obtaining the state of the current sampling point in the sample; If the current sampling point is a rising edge, then determine whether the number of the sampling point corresponding to the first rising edge is a preset value; If the number of the sampling point corresponding to the first rising edge is the preset value, then the number of the sampling point corresponding to the first rising edge and the number of the sampling point corresponding to the last rising edge are set to the number of the current sampling point, and the number of rising edges is incremented by 1; If the number of the sampling point corresponding to the first rising edge is not the preset value, then the number of the sampling point corresponding to the last rising edge is set to the number of the current sampling point, and the number of rising edges is incremented by 1; The next sampling point in the sample is obtained as the current sampling point, and the process returns to the step of obtaining the current sampling point in the sample, until all sampling points in the sample have been traversed. The step of determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute includes: The total number of valid pulses within the comprehensive analysis interval is obtained based on the single-sample attributes of each sample; wherein, the comprehensive analysis interval includes all the samples. The number of sampling points analyzed for each sample is obtained respectively; The number of sampling points analyzed for each sample is summed to obtain the number of sampling points analyzed for the comprehensive analysis interval. The current rotational speed value is determined based on the number of effective pulses, the preset sampling frequency, the number of sampling points analyzed in the comprehensive analysis interval, and the number of teeth of the rotational speed sensor.

2. The rotational speed measurement method according to claim 1, characterized in that, The step of obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge includes: The sampling point number corresponding to the first rising edge and the sampling point number corresponding to the last rising edge in the sample are both initialized to -1, and the number of rising edges is initialized to 0. Obtain the state of the first sampling point in the sample, and assign the state of the first sampling point to the state flag bit; wherein, the state flag bit represents the state of the previous sampling point corresponding to the current sampling point; Initialize the current loop count to 1; Determine whether the current loop count is less than the sample length of the sample; If the current loop count is less than the sample length of the sample, then determine whether the state of the sampling point numbered with the current loop count is different from the state flag bit, and the state flag bit is 0; If the state of the sampling point numbered at the current loop number is different from the state flag bit, and the state flag bit is 0, then determine whether the number of the sampling point corresponding to the first rising edge is -1; If the number of the sampling point corresponding to the first rising edge is not -1, then the number of the sampling point corresponding to the last rising edge is set to the current loop count, and the number of rising edges is incremented by 1; If the number of the sampling point corresponding to the first rising edge is -1, then the number of the sampling point corresponding to the first rising edge is set to the current loop count, the number of the sampling point corresponding to the last rising edge is set to the current loop count, and the number of rising edges is incremented by 1; If the state of the sampling point numbered at the current loop number is the same as the state flag bit, and / or the state flag bit is not 0, then the state flag bit is set to the state of the sampling point numbered at the current loop number, and the current loop number is incremented by 1; Return to the step of determining whether the current loop count is less than the sample length of the sample; If the current loop count is not less than the sample length of the sample, then the process of obtaining the number of rising edges in the sample, the number of the sampling point corresponding to the first rising edge, and the number of the sampling point corresponding to the last rising edge ends.

3. The rotational speed measurement method according to claim 1, characterized in that, The step of obtaining the number of sampling points for each sample includes: The difference between the sample length of the first sample in all the samples and the number of the sampling point corresponding to the first rising edge is obtained to obtain the number of sampling points analyzed for the first sample. Obtain the number of the sampling point corresponding to the last rising edge of the last sample in all the samples, so as to obtain the number of sampling points analyzed for the last sample; Obtain the sample length of each of the remaining samples in all the samples to obtain the number of sampling points analyzed for each of the remaining samples.

4. The rotational speed measurement method according to claim 1, characterized in that, Before determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute, and after obtaining the single-sample attribute corresponding to each sample, the method further includes: Write each of the single-sample attributes within the comprehensive analysis interval into the attribute cache area; The maximum number of attribute caches in the attribute cache area is adapted to the number of samples in the comprehensive analysis area.

5. The rotational speed measurement method according to claim 4, characterized in that, The step of determining the current rotational speed value based on the sample length of each sample and its corresponding single-sample attribute includes: Determine whether the single-sample attribute in the attribute cache is full; If the single-sample attribute in the attribute cache is not full, then the current rotation speed value is set to 0, and the process ends. If the single-sample attribute in the attribute buffer is full, then the number of rising edges in the comprehensive analysis interval and the number of sampling points analyzed in the comprehensive analysis interval are both set to 0; Traverse the attribute cache area and determine whether the traversal of the attribute cache area has been completed; If the attribute cache has not been fully traversed, then the single-sample attribute in the attribute cache is retrieved; Determine whether the single-sample attribute is the first single-sample attribute in the attribute cache; If it is confirmed to be the first single-sample attribute, then obtain the first difference between the sample length and the number of the sampling point corresponding to the first rising edge in the single-sample attribute, sum the number of sampling point analyses in the comprehensive analysis interval with the first difference to update the number of sampling point analyses in the comprehensive analysis interval; sum the number of rising edges in the comprehensive analysis interval with the number of rising edges in the single-sample attribute to update the number of rising edges in the comprehensive analysis interval. If it is confirmed that it is not the first single-sample attribute, then determine whether the single-sample attribute is the last single-sample attribute in the attribute cache. If it is confirmed to be the last single-sample attribute, then the number of sampling points analyzed in the comprehensive analysis interval is summed with the number of the sampling point corresponding to the last rising edge in the single-sample attribute to update the number of sampling points analyzed in the comprehensive analysis interval; the number of rising edges in the comprehensive analysis interval is summed with the number of rising edges in the single-sample attribute to update the number of rising edges in the comprehensive analysis interval. If it is confirmed that it is not the last single sample attribute, then the number of sampling point analyses in the comprehensive analysis interval is summed with the sample length to update the number of sampling point analyses in the comprehensive analysis interval; the number of rising edges in the comprehensive analysis interval is summed with the number of rising edges in the single sample attribute to update the number of rising edges in the comprehensive analysis interval. Return to the step of determining whether the attribute cache has been completely traversed; If the attribute cache traversal is completed, then obtain the second difference between the number of rising edges minus 1 in the comprehensive analysis interval, and obtain the first quotient between the number of sample points analyzed in the comprehensive analysis interval and the preset sampling frequency; obtain the second quotient between the second difference and the first quotient to obtain the rotational speed pulse frequency; The current rotational speed value is determined based on the rotational speed pulse frequency.

6. The rotational speed measurement method according to claim 4, characterized in that, The step of writing each of the single-sample attributes within the comprehensive analysis interval into the attribute cache includes: Determine whether the number of single-sample attributes in the attribute cache has reached the maximum number of attribute caches; If not, the single-sample attribute is written into the attribute cache area; If so, delete the single-sample attribute with the longest write time in the attribute cache, and write the single-sample attribute into the attribute cache.

7. A speed measuring device, characterized in that, The apparatus for performing the rotational speed measurement method according to any one of claims 1 to 6, the apparatus comprising: The sampling module is used to perform AD sampling on the speed pulse signal transmitted by the speed sensor according to a preset sampling frequency to obtain a digital speed signal; wherein, the digital speed signal contains multiple sampling points; The processing module is used to divide the digital speed signal into a preset number of samples sequentially; The acquisition module is used to acquire the single-sample attributes corresponding to each of the samples respectively; wherein, the single-sample attributes include the level change information of the digital speed signal; The determination module is used to determine the current rotational speed value based on the sample length of each sample and its corresponding single sample attribute.

8. A speed measuring device, characterized in that, include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the rotational speed measurement method as described in any one of claims 1 to 6.

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