Motor speed determination method, device, equipment and storage medium based on Hall element
When the level state of the Hall element occurs, the absolute value of the motor speed is calculated based on the invalid change counting period value of the previous calculation period, which solves the problem of large calculation error at low speeds and improves the accuracy of speed calculation Spend.
Patent Information
- Application Number
- CN202410878544.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-07-02
AI Technical Summary
In the prior art, when calculating the motor speed and when the motor speed is low, the Hall sensor may not detect a level jump, resulting in large calculation errors and affecting speed control.
In each calculation cycle, it is determined whether the level state of the Hall element has an effective jump. If it occurs, the absolute value of the rotation speed is calculated based on the invalid change counting period value of the previous calculation cycle, and before one electric cycle is reached, according to The preset state sequence changes determine the effective jump.
It improves the accuracy of motor speed calculation, reduces the speed calculation error, and avoids misjudging the speed to zero at low speeds.
Smart Images

Figure CN118624935B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of motor speed determination, and in particular to a motor speed determination method, device, equipment and storage medium based on Hall elements. Background Art
[0002] With the development of new energy technology, electric vehicles are becoming more and more widely used. Electric vehicles can include road vehicles and non-road vehicles. Non-road vehicles can include forklifts, ball cars and aerial work platforms.
[0003] The driver of an electric vehicle can obtain the actual speed of the motor of the vehicle. When the actual speed of the motor does not match the target speed of the motor corresponding to the target speed of the vehicle, the driver controls the motor to accelerate or decelerate, and adjusts the speed of the motor so that the speed of the motor is close to the target speed. When the driver adjusts the speed of the motor, it can adopt the speed loop control strategy and the current loop control strategy, take the target speed and actual speed of the motor as the input parameters of the speed loop control strategy, output the target current to the current loop, and the current loop outputs the target voltage to the motor according to the target current to adjust the motor speed.
[0004] The motor driver can obtain the actual speed of the motor through the Hall sensor. The Hall sensor is installed on the motor, and the motor speed can be calculated through the pulse waveform output by the Hall sensor. The prior art generally measures the number of level jumps of the Hall sensor within a certain period of time, and calculates the motor speed based on the number of level jumps and the elapsed time. However, when the motor speed is low, the level of the Hall sensor does not jump within a certain period of time, and the motor speed will be calculated as zero, resulting in a large error in the calculated motor speed, which affects the control of the motor speed. Summary of the invention
[0005] The present invention provides a method, device, equipment and storage medium for determining the motor speed based on a Hall element, so as to solve the problem of large calculation error of the motor speed.
[0006] According to one aspect of the present invention, a method for determining a motor speed based on a Hall element is provided. The method for determining a motor speed based on a Hall element comprises:
[0007] In each calculation cycle, if the level state of the Hall element changes effectively, the absolute value of the motor speed is calculated based on the count cycle value of the invalid state change corresponding to the previous calculation cycle, and the count cycle value is set to zero; wherein, before the level state change of the Hall element reaches one electrical cycle, the effective change to the level state changes in a preset state sequence; after the level state change of the Hall element reaches one electrical cycle, the effective change to the level state change is consistent with the initial state change;
[0008] If the level state of the Hall element does not change effectively, the count cycle value of the invalid state change is increased by one, and the absolute value of the motor speed is calculated based on the count cycle value corresponding to the current calculation cycle;
[0009] The rotational speed direction of the motor is determined according to the order in which the level states of the Hall elements change, and the rotational speed of the motor is determined according to the rotational speed direction and the absolute value of the rotational speed.
[0010] Optionally, the level state of the Hall element does not undergo a valid jump, including:
[0011] The level state of the Hall element has no jump or an invalid jump occurs; wherein, before the level state jump of the Hall element reaches one electrical cycle, the invalid jump means that the level state does not change in the preset state sequence, or the level state jumps to a state other than the preset state; after the level state jump of the Hall element reaches one electrical cycle, the invalid jump means that the level state does not change in the preset state sequence, or the level state of the Hall element jumps to a state other than the preset state, or the level state jump is different from the initial state jump.
[0012] Optionally, if the level state of the Hall element changes effectively, the absolute value of the motor speed is calculated based on the count cycle value of the invalid state change corresponding to the previous calculation cycle, including:
[0013] If the level state of the Hall element changes effectively, the target cycle value is determined to be the count cycle value of the invalid state change corresponding to the previous calculation cycle plus one, and the product of the target cycle value and the duration of the calculation cycle is used as the first target duration;
[0014] Dividing the first target number of level state transitions in the current calculation cycle by the first target product to obtain an absolute value of the rotation speed of the motor;
[0015] Among them, before the level state jump of the Hall element reaches one electrical cycle, the first target product is the product of the first target time length, the number of pole pairs of the motor and the number of level states within one electrical cycle; after the level state jump of the Hall element reaches one electrical cycle, the first target product is the product of the first target time length and the number of pole pairs of the motor.
[0016] Optionally, calculating the absolute value of the rotation speed of the motor based on the counting cycle value corresponding to the current calculation cycle includes:
[0017] If the current counting cycle value of the invalid state change in the current calculation cycle is less than or equal to the historical counting cycle value of the corresponding invalid state change in the historical calculation cycle, then the absolute value of the motor speed is determined to be the absolute value of the historical speed in the historical calculation cycle; wherein the historical calculation cycle is the counting cycle of the last valid change of the level state;
[0018] If the current counting cycle value of the invalid state change in the current calculation cycle is greater than the historical counting cycle value, the product of the current counting cycle value and the duration of the calculation cycle is used as the second target duration; and 1 is divided by the second target product to obtain the absolute value of the rotation speed of the motor;
[0019] Among them, before the level state jump of the Hall element reaches one electrical cycle, the second target product is the product of the second target time length, the number of pole pairs of the motor and the number of level states within one electrical cycle; after the level state jump of the Hall element reaches one electrical cycle, the second target product is the product of the second target time length and the number of pole pairs of the motor.
[0020] Optionally, the method further comprises:
[0021] If the count cycle value of the invalid change of the level state of the Hall element reaches a first preset value, it is determined that the speed of the motor is zero.
[0022] Optionally, three Hall elements are evenly arranged on the motor; and the method further comprises:
[0023] If the number of times that the level values of the three Hall elements are all the first value or all the second value reaches a second preset value, a fault alarm signal is issued.
[0024] Optionally, the method further comprises:
[0025] If the difference between the current speed of the motor in the current calculation cycle and the previous speed of the motor in the previous calculation cycle is greater than the maximum speed increment, it is determined that the current speed is invalid; wherein the maximum speed increment is calculated based on the maximum acceleration of the motor and the duration of the calculation cycle.
[0026] According to another aspect of the present invention, a device for determining motor speed based on a Hall element is provided, comprising:
[0027] The first speed absolute value calculation module is used to calculate the absolute value of the speed of the motor based on the count cycle value of the invalid state change corresponding to the previous calculation cycle in each calculation cycle if the level state of the Hall element changes effectively, and set the count cycle value to zero; wherein, before the level state of the Hall element changes for one electrical cycle, the effective change to the level state changes in accordance with a preset state sequence; after the level state of the Hall element changes for one electrical cycle, the effective change to the level state change is consistent with the initial state change;
[0028] A second speed absolute value calculation module is used to increase the count cycle value of invalid state change by one if the level state of the Hall element does not change effectively, and calculate the absolute value of the motor speed based on the count cycle value corresponding to the current calculation cycle;
[0029] The rotation speed determination module is used to determine the rotation speed direction of the motor according to the order of the level state change of the Hall element, and determine the rotation speed of the motor according to the rotation speed direction and the absolute value of the rotation speed.
[0030] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0031] at least one processor; and
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the motor speed determination method based on Hall elements described in any embodiment of the present invention.
[0034] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the motor speed determination method based on Hall elements described in any embodiment of the present invention when executed.
[0035] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the method for determining a motor speed based on a Hall element according to any embodiment of the present invention is implemented.
[0036] The technical solution of the embodiment of the present invention can calculate the absolute value of the motor speed by counting the cycle value of the invalid change of the state corresponding to the previous calculation cycle when the level state of the Hall element changes effectively. Therefore, when calculating the absolute value of the speed, not only the duration of the current calculation cycle corresponding to the effective jump of the level state is considered, but also the number of cycles of the invalid jump that has passed before is considered, so that the duration corresponding to the current effective jump can be accurately determined, thereby improving the accuracy of the motor speed calculation. Before the level state jump of the Hall element reaches an electrical cycle, the effective jump to the level state changes according to the preset state sequence; after the level state jump of the Hall element reaches an electrical cycle, the effective jump to the level state jump is consistent with the initial state jump. In this way, before reaching an electrical cycle, the motor speed can be calculated according to the level state change, avoiding the determination of the motor speed as zero due to the absence of periodic jumps, that is, avoiding the misjudgment of the motor speed. After reaching an electrical cycle, the motor speed is calculated based on the periodic change of the level state, which can avoid the situation where a level state jump cannot correspond to one-sixth of the electrical cycle when the Hall element is not completely evenly set, that is, it can avoid the situation where a level state jump does not correspond to the motor turning one-sixth of a circle, which can effectively improve the accuracy of the motor speed calculation and reduce the speed calculation error. In addition, when the level state has an invalid jump or no jump, the absolute value of the motor speed is still calculated instead of directly determining the motor speed to be zero. When the motor speed is low, the misjudgment of the motor speed is avoided, thereby reducing the calculation error of the motor speed and improving the accuracy of the motor speed calculation.
[0037] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 is a flow chart of a method for determining motor speed based on Hall elements provided by an embodiment of the present invention;
[0040] Figure 2 is a schematic diagram of the level state of the Hall element provided by an embodiment of the present invention;
[0041] Figure 3 is a flow chart of another method for determining motor speed based on Hall elements provided by an embodiment of the present invention;
[0042] Figure 4 is a flow chart of another method for determining motor speed based on Hall elements provided in an embodiment of the present invention;
[0043] Figure 5 1 is a schematic diagram of the structure of a motor speed determination device based on a Hall element provided in an embodiment of the present invention;
[0044] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0047] An embodiment of the present invention provides a method for determining a motor speed based on a Hall element. A Hall element is a Hall sensor. A Hall element is a magnetic sensor based on the Hall effect. A plurality of Hall elements are regularly arranged on a motor. When the rotor of the motor passes through the Hall element, the pulse signal output by the Hall element changes. The pulse signal of the Hall element can be obtained, and the number of pulses emitted per unit time can be measured to determine the speed of the motor. The method for determining a motor speed based on a Hall element of this embodiment can be implemented by a motor speed determining device based on a Hall element, and the motor speed determining device based on a Hall element can be set in a motor driver.
[0048] Figure 1 is a flow chart of a method for determining motor speed based on a Hall element provided by an embodiment of the present invention, with reference to Figure 1 , the motor speed determination method based on Hall element includes:
[0049] S110. In each calculation cycle, determine whether the level state of the Hall element changes effectively. If so, execute step S120; if not, execute step S130.
[0050] S120. Calculate the absolute value of the motor speed based on the counting cycle value of the invalid state change corresponding to the previous calculation cycle, and set the counting cycle value to zero; wherein, before the level state jump of the Hall element reaches one electrical cycle, the effective jump to the level state changes in a preset state sequence; after the level state jump of the Hall element reaches one electrical cycle, the effective jump to the level state jump is consistent with the initial state jump.
[0051] Wherein, the duration of each calculation cycle is a preset duration, and the motor speed is calculated once every preset duration. The level state of the Hall element includes the level values of all Hall elements. When at least one Hall element is set on the motor, the output level of at least one Hall element changes, and the level state of the Hall element will jump. The counting cycle value of invalid state change can count the calculation cycles in which the level state has invalid jumps and no jumps.
[0052] For example, if three Hall elements are evenly arranged on the motor, when the motor is operating normally, the level states of the Hall elements can be six states: 010, 011, 001, 101, 100, and 110. Among them, for example, 010 means that the second Hall element outputs a high level, and the other two Hall elements output a low level. For example, 011 means that the second and third Hall elements output a high level, and the first Hall element outputs a low level. The other level states are similar and will not be repeated here. The six states are converted to decimal values of 2, 3, 1, 5, 4, and 6. Figure 2 is a schematic diagram of the level state of the Hall element provided by an embodiment of the present invention, such as Figure 2 As shown, h A Indicates the pulse signal output by the first Hall element, h B Indicates the pulse signal output by the second Hall element, h C Indicates the pulse signal output by the third Hall element. The t1 stage is the pulse signal when the level state of the Hall element is state 2, the t2 stage is the pulse signal when the level state of the Hall element is state 3, the t3 stage is the pulse signal when the level state of the Hall element is state 1, the t4 stage is the pulse signal when the level state of the Hall element is state 5, the t5 stage is the pulse signal when the level state of the Hall element is state 4, and the t6 stage is the pulse signal when the level state of the Hall element is state 6.
[0053] For example, the preset state sequence is 2, 3, 1, 5, 4, 6, and 6, 4, 5, 1, 3, 2. The sequence of 2, 3, 1, 5, 4, 6 indicates that the motor rotates forward, and the sequence of 6, 4, 5, 1, 3, 2 indicates that the motor rotates reversely. Alternatively, the sequence of 2, 3, 1, 5, 4, 6 indicates that the motor rotates reversely, and the sequence of 6, 4, 5, 1, 3, 2 indicates that the motor rotates forward. In some other embodiments, the preset state sequence may also be 5, 1, 3, 2, 6, 4, or other sequences, which are not limited in this embodiment.
[0054] Among them, one electrical cycle is a cycle in which the level state of the Hall element jumps in a preset state sequence. One electrical cycle corresponds to one rotation of the motor. When the three Hall elements are completely evenly set, each level state jump corresponds to one sixth rotation of the motor.
[0055] Before an electrical cycle, the level state jumps in the preset state sequence, which is a valid jump. For example, the jump from state 2 to state 3 is a valid jump, and the jump from state 3 to state 1 is also a valid jump. For example, the initial state jump is from state 2 to state 3. After an electrical cycle, if the jump from state 2 to state 3 occurs again, it is a valid jump. For example, the initial state jump is from state 1 to state 5. After an electrical cycle, if the jump from state 1 to state 5 occurs again, it is a valid jump.
[0056] Specifically, the count cycle value of the invalid change of state corresponding to the previous calculation cycle is the number of cycles passed before the current calculation cycle, and the duration corresponding to the current valid jump can be determined according to the number of cycles of invalid jumps passed before the current calculation cycle. Therefore, by calculating the absolute value of the motor speed based on the count cycle value of the invalid change of state corresponding to the previous calculation cycle when the level state of the Hall element effectively jumps. Therefore, when calculating the absolute value of the speed, not only the duration of the current calculation cycle corresponding to the effective jump of the level state is considered, but also the number of cycles of invalid jumps that have passed before is considered, so that the duration corresponding to the current valid jump can be accurately determined, thereby improving the accuracy of the motor speed calculation.
[0057] For example, if the current calculation cycle is the fourth calculation cycle, a valid jump occurs in the first calculation cycle, but no valid jump occurs in the second calculation cycle, then the counting cycle value of invalid state change is 1; if no valid jump occurs in the third calculation cycle, then the counting cycle value of invalid state change is 2; if a valid jump occurs in the fourth calculation cycle, then the duration of the valid jump can be determined based on the counting cycle value 2 of invalid state change and the current calculation cycle.
[0058] By setting the count cycle value of invalid state change to zero when a valid jump occurs in the level state, the duration of the valid jump can be accurately determined when a valid jump occurs next time, further improving the accuracy of the speed calculation.
[0059] More importantly, before the level state jump of the Hall element reaches an electrical cycle, the effective jump to the level state changes in accordance with the preset state sequence; after the level state jump of the Hall element reaches an electrical cycle, the effective jump to the level state jump is consistent with the initial state jump. In this way, before reaching an electrical cycle, the motor speed can be calculated according to the level state change, avoiding the determination of the motor speed as zero without periodic jumps, that is, avoiding the misjudgment of the motor speed. And after reaching an electrical cycle, the effective jump to the level state jump is consistent with the initial state jump, that is, the motor speed is calculated according to the periodic change of the level state, which can avoid the situation that when the Hall element is not completely evenly set, a level state jump cannot correspond to one-sixth of the electrical cycle, that is, it can avoid the situation that a level state jump does not correspond to the motor turning one-sixth of a circle, and when the level state changes periodically, it can be determined that the motor has turned a circle, that is, the motor speed is calculated according to the periodic change of the level state, which can effectively improve the accuracy of the motor speed calculation and reduce the calculation error of the speed.
[0060] S130, adding one to the counting cycle value of the invalid state change, and calculating the absolute value of the rotation speed of the motor based on the counting cycle value corresponding to the current calculation cycle.
[0061] The count cycle value of invalid state change is the number of cycles in which the level state has invalid jumps and no jumps. For example, in the first calculation cycle, the level state has invalid jumps, and the count cycle value of invalid state change is 1. In the second calculation cycle, the level state has no jump, and the count cycle value of invalid state change is 2.
[0062] Specifically, when the level state of the Hall element undergoes an invalid jump or no jump, the count cycle value of the invalid state change is added by one, and the number of cycles through which the level state undergoes an invalid jump or no jump can be determined. Then, according to the calculation cycle value corresponding to the current calculation cycle, the duration through which the level state undergoes an invalid jump or no jump can be determined, thereby determining the absolute value of the motor's rotation speed. Thus, when the level state undergoes an invalid jump or no jump, the absolute value of the motor's rotation speed is still calculated, rather than directly determining that the motor's rotation speed is zero. When the motor's rotation speed is low, the misjudgment of the motor's rotation speed is avoided, thereby reducing the calculation error of the motor's rotation speed and improving the accuracy of the motor's rotation speed calculation.
[0063] S140, determining the rotational speed direction of the motor according to the order in which the level state of the Hall element changes, and determining the rotational speed of the motor according to the rotational speed direction and the absolute value of the rotational speed.
[0064] Specifically, the direction of the motor's rotation speed can be determined by comparing the order of the level state changes of the Hall element with the set preset state order. For example, the preset state order is 2, 3, 1, 5, 4, 6, and 6, 4, 5, 1, 3, 2. The order of 2, 3, 1, 5, 4, 6 indicates that the motor rotates forward, and the order of 6, 4, 5, 1, 3, 2 indicates that the motor rotates reversely. Then, when the level state jumps from 2 to 3, and then jumps from 3 to 1, it can be determined that the motor is rotating forward.
[0065] When determining the rotational speed direction, it can be determined based on a sequence of state changes or based on several consecutive state changes, thereby improving the accuracy of the rotational speed direction determination.
[0066] The motor speed can be determined by combining the direction of the motor speed and the absolute value of the speed, that is, the motor speed has a direction sign. By determining the motor speed, it is easy to control the motor and thus realize the control of the vehicle.
[0067] The technical solution of this embodiment can calculate the absolute value of the motor speed by counting the invalid change of the state corresponding to the previous calculation cycle when the level state of the Hall element changes effectively. Therefore, when calculating the absolute value of the speed, not only the duration of the current calculation cycle corresponding to the effective jump of the level state is considered, but also the number of cycles of the invalid jump that has passed before is considered, so that the duration corresponding to the current effective jump can be accurately determined, thereby improving the accuracy of the motor speed calculation. Before the level state jump of the Hall element reaches an electrical cycle, the effective jump to the level state changes according to the preset state sequence; after the level state jump of the Hall element reaches an electrical cycle, the effective jump to the level state jump is consistent with the initial state jump. In this way, before reaching an electrical cycle, the motor speed can be calculated according to the level state change, avoiding the determination of the motor speed as zero due to the absence of periodic jumps, that is, avoiding the misjudgment of the motor speed. After reaching an electrical cycle, the motor speed is calculated based on the periodic change of the level state, which can avoid the situation where a level state jump cannot correspond to one-sixth of the electrical cycle when the Hall element is not completely evenly set, that is, it can avoid the situation where a level state jump does not correspond to the motor turning one-sixth of a circle, which can effectively improve the accuracy of the motor speed calculation and reduce the speed calculation error. In addition, when the level state has an invalid jump or no jump, the absolute value of the motor speed is still calculated instead of directly determining the motor speed to be zero. When the motor speed is low, the misjudgment of the motor speed is avoided, thereby reducing the calculation error of the motor speed and improving the accuracy of the motor speed calculation.
[0068] On the basis of the above technical solution, optionally, the level state of the Hall element does not effectively change, including:
[0069] The level state of the Hall element has no jump or an invalid jump occurs; wherein, before the level state jump of the Hall element reaches one electrical cycle, the invalid jump means that the level state does not change in the preset state sequence, or the level state jumps to a state other than the preset state; after the level state jump of the Hall element reaches one electrical cycle, the invalid jump means that the level state does not change in the preset state sequence, or the level state of the Hall element jumps to a state other than the preset state, or the level state jump is different from the initial state jump.
[0070] Exemplarily, for example, the preset state sequence is 2, 3, 1, 5, 4, 6, and 6, 4, 5, 1, 3, 2. Before the level state jump of the Hall element reaches one electrical cycle, the level state does not change in the preset state sequence, for example, the level state of the Hall element jumps from state 1 to 2, indicating that an invalid jump has occurred. When the level state jumps to a state other than the preset state, for example, when the level state jumps to 000 or 111, it indicates that an invalid jump has occurred.
[0071] For example, the initial state jumps from state 2 to state 3. After the level state jump of the Hall element reaches one electrical cycle, the level state does not change in the preset state sequence, for example, the level state of the Hall element jumps from state 1 to 2, indicating that an invalid jump has occurred. When the level state jumps to a state other than the preset state, for example, when the level state jumps to 000 or 111, it indicates that an invalid jump has occurred. When the level state jump is different from the initial state jump, for example, the level state jumps from state 5 to state 4, it indicates that an invalid jump has occurred.
[0072] In this way, it can be determined whether the jump in the level state is a valid jump or an invalid jump, so that it is convenient to calculate the absolute value of the motor speed by using different calculation methods according to the situation of the level state jump, so as to achieve accurate calculation of the motor speed.
[0073] Based on the above technical solutions, Figure 3 is a flowchart of another method for determining the motor speed based on a Hall element provided by an embodiment of the present invention. Optionally, refer to Figure 3 , the motor speed determination method based on Hall element includes:
[0074] S210. In each calculation cycle, determine whether the level state of the Hall element changes effectively. If so, execute step S220; if not, execute step S240.
[0075] S220: Determine a target cycle value that is the count cycle value of the invalid state change corresponding to the previous calculation cycle plus one, and take the product of the target cycle value and the duration of the calculation cycle as the first target duration.
[0076] For example, the count period of invalid state changes corresponding to the previous calculation period is N n-1 , the target cycle value is K, then the target cycle value K=N n-1 +1. For example, if the current calculation cycle is the fourth calculation cycle, the previous calculation cycle is the third calculation cycle. If a valid jump occurs in the first calculation cycle and no valid jump occurs in the second calculation cycle, the count cycle value of invalid state change is 1. If no valid jump occurs in the third calculation cycle, the count cycle value of invalid state change is 2. If a valid jump occurs in the fourth calculation cycle, the target cycle value is 3.
[0077] For example, if the duration of the cycle Tm is calculated, the first target duration is Tm×K. In this way, by calculating the first target duration, the duration corresponding to the current valid jump can be determined.
[0078] S230, dividing the first target number of level state jumps in the current calculation cycle by the first target product to obtain the absolute value of the motor's rotational speed; and setting the counting cycle value to zero; wherein, before the level state jump of the Hall element reaches one electrical cycle, the first target product is the product of the first target duration, the number of pole pairs of the motor and the number of level states in one electrical cycle; after the level state jump of the Hall element reaches one electrical cycle, the first target product is the product of the first target duration and the number of pole pairs of the motor.
[0079] For example, if the number of pole pairs of the motor is P, when three Hall elements are provided, the number of level states in one electrical cycle is 6. Before the level state jump of the Hall element reaches one electrical cycle, the first target product is Tm×K×P×6. After the level state jump of the Hall element reaches one electrical cycle, the first target product is Tm×K×P. In this way, the absolute value of the motor speed can be calculated by dividing the first target number by the first target product.
[0080] Optionally, the duration Tm of the calculation cycle is less than or equal to a set value. If the set value is small, such as 100 microseconds, the duration of the calculation cycle is very small, and the level state of the Hall element changes at most once in one calculation cycle, and the first target number is 1. Therefore, before the level state of the Hall element changes for one electrical cycle, the absolute value V of the motor speed is After the level state of the Hall element jumps to one electrical cycle, the absolute value of the motor speed is In this way, it is possible to avoid misjudging multiple jumps in the level state as invalid jumps, thereby improving the accuracy of the motor speed calculation.
[0081] S240, adding one to the counting cycle value of the invalid state change, and calculating the absolute value of the rotation speed of the motor based on the counting cycle value corresponding to the current calculation cycle.
[0082] S250, determining the rotational speed direction of the motor according to the order in which the level state of the Hall element changes, and determining the rotational speed of the motor according to the rotational speed direction and the absolute value of the rotational speed.
[0083] Based on the above technical solutions, Figure 4 is a flowchart of another method for determining the motor speed based on a Hall element provided by an embodiment of the present invention. Optionally, refer to Figure 4 , the motor speed determination method based on Hall element includes:
[0084] S310. In each calculation cycle, determine whether the level state of the Hall element changes effectively. If so, execute step S320; if not, execute step S330.
[0085] S320, calculating the absolute value of the rotation speed of the motor based on the counting cycle value of the invalid state change corresponding to the previous calculation cycle, and setting the counting cycle value to zero.
[0086] S330, determine whether the current counting cycle value of the invalid state change in the current calculation cycle is greater than the historical counting cycle value of the corresponding invalid state change in the historical calculation cycle. If not, execute step S340; if so, execute step S350; wherein the historical calculation cycle is the counting cycle of the last effective change of the level state.
[0087] For example, if no valid jump occurs in the first calculation cycle, the count cycle value of the invalid state change is 1; if no valid jump occurs in the second calculation cycle, the count cycle value of the invalid state change is 2; if no valid jump occurs in the third calculation cycle, the count cycle value of the invalid state change is 3; if a valid jump occurs in the fourth calculation cycle, the count cycle value of the invalid state change is 0. If no valid jump occurs in the fifth calculation cycle, the count cycle value of the invalid state change is 1; if no valid jump occurs in the sixth calculation cycle, the count cycle value of the invalid state change is 2; if no valid jump occurs in the seventh calculation cycle, the count cycle value of the invalid state change is 3; if no valid jump occurs in the eighth calculation cycle, the count cycle value of the invalid state change is 4.
[0088] The historical calculation cycle is the fourth calculation cycle, and the historical counting cycle value is 3. For example, if the current calculation cycle is the sixth calculation cycle, the current counting cycle value of the current calculation cycle is less than the historical counting cycle value. For example, if the current calculation cycle is the eighth calculation cycle, the current counting cycle value of the current calculation cycle is greater than the historical calculation cycle value.
[0089] S340. Determine that the absolute value of the rotation speed of the motor is the absolute value of the historical rotation speed in the historical calculation cycle.
[0090] Specifically, the current count cycle value of the invalid state change in the current calculation cycle is less than the historical count cycle value of the corresponding invalid state change in the historical calculation cycle, indicating that the current calculation cycle has not yet reached the time when a jump is required, and the absolute value of the motor speed can be determined to be the absolute value of the historical speed in the historical calculation cycle. The current count cycle value of the invalid state change in the current calculation cycle is equal to the historical count cycle value of the corresponding invalid state change in the historical calculation cycle, indicating that the motor is running at a uniform speed, and the absolute value of the motor speed can be determined to be the absolute value of the historical speed in the historical calculation cycle.
[0091] In this way, when the level state of the Hall element does not change effectively, the absolute value of the motor speed will also be calculated, which can avoid misjudgment when the motor speed is low and reduce the error of speed calculation.
[0092] S350, taking the product of the current counting cycle value and the duration of the calculation cycle as the second target duration; and dividing 1 by the second target product to obtain the absolute value of the motor speed;
[0093] Among them, before the level state jump of the Hall element reaches one electrical cycle, the second target product is the product of the second target time length, the number of pole pairs of the motor and the number of level states in one electrical cycle; after the level state jump of the Hall element reaches one electrical cycle, the second target product is the product of the second target time length and the number of pole pairs of the motor.
[0094] Specifically, the current count cycle value of the invalid state change in the current calculation cycle is greater than the historical count cycle value of the corresponding invalid state change in the historical calculation cycle, indicating that the motor speed may be reduced, and the product of the current count cycle value and the duration of the calculation cycle is used as the second target duration to obtain the duration of the current calculation cycle. Divide 1 by the second target product to obtain the absolute value of the motor speed. In this way, when the motor speed decreases, it can be known in time that when the level state of the Hall element does not effectively jump, the absolute value of the motor speed will also be calculated, which can avoid misjudgment when the motor speed is low and reduce the error of the speed calculation.
[0095] For example, if the current counting cycle value of the invalid state change in the current calculation cycle is L, and the duration of the calculation cycle is Tm, then the second target duration is Tm×L. Therefore, before the level state jump of the Hall element reaches one electrical cycle, the absolute value V of the motor speed is After the level state of the Hall element jumps to one electrical cycle, the absolute value of the motor speed is
[0096]
[0097] S360, determining the rotational speed direction of the motor according to the order in which the level state of the Hall element changes, and determining the rotational speed of the motor according to the rotational speed direction and the absolute value of the rotational speed.
[0098] On the basis of the above technical solutions, optionally, the method for determining the motor speed based on the Hall element further includes:
[0099] If the count cycle value of the invalid change of the level state of the Hall element reaches a first preset value, it is determined that the speed of the motor is zero.
[0100] Specifically, if the count cycle value of the invalid change of the level state of the Hall element reaches a first preset value, it indicates that the rotor of the motor has not rotated for a long time, that is, the motor has not been running for a long time, and the speed of the motor is determined to be zero. In this way, it can be avoided that the speed is determined to be zero when the level state of the Hall element does not jump effectively, and it can avoid misjudgment when the motor speed is low, and reduce the error of speed calculation.
[0101] On the basis of the above technical solutions, optionally, three Hall elements are evenly arranged on the motor. The motor speed determination method based on Hall elements also includes:
[0102] If the number of times that the level values of the three Hall elements are all the first value or all the second value reaches a second preset value, a fault alarm signal is issued.
[0103] The first value is 1 and the second value is 0; or the first value is 0 and the second value is 1. If the level values of the three Hall elements are all the first value or all the second value, that is, the level state is 000 or 111, and the two states of 000 and 111 are not in the preset state sequence, it indicates that the level state of the Hall element jumps abnormally.
[0104] Specifically, the number of times that the level values of the three Hall elements are all the first value or all the second value is counted. If the number of times that the level values of the three Hall elements are all the first value or all the second value reaches a second preset value, it indicates that the motor or the Hall element is faulty, and a fault alarm message is issued to prompt the user to repair it in time.
[0105] On the basis of the above technical solutions, optionally, the method for determining the motor speed based on the Hall element further includes:
[0106] If the difference between the current speed of the motor in the current calculation cycle and the previous speed of the motor in the previous calculation cycle is greater than the maximum speed increment, it is determined that the current speed is invalid; wherein the maximum speed increment is calculated based on the maximum acceleration of the motor and the duration of the calculation cycle.
[0107] For example, in the i-th calculation cycle (i is a positive integer), the level state of the Hall element changes from state 2 to state 3, and then due to magnetic field interference, it immediately jumps from state 3 to state 2, that is, the level state changes suddenly in a short time, then the absolute value of the calculated speed will be very large, greater than the maximum speed increment, and, because the order of change of the level state is opposite in a short time, the motor driver may think that the speed direction needs to be changed. Therefore, by determining that the current speed is invalid when the difference between the current speed of the motor in the current calculation cycle and the previous speed of the motor in the previous calculation cycle is greater than the maximum speed increment, it can be avoided that the calculated speed is large, which affects the control of the motor speed and improves the accuracy of the speed calculation.
[0108] After determining that the current speed is invalid, the absolute value of the motor speed can be determined by using the calculation method of the motor state corresponding to the level state not having an effective jump, that is, the absolute value of the motor speed can be calculated by using steps S330 to S350.
[0109] The embodiment of the present invention also provides a motor speed determination device based on a Hall element, Figure 5 is a schematic diagram of a motor speed determination device based on a Hall element provided by an embodiment of the present invention, with reference to Figure 5 , the motor speed determination device based on the Hall element includes: a first speed absolute value calculation module 410, a second speed absolute value calculation module 420 and a speed determination module 430;
[0110] The first speed absolute value calculation module 410 is used to calculate the absolute value of the motor speed based on the count cycle value of the invalid state change corresponding to the previous calculation cycle in each calculation cycle if the level state of the Hall element changes effectively, and set the count cycle value to zero; wherein, before the level state of the Hall element changes by one electrical cycle, the effective change to the level state changes in accordance with the preset state sequence; after the level state of the Hall element changes by one electrical cycle, the effective change to the level state change is consistent with the initial state change;
[0111] The second speed absolute value calculation module 420 is used to increase the count cycle value of invalid state change by one if the level state of the Hall element does not change effectively, and calculate the absolute value of the motor speed based on the count cycle value corresponding to the current calculation cycle;
[0112] The speed determination module 430 is used to determine the speed direction of the motor according to the order of the level state changes of the Hall element, and determine the speed of the motor according to the speed direction and the absolute value of the speed.
[0113] The motor speed determination device based on Hall elements provided in the embodiment of the present invention can execute the motor speed determination method based on Hall elements provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0114] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0115] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0116] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0117] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a motor speed determination method based on a Hall element.
[0118] In some embodiments, the motor speed determination method based on the Hall element can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the motor speed determination method based on the Hall element described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the motor speed determination method based on the Hall element in any other appropriate manner (for example, by means of firmware).
[0119] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0120] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0121] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0122] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0123] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0124] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0125] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0126] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for determining motor speed based on Hall element, characterized in that: include: In each calculation cycle, if the level state of the Hall element changes effectively, the absolute value of the motor speed is calculated based on the count cycle value of the invalid state change corresponding to the previous calculation cycle, and the count cycle value is set to zero; wherein, before the level state change of the Hall element reaches one electrical cycle, the effective change to the level state changes in accordance with the preset state sequence; after the level state change of the Hall element reaches one electrical cycle, the effective change to the level state change is consistent with the initial state change; the count cycle value of the invalid state change is the calculation cycle for counting the invalid change or no change of the level state; If the level state of the Hall element does not change effectively, the count cycle value of the invalid state change is increased by one, and the absolute value of the motor speed is calculated based on the count cycle value corresponding to the current calculation cycle; Determining the rotational speed direction of the motor according to the order in which the level state of the Hall element changes, and determining the rotational speed of the motor according to the rotational speed direction and the absolute value of the rotational speed; The level state of the Hall element does not undergo effective jump, including: The level state of the Hall element has no jump or an invalid jump occurs; wherein, before the level state jump of the Hall element reaches one electrical cycle, the invalid jump means that the level state does not change in the preset state sequence, or the level state jumps to a state other than the preset state; after the level state jump of the Hall element reaches one electrical cycle, the invalid jump means that the level state does not change in the preset state sequence, or the level state of the Hall element jumps to a state other than the preset state, or the level state jump is different from the initial state jump; If the level state of the Hall element changes effectively, the absolute value of the motor speed is calculated based on the count cycle value of the invalid state change corresponding to the previous calculation cycle, including: If the level state of the Hall element changes effectively, the target cycle value is determined to be the count cycle value of the invalid state change corresponding to the previous calculation cycle plus one, and the product of the target cycle value and the duration of the calculation cycle is used as the first target duration; The absolute value of the rotation speed of the motor is obtained by dividing the first target number of level state transitions in the current calculation cycle by the first target product; the first target number is the number of level state transitions of the Hall element in one calculation cycle; Wherein, before the level state jump of the Hall element reaches one electrical cycle, the first target product is the product of the first target duration, the number of pole pairs of the motor, and the number of level states in one electrical cycle; after the level state jump of the Hall element reaches one electrical cycle, the first target product is the product of the first target duration and the number of pole pairs of the motor; The step of calculating the absolute value of the rotation speed of the motor based on the counting cycle value corresponding to the current calculation cycle includes: If the current counting cycle value of the invalid state change in the current calculation cycle is less than or equal to the historical counting cycle value of the corresponding invalid state change in the historical calculation cycle, then the absolute value of the motor speed is determined to be the absolute value of the historical speed in the historical calculation cycle; wherein the historical calculation cycle is the calculation cycle in which the last level state has a valid change; If the current counting cycle value of the invalid state change in the current calculation cycle is greater than the historical counting cycle value, the product of the current counting cycle value and the duration of the calculation cycle is used as the second target duration; and 1 is divided by the second target product to obtain the absolute value of the rotation speed of the motor; Among them, before the level state jump of the Hall element reaches one electrical cycle, the second target product is the product of the second target time length, the number of pole pairs of the motor and the number of level states within one electrical cycle; after the level state jump of the Hall element reaches one electrical cycle, the second target product is the product of the second target time length and the number of pole pairs of the motor.
2. The method according to claim 1, characterized in that The method further comprises: If the count cycle value of the invalid change of the level state of the Hall element reaches a first preset value, it is determined that the speed of the motor is zero.
3. The method according to claim 1, characterized in that The motor is evenly provided with three Hall elements; the method further comprises: If the number of times that the level values of the three Hall elements are all the first value or all the second value reaches a second preset value, a fault alarm signal is issued.
4. The method according to claim 1, characterized in that: The method further comprises: If the difference between the current speed of the motor in the current calculation cycle and the previous speed of the motor in the previous calculation cycle is greater than the maximum speed increment, it is determined that the current speed is invalid; wherein the maximum speed increment is calculated based on the maximum acceleration of the motor and the duration of the calculation cycle.
5. A motor speed determination device based on a Hall element, used to execute the motor speed determination method based on a Hall element as claimed in any one of claims 1 to 4, characterized in that: include: The first speed absolute value calculation module is used to calculate the absolute value of the speed of the motor based on the count cycle value of the invalid state change corresponding to the previous calculation cycle in each calculation cycle if the level state of the Hall element changes effectively, and set the count cycle value to zero; wherein, before the level state of the Hall element changes for one electrical cycle, the effective change to the level state changes in accordance with a preset state sequence; after the level state of the Hall element changes for one electrical cycle, the effective change to the level state change is consistent with the initial state change; A second speed absolute value calculation module is used to increase the count cycle value of invalid state change by one if the level state of the Hall element does not change effectively, and calculate the absolute value of the motor speed based on the count cycle value corresponding to the current calculation cycle; The rotation speed determination module is used to determine the rotation speed direction of the motor according to the order of the level state change of the Hall element, and determine the rotation speed of the motor according to the rotation speed direction and the absolute value of the rotation speed.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the motor speed determination method based on Hall elements according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the motor speed determination method based on Hall elements according to any one of claims 1 to 4 when executed.
Citation Information
Patent Citations
Hall signal identification method used for motor control system and apparatus thereof
CN105790652A
Method for measuring rotation speed of brushless direct-current motor
CN106655959A