Motor angle determination method and device, electronic equipment and storage medium
By determining the initial and current angle of the motor according to the status and preset relationship of the Hall element in an electric vehicle, the problem of inaccurate motor angle determination is solved, and higher angle determination accuracy and motor control accuracy are achieved.
Patent Information
- Application Number
- CN202510519099.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-04-24
AI Technical Summary
The prior art is difficult to accurately determine the angle of the motor in an electric vehicle, especially when the motor speed is low or not running, the signal output by the Hall sensor changes slowly or does not change, resulting in the inability to accurately determine the angle of the motor.
When the vehicle starts, the initial angle range of the motor is determined according to the Hall state and the preset Hall state change order of all Hall elements corresponding to the motor, and the median value of the initial angle range is used as the initial angle of the motor. After the vehicle starts, when the Hall state changes for the first time, the angle of the motor is determined based on the changed Hall state and the preset relationship. During the current calculation period, the current calculated angle of the motor is determined based on the current rotation speed of the motor, the current control frequency and the preset compensation value.
Through these steps, the angle of the motor can be determined more accurately, which improves the accuracy of the motor angle determination and ensures that the motor can be accurately controlled at different speeds and states.
Smart Images

Figure CN120034073A_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 road vehicles and non-road vehicles. Non-road vehicles include forklifts and shovel trucks.
[0003] Electric vehicles generally control the motor based on a controller, and the motor rotates to drive the reduction box or hydraulic gear pump to complete the action. In order to control the motor, it is necessary to detect the speed and angle of the motor, and control the motor according to the real-time angle and real-time speed of the motor.
[0004] The motor of the vehicle includes a three-phase motor, which is generally equipped with a three-phase Hall sensor. The vehicle controller calculates the speed and angle of the motor by capturing the change in the signal output by the Hall sensor each time. The Hall sensor outputs a pulse signal, which includes a valid level and an invalid level. However, when the motor speed is low, the signal output by the Hall sensor changes slowly, and there are many cases where the valid level cannot be obtained, or when the motor is not running, the signal output by the Hall sensor does not change, and the angle of the motor cannot be accurately determined. Summary of the invention
[0005] The present invention provides a method, device, electronic device and storage medium for determining a motor angle, so as to solve the problem that the motor angle cannot be accurately determined.
[0006] According to one aspect of the present invention, a method for determining a motor angle is provided, the method comprising: 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 the 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 corresponding relationship between the Hall state and the motor angle; 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.
[0007] Optionally, in the current calculation cycle, determining 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 includes: In a current calculation cycle, determining a current angle increment according to the current rotation speed and the current control frequency; A current calculated angle of the motor is determined according to a sum of the current angle increment, a previous angle of the motor, and the preset compensation value.
[0008] Optionally, 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 rotation speed to the current control frequency.
[0009] Optionally, the method further comprises: After the calculation cycle starts, if the Hall states of all the 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; The determining the angle of the motor according to the current calculated angle comprises: 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.
[0010] Optionally, in the current calculation cycle, after determining 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, the method further includes: After the calculation cycle starts, if the Hall state changes, the current preset angle of the motor is determined according to the Hall state after the change 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 by a preset number of calculation cycles in the future is compensated according to the current angle compensation value.
[0011] Optionally, compensating a calculation angle determined by a preset number of calculation cycles in the future according to the current angle compensation value includes: Determine 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.
[0012] Optionally, 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 length 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; 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.
[0013] According to another aspect of the present invention, a motor angle determination device is provided, the motor angle determination device comprising: An initial angle range determination module is used to 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 when the vehicle is started; wherein the Hall state is the level value of the output signal of all Hall elements; An initial angle determination module, used for taking the median of the initial angle range as the initial angle of the motor; A first angle determination module, configured to determine the angle of the motor corresponding to the first change of the Hall state according to the changed Hall state and a preset relationship when the Hall state changes for the first time after the vehicle is started; wherein the preset relationship is a corresponding relationship between the Hall state and the motor angle; The second angle determination module is used to determine the current calculation angle of the motor according to the current rotation 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.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: 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 angle determination method described in any embodiment of the present invention.
[0015] 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 described in any embodiment of the present invention when executed.
[0016] According to another aspect of the present invention, a computer program product is provided. The computer program product comprises a computer program. When the computer program is executed by a processor, the method for determining the motor angle according to any embodiment of the present invention is implemented.
[0017] 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 according to the Hall state 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 according to 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, and then compensation is performed according to the preset compensation value, so that the accurate current calculated angle of the motor can be obtained, and the calculated angle of the motor is obtained in each calculation cycle, thereby realizing the periodic determination of the motor angle.
[0018] 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
[0019] 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.
[0020] Figure 1 is a flow chart of a method for determining a motor angle provided by an embodiment of the present invention; Figure 2 is a flow chart of another motor angle determination method provided by an embodiment of the present invention; Figure 3 is a flow chart of another method for determining a motor angle provided by an embodiment of the present invention; Figure 4 is a structural schematic diagram of a motor angle determination device provided by an embodiment of the present invention; Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] 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.
[0022] 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.
[0023] The embodiment of the present invention provides a method for determining a motor angle. The motor may be a motor in a vehicle. The vehicle may be an electric vehicle. The electric vehicle includes road vehicles and non-road vehicles. Non-road vehicles include forklifts and shovel trucks. The method for determining a motor angle may be executed by a controller in the vehicle. The controller may be a whole machine controller for controlling the operation of the motor, or may be a separate controller, which is not limited in this embodiment. The motor angle may be used to describe the position of the motor rotor during rotation, that is, the motor angle changes continuously during the rotation of the motor.
[0024] Figure 1 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: 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.
[0025] Wherein, for example, if the motor is a three-phase motor, the motor is configured with three Hall elements, and the Hall elements can be arranged on the stator of the motor or at other positions, 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, and the three Hall elements output three pulse signals. The Hall state is the level value of the output signal of all Hall elements, and when the motor is running normally, the Hall state can be 001, 010, 011, 100, 101 or 110. Wherein, for example, 010 is the second Hall element outputting a high level, and the other two Hall elements output a low level. For example, 011 is the second Hall element and the third Hall element outputting a high level, and the first Hall element outputting a low level, and the other Hall states are similar, which will not be repeated here. The preset Hall state change order is pre-set, for example, when the motor is rotating forward, it changes in the order of 010, 011, 001, 101, 100, and 110.
[0026] 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, it has rotated a sector, and the Hall state has a corresponding relationship with the motor angle. For example, the Hall state 010 corresponds to a motor angle of 0°, the Hall state 011 corresponds to a motor angle of 60°, the Hall state 001 corresponds to a motor angle of 120°, the Hall state 101 corresponds to a motor angle of 180°, the Hall state 100 corresponds to a motor angle of 240°, the Hall state 110 corresponds to a motor angle of 300°, and the Hall state 010 corresponds to a motor angle of 360°, that is, 0°.
[0027] 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°.
[0028] S120: Taking the median of the initial angle range as the initial angle of the motor.
[0029] Specifically, the median of the initial angle range can be 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 likely to be close, 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.
[0030] 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 corresponding relationship between the Hall state and the motor angle.
[0031] Specifically, 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 motor angle corresponding to the first change of the Hall state is determined from the preset relationship based on the changed Hall state. Since the Hall state and the motor angle have a one-to-one correspondence, the accurate motor angle can be determined based on the preset relationship, further improving the accuracy of the motor angle determination.
[0032] 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.
[0033] 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 a motor is obtained in each calculation cycle. The current calculation angle can be used as the angle of the motor, or the current calculation angle can be calibrated or compensated to determine the angle of the motor. Thereby, the angle of the motor is periodically determined. 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.
[0034] 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.
[0035] The technical solution of this embodiment, when the vehicle starts, determines the initial angle range of the motor according to the Hall state of all Hall elements corresponding to the motor and the preset Hall state change sequence, and uses 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 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 according to 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, and then compensated according to the preset compensation value, so as to obtain the accurate current calculation angle of the motor. The current calculation angle of a motor is obtained in each calculation cycle, thereby realizing the periodic determination of the motor angle.
[0036] Based on 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: S210. 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.
[0037] S220: Taking the median value of the initial angle range as the initial angle of the motor.
[0038] 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.
[0039] S240. In the current calculation cycle, determine the current angle increment according to the current rotation speed and the current control frequency.
[0040] Among them, the current speed and current control frequency of the motor are the speed and control frequency corresponding to the current calculation cycle.
[0041] Specifically, the current angle increment is the angle increment of the current calculation cycle, that is, the angle that the motor rotates during 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 rotation 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.
[0042] S250, determining a current calculated angle of the motor according to the sum of a current angle increment, a previous angle of the motor and a preset compensation value, and determining the angle of the motor according to the current calculated angle.
[0043] Specifically, when the calculation cycle is just started, the previous angle of the motor is the angle of the motor determined according to the Hall state and the preset relationship. After the calculation cycle is executed, the previous angle of the motor is the angle of the motor determined in the previous calculation cycle. The previous angle of the motor is added to the current angle increment, and then the preset compensation value is added to obtain the current calculated angle of the motor, which can compensate for the motor angle and improve the accuracy of the motor angle determination.
[0044] On the basis of the above technical solution, optionally, determining the current angle increment according to the current rotation speed and the current control frequency includes: The current angle increment is determined according to the ratio of the current rotation speed to the current control frequency.
[0045] 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 of the rotational speed and the frequency) to obtain the current angle increment.
[0046] 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 of speed and frequency. For example, if the previous angle of the motor is E', and the preset compensation value is △Eexp, then the current calculated angle Eang = E'+△Eang+△Eexp.
[0047] Among them, the current speed is a signed number, that is, it may be a positive value or a negative value, which is determined specifically according to the direction of the motor, and is not limited in this embodiment. Then the current angle increment △Eang can be a positive value or a negative value. For example, when the motor rotates forward, the current angle increment △Eang is a positive value, and when the motor rotates reversely, the current angle increment △Eang is a negative value.
[0048] It can be seen that, for example, when the motor rotates forward, the angle changes in the direction of increase. When the motor angle increases to 360°, the motor angle will become 0° and continue to increase from 0°. For example, when the motor rotates reversely, the angle changes in the direction of decrease. When the motor angle decreases to 0°, the motor angle will become 360° and continue to decrease from 360°.
[0049] On the basis of the above technical solution, after entering the calculation cycle, in order to avoid the current calculation angle calculated in the calculation cycle from conflicting with the angle determined according to the Hall state and the preset relationship, when the Hall state changes, the angle determined by the Hall state and the preset relationship is no longer directly used, but the current calculation angle calculated in the calculation cycle can be calibrated or compensated according to the angle determined by the Hall state and the preset relationship, thereby realizing the combination of the two determination methods and improving the accuracy of the motor angle determination. The calibration or compensation method is explained below, but it is not a limitation of this application.
[0050] In one implementation, optionally, the motor angle determination method further includes: After the calculation cycle starts, if the Hall states of all the 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.
[0051] Specifically, after the calculation cycle starts, as long as the Hall state changes, the changed Hall state is substituted into the preset relationship to determine the current angle range of the motor. That is, when the current Hall state changes, the calculated angle calculated by the calculation cycle should be within the current angle range until the next Hall state changes.
[0052] Optionally, determining the angle of the motor according to the current calculated angle includes: 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.
[0053] Specifically, if the current calculation angle determined in the current calculation cycle is within the current angle range corresponding to the current calculation cycle, it indicates that the current calculation angle is relatively accurate, and the current calculation angle can be used as the motor angle, thereby improving the accuracy of the motor angle determination and avoiding a large difference between the determined motor angle and the actual motor angle.
[0054] Step a2: If the currently 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.
[0055] Specifically, if the current calculated angle calculated in the current calculation cycle is less than the minimum value of the corresponding current angle range, it means that the calculated current calculated angle is too small, and the angle calculation may be overdue when the motor is reversed, or the angle calculation may be behind when the motor is forward. The minimum value of the current angle range is used as the angle of the motor, and the current angle range is determined according to the Hall state and the preset relationship, so as to improve the accuracy of the motor angle determination.
[0056] 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.
[0057] Specifically, if the current calculated angle calculated in the current calculation cycle is greater than the maximum value of the corresponding current angle range, it means that the calculated current calculated angle is too large, and the angle calculation may be overdue when the motor is rotating forward, or the angle calculation may be behind when the motor is rotating reversely. The maximum value of the current angle range is used as the angle of the motor, and the current angle range is determined according to the Hall state and the preset relationship, so as to improve the accuracy of the motor angle determination.
[0058] In another embodiment, Figure 3 is a flowchart of another motor angle determination method provided by an embodiment of the present invention. Optionally, refer to Figure 3 , the motor angle determination method includes: 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.
[0059] S320: Taking the median value of the initial angle range as the initial angle of the motor.
[0060] 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.
[0061] S340. 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.
[0062] 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.
[0063] Specifically, the preset relationship is stored in the controller. After the calculation cycle starts, 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 when the Hall state changes to the next time the Hall state changes.
[0064] S360: When the current preset angle is different from the corresponding current calculated angle, determine the current angle compensation value according to the error value between the current preset angle and the current calculated angle.
[0065] Specifically, before the next Hall state change, if the current calculated angle calculated in the current calculation cycle is different from the current preset angle, the 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, for example, the error value is used as the current angle compensation value. The current angle compensation value may correspond to the current calculation cycle, or the next calculation cycle, or multiple future calculation cycles, which are not limited here.
[0066] S370. Compensate the calculation angle determined by a preset number of calculation cycles in the future according to the current angle compensation value.
[0067] 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, and the current angle compensation value can be used to compensate the calculation angle determined by the calculation cycle for multiple times, which can avoid large changes in the calculation angle calculated in the calculation cycle, thereby causing motor vibration or current spikes in the motor, 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 current spikes in the motor, etc., and the operation of the motor can be better controlled according to the determined motor angle.
[0068] On the basis of the above technical solution, optionally, compensating the calculation angle determined by a preset number of calculation cycles in the future according to the current angle compensation value includes: Step b1, determining a unit compensation value according to a preset number and a current angle compensation value.
[0069] 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.
[0070] Step b2: compensating the calculation angle determined by a preset number of calculation cycles in the future according to the unit compensation value.
[0071] Specifically, the calculated angle determined by a preset number of calculation cycles in the future can be added with a unit compensation value to obtain the final motor angle, thereby compensating the calculated angle calculated by the calculation cycle and further improving the accuracy of the motor angle determination.
[0072] For example, if the current preset angle is Es and the current calculated angle is Eang, the current angle compensation value Ae is Ae=Es-Eang. For example, if the preset number is Tp, the unit compensation value △Ee is In the future preset number of calculation cycles after determining the current angle compensation value, 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.
[0073] Based on the above technical solutions, optionally, determining the angle of the motor according to the current calculated angle includes: Step c1, determining a preset number of changes according to a preset rotation speed and a preset duration of the motor.
[0074] Specifically, the speed of change of the Hall state is related to the speed of the motor, and the preset number of changes of the Hall state within the preset time can be determined according to 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.
[0075] Step c2: If the number of changes in the Hall state within the preset time length 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.
[0076] Specifically, if the number of changes in the Hall state within the preset time is less than or equal to the preset number of changes, it indicates that the Hall state changes slowly, that is, 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, it is possible to avoid the problem that when the Hall state changes slowly and the Hall state changes less within the preset time, the calculated angle determined by the calculation cycle cannot be calibrated or compensated in time, resulting in a large error in the determined motor angle.
[0077] Step c3: If the number of changes in 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 calculation angle of the motor determined in the current calculation cycle.
[0078] Specifically, if the number of changes in the Hall state within a preset time is greater than the preset number of changes, it indicates that the Hall state changes faster, that is, the motor speed is higher. By determining the angle of the motor according to the current calculated angle of the motor determined in the current calculation cycle when the motor speed is higher, the current calculated angle can be calibrated or compensated in time according to the change in the Hall state, so that the final determined motor angle is more accurate.
[0079] 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.
[0080] The embodiment of the present invention further provides a device for determining a motor angle. Figure 4 is a schematic diagram of the structure of a motor angle determination device provided by an embodiment of the present invention, such as 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; The initial angle range determination module 101 is used to determine the initial angle range of the motor according to the Hall states of all Hall elements corresponding to the motor and the preset Hall state change sequence when the vehicle is started; wherein the Hall state is the level value of the output signal of all Hall elements; The initial angle determination module 102 is used to use the median of the initial angle range as the initial angle of the motor; The first angle determination module 103 is used to determine the motor angle corresponding to the first change of the Hall state according to the changed Hall state and the preset relationship when the Hall state changes for the first time after the vehicle is started; wherein the preset relationship is the corresponding relationship between the Hall state and the motor angle; The second angle determination module 104 is used to determine the current calculation angle of the motor according to the current rotation 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.
[0081] 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 functional modules and beneficial effects corresponding to the execution method.
[0082] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. Figure 5A 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.
[0083] like Figure 5 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), a random access memory (RAM), 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) or the computer program loaded from the storage unit 18 to the random access memory (RAM). In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface is also connected to the bus 14.
[0084] 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.
[0085] The processor 11 may be a variety of general and / or dedicated 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 angle determination method.
[0086] In some embodiments, the motor angle determination method may 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 may 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 angle determination method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the motor angle determination method in any other suitable manner (e.g., by means of firmware).
[0087] 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.
[0088] 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.
[0089] 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 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.
[0090] 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).
[0091] 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.
[0092] 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.
[0093] 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.
[0094] 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 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 the 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 corresponding relationship between the Hall state and the motor angle; In a current calculation cycle, a current calculation angle of the motor is determined according to a current rotation speed of the motor, a current control frequency and a preset compensation value, and an angle of the motor is determined according to the current calculation angle.
2. The method according to claim 1, characterized in that The method of determining 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 in the current calculation cycle includes: In a current calculation cycle, determining a current angle increment according to the current rotation speed and the current control frequency; A current calculated angle of the motor is determined according to a 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 rotation speed to the current control frequency.
4. The method according to claim 1, characterized in that The method further comprises: After the calculation cycle starts, if the Hall states of all the 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; The determining the angle of the motor according to the current calculated angle comprises: 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, characterized in that In the current calculation cycle, after determining 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, the method further includes: After the calculation cycle starts, if the Hall state changes, the current preset angle of the motor is determined according to the Hall state after the change 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 by 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 by a preset number of calculation cycles in the future according to the current angle compensation value includes: Determine 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. The method according to claim 1, characterized in that The determining the angle of the motor according to the current calculated angle comprises: 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 length 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; 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.
8. A motor angle determination device, characterized in that: include: An initial angle range determination module is used to 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 when the vehicle is started; wherein the Hall state is the level value of the output signal of all Hall elements; An initial angle determination module, used for taking the median of the initial angle range as the initial angle of the motor; A first angle determination module, configured to determine the angle of the motor corresponding to the first change of the Hall state according to the changed Hall state and a preset relationship when the Hall state changes for the first time after the vehicle is started; wherein the preset relationship is a corresponding relationship between the Hall state and the motor angle; The second angle determination module is used to determine the current calculation angle of the motor according to the current rotation 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.
9. 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 perform the motor angle determination method according to any one of claims 1 to 7.
10. 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 7 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
Motor rotating speed determination method and device based on Hall element, equipment and storage medium
CN118624935A
BLDC (brushless direct current) rotor angle acquisition method and system for automatically compensating Hall sector error, medium and equipment
CN118677299A
Motor control method and device, electronic equipment and storage medium
CN119009896A