Motor angle determination method, device, electronic device and storage medium
By determining the initial angle range when the motor starts and using the Hall state change relationship, combining the motor speed and frequency compensation values, the motor angle is periodically determined, which solves the problem of slow Hall sensor signal change at low speeds, and achieves high-precision control of the motor angle.
Patent Information
- Application Number
- CN202510519099.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-04-24
AI Technical Summary
In the prior art, the Hall sensor output signal changes slowly at low speeds, resulting in the inability to accurately determine the motor angle, especially when the motor is not running, the effective level signal cannot be obtained.
The initial angle range is determined by determining the order of change of all Hall element states of the motor and the preset Hall states when the vehicle is started, and the median value of the initial angle range is used as the initial angle; after the vehicle is started, the motor angle is determined based on the preset relationship when the Hall state changes for the first time; during the calculation period, the current calculated angle of the motor is periodically determined in combination with the current rotation speed, control frequency and preset compensation value of the motor.
It improves the accuracy of motor angle determination, ensures that the motor can be accurately controlled at low speeds and stationary conditions, reduces the error in angle determination, and improves the accuracy of motor control.
Smart Images

Figure CN120034073B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of motor technology, and in particular to a method, device, electronic device and storage medium for determining a motor angle. Background Art
[0002] With the rapid development of technologies such as battery energy storage, electric vehicles are also developing rapidly. Electric vehicles can include both road vehicles and non-road vehicles. Non-road vehicles include forklifts and shovel trucks.
[0003] Electric vehicles typically use a controller to control the motor, which rotates to drive a reduction gearbox or hydraulic gear pump to complete the movement. To control the motor, it is necessary to detect the motor's speed and angle, and then control the motor based on the motor's real-time angle and speed.
[0004] A vehicle's motor consists of a three-phase motor, typically equipped with a three-phase Hall effect sensor. The vehicle's controller calculates the motor's speed and angle by capturing each change in the Hall effect sensor's output signal. The Hall effect sensor outputs a pulse signal, which contains both active and inactive levels. However, at low motor speeds, the Hall effect sensor's output signal changes slowly, often failing to obtain an active level. Or, when the motor is not running, the Hall effect sensor's output signal remains unchanged, making it impossible to accurately determine the motor's angle. Summary of the Invention
[0005] The present invention provides a motor angle determination method, device, electronic device and storage medium to solve the problem of being unable to accurately determine the motor angle.
[0006] According to one aspect of the present invention, a method for determining a motor angle is provided, the method comprising:
[0007] When the vehicle is started, the initial angle range of the motor is determined according to the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements;
[0008] Using the median of the initial angle range as the initial angle of the motor;
[0009] After the vehicle is started, when the Hall state changes for the first time, the angle of the motor corresponding to the first change of the Hall state is determined according to the changed Hall state and a preset relationship; wherein the preset relationship is a correspondence between the Hall state and the motor angle;
[0010] In a current calculation cycle, a current calculation angle of the motor is determined according to a current rotation speed, a current control frequency and a preset compensation value of the motor, and an angle of the motor is determined according to the current calculation angle.
[0011] Optionally, in the current calculation cycle, determining the current calculation angle of the motor according to the current speed, the current control frequency and the preset compensation value of the motor includes:
[0012] In a current calculation cycle, determining a current angle increment according to the current rotational speed and the current control frequency;
[0013] A current calculated angle of the motor is determined based on the sum of the current angle increment, a previous angle of the motor, and the preset compensation value.
[0014] Optionally, determining the current angle increment according to the current rotation speed and the current control frequency includes:
[0015] A current angle increment is determined according to a ratio of the current rotational speed to the current control frequency.
[0016] Optionally, the method further includes:
[0017] After the calculation cycle starts, if the Hall states of all Hall elements corresponding to the motor change, the current angle range of the motor is determined according to the changed Hall states and the preset relationship;
[0018] Determining the angle of the motor according to the current calculated angle includes:
[0019] If the current calculated angle is within the corresponding current angle range, the current calculated angle is used as the angle of the motor;
[0020] If the current calculated angle is smaller than the corresponding minimum value of the current angle range, the minimum value of the current angle range is used as the angle of the motor;
[0021] If the current calculated angle is greater than the corresponding maximum value of the current angle range, the maximum value of the current angle range is used as the angle of the motor.
[0022] Optionally, in the current calculation cycle, after determining the current calculation angle of the motor according to the current speed, the current control frequency and the preset compensation value of the motor, the method further includes:
[0023] After the calculation cycle starts, if the Hall state changes, determining the current preset angle of the motor according to the changed Hall state and the preset relationship;
[0024] When the current preset angle is different from the corresponding current calculated angle, determining a current angle compensation value according to an error value between the current preset angle and the current calculated angle;
[0025] The calculation angle determined in a preset number of calculation cycles in the future is compensated according to the current angle compensation value.
[0026] Optionally, compensating the calculation angle determined in a preset number of calculation cycles in the future according to the current angle compensation value includes:
[0027] Determining a unit compensation value according to the preset number and the current angle compensation value;
[0028] The calculation angle determined by a preset number of calculation cycles in the future is compensated according to the unit compensation value.
[0029] Optionally, determining the angle of the motor according to the current calculated angle includes:
[0030] Determining a preset number of changes according to a preset speed and a preset duration of the motor;
[0031] If the number of changes of the Hall state within the preset time period is less than or equal to the preset number of changes, the median of the current angle range corresponding to the motor is used as the angle of the motor;
[0032] If the number of changes of the Hall state within the preset time period is greater than the preset number of changes, the angle of the motor is determined according to the current calculated angle of the motor determined in the current calculation cycle.
[0033] According to another aspect of the present invention, a motor angle determination device is provided, the motor angle determination device comprising:
[0034] An initial angle range determination module, configured to determine the initial angle range of the motor when the vehicle is started, based on the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements;
[0035] an initial angle determination module, configured to use a median value of the initial angle range as the initial angle of the motor;
[0036] a first angle determination module, configured to determine, when the Hall state changes for the first time after the vehicle is started, the angle of the motor corresponding to the first change in the Hall state based on the changed Hall state and a preset relationship; wherein the preset relationship is a correspondence between the Hall state and the motor angle;
[0037] The second angle determination module is used to determine the current calculation angle of the motor according to the current speed, current control frequency and preset compensation value of the motor in the current calculation cycle, and determine the angle of the motor according to the current calculation angle.
[0038] According to another aspect of the present invention, an electronic device is provided, comprising:
[0039] at least one processor; and
[0040] a memory communicatively connected to the at least one processor; wherein,
[0041] The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the motor angle determination method according to any embodiment of the present invention.
[0042] 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 angle determination method according to any embodiment of the present invention when executed.
[0043] 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 angle according to any embodiment of the present invention is implemented.
[0044] The technical solution of the embodiment of the present invention is that when the vehicle starts, the initial angle range of the motor is determined based on the Hall states of all Hall elements corresponding to the motor and the preset Hall state change sequence, and the median of the initial angle range is used as the initial angle of the motor, which can be closer to the actual angle of the motor, thereby improving the accuracy of the motor angle determination. After the vehicle starts, before the Hall state changes for the first time, the initial angle of the motor is used to control the operation of the motor. After the vehicle starts, when the Hall state changes for the first time, the angle of the motor corresponding to the first change of the Hall state is determined from the preset relationship based on the changed Hall state, which can further improve the accuracy of the motor angle determination. After the Hall state changes for the first time, the calculation cycle starts to be cyclically executed. In the current calculation cycle, the angle increment of the motor can be determined by the current speed of the motor and the current control frequency. Then, compensation is performed according to the preset compensation value to obtain the accurate current calculated angle of the motor. A calculated angle of the motor is obtained in each calculation cycle, thereby achieving periodic determination of the motor angle.
[0045] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] 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.
[0047] Figure 1 is a flow chart of a method for determining a motor angle provided by an embodiment of the present invention;
[0048] Figure 2 is a flow chart of another motor angle determination method provided by an embodiment of the present invention;
[0049] Figure 3 is a flow chart of another method for determining a motor angle provided by an embodiment of the present invention;
[0050] Figure 4 1 is a schematic structural diagram of a motor angle determination device provided by an embodiment of the present invention;
[0051] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions 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 embodiments described 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 making creative efforts should fall within the scope of protection of the present invention.
[0053] It should be noted that the terms "first", "second", etc. in the description 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 numbers 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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0054] An embodiment of the present invention provides a method for determining a motor angle. The motor may be a motor in a vehicle, and the vehicle may be an electric vehicle, including both road vehicles and non-road vehicles. Non-road vehicles include forklifts and shovel trucks. The method for determining the motor angle may be executed by a controller in the vehicle. The controller may be a whole-machine controller that controls the operation of the motor, or a separate controller, and this embodiment does not limit this. The motor angle can be used to describe the position of the motor rotor during rotation. That is, the motor angle continuously changes during motor rotation.
[0055] Figure 1 This is a flow chart of a method for determining a motor angle provided by an embodiment of the present invention, with reference to Figure 1 , the motor angle determination method includes:
[0056] S110. When the vehicle is started, the initial angle range of the motor is determined according to the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements.
[0057] Wherein, for example, if the motor is a three-phase motor, the motor is equipped with three Hall elements, and the Hall elements can be set on the stator of the motor or at other locations, which is not limited in this embodiment. The output signal output by the Hall element can be a pulse signal, and each Hall element outputs a pulse signal, so the three Hall elements output three pulse signals. The Hall state is the level value of the output signal of all Hall elements, so when the motor is operating normally, the Hall state can be 001, 010, 011, 100, 101 or 110. Wherein, for example, 010 means the second Hall element outputs a high level, and the other two Hall elements output a low level. For example, 011 means the second Hall element and the third Hall element output a high level, and the first Hall element outputs a low level. The other Hall states are similar and will not be repeated here. The preset Hall state change order is pre-set, for example, when the motor rotates forward, it changes in the order of 010, 011, 001, 101, 100, and 110.
[0058] Specifically, for example, if the Hall elements are evenly arranged on the motor, each change in the Hall state means that the motor has rotated 60°, that is, rotated through a sector. The Hall state has a corresponding relationship with the motor angle. For example, a Hall state of 010 corresponds to a motor angle of 0°, a Hall state of 011 corresponds to a motor angle of 60°, a Hall state of 001 corresponds to a motor angle of 120°, a Hall state of 101 corresponds to a motor angle of 180°, a Hall state of 100 corresponds to a motor angle of 240°, a Hall state of 110 corresponds to a motor angle of 300°, and a Hall state of 010 corresponds to a motor angle of 360°, that is, 0°.
[0059] Therefore, the initial angle range of the motor can be determined by the Hall state and the known preset Hall state change sequence. For example, when the Hall state is 011, the initial angle range of the motor is greater than or equal to 60° and less than 120°.
[0060] S120: Using the median of the initial angle range as the initial angle of the motor.
[0061] Specifically, the median of the initial angle range is obtained by adding the minimum and maximum values of the initial angle range and dividing by 2. For example, when the vehicle is just started, the Hall state is 011, and the initial angle range of the motor is greater than or equal to 60° and less than 120°, then the initial angle is 90°. By setting the initial angle of the motor to the median of the initial angle range, the actual angle of the motor can be more accurately approximated, thereby improving the accuracy of the motor angle determination. In this way, the motor operation can be more accurately controlled according to the initial angle of the motor.
[0062] S130. After the vehicle is started, when the Hall state changes for the first time, determine the motor angle corresponding to the first change of the Hall state according to the changed Hall state and a preset relationship; wherein the preset relationship is the correspondence between the Hall state and the motor angle.
[0063] Specifically, after the vehicle starts, before the Hall effect state changes for the first time, the motor's initial angle is used to control motor operation. When the Hall effect state changes for the first time after the vehicle starts, the motor angle corresponding to the first Hall effect state change is determined from a preset relationship based on the changed Hall effect state. Because the Hall effect state and the motor angle have a one-to-one correspondence, the precise motor angle can be determined based on this preset relationship, further improving the accuracy of motor angle determination.
[0064] S140 . In the current calculation cycle, determine the current calculation angle of the motor according to the current rotation speed, the current control frequency, and the preset compensation value of the motor, and determine the angle of the motor according to the current calculation angle.
[0065] Specifically, after the Hall state changes for the first time, the calculation cycle starts to be executed cyclically, and each calculation cycle corresponds to the calculation angle of a motor, that is, the calculation angle of the motor is periodically determined, and the current calculation cycle corresponds to the current calculation angle. In the current calculation cycle, the current angle increment of the motor can be determined by the current speed of the motor and the current control frequency, and then compensated according to the preset compensation value to obtain the accurate current calculation angle of the motor, and the calculation angle of the motor is obtained in each calculation cycle. The current calculation angle can be used as the angle of the motor, or the angle of the motor can be determined after calibrating or compensating the current calculation angle. This achieves the periodic determination of the angle of the motor. The duration of each cycle of the calculation cycle is short, so the angle of the motor can be determined in real time and accurately, so that the motor can be controlled according to the real-time angle and target angle of the motor, so that the actual angle of the motor is close to or equal to the set target angle.
[0066] The current control frequency is the frequency of the output voltage of the inverter circuit connected to the motor, that is, the frequency of the control signal of the inverter circuit. For example, the frequency of the calculation cycle is the same as the current control frequency of the motor.
[0067] The technical solution of this embodiment is to determine the initial angle range of the motor based on the Hall states of all Hall elements corresponding to the motor and the preset Hall state change sequence when the vehicle is started, and use the median of the initial angle range as the initial angle of the motor, which can be closer to the actual angle of the motor, thereby improving the accuracy of the motor angle determination. After the vehicle is started, before the Hall state changes for the first time, the initial angle of the motor is used to control the operation of the motor. After the vehicle is started, when the Hall state changes for the first time, the angle of the motor corresponding to the first change of the Hall state is determined from the preset relationship based on the changed Hall state, which can further improve the accuracy of the motor angle determination. After the Hall state changes for the first time, the calculation cycle begins to be cyclically executed. In the current calculation cycle, the angle increment of the motor can be determined based on the current speed of the motor and the current control frequency. Then, compensation is performed based on the preset compensation value to obtain the accurate current calculated angle of the motor. The current calculated angle of the motor is obtained in each calculation cycle, thereby achieving periodic determination of the motor angle.
[0068] On the basis of the above technical solutions, Figure 2 is a flowchart of another motor angle determination method provided by an embodiment of the present invention. Optionally, refer to Figure 2 , the motor angle determination method includes:
[0069] S210. When the vehicle is started, determine the initial angle range of the motor according to the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements.
[0070] S220: Using the median of the initial angle range as the initial angle of the motor.
[0071] S230. After the vehicle is started, when the Hall state changes for the first time, determine the motor angle corresponding to the first change of the Hall state according to the changed Hall state and a preset relationship; wherein the preset relationship is the corresponding relationship between the Hall state and the motor angle.
[0072] S240: In the current calculation cycle, determine the current angle increment according to the current rotation speed and the current control frequency.
[0073] The current speed and control frequency of the motor are the speed and control frequency corresponding to the current calculation cycle.
[0074] Specifically, the current angle increment is the angle increment of the current calculation cycle, that is, the angle rotated by the motor within the duration of one calculation cycle. For example, if the frequency of the calculation cycle is the same as the current control frequency of the motor, the angle increment of the motor within one calculation cycle can be determined based on the current speed and the current control frequency, that is, the current angle increment corresponding to the current calculation cycle is determined, thereby determining the current angle increment of the current calculation cycle.
[0075] S250 , determining a current calculated angle of the motor according to the sum of the current angle increment, the previous angle of the motor, and a preset compensation value, and determining the angle of the motor according to the current calculated angle.
[0076] Specifically, at the beginning of a calculation cycle, the previous motor angle is the angle determined based on the Hall effect state and a preset relationship. After each calculation cycle, the previous motor angle is the angle determined during the previous calculation cycle. The current calculated motor angle is calculated by adding the previous motor angle to the current angle increment and then adding a preset compensation value. This compensates for the motor angle and improves the accuracy of the motor angle determination.
[0077] Based on the above technical solution, optionally, determining the current angle increment according to the current rotation speed and the current control frequency includes:
[0078] The current angle increment is determined based on the ratio of the current rotational speed to the current control frequency.
[0079] Specifically, the ratio of the current rotational speed to the current control frequency may be used as the current angle increment, or the ratio of the current rotational speed to the current control frequency may be multiplied by a constant (a unit conversion constant between rotational speed and frequency) to obtain the current angle increment.
[0080] For example, if the current angle increment is ΔEang, the current speed of the motor is Vspd, and the current control frequency is Fm, then , where N is the unit conversion constant between speed and frequency. For example, if the previous motor angle is E' and the preset compensation value is △Eexp, the current calculated angle Eang = E' + △Eang + △Eexp.
[0081] The current speed is a signed number, meaning it can be positive or negative, depending on the motor's rotation direction, which is not limited in this embodiment. The current angle increment, ΔEang, can be positive or negative. For example, when the motor is rotating forward, the current angle increment, ΔEang, is positive; when the motor is rotating backward, the current angle increment, ΔEang, is negative.
[0082] As can be seen, for example, when the motor rotates forward, the angle changes in an increasing direction. After the motor angle increases to 360°, the motor angle will become 0° and continue to increase from 0°. For example, when the motor rotates backward, the angle changes in a decreasing direction. After the motor angle decreases to 0°, the motor angle will become 360° and continue to decrease from 360°.
[0083] Based on the above technical solution, after entering the calculation cycle, in order to avoid a conflict between the current calculated angle calculated in the calculation cycle and the angle determined based on the relationship between the Hall state and the preset, when the Hall state changes, the angle determined based on the relationship between the Hall state and the preset is no longer directly used. Instead, the current calculated angle calculated in the calculation cycle can be calibrated or compensated based on the angle determined based on the relationship between the Hall state and the preset, thereby achieving a combination of the two determination methods and improving the accuracy of the motor angle determination. The calibration or compensation method is described below, but it does not limit this application.
[0084] In one embodiment, optionally, the motor angle determination method further includes:
[0085] After the calculation cycle starts, if the Hall states of all Hall elements corresponding to the motor change, the current angle range of the motor is determined based on the changed Hall states and a preset relationship.
[0086] Specifically, after the calculation cycle begins, whenever the Hall effect state changes, the changed Hall effect state is substituted into the preset relationship to determine the current angle range of the motor. That is, from the moment the current Hall effect state changes until the next Hall effect state change, the calculated angle obtained during the calculation cycle should remain within the current angle range.
[0087] Optionally, determining the angle of the motor based on the current calculated angle includes:
[0088] Step a1: If the current calculated angle is within the corresponding current angle range, the current calculated angle is used as the angle of the motor.
[0089] Specifically, if the current calculated angle determined during the current calculation cycle is within the current angle range corresponding to the current calculation cycle, the current calculated angle is accurate and can be used as the motor angle. This improves the accuracy of the motor angle determination and avoids a large discrepancy between the determined motor angle and the actual motor angle.
[0090] Step a2: If the current calculated angle is smaller than the corresponding minimum value of the current angle range, the minimum value of the current angle range is used as the angle of the motor.
[0091] Specifically, if the current calculated angle in the current calculation cycle is less than the minimum value of the corresponding current angle range, it indicates that the calculated current angle is too small, and the angle calculation may be exceeded during motor reverse rotation or behind during motor forward rotation. The minimum value of the current angle range is used as the motor angle. The current angle range is determined based on the Hall effect state and the preset relationship, thereby improving the accuracy of motor angle determination.
[0092] Step a3: If the current calculated angle is greater than the corresponding maximum value of the current angle range, the maximum value of the current angle range is used as the angle of the motor.
[0093] Specifically, if the current calculated angle in the current calculation cycle is greater than the maximum value of the corresponding current angle range, it indicates that the calculated current angle is too large, possibly exceeding the angle calculation time limit during forward rotation or lagging behind during reverse rotation. The maximum value of the current angle range is used as the motor angle. The current angle range is determined based on the Hall effect state and a preset relationship, thereby improving the accuracy of motor angle determination.
[0094] In another embodiment, Figure 3 This is a flowchart of another method for determining a motor angle provided by an embodiment of the present invention. Optionally, refer to Figure 3 , the motor angle determination method includes:
[0095] S310. When the vehicle is started, the initial angle range of the motor is determined according to the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements.
[0096] S320: Taking the median value of the initial angle range as the initial angle of the motor.
[0097] S330. After the vehicle is started, when the Hall state changes for the first time, determine the motor angle corresponding to the first change of the Hall state according to the changed Hall state and a preset relationship; wherein the preset relationship is the corresponding relationship between the Hall state and the motor angle.
[0098] S340 . In the current calculation cycle, determine the current calculation angle of the motor according to the current speed of the motor, the current control frequency, and the preset compensation value, and determine the angle of the motor according to the current calculation angle.
[0099] S350: After the calculation cycle starts, if the Hall state changes, the current preset angle of the motor is determined according to the changed Hall state and the preset relationship.
[0100] Specifically, the preset relationship is stored in the controller. After the calculation cycle begins, if the Hall state changes, the changed Hall state is substituted into the preset relationship to obtain the current preset angle of the motor. The current preset angle is the preset angle from the time the Hall state changes to the next Hall state change.
[0101] S360: When the current preset angle is different from the corresponding current calculated angle, determine a current angle compensation value according to an error value between the current preset angle and the current calculated angle.
[0102] Specifically, before the next Hall effect state change, if the current calculated angle calculated in the current calculation cycle is different from the current preset angle, an error value between the current preset angle and the current calculated angle is calculated. For example, the difference between the current preset angle and the current calculated angle is used as the error value, and the error value is used as the current angle compensation value. The current angle compensation value can correspond to the current calculation cycle, the next calculation cycle, or multiple future calculation cycles, and is not limited here.
[0103] S370: Compensate the calculation angle determined by a preset number of calculation cycles in the future according to the current angle compensation value.
[0104] Specifically, the calculation angle determined by a preset number of calculation cycles in the future is compensated according to the current angle compensation value, that is, the current angle compensation value corresponds to a preset number of calculation cycles in the future. The preset number can be an integer greater than 1, so the current angle compensation value can be used to compensate the calculation angle determined by the calculation cycle in multiple times, which can avoid large changes in the calculation angle calculated in the calculation cycle, thereby causing motor vibration or motor current spikes, etc. In this way, when there is an error between the current calculation angle calculated in the current calculation cycle and the current preset angle, the current calculation angle will not be directly updated according to the current preset angle, thereby avoiding sudden changes in the angle, which may cause motor vibration or motor current spikes, etc., and the operation of the motor can be better controlled according to the determined motor angle.
[0105] Based on the above technical solution, optionally, compensating the calculation angle determined in a preset number of calculation cycles in the future according to the current angle compensation value includes:
[0106] Step b1: Determine the unit compensation value according to the preset number and the current angle compensation value.
[0107] Specifically, the ratio of the current angle compensation value to the preset number can be used as the unit compensation value, so that the current angle compensation value can be used to compensate the calculated angle determined by the calculation cycle multiple times, which can avoid large changes in the motor angle, thereby causing motor vibration or motor current spikes, etc.
[0108] Step b2: Compensating the calculation angles determined by a preset number of calculation cycles in the future according to the unit compensation value.
[0109] Specifically, the calculated angle determined by a preset number of calculation cycles in the future can be added with the unit compensation value to obtain the final motor angle, thereby compensating the calculated angle calculated in the calculation cycle and further improving the accuracy of the motor angle determination.
[0110] For example, if the current preset angle is Es and the current calculated angle is Eang, then the current angle compensation value Ae is Ae=Es-Eang. For example, if the preset number is Tp, then the unit compensation value △Ee is In the future preset number of calculation cycles after the current angle compensation value is determined, the count value is set to the preset number. In each calculation cycle, it is determined whether the count value is zero. If the count value is not zero, the count value is reduced by one, and the angle determined by the calculation cycle is added with the unit compensation value until the count value becomes zero. In this way, the calculation angle calculated in the calculation cycle is compensated.
[0111] Based on the above technical solutions, optionally, determining the angle of the motor according to the current calculated angle includes:
[0112] Step c1: determining a preset number of changes according to a preset speed of the motor and a preset duration.
[0113] Specifically, the speed of change of the Hall state is related to the speed of the motor. The preset number of changes of the Hall state within the preset time period can be determined based on the preset speed of the motor. The preset speed can be a lower speed. When the speed of the motor is less than the preset speed, the speed of the motor is lower.
[0114] Step c2: If the number of changes in the Hall state within the preset time period is less than or equal to the preset number of changes, the median value of the current angle range corresponding to the motor is used as the angle of the motor.
[0115] Specifically, if the number of Hall effect state changes within a preset time period is less than or equal to the preset number of changes, this indicates that the Hall effect state is changing slowly, i.e., the motor speed is low. By using the median of the current angle range corresponding to the motor as the motor angle when the motor speed is low, this can avoid the problem of large errors in the determined motor angle caused by the inability to timely calibrate or compensate the calculated angle determined during the calculation cycle when the Hall effect state changes slowly and the Hall effect state changes less frequently within the preset time period.
[0116] Step c3: If the number of changes in the Hall state within the preset time period is greater than the preset number of changes, the angle of the motor is determined according to the current calculated angle of the motor determined in the current calculation cycle.
[0117] Specifically, if the Hall effect state changes more times than the preset number of changes within a preset time period, this indicates that the Hall effect state is changing rapidly, i.e., the motor speed is high. By determining the motor angle based on the current calculated angle of the motor determined in the current calculation cycle when the motor speed is high, the current calculated angle can be calibrated or compensated in a timely manner based on the changes in the Hall effect state, making the ultimately determined motor angle more accurate.
[0118] In this way, after the calculation cycle starts, when the motor speed is low, the median of the current angle range corresponding to the motor can be used as the angle of the motor. When the motor speed is high, the angle of the motor can be determined based on the current calculation angle of the motor determined in the calculation cycle, thereby realizing a method of dynamically adjusting the motor angle according to the motor speed, thereby further improving the accuracy of the motor angle determination.
[0119] The embodiment of the present invention further provides a device for determining a motor angle. Figure 4 FIG. 1 is a schematic diagram of a motor angle determination device provided by an embodiment of the present invention. Figure 4 As shown, the device includes: an initial angle range determination module 101, an initial angle determination module 102, a first angle determination module 103 and a second angle determination module 104;
[0120] The initial angle range determination module 101 is used to determine the initial angle range of the motor when the vehicle is started based on the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements;
[0121] The initial angle determination module 102 is configured to use the median of the initial angle range as the initial angle of the motor;
[0122] The first angle determination module 103 is configured to determine the motor angle corresponding to the first change in the Hall state when the Hall state changes for the first time after the vehicle is started, based on the changed Hall state and a preset relationship; wherein the preset relationship is a correspondence between the Hall state and the motor angle;
[0123] The second angle determination module 104 is configured to determine the current calculated angle of the motor according to the current rotational speed, the current control frequency and the preset compensation value of the motor in the current calculation cycle, and determine the angle of the motor according to the current calculated angle.
[0124] A motor angle determination device provided in an embodiment of the present invention can execute the motor angle determination method provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method.
[0125] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. Figure 5 A schematic diagram 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 assistants, cellular phones, smartphones, 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 claimed herein.
[0126] like Figure 5 As shown, electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) or random access memory (RAM), communicatively connected to at least one processor 11. The memory stores computer programs executable by the at least one processor. Processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM or loaded from storage unit 18 into the RAM. RAM 13 can also store various programs and data required for the operation of electronic device 10. Processor 11, ROM 12, and RAM 13 are interconnected via bus 14. An input / output (I / O) interface is also connected to bus 14.
[0127] Multiple 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 magnetic 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 via a computer network such as the Internet and / or various telecommunication networks.
[0128] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any other suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as the motor angle determination method.
[0129] In some embodiments, the motor angle determination method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the motor angle determination method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the motor angle determination method in any other suitable manner (e.g., via firmware).
[0130] Various embodiments of the systems and techniques described above 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), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes 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.
[0131] 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, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0132] 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 conjunction with an instruction execution system, device, or apparatus. A computer-readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, 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.
[0133] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device that has: 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0134] The systems and techniques described herein can be implemented in a computing system that includes back-end 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 front-end components (e.g., a user computer with a graphical user interface or 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 back-end components, middleware components, or front-end components. The components of the system can 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.
[0135] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0136] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0137] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for determining a motor angle, characterized in that: include: When the vehicle is started, the initial angle range of the motor is determined according to the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements; Using the median of the initial angle range as the initial angle of the motor; After the vehicle is started, when the Hall state changes for the first time, the angle of the motor corresponding to the first change of the Hall state is determined according to the changed Hall state and a preset relationship; wherein the preset relationship is a correspondence between the Hall state and the motor angle; In a current calculation cycle, determining a current calculation angle of the motor according to a current speed of the motor, a current control frequency, and a preset compensation value, and determining an angle of the motor according to the current calculation angle; Determining the angle of the motor according to the current calculated angle includes: Determining a preset number of changes according to a preset speed and a preset duration of the motor; If the number of changes of the Hall state within the preset time period is less than or equal to the preset number of changes, the median of the current angle range corresponding to the motor is used as the angle of the motor; If the number of changes of the Hall state within the preset time period is greater than the preset number of changes, the angle of the motor is determined according to the current calculated angle of the motor determined in the current calculation cycle.
2. The method according to claim 1, characterized in that The method of determining the current calculated angle of the motor according to the current rotation speed, the current control frequency and the preset compensation value of the motor in the current calculation cycle includes: In a current calculation cycle, determining a current angle increment according to the current rotational speed and the current control frequency; A current calculated angle of the motor is determined based on the sum of the current angle increment, a previous angle of the motor, and the preset compensation value.
3. The method according to claim 2, characterized in that The determining the current angle increment according to the current rotation speed and the current control frequency includes: A current angle increment is determined according to a ratio of the current rotational speed to the current control frequency.
4. The method according to claim 1, wherein The method further comprises: After the calculation cycle starts, if the Hall states of all Hall elements corresponding to the motor change, the current angle range of the motor is determined according to the changed Hall states and the preset relationship; Determining the angle of the motor according to the current calculated angle includes: If the current calculated angle is within the corresponding current angle range, the current calculated angle is used as the angle of the motor; If the current calculated angle is smaller than the corresponding minimum value of the current angle range, the minimum value of the current angle range is used as the angle of the motor; If the current calculated angle is greater than the corresponding maximum value of the current angle range, the maximum value of the current angle range is used as the angle of the motor.
5. The method according to claim 1, wherein In a current calculation cycle, after determining a current calculation angle of the motor according to a current rotational speed, a current control frequency, and a preset compensation value of the motor, the method further includes: After the calculation cycle starts, if the Hall state changes, determining the current preset angle of the motor according to the changed Hall state and the preset relationship; When the current preset angle is different from the corresponding current calculated angle, determining a current angle compensation value according to an error value between the current preset angle and the current calculated angle; The calculation angle determined in a preset number of calculation cycles in the future is compensated according to the current angle compensation value.
6. The method according to claim 5, characterized in that The compensating the calculation angle determined in a preset number of calculation cycles in the future according to the current angle compensation value includes: Determining a unit compensation value according to the preset number and the current angle compensation value; The calculation angle determined by a preset number of calculation cycles in the future is compensated according to the unit compensation value.
7. A motor angle determination device, characterized in that: include: An initial angle range determination module, configured to determine the initial angle range of the motor when the vehicle is started, based on the Hall states of all Hall elements corresponding to the motor and a preset Hall state change sequence; wherein the Hall state is the level value of the output signal of all Hall elements; an initial angle determination module, configured to use a median value of the initial angle range as the initial angle of the motor; a first angle determination module, configured to determine, when the Hall state changes for the first time after the vehicle is started, the angle of the motor corresponding to the first change in the Hall state based on the changed Hall state and a preset relationship; wherein the preset relationship is a correspondence between the Hall state and the motor angle; The second angle determination module is used to determine the current calculated angle of the motor according to the current speed, current control frequency and preset compensation value of the motor in the current calculation cycle, and determine the angle of the motor according to the current calculated angle. The second angle determination module is specifically used to determine the preset number of changes according to the preset speed and preset time length of the motor; if the number of changes of the Hall state within the preset time length is less than or equal to the preset number of changes, the median of the current angle range corresponding to the motor is used as the angle of the motor; if the number of changes of the Hall state within the preset time length is greater than the preset number of changes, the angle of the motor is determined according to the current calculated angle of the motor determined in the current calculation cycle.
8. 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. The computer program is executed by the at least one processor to enable the at least one processor to perform the motor angle determination method according to any one of claims 1 to 6.
9. 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 angle determination method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Rotor rotation angle deviation adjustment method, gate control method and electronic device
CN114268247A
Motor Hall starting method and system
CN117879406A