Servo motor driving method and device, servo motor, storage medium and product
By obtaining the rotor assembly position information and reference position offset information of the servo motor, determining the target electrical angle and driving the rotor assembly to rotate, the problem that the rotor cannot accurately reach the 0° position in the traditional motor vector control method is solved, and precise vector control is achieved and motor loss is reduced.
Patent Information
- Application Number
- CN202311092435.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2025-02-25
AI Technical Summary
The traditional motor vector control method cannot ensure that the rotor reaches the 0° position accurately, resulting in inaccurate vector control and large motor losses.
By obtaining the first position information of the rotor assembly of the servo motor at the current position and the second position information passing through the reference position, combining the position offset information between the reference position and the initial position of the rotor assembly, the target electrical angle of the rotor assembly is determined, and the rotor assembly is driven to rotate according to the target electrical angle.
Accurate vector control of servo motors is realized, control accuracy is improved, and motor loss is reduced.
Smart Images

Figure CN119519505A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of motor technology, and in particular to a servo motor driving method, device, servo motor, storage medium and product. Background Art
[0002] With the development of permanent magnet motors, permanent magnet brushless DC motors are widely used in industrial robots, medical robots and other fields. When performing vector control on permanent magnet brushless DC motors, it is necessary to calibrate the electrical angle of the permanent magnet brushless DC motor first, so as to reduce the power loss of the motor and avoid reversal or even jamming.
[0003] In the traditional method, before vector control is performed on a permanent magnet brushless DC motor, a 0° current is usually applied to the motor's rotor so that the rotor is attracted to the 0° position and fixed; then, the encoder connected to the motor is initialized, and the rotor is driven to move through the encoder, thereby realizing vector control of the motor.
[0004] However, for the traditional motor vector control method, since it cannot ensure that the rotor can accurately reach the 0° position after the 0° current is applied, it will cause inaccurate vector control of the motor and large motor losses. Summary of the invention
[0005] Based on this, it is necessary to provide a servo motor driving method, device, computer equipment, computer readable storage medium and computer program product that can improve the vector control accuracy of the motor and reduce motor loss in response to the above technical problems.
[0006] In a first aspect, the present application provides a servo motor driving method. The method comprises:
[0007] Acquire first position information of a rotor assembly of the servo motor at a current position and second position information of the rotor assembly after passing a reference position;
[0008] Determine the target electrical angle of the rotor assembly at the current position according to the first position information, the second position information and the position offset information between the reference position and the initial position of the rotor assembly; the initial position is the position corresponding to the rotor assembly at the initial electrical angle;
[0009] The rotor assembly is driven to rotate according to the target electrical angle.
[0010] In one embodiment, the servo motor includes an incremental encoder; obtaining first position information of a rotor component of the servo motor at a current position and second position information of the rotor component after a reference position includes:
[0011] Acquire first position information of the rotor assembly of the servo motor at the current position through an incremental encoder;
[0012] The preset state change information is acquired through the incremental encoder, and the second position information of the rotor assembly passing through the reference position is determined according to the preset state change information.
[0013] In one embodiment, the servo motor further includes a Hall sensor; the preset state change information includes first preset state change information and second preset state change information; the first preset state change information includes state change information of a pulse signal of the Hall sensor, and the second preset state change information includes state change information of a preset pulse signal of an incremental encoder;
[0014] Acquiring preset state change information through an incremental encoder, and determining second position information of the rotor assembly passing through a reference position according to the preset state change information, including:
[0015] If the preset state change information first acquired by the incremental encoder is the first preset state change information, determining the second position information of the rotor assembly passing through the reference position according to the first preset state change information;
[0016] If the preset state change information first acquired by the incremental encoder is the second preset state change information, the second position information of the rotor assembly passing through the reference position is determined according to the second preset state change information.
[0017] In one embodiment, the method further comprises:
[0018] Acquire first position offset information corresponding to the first preset state change information; and use the first position offset information as position offset information between the reference position and the initial position of the rotor assembly; or,
[0019] Second position offset information corresponding to the second preset state change information is obtained; and the second position offset information is used as position offset information between the reference position and the initial position of the rotor assembly.
[0020] In one embodiment, determining a target electrical angle of the rotor assembly at a current position according to the first position information, the second position information, and the position offset information between the reference position and the initial position of the rotor assembly includes:
[0021] Calculate the difference between the first position information and the second position information, and calculate the sum of the difference and the position offset information to obtain the target position information of the current position relative to the initial position;
[0022] The target electrical angle of the rotor assembly at the current position relative to the initial position is determined based on the target position information and a preset conversion relationship; the preset conversion relationship is used to convert the position information of the incremental encoder into the electrical angle of the rotor assembly.
[0023] In one embodiment, the method further comprises:
[0024] The rotor assembly in the servo motor is driven to perform multiple bidirectional movements to determine the initial position information of the rotor assembly at the initial position; during the multiple bidirectional movements, the rotor assembly passes through the initial position multiple times;
[0025] The rotor assembly in the servo motor is driven to perform a preset unidirectional motion, and the third position information of the rotor assembly when a first preset state change occurs and the fourth position information of the rotor assembly when a second preset state change occurs are determined; the first preset state change includes multiple state changes of the pulse signal of the Hall sensor, and the second preset state change includes the state change of the preset pulse signal of the incremental encoder; during the preset unidirectional motion process, the multiple state changes of the pulse signal of the Hall sensor and the state change of the preset pulse signal of the incremental encoder all occur once;
[0026] The first position offset information corresponding to the first preset state change is calculated according to the third position information and the initial position information; and the second position offset information corresponding to the second preset state change is calculated according to the fourth position information and the initial position information.
[0027] In one embodiment, calculating first position offset information corresponding to a first preset state change according to the third position information and the initial position information; and calculating second position offset information corresponding to a second preset state change according to the fourth position information and the initial position information, includes:
[0028] For each first preset state change, calculating the difference between the third position information when the first preset state change occurs and the initial position information, to obtain the first position offset information corresponding to the first preset state change;
[0029] The difference between the fourth position information when the second preset state changes and the initial position information is calculated to obtain the second position offset information corresponding to the second preset state change.
[0030] In one embodiment, driving a rotor assembly in a servo motor to perform a plurality of bidirectional movements to determine initial position information of the rotor assembly at an initial position includes:
[0031] driving a rotor assembly in a servo motor to perform multiple bidirectional movements, and determining multiple candidate position information of the rotor assembly after passing through an initial position;
[0032] An average value of the plurality of candidate position information is calculated, and the average value of the plurality of candidate position information is used as the initial position information of the rotor assembly at the initial position.
[0033] In one embodiment, the method further comprises:
[0034] For each candidate position information, calculate the position error between the candidate position information and the initial position information, and determine whether the candidate position information meets the first position error condition according to the position error and a preset error threshold;
[0035] When each candidate position information satisfies the first position error condition, it is determined that the initial position information calibration is successful.
[0036] In one embodiment, the bidirectional motion includes a first motion endpoint position and a second motion endpoint position; and the method further includes:
[0037] Driving the rotor assembly in the servo motor to perform multiple bidirectional movements, determining position information of the rotor assembly when it passes through a first motion endpoint, and position information of the rotor assembly when it passes through a second motion endpoint;
[0038] Determining whether the position information of each first motion endpoint position and the position information of each second motion endpoint position meet a second position error condition according to the position information of each first motion endpoint position and the position information of each second motion endpoint position;
[0039] Accordingly, when each candidate position information satisfies the first position error condition, determining that the initial position information calibration is successful includes:
[0040] When each candidate position information satisfies the first position error condition, and the position information of each first motion endpoint position and the position information of each second motion endpoint position satisfy the second position error condition, it is determined that the initial position information calibration is successful.
[0041] In a second aspect, the present application also provides a servo motor driving device. The device comprises:
[0042] A first acquisition module, used to acquire first position information of a rotor assembly of the servo motor at a current position and second position information of the rotor assembly after a reference position;
[0043] A first determination module is used to determine a target electrical angle of the rotor assembly at a current position according to the first position information, the second position information, and the position offset information between the reference position and the initial position of the rotor assembly; the initial position is the position corresponding to the rotor assembly at the initial electrical angle;
[0044] The driving module is used to drive the rotor assembly to rotate according to the target electrical angle.
[0045] In a third aspect, the present application further provides a servo motor, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the servo motor driving method in the first aspect when executing the computer program.
[0046] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the servo motor driving method in the first aspect are implemented.
[0047] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the servo motor driving method in the first aspect are implemented.
[0048] The above-mentioned servo motor driving method, device, servo motor, storage medium and computer program product obtain the first position information of the rotor assembly of the servo motor at the current position and the second position information of the rotor assembly after a reference position; then, according to the first position information, the second position information and the position offset information between the reference position and the initial position of the rotor assembly, determine the target electrical angle of the rotor assembly at the current position; drive the rotor assembly to rotate according to the target electrical angle; wherein the initial position is the position corresponding to the rotor assembly at the initial electrical angle. That is to say, in the embodiment of the present application, the target electrical angle of the rotor assembly at the current position can be accurately calculated by combining the position offset information between the predetermined reference position and the initial position of the rotor assembly, the first position information of the rotor assembly at the current position and the second position information of the rotor assembly after passing the reference position; since the position offset information between the reference position and the initial position of the rotor assembly is fixed, if the position offset information between the reference position and the initial position of the rotor assembly is accurately calibrated, then the real-time electrical angle of the rotor assembly can be accurately calculated; compared with the traditional method, there is no need to drive the rotor assembly to the initial 0° position before controlling the rotation of the rotor assembly; therefore, the problem of inaccurate real-time electrical angle calculation caused by the initial electrical angle error due to the inability of the rotor assembly to accurately move to the initial 0° position can be solved; and by adopting this scheme, after the servo motor is powered on, the rotor assembly can realize the accurate calculation of the real-time electrical angle of the rotor assembly at any initial position, thereby realizing accurate vector control of the servo motor; improving the control accuracy of the servo motor and reducing motor loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A diagram showing an application environment of a servo motor driving method in an embodiment;
[0050] Figure 2 A schematic diagram of a servo motor driving method according to an embodiment;
[0051] Figure 3 is a flow chart of a servo motor driving method in another embodiment;
[0052] Figure 4 is a flow chart of a servo motor driving method in another embodiment;
[0053] Figure 5 is a flow chart of a servo motor driving method in another embodiment;
[0054] Figure 6 is a flow chart of a servo motor driving method in another embodiment;
[0055] Figure 7 is a flow chart of a servo motor driving method in another embodiment;
[0056] Figure 8 A schematic diagram of the control system structure of a servo motor in one embodiment;
[0057] Fig. 9 A schematic diagram of the positions of a Hall sensor and a rotor assembly in one embodiment;
[0058] Fig.10 A schematic diagram of the connection between a servo motor and an incremental encoder in one embodiment;
[0059] Fig.11 An electrical angle control flow chart of electrical angle calibration in one embodiment;
[0060] Fig.12 A schematic diagram of the working principle of electrical angle calculation in one embodiment;
[0061] Fig.13 A schematic diagram of the working principle of electrical angle calculation in another embodiment;
[0062] Fig.14 is a structural block diagram of a servo motor driving device in one embodiment;
[0063] Fig.15 Schematic diagram of the internal structure of a servo motor in one embodiment. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0065] Joint motor drivers play a very important role in the fields of industrial robots and medical robots. Compared with traditional motors, brushless servo motors have advantages such as small size, energy saving, long service life, and strong controllability, making them more suitable for use on certain joints. With the high requirements for motor size in the fields of industrial robots and medical robots, permanent magnet brushless DC motors are increasingly used in the fields of industrial robots, medical robots, etc.
[0066] When controlling a brushless motor, it is usually necessary to calibrate the electrical angle of the brushless motor. If the correct motor calibration is not performed, it may cause motor output power loss, reversal, or even jamming. For example, when vector control is performed on a permanent magnet brushless motor, the rotor zero position is usually set at the position where the rotor pole coincides with the alpha axis, i.e., the A-phase axis, and a field-oriented control (FOC) algorithm is used to generate a 90° phase-leading current to drive the motor to rotate. Usually, when a permanent magnet brushless motor is powered on and starts working, the rotor position is random, and the initial position of the incremental encoder is 0, which makes it impossible to calculate the initial electrical angle deviation.
[0067] Traditionally, when a permanent magnet brushless motor is powered on and starts working, a 0° current is first applied to the rotor, which interacts with the fixed magnetic field of the stator, causing the rotor to be attracted to the 0° position and fixed; then the encoder count value is initialized to 0, and based on the FOC algorithm, the encoder generates a 90° leading current to drive the rotor to rotate.
[0068] However, with this method, since it cannot be ensured that the rotor can accurately reach the 0° position after the 0° current is applied, it will still cause inaccurate vector control of the motor, resulting in greater motor losses.
[0069] Based on this, the present application proposes a motor driving method, which calculates the electrical angle of the rotor by means of a fixed offset between a reference position and the rotor at a 0° position, thereby achieving precise vector control of the motor.
[0070] The motor driving method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. The robot 102 includes a mechanical arm, which is composed of multiple joints. When driving each joint to move, a servo motor 104 is required; each joint can be connected to a servo motor 104, and the corresponding joint movement is controlled by the servo motor 104. The servo motor 104 includes a rotor assembly and a stator assembly. When the servo motor 104 is vector controlled, the rotor assembly of the servo motor 104 needs to be calibrated in electrical angle; thereby achieving precise vector control of the servo motor 104.
[0071] Exemplarily, during the rotation of the servo motor 104 , the position of the rotor assembly can be detected in real time by a position sensor to obtain the real-time electrical angle of the rotor assembly during the rotation; wherein the position sensor may include but is not limited to an encoder, a Hall sensor, etc.
[0072] The servo motor 104 may include but is not limited to a brushless servo motor, a permanent magnet brushless servo motor, a permanent magnet brushless DC motor, etc.; the robot 102 may include but is not limited to an industrial robot, a medical robot, etc.
[0073] In one embodiment, Figure 2 As shown, a servo motor driving method is provided, which is applied to Figure 1 The servo motor in the example is used as an example to illustrate, including the following steps:
[0074] Step 202 , obtaining first position information of a rotor assembly of the servo motor at a current position and second position information of the rotor assembly after passing a reference position.
[0075] Exemplarily, after the servo motor is powered on, the real-time electrical angle calculation of the rotor assembly can be achieved using an encoder connected to the servo motor; that is, the movement of the rotor assembly is encoded and counted by the encoder, and the encoded count value collected by the encoder is converted into the electrical angle value of the rotor assembly through a preset conversion relationship, so as to obtain the real-time electrical angle of the rotor assembly.
[0076] Then, based on this, during the movement of the rotor assembly, the position of the rotor assembly can be detected in real time through the encoder to obtain the first position information of the rotor assembly at the current position; in one implementation, the encoder can be an incremental encoder; when the rotor assembly starts to move after power-on, the incremental encoder also starts working, that is, it starts counting from the initial count value (usually set to 0); thereby obtaining the first position information of the rotor assembly at the current position, and the first position information can be the current encoding count value of the incremental encoder.
[0077] Exemplarily, during the movement of the rotor assembly, the real-time position of the rotor assembly can also be detected by a Hall sensor to obtain the first position information of the rotor assembly at the current position; of course, in other examples, other types of position sensors can also be used to realize the position detection of the rotor assembly; the embodiment of the present application does not limit the specific type of the position sensor.
[0078] In addition, in the present embodiment, a reference position is also provided for the real-time electrical angle detection of the rotor, and the reference position may include the position corresponding to the preset signal of the incremental encoder; for example: when the incremental encoder is an ABI incremental encoder or an ABZ incremental encoder, that is, the incremental encoder includes an I pulse signal or a Z pulse signal, the reference position may include the position corresponding to the I pulse signal or the Z pulse signal; optionally, the reference position may also include the position corresponding to the Hall state of the Hall sensor, wherein the Hall sensor includes six Hall states, and the position corresponding to each Hall state can be used as a reference position.
[0079] In one implementation, the reference position may include the position corresponding to the I pulse signal or the Z pulse signal of the incremental encoder, and the positions corresponding to each Hall state; then, when the rotor assembly passes through a target position for the first time, the target position can be used as a reference position for calculating the real-time electrical angle of the rotor assembly; and the incremental encoder is used to record the encoding count value of the rotor assembly when it passes through the target position, thereby obtaining the second position information of the rotor assembly when it passes the reference position.
[0080] Of course, in other implementations, different positions may be pre-set as reference positions, and when the rotor assembly passes through the reference position, the second position information corresponding to the reference position is recorded.
[0081] Step 204 , determining a target electrical angle of the rotor assembly at the current position according to the first position information, the second position information, and the position offset information between the reference position and the initial position of the rotor assembly.
[0082] The initial position is the position of the rotor assembly at the initial electrical angle, which may be 0° or other electrical angle values.
[0083] Exemplarily, when the initial electrical angle is 0°, the position offset information is the position offset information between the reference position and the 0° electrical angle of the rotor assembly; the position offset information can be determined by pre-calibrating the electrical angle of the rotor assembly.
[0084] Based on this, after determining the first position information of the rotor assembly, the second position information of the rotor assembly when it passes the reference position, and the position offset information between the reference position and the 0° electrical angle of the rotor assembly, the target electrical angle of the rotor assembly at the current position can be calculated based on the first position information, the second position information and the position offset information.
[0085] In one implementation, the servo motor can first calculate the difference between the first position information and the second position information to obtain the relative position information between the current position and the reference position; then, calculate the sum of the difference and the position offset information to obtain the target position information of the current position relative to the initial position; that is, sum the relative position information between the current position and the reference position and the position offset information between the reference position and the initial 0° position to obtain the target position information between the current position and the initial 0° position, that is, the target position information of the current position relative to the initial position.
[0086] Furthermore, the servo motor can determine the target electrical angle of the rotor assembly at the current position relative to the initial position based on the target position information and the preset conversion relationship; wherein the preset conversion relationship can be used to convert the position information of the incremental encoder into the electrical angle value of the rotor assembly. In other words, the target position information of the current position relative to the initial position is converted into the target electrical angle of the current position relative to the initial position; thus, the method can be used to realize the calculation of the real-time electrical angle of the rotor assembly.
[0087] Step 206: driving the rotor assembly to rotate according to the target electrical angle.
[0088] After obtaining the real-time electrical angle of the rotor assembly during the rotation process through the above steps, the target electrical angle can be fed back to the servo motor control system so that the servo motor control system can control the rotation of the rotor assembly based on the fed-back target electrical angle. Exemplarily, the servo motor control system may include a coordinate transformation Park's Transformation (Park's Transformation, referred to as Park) inverse transformation module, a space vector pulse width modulation (Space Vector Pulse Width Modulation, referred to as SVPWM) module, a three-phase inverter module, etc.; the target electrical angle of the rotor assembly can be fed back to the coordinate transformation Park inverse transformation module for calculation to obtain a first calculation result; then, the first calculation result is input into the SVPWM module for calculation to obtain a second calculation result; then, the second calculation result is input into the three-phase inverter module for calculation to obtain a three-phase voltage signal; the servo motor is controlled based on the three-phase voltage signal to achieve vector control of the servo motor.
[0089] In the above-mentioned servo motor driving method, the first position information of the rotor assembly of the servo motor at the current position and the second position information of the rotor assembly after passing the reference position are obtained; then, the target electrical angle of the rotor assembly at the current position is determined according to the first position information, the second position information and the position offset information between the reference position and the initial position of the rotor assembly; the rotor assembly is driven to rotate according to the target electrical angle; wherein the initial position is the position corresponding to the rotor assembly at the initial electrical angle. That is to say, in the embodiment of the present application, the target electrical angle of the rotor assembly at the current position can be accurately calculated by combining the position offset information between the predetermined reference position and the initial position of the rotor assembly, the first position information of the rotor assembly at the current position and the second position information of the rotor assembly after passing the reference position; since the position offset information between the reference position and the initial position of the rotor assembly is fixed, if the position offset information between the reference position and the initial position of the rotor assembly is accurately calibrated, then the real-time electrical angle of the rotor assembly can be accurately calculated; compared with the traditional method, there is no need to drive the rotor assembly to the initial 0° position before controlling the rotation of the rotor assembly; therefore, the problem of inaccurate real-time electrical angle calculation caused by the initial electrical angle error due to the inability of the rotor assembly to accurately move to the initial 0° position can be solved; and by adopting this scheme, after the servo motor is powered on, the rotor assembly can realize the accurate calculation of the real-time electrical angle of the rotor assembly at any initial position, thereby realizing accurate vector control of the servo motor; improving the control accuracy of the servo motor and reducing motor loss.
[0090] Figure 3 is a flow chart of a servo motor driving method in another embodiment. This embodiment relates to an optional implementation process in which the servo motor obtains first position information of the rotor component at the current position and second position information of the rotor component after a reference position when the servo motor includes an incremental encoder. Based on the above embodiment, Figure 3 As shown, the above step 204 includes:
[0091] Step 302: Acquire first position information of a rotor assembly of the servo motor at a current position through an incremental encoder.
[0092] Step 304: acquiring preset state change information through an incremental encoder, and determining second position information of the rotor assembly passing through a reference position according to the preset state change information.
[0093] Exemplarily, when the incremental encoder is an ABI incremental encoder or an ABZ incremental encoder, the preset state change information may include the I pulse signal change information or the Z pulse signal change information of the incremental encoder. Accordingly, the reference position may include the position corresponding to the I pulse signal or the Z pulse signal, that is, the reference position is a position determined based on the incremental encoder for accurately calculating the real-time electrical angle of the rotor assembly.
[0094] That is to say, in this embodiment, the position of the rotor assembly can be detected in real time through the incremental encoder, and the first position information of the rotor assembly at the current position can be recorded; the preset state change information can also be obtained through the incremental encoder, and when the preset state change information is obtained, that is, when the I pulse signal change information or the Z pulse signal change information is detected, it indicates that the rotor assembly has rotated to the reference position at this time, and the second position information of the rotor assembly passing through the reference position at this time is recorded.
[0095] In this embodiment, when the servo motor includes an incremental encoder, the first position information of the rotor assembly of the servo motor at the current position can be obtained through the incremental encoder; and the preset state change information can be obtained through the incremental encoder, and the second position information of the rotor assembly passing through the reference position can be determined according to the preset state change information. That is, by adopting the method proposed in this embodiment, it is only necessary to replace the encoder in the traditional servo motor with a type I or type Z incremental encoder, and pre-calibrate the position offset information between the I signal position or the Z signal position and the initial position of the rotor assembly; the real-time electrical angle of the rotor assembly can be accurately calculated during the rotation of the rotor assembly, thereby realizing accurate vector control of the servo motor and improving the control accuracy of the servo motor. Of course, in the case where the traditional servo motor includes a type I or type Z incremental encoder, it is only necessary to adopt the method proposed in this application, pre-calibrate the rotor assembly, obtain the position offset information between the I signal position or the Z signal position and the initial position of the rotor assembly, and realize accurate vector control of the servo motor. That is, by adopting the method in this embodiment, it is possible to improve the traditional servo motor more conveniently, thereby optimizing the vector control accuracy of the servo motor and improving the control accuracy of the servo motor.
[0096] In one embodiment, the servo motor may further include a Hall sensor. Since the Hall sensor has six Hall states, the six Hall states can all be used to detect preset state change information during the rotation of the rotor assembly of the servo motor; therefore, in one implementation, the preset state change information may include state change information of the pulse signal of the Hall sensor; that is, in this implementation, a non-class I or non-class Z incremental encoder can be used in combination with a Hall sensor to achieve precise vector control of the servo motor. In other words, in the absence of a class I or class Z incremental encoder, precise vector control of the servo motor can also be achieved with the help of a Hall sensor.
[0097] Based on this, in the above step 304, the preset state change information is obtained through the incremental encoder, and the second position information of the rotor assembly passing the reference position is determined according to the preset state change information, which may include: when the Hall state change of the Hall sensor is obtained for the first time through the incremental encoder, the position information corresponding to the Hall state change at this time can be recorded as the second position information of the rotor assembly passing the reference position; accordingly, the reference position at this time can be the position corresponding to the Hall state; the position offset information between the reference position and the initial position of the rotor assembly can be the position offset information between the position corresponding to the Hall state and the initial position of the rotor assembly.
[0098] It should be noted that for each of the six Hall states of the Hall sensor, if the incremental encoder acquires the Hall state for the first time, rather than the second time, the servo motor can calculate the real-time electrical angle of the rotor assembly based on the position information corresponding to a Hall state change acquired for the first time, and the position offset information corresponding to the Hall state. For example: when the first Hall state change is acquired for the first time, the target electrical angle of the rotor assembly can be calculated based on the second position information corresponding to the first Hall state change, and the position offset information corresponding to the first Hall state change; or, when the second Hall state change is acquired for the first time, the target electrical angle of the rotor assembly can be calculated based on the second position information corresponding to the second Hall state change, and the position offset information corresponding to the second Hall state change; etc.
[0099] Of course, for each Hall state, if the incremental encoder does not collect the Hall state change for the first time, the target electrical angle of the rotor assembly can also be calculated based on the second position information corresponding to the Hall state change collected for the current time, the position offset information corresponding to the Hall state, and the relative position information between the first time and the current time. For example: record the second position information corresponding to the first Hall state change collected for the third time, combined with the position offset information corresponding to the first Hall state change, and combined with the relative position information between the third time and the first time; by calculating the difference between the first position information and the second position information, and calculating the sum of the difference, the position offset information and the relative position information, the target position information of the current position relative to the initial position can be obtained; wherein, the relative position information between the third time and the first time is equal to the product of the difference between the third time and the first time and the full circle position offset corresponding to the first time; and then, the target electrical angle of the rotor assembly at the current position relative to the initial position can be determined based on the target position information and the preset conversion relationship.
[0100] In another implementation, the preset state change information may also include first preset state change information and second preset state change information; wherein, the first preset state change information includes the state change information of the pulse signal of the Hall sensor, and the second preset state change information includes the state change information of the preset pulse signal of the incremental encoder; that is, in this implementation, precise vector control of the servo motor can be achieved through a Class I or Class Z incremental encoder combined with a Hall sensor.
[0101] refer to Figure 4 As shown, in the case where the preset state change information includes the first preset state change information and the second preset state change information, the preset state change information is acquired by the incremental encoder in the above step 304, and the second position information of the rotor assembly passing through the reference position is determined according to the preset state change information, which may include:
[0102] Step 402: If the preset state change information first acquired by the incremental encoder is the first preset state change information, second position information of the rotor assembly passing through the reference position is determined according to the first preset state change information.
[0103] Step 404: if the preset state change information first acquired by the incremental encoder is the second preset state change information, determine the second position information of the rotor assembly passing through the reference position according to the second preset state change information.
[0104] That is to say, when the preset state change information includes state change information corresponding to multiple different position sensors, the second position information of the rotor assembly passing through the reference position can be determined based on the state change information triggered by the rotor assembly passing through for the first time.
[0105] Correspondingly, the servo motor can also determine the position offset information between the reference position and the initial position of the rotor assembly according to the state change information of the rotor assembly passing through and triggered for the first time. Exemplarily, when the preset state change information obtained for the first time is the first preset state change information, the first position offset information corresponding to the first preset state change information can also be obtained; and the first position offset information is used as the position offset information between the reference position and the initial position of the rotor assembly. That is, when the state change information of the I pulse signal or the Z pulse signal is obtained for the first time, the position information when the state change of the I pulse signal or the Z pulse signal occurs is obtained as the second position information of the rotor assembly passing through the reference position; at the same time, the position corresponding to the I pulse signal or the Z pulse signal is used as the reference position, and the first position offset information between the position corresponding to the I pulse signal or the Z pulse signal and the initial position of the rotor assembly is obtained as the position offset information between the reference position and the initial position of the rotor assembly; that is, based on the second position information of the first occurrence of the I pulse signal change or the Z pulse signal change, the position offset information between the position corresponding to the I pulse signal or the Z pulse signal and the initial position of the rotor assembly, and the first position information of the rotor assembly at the current position, the target electrical angle of the rotor assembly at the current position is calculated.
[0106] Exemplarily, when the preset state change information obtained for the first time is the second preset state change information (that is, any Hall state change information of the Hall sensor), the second position offset information corresponding to the second preset state change information can also be obtained; and the second position offset information is used as the position offset information between the reference position and the initial position of the rotor assembly. That is to say, when any Hall state change information corresponding to the Hall sensor is obtained for the first time, the position information where the Hall state change occurs is obtained as the second position information of the rotor assembly passing through the reference position; at the same time, the position corresponding to the Hall state is used as the reference position, and the second position offset information between the position corresponding to the Hall state and the initial position of the rotor assembly is obtained as the position offset information between the reference position and the initial position of the rotor assembly; that is, based on the second position information where the Hall state change occurs for the first time, the position offset information between the position corresponding to the Hall state and the initial position of the rotor assembly, and the first position information of the rotor assembly at the current position, the target electrical angle of the rotor assembly at the current position is calculated.
[0107] In one implementation, if the first detected information is the Hall state change information, then during the subsequent rotation of the rotor assembly, the servo motor can calculate the target electrical angle of the rotor assembly at the current position based on the second position information corresponding to the Hall state change information, the position offset information corresponding to the Hall state change information, and the first position information of the rotor assembly; that is, the target electrical angle is calculated based on the Hall state; in this case, if the state change of the I pulse signal or the Z pulse signal is detected during the rotation of the rotor assembly, then the first method of calculating the target electrical angle based on the Hall state can be switched to the second method of calculating the target electrical angle based on the I pulse signal or the Z pulse signal; that is, at this time, the target electrical angle of the rotor assembly at the current position can be calculated based on the second position information corresponding to the I pulse signal or the Z pulse signal change information, the position offset information corresponding to the I pulse signal or the Z pulse signal, and the first position information of the rotor assembly. Since the detection accuracy of the I pulse signal or the Z pulse signal of the incremental sensor is higher than the detection accuracy of the Hall state change of the Hall sensor, when the target electrical angle of the rotor assembly is calculated based on the I pulse signal or the Z pulse signal, the accuracy of the calculated real-time electrical angle of the rotor assembly will also be higher.
[0108] Figure 5 FIG. 1 is a flow chart of a servo motor driving method in another embodiment. This embodiment involves an optional implementation process of calibrating a rotor assembly and obtaining position offset information between a reference position and an initial position of the rotor assembly. Based on the above embodiment, Figure 5 As shown, the above method also includes:
[0109] Step 502 : driving the rotor assembly in the servo motor to perform multiple bidirectional movements to determine initial position information of the rotor assembly at an initial position.
[0110] In the process of multiple bidirectional movements, the rotor assembly passes through the initial position multiple times.
[0111] For example, the initial position of the rotor assembly may be a position where the electrical angle of the rotor assembly is 0°. The bidirectional motion may be a cyclic reciprocating motion on both sides of 0°, so that the rotor assembly can pass through the 0° position multiple times, and obtain multiple candidate position information corresponding to the rotor assembly at the 0° position.
[0112] Exemplarily, the bidirectional motion may be a motion between +N° and -M°; wherein the magnitudes of the forward angle N° and the reverse angle M° may be the same or different, such as: multiple bidirectional motions between +180° and -180°, multiple bidirectional motions between +90° and -180°, multiple bidirectional motions between +180° and -90°, etc. In addition, the forward angle reached by each motion may also be different, and of course, the reverse angle reached by each motion may also be different; for example: motion from +180° to -160°, from -160° to +140°, from +140° to -120°, etc. The embodiment of the present application does not specifically limit the form of the bidirectional motion.
[0113] Exemplarily, the rotor assembly in the servo motor can be driven to perform multiple bidirectional movements to determine multiple candidate position information of the rotor assembly after passing through an initial position; then, the average value of the multiple candidate position information is calculated, and the average value of the multiple candidate position information is used as the initial position information of the rotor assembly at the initial position.
[0114] Exemplarily, when calculating the average value of multiple candidate position information, the maximum candidate position information and the minimum candidate position information may be removed first, and then the average value of the multiple candidate position information remaining after removing the maximum candidate position information and the minimum candidate position information is calculated.
[0115] For example, when a plurality of candidate position information when the rotor assembly passes through the initial position is obtained, the median position information can also be determined from the plurality of candidate position information as the initial position information of the rotor assembly at the initial position. The median position information can be obtained by sorting the plurality of candidate position information and taking the position information at the center of the sorting as the median position information.
[0116] Step 504 , driving the rotor assembly in the servo motor to perform a preset unidirectional motion, and determining the third position information of the rotor assembly when a first preset state change occurs and the fourth position information of the rotor assembly when a second preset state change occurs.
[0117] The first preset state change includes multiple state changes of the pulse signal of the Hall sensor, and the second preset state change includes the state change of the preset pulse signal of the incremental encoder; during the preset unidirectional movement, the multiple state changes of the pulse signal of the Hall sensor and the state change of the preset pulse signal of the incremental encoder all occur once. For example, the preset unidirectional movement can be a movement from P° to Q°, wherein the electrical angle range between P° and Q° can be between 360° and 420°; such as: movement from 0° to 360°, from 0° to 400°, from 10° to 400°, from -10° to 400°, etc.
[0118] During the preset unidirectional motion, the third position information corresponding to each Hall state change is collected when the rotor assembly triggers the change, and the fourth position information of the rotor assembly is collected when the I pulse signal change or the Z pulse signal change is triggered.
[0119] Step 506, calculating first position offset information corresponding to a first preset state change according to the third position information and the initial position information; and calculating second position offset information corresponding to a second preset state change according to the fourth position information and the initial position information.
[0120] Exemplarily, when the initial position is 0°, the initial position information of the rotor assembly corresponding to the initial position 0° can be obtained through the above step 502; and when the rotor assembly is driven to perform a preset unidirectional motion from the initial position 0°, the third position information relative to the initial position 0° when each first preset state change occurs, and the fourth position information relative to the initial position 0° when the second preset state change occurs can be obtained through the above step 504; then, based on this, for each first preset state change, the difference between the third position information when the first preset state change occurs and the initial position information can be calculated, so as to obtain the first position offset information corresponding to the first preset state change; that is, the first position offset information of each Hall state relative to the initial position 0° is obtained.
[0121] Similarly, the difference between the fourth position information when the second preset state changes occurs and the initial position information can be calculated to obtain the second position offset information corresponding to the second preset state change; that is, the second position offset information of the I signal state change or the Z signal state change relative to the initial position 0° is obtained.
[0122] In this embodiment, when the electrical angle of the rotor assembly is calibrated, the initial position information of the rotor assembly at the initial position of 0° is measured by driving the rotor assembly to perform multiple bidirectional movements; the driving method of multiple bidirectional movements can more accurately obtain the initial position information of the rotor assembly corresponding to the initial position of 0°, and provide accurate data basis for the subsequent calculation of position offset information. Next, by driving the rotor assembly to perform a preset unidirectional motion, the third position information of the rotor assembly when each Hall state change is triggered, and the fourth position information when the I / Z signal state change is triggered are measured; and according to the third position information when each Hall state changes and the initial position information of the rotor assembly at the initial position, the first position offset information of each Hall state relative to the initial position is determined; and according to the fourth position information when the I / Z signal state changes and the initial position information of the rotor assembly at the initial position, the second position offset information of the I / Z signal state relative to the initial position is determined; by using this calibration method, the position offset information of each reference position relative to the initial position of the rotor assembly can be obtained, thereby providing a data basis for the real-time electrical angle calculation of the rotor assembly; so that when the rotor assembly starts to rotate from any position after power-on, the real-time electrical angle of the rotor assembly can be accurately calculated; thereby improving the accuracy of the vector control of the servo motor.
[0123] Figure 6 FIG. 2 is a flow chart of a servo motor driving method in another embodiment. This embodiment involves an optional implementation process for determining whether the calibration is successful. Based on the above embodiment, Figure 6 As shown, the above method also includes:
[0124] Step 602: For each candidate position information, calculate the position error between the candidate position information and the initial position information, and determine whether the candidate position information satisfies a first position error condition according to the position error and a preset error threshold.
[0125] That is to say, when the initial position information of the rotor assembly at the initial position is determined based on multiple candidate position information, the position error between each candidate position information and the initial position information can be further determined, and the position error can be compared with a preset error threshold; if the position error is less than or equal to the preset error threshold, it means that the candidate position information meets the first position error condition. That is, it is ensured that each time the rotor assembly rotates to the initial position, the corresponding candidate position information at the initial position is approximately the same, so as to improve the accuracy of the position information corresponding to the initial position.
[0126] Step 604: When each candidate position information satisfies the first position error condition, it is determined that the initial position information calibration is successful.
[0127] That is to say, when the candidate position information of the rotor assembly satisfies the first position error condition each time when the rotor assembly passes through the initial position, it can be said that the position information of the rotor assembly at the initial position is relatively accurate. Then, the initial position information of the rotor assembly at the initial position can be determined based on the multiple candidate position information, and it is determined that the initial position information is relatively accurate, indicating that the initial position information calibration is successful.
[0128] Based on this, when the calibration is successful, further, the position offset information of each reference position relative to the initial position can be determined based on the initial position information, thereby ensuring the accuracy of each position offset information.
[0129] In this embodiment, in the process of using multiple bidirectional movements to drive the rotor assembly to rotate to determine the initial position information of the rotor assembly at the initial position, by judging whether each candidate position information is approximately the same, it is ensured that the rotor assembly can accurately rotate to the initial position, reducing the position error each time passing the initial position, thereby improving the calibration accuracy of the initial position information of the initial position; providing a high-precision data basis for the subsequent calibration process and real-time electrical angle calculation process; and thereby improving the vector control accuracy of the servo motor.
[0130] Figure 7 FIG. 2 is a flow chart of a servo motor driving method in another embodiment. This embodiment involves another optional implementation process for ensuring successful calibration and improving calibration accuracy. Based on the above embodiment, Figure 7 As shown, the above method also includes:
[0131] Step 702 , driving the rotor assembly in the servo motor to perform multiple bidirectional movements, and determining the position information of the rotor assembly when it passes through the first movement endpoint position, and the position information of the rotor assembly when it passes through the second movement endpoint position.
[0132] Wherein, the bidirectional motion includes a first motion endpoint position and a second motion endpoint position, and the first motion endpoint position and the second motion endpoint position are respectively located on both sides of the initial position. For example: when the initial position is the position corresponding to the electrical angle of 0°, the first motion endpoint position can be a forward electrical angle position, and the second motion endpoint position can be a reverse electrical angle position; or, the first motion endpoint position can also be a reverse electrical angle position, and the second motion endpoint position can be a forward electrical angle position. In addition, it should be noted that the absolute value of the electrical angle corresponding to the first motion endpoint position and the absolute value of the electrical angle corresponding to the second motion endpoint position can be the same or different.
[0133] For example, in the process of driving the rotor assembly in the servo motor to perform multiple bidirectional movements, the position information of the rotor assembly each time it passes through the first movement endpoint position and the position information of the rotor assembly each time it passes through the second movement endpoint position can also be determined.
[0134] Step 704: Determine whether the position information of each first motion endpoint position and the position information of each second motion endpoint position meet a second position error condition based on the position information of each first motion endpoint position and the position information of each second motion endpoint position.
[0135] The second position error condition may include a first position error sub-condition corresponding to the first motion endpoint position, and a second position error sub-condition corresponding to the second motion endpoint position.
[0136] For example, it is possible to determine whether the position information of each first motion endpoint position satisfies the first position error sub-condition based on the position information of each first motion endpoint position; and to determine whether the position information of each second motion endpoint position satisfies the second position error sub-condition based on the position information of each second motion endpoint position.
[0137] Exemplarily, for the first motion endpoint position, the average value of the position information of each first motion endpoint position can be calculated to obtain the first average position information; then, the position error between the position information of the first motion endpoint position and the first average position information is calculated; if the position error is less than or equal to the preset error threshold, it is determined that the position information of the first motion endpoint position satisfies the first position error sub-condition; if the position information of each first motion endpoint position satisfies the first position error sub-condition, it means that each time the rotor assembly moves to the first motion endpoint position, the corresponding position information is almost the same; that is, it ensures that the rotor assembly can move to the first motion endpoint position each time, and there will be no situation where the rotor assembly cannot accurately move to the first motion endpoint position due to friction or other reasons; the movement accuracy of the first motion endpoint position is improved.
[0138] Exemplarily, for the second motion endpoint position, the average value of the position information of each second motion endpoint position can be calculated to obtain the second average position information; then, the position error between the position information of the second motion endpoint position and the second average position information is calculated; if the position error is less than or equal to the preset error threshold, it is determined that the position information of the second motion endpoint position satisfies the second position error sub-condition; if the position information of each second motion endpoint position satisfies the second position error sub-condition, it means that each time the rotor assembly moves to the second motion endpoint position, the corresponding position information is almost the same; that is, it ensures that the rotor assembly can move to the second motion endpoint position each time, and there will be no situation where the rotor assembly cannot accurately move to the second motion endpoint position due to friction or other reasons; the movement accuracy of the second motion endpoint position is improved.
[0139] Exemplarily, the above-mentioned second position error condition may also include a third position error sub-condition; the third position error sub-condition is used to characterize that each time the rotor assembly performs bidirectional motion, it reciprocates between the first motion endpoint position and the second motion endpoint position; that is, to ensure that one movement can completely move from the first motion endpoint position to the second motion endpoint position, or, from the second motion endpoint position to the first motion endpoint position.
[0140] For example, if a bidirectional motion includes moving from a first motion endpoint position to a second motion endpoint position, and moving from a second motion endpoint position to a first motion endpoint position; then, when moving from the first motion endpoint position to the second motion endpoint position, the position information of the rotor assembly when moving to the second motion endpoint position can be collected; when moving from the second motion endpoint position to the first motion endpoint position, the position information of the rotor assembly when moving to the first motion endpoint position can be collected. Based on this, when undergoing W bidirectional motions, W pieces of position information at the first motion endpoint position and W pieces of position information at the second motion endpoint position can be collected.
[0141] Next, for each bidirectional movement, the interval position information between the position information at the first movement endpoint position and the position information at the second movement endpoint position corresponding to the bidirectional movement can be calculated respectively, and the error between the interval position information and the preset position information threshold can be calculated; when it is determined that the error is less than or equal to the preset error threshold, it can be determined that the bidirectional movement satisfies the third position error sub-condition; further, when it is determined that each bidirectional movement satisfies the third position error sub-condition, it can be determined that the rotor assembly can reciprocate between the first movement endpoint position and the second movement endpoint position each time.
[0142] Exemplarily, with respect to the judgment of the above three position error sub-conditions, when the first position error sub-condition and the second position error sub-condition are met, it can be determined that the second position error condition is met; of course, it can also be determined that the second position error condition is met when the first position error sub-condition, the second position error sub-condition and the third position error sub-condition are met.
[0143] Accordingly, the above step 604 may include:
[0144] Step 706, when all candidate position information satisfies the first position error condition, and the position information of each first motion endpoint position and the position information of each second motion endpoint position satisfies the second position error condition, it is determined that the initial position information calibration is successful.
[0145] In the present embodiment, during the process of the rotor assembly performing multiple bidirectional movements, error judgment is made on the position information of the rotor assembly each time it passes the initial position, error judgment is made on the position information of the rotor assembly each time it passes the first movement endpoint position, error judgment is made on the position information of the rotor assembly each time it passes the second movement endpoint position, and error judgment is made on the movement position information of the rotor assembly between the first movement endpoint position and the second movement endpoint position. That is, a comprehensive judgment is made from four dimensions as to whether the calibration process of the rotor assembly meets the preset calibration conditions, so as to achieve high-precision calibration of the rotor assembly and obtain a high-precision calibration result. This provides strong data support for the subsequent calculation of the real-time electrical angle of the rotor assembly, and can greatly improve the accuracy of vector control of the servo motor.
[0146] In one embodiment, a complete embodiment of a servo motor driving method is provided. First, refer to Figure 8 As shown, it shows a system structure diagram of a servo motor drive control. It includes a coordinate transformation Park inverse transformation module, an SVPWM module, a three-phase inverter and a servo motor; wherein the servo motor may include Figure 8 The permanent magnet synchronous motor (PMSM) shown in the figure; in addition, the servo motor drive control system is also configured with an incremental encoder and a Hall sensor, adopts a FOC control algorithm, and uses the Hall signal value and the incremental encoder to measure the electrical angle position of the servo motor rotor.
[0147] refer to Fig. 9 As shown, it shows a schematic diagram of the position of a Hall sensor and a rotor. And reference Fig.10 As shown, it shows a schematic diagram of the connection between a motor and an incremental encoder; in this example, for a permanent magnet brushless DC motor, an incremental encoder is configured, and the incremental encoder is used to measure the motor position increment value using AB phase pulses, and the motor full circle increment value is measured using I (or Z) phase pulses.
[0148] Secondly, continue to refer to Figure 8 As shown in the system structure diagram, a control switch is also included. When the control switch is turned on, a complete motor drive closed-loop control system can be formed; the calculated real-time electrical angle of the servo motor rotor is fed back to the coordinate transformation Park inverse transformation module, so that the coordinate transformation Park inverse transformation module can control the rotor of the servo motor based on the input voltage Uq and Ud, and the real-time electrical angle θ.
[0149] When the control switch is disconnected, it can be used to calibrate the initial electrical angle of the servo motor's rotor, that is, the given electrical angle is input from the outside to the coordinate transformation Park inverse transformation module, thereby realizing the calibration of the rotor electrical angle.
[0150] The following is a detailed description of the rotor electrical angle calibration process. Fig.11 As shown, the following steps are included:
[0151] Step 1: Let the SVPWM module set the electrical angle θ=0, the quadrature axis set voltage Uq=0 (so that the torque direction is consistent with the D-axis direction, the D-axis direction can be represented as the direction of the rotor), and the direct axis set voltage Ud ramps up from 0 to 1 / 2 times the rated voltage U*, that is, Ud=U* / 2.
[0152] Step 2: Let the given electrical angle θ of the SVPWM module slowly change to -30° and stabilize for 1 second.
[0153] Step 3: Let the SVPWM module slowly change the given electrical angle θ to 180°, record the electrical angle jump θ = 0°, that is, at time t1, the incremental encoder records the accumulated position value α1; when the electrical angle θ is 180°, stabilize for 1s, record the position stability at time thi1, and the incremental encoder records the position value β1.
[0154] Step 4: Let the SVPWM module set the electrical angle θ to change slowly to -180°, record the electrical angle jump θ=0°, that is, at time t2, the incremental encoder records the accumulated position value α2; when the electrical angle θ is -180°, stabilize for 1s, record the position stability at time tlow1, and the incremental encoder records the position value γ1.
[0155] Step 5: Repeat steps 3 and 4 four times, and record the incremental encoder position values α3-α8 corresponding to the times t3-t8, the incremental encoder position values β2-β4 corresponding to the times thi2-thi4, and the incremental encoder position values γ2-γ4 corresponding to the times tlow2-tlow4.
[0156] Step 6: Let the SVPWM module set the electrical angle θ to slowly change to 0°.
[0157] Step 7: Let the SVPWM module slowly change the given electrical angle θ to 400°, and capture the 6 state switching moments of the Hall sensor thall1-thall6, the incremental encoder position values Angle_hall1-Angle_hall6, and the I signal state switching moment, the incremental encoder position value Angle_Abi.
[0158] Step 8: Calculate the offset angle; the number of pulses per full circle of the incremental encoder Abi is known, and the number of motor pole pairs n p Known.
[0159] 1. Set the polarity deflection flag; if β i >γ i (i=1-4), then polar=1, otherwise polar=-1.
[0160] 2. 0° electrical angle position value: α0 = (α1 + α2 + α3 + α4 + α5 + α6 + α7 + α8) / 8
[0161] 3. 180° electrical angle position value: β = (β1 + β2 + β3 + β4) / 4, detβ i =β i -β, i=1-4
[0162] 4. -180° electrical angle position value: γ=(γ1+γ2+γ3+γ4) / 4, detγ i =γ i -γ, i=1-4
[0163] 5. Position difference of plus or minus 180°: det i =polar*(β i -γ i )
[0164] 6. Judge a(4): |detβ i * p *360 / |<allowable angle error (e.g. 5°)
[0165] Here, a(4) is used to determine the position error of the incremental encoder at 180°, that is, to ensure that the rotor assembly rotates accurately to the position corresponding to 180° each time to avoid failure to rotate to the position corresponding to 180° due to friction or other reasons.
[0166] 7. Judge b(4): |detγ i * p *360 / |<allowable angle error (e.g. 5°)
[0167] Here, b(4) is used to determine the position error of the incremental encoder at -180°, that is, to ensure that the rotor assembly rotates accurately to the position corresponding to -180° each time to avoid failure to rotate to the position corresponding to -180° due to friction or other reasons.
[0168] 8. Judge c(4): |polar*det i * p *360 / -360<allowable angle error (e.g. 5°)
[0169] Here c(4) is used to determine whether the rotor assembly rotates between positive and negative 180 degrees, that is, to ensure that the rotor assembly rotates 360 degrees in one direction at a time.
[0170] 9. Judge d(8):|(α i -0)* p *360 / |<allowable angle error (e.g. 5°)
[0171] Here, d(8) is used to determine the position error of the incremental encoder at 0°, that is, to determine whether the rotor assembly can accurately reach the position corresponding to 0° each time it passes through 0°.
[0172] 10. If a, b, c, and d are all true, the calibration is correct. Next, calculate the offset angle and store it.
[0173] a) The offset angle between the I signal position and the initial 0° position: Offset_Index = Angle_Abi - α0
[0174] b) The offset angle between Hall state 1 and the initial 0° position: Offset_Hall1 = Angle_Hall1 - α0
[0175] c) The offset angle between Hall state 2 and the initial 0° position: Offset_Hall2 = Angle_Hall2 - α0
[0176] d) The offset angle between Hall state 3 and the initial 0° position: Offset_Hall3 = Angle_Hall3 - α0
[0177] e) The offset angle between Hall state 4 and the initial 0° position: Offset_Hall4 = Angle_Hall4 - α0
[0178] f) The offset angle between Hall state 5 and the initial 0° position: Offset_Hall5 = Angle_Hall5 - α0
[0179] g) The offset angle between Hall state 6 and the initial 0° position: Offset_Hall6 = Angle_Hall6 - α0
[0180] Then, after the calibration is completed, the real-time electrical angle calculation of the servo motor's rotor can be performed based on the calibration result of point 10 in step 8 above. Figure 8 The control switch shown in is closed, making the entire system structure conductive.
[0181] refer to Fig.12 As shown, it shows a schematic diagram of the working principle of electrical angle calculation using an incremental encoder and a Hall sensor.
[0182] Among them, state 1: after the motor driver is powered on, the I signal of the incremental encoder and the state switching of the Hall sensor do not appear. At this time, the electrical angle can be determined according to the state of the Hall sensor. The corresponding relationship between the Hall state and the electrical angle is shown in Table 1. The electrical angle error range in state 1 is 0°-60°.
[0183] Table 1
[0184]
[0185]
[0186] Exemplarily, after the motor driver is powered on, the current Hall state of the Hall sensor can be detected, and in combination with the above Table 1, based on the current Hall state, the offset angle corresponding to the current Hall state can be determined, and then the electrical angle of the rotor can be calculated based on the offset angle corresponding to the current Hall state.
[0187] For example: after the motor driver is powered on, if the Hall state of the Hall sensor is state 4, then through the above Table 1, it can be determined that the offset angle corresponding to the Hall state 4 is Offset_Hall1; then, at this time, the electrical angle of the rotor can be calculated based on the offset angle Offset_Hall1, that is, the electrical angle of the rotor = polar × (Offset_Hall1) × 360 × n p / Abi.
[0188] State 2: In state 1, once the Hall state switch is captured, it enters state 2 and uses the offset angle of the Hall sensor and the incremental encoder to determine the exact electrical angle. The calculation formula is shown in formula (1).
[0189] θ=polar*(Angle_real-Angle_switch+Offset_Hallu)*360*n p / Abi (1)
[0190] Among them, Angle_real is the first position information of the rotor assembly at the current position collected by the incremental encoder; Angle_switch is the second position information of the rotor assembly collected by the incremental encoder when it passes the reference position (that is, the Hall state switching occurs); Offset_Halli is the offset angle between the position corresponding to the Hall state and the initial 0° position; i represents the Hall commutation position, and the i rule is:
[0191] i=1 corresponds to the bidirectional transition between Hall states 4 and 6
[0192] i=2 corresponds to the bidirectional jump between Hall states 6 and 2
[0193] i=3 corresponds to the bidirectional transition between Hall states 2 and 3
[0194] i=4 corresponds to the bidirectional transition between Hall states 3 and 1
[0195] i=5 corresponds to the bidirectional transition between Hall states 1 and 5
[0196] i=6 corresponds to the bidirectional transition between Hall states 5 and 4
[0197] State 3: In state 1 or state 2, once the I signal of the incremental encoder is detected, state 3 is entered, and the offset angle of the incremental encoder and the incremental encoder value are used to determine the accurate electrical angle. The calculation formula is as shown in formula (2).
[0198] θ=polar*(Angle_real-Angle_Index+Offset_Index)*360*n p / Abi (2)
[0199] Among them, Angle_Index is the second position information of the rotor assembly collected by the incremental encoder when it passes through the reference position (that is, the I signal state changes); Offset_Halli is the offset angle between the position corresponding to the I signal state and the initial 0° position.
[0200] For example, when the incremental encoder does not have an I signal pulse, there is no state 3, that is, only a jump between state 1 and state 2 is performed, that is, position detection is only performed through the Hall sensor, thereby realizing the calculation of the real-time electrical angle of the rotor assembly; Fig.13 shown.
[0201] The motor driving method in this embodiment uses an ABI (or ABZ) incremental encoder to measure the mechanical angle of the motor end and uses a Hall sensor to calculate the initial electrical angle. The above-mentioned servo motor electrical angle calibration method and real-time electrical angle calculation method can quickly and accurately calibrate the initial electrical angle of the servo motor in the calibration mode, and can quickly calculate the actual electrical angle of the motor in the operation mode, supporting the subsequent motor control algorithm.
[0202] In addition, in the electrical angle calibration method, a two-way multiple low-speed motion method is adopted to measure the incremental encoder value corresponding to the 0° electrical angle during the motion process, and the cumulative average of multiple bidirectional measurement values is used as the 0 position value; the bidirectional motion sampling average processing method can reduce the position value deviation caused by mechanical clearance, viscous friction, etc., and improve the accuracy of calibration. Furthermore, the use of multiple criteria to confirm the correctness of the calibration can ensure the correctness and accuracy of the current calibration measurement. In addition, after the 0° calibration is successfully confirmed, the offset angle between the I signal and the Hall state and the initial 0° is obtained through a 400° unidirectional scan, ensuring that in the motion mode, when the I signal Index changes and the Hall hall jumps, the actual electrical angle of the motor can be accurately identified, thereby improving the accuracy of the motor vector control.
[0203] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0204] Based on the same inventive concept, the embodiment of the present application also provides a servo motor driving device for implementing the servo motor driving method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more servo motor driving device embodiments provided below can refer to the limitations of the servo motor driving method above, and will not be repeated here.
[0205] In one embodiment, Fig.14 As shown, a servo motor driving device is provided, including: a first acquisition module 1402, a first determination module 1404 and a driving module 1406, wherein:
[0206] The first acquisition module 1402 is used to acquire first position information of the rotor assembly of the servo motor at a current position and second position information of the rotor assembly after passing through a reference position.
[0207] The first determination module 1404 is used to determine the target electrical angle of the rotor assembly at the current position according to the first position information, the second position information and the position offset information between the reference position and the initial position of the rotor assembly; the initial position is the position corresponding to the rotor assembly at the initial electrical angle.
[0208] The driving module 1406 is used to drive the rotor assembly to rotate according to the target electrical angle.
[0209] In one embodiment, the servo motor includes an incremental encoder; the first acquisition module 1402 includes:
[0210] A first acquisition submodule, used to acquire first position information of a rotor assembly of the servo motor at a current position through an incremental encoder;
[0211] The second acquisition submodule is used to acquire preset state change information through an incremental encoder, and determine second position information of the rotor assembly passing through a reference position according to the preset state change information.
[0212] In one embodiment, the servo motor further includes a Hall sensor; the preset state change information includes first preset state change information and second preset state change information; the first preset state change information includes state change information of a pulse signal of the Hall sensor, and the second preset state change information includes state change information of a preset pulse signal of an incremental encoder;
[0213] The second acquisition submodule is used to determine the second position information of the rotor assembly passing through the reference position according to the first preset state change information when the preset state change information first acquired through the incremental encoder is the first preset state change information; and to determine the second position information of the rotor assembly passing through the reference position according to the second preset state change information when the preset state change information first acquired through the incremental encoder is the second preset state change information.
[0214] In one embodiment, the device further comprises:
[0215] A second acquisition module, used to acquire first position offset information corresponding to the first preset state change information;
[0216] a second determining module, configured to use the first position offset information as position offset information between a reference position and an initial position of the rotor assembly; or
[0217] The second acquisition module is further used to acquire second position offset information corresponding to the second preset state change information;
[0218] The second determining module is further configured to use the second position offset information as position offset information between the reference position and the initial position of the rotor assembly.
[0219] In one embodiment, the first determining module 1404 includes:
[0220] A first calculation submodule is used to calculate the difference between the first position information and the second position information, and calculate the sum of the difference and the position offset information to obtain the target position information of the current position relative to the initial position;
[0221] The first determination submodule is used to determine the target electrical angle of the rotor assembly at the current position relative to the initial position based on the target position information and a preset conversion relationship; the preset conversion relationship is used to convert the position information of the incremental encoder into the electrical angle of the rotor assembly.
[0222] In one embodiment, the device further comprises:
[0223] A third determination module is used to drive the rotor assembly in the servo motor to perform multiple bidirectional movements to determine the initial position information of the rotor assembly at the initial position; the rotor assembly passes through the initial position multiple times during the multiple bidirectional movements;
[0224] A fourth determination module is used to drive the rotor assembly in the servo motor to perform a preset unidirectional motion, and determine the third position information of the rotor assembly when a first preset state change occurs and the fourth position information when a second preset state change occurs; the first preset state change includes multiple state changes of the pulse signal of the Hall sensor, and the second preset state change includes the state change of the preset pulse signal of the incremental encoder; during the preset unidirectional motion process, the multiple state changes of the pulse signal of the Hall sensor and the state change of the preset pulse signal of the incremental encoder all occur once;
[0225] The calculation module is used to calculate the first position offset information corresponding to the first preset state change according to the third position information and the initial position information; and calculate the second position offset information corresponding to the second preset state change according to the fourth position information and the initial position information.
[0226] In one embodiment, the computing module includes:
[0227] A second calculation submodule is used to calculate, for each first preset state change, a difference between the third position information when the first preset state change occurs and the initial position information, so as to obtain the first position offset information corresponding to the first preset state change;
[0228] The third calculation submodule is used to calculate the difference between the fourth position information and the initial position information when the second preset state changes, and obtain the second position offset information corresponding to the second preset state change.
[0229] In one embodiment, the third determination module includes:
[0230] A second determination submodule is used to drive the rotor assembly in the servo motor to perform multiple bidirectional movements to determine multiple candidate position information of the rotor assembly after passing through the initial position;
[0231] The fourth calculation submodule is used to calculate an average value of multiple candidate position information, and use the average value of the multiple candidate position information as the initial position information of the rotor assembly at the initial position.
[0232] In one embodiment, the device further comprises:
[0233] A fifth determination module, configured to calculate, for each candidate position information, a position error between the candidate position information and the initial position information, and determine whether the candidate position information satisfies a first position error condition according to the position error and a preset error threshold;
[0234] The sixth determination module is used to determine whether the initial position information is calibrated successfully when all candidate position information satisfies the first position error condition.
[0235] In one embodiment, the bidirectional motion includes a first motion endpoint position and a second motion endpoint position; the device further includes:
[0236] A seventh determination module is used to drive the rotor assembly in the servo motor to perform multiple bidirectional movements, and determine the position information of the rotor assembly when it passes through the first movement endpoint position, and the position information of the rotor assembly when it passes through the second movement endpoint position;
[0237] An eighth determination module, used to determine whether the position information of each first motion endpoint position and the position information of each second motion endpoint position meet a second position error condition according to the position information of each first motion endpoint position and the position information of each second motion endpoint position;
[0238] Correspondingly, the sixth determination module is used to determine that the initial position information calibration is successful when each candidate position information satisfies the first position error condition, the position information of each first motion endpoint position and the position information of each second motion endpoint position satisfy the second position error condition.
[0239] Each module in the above servo motor drive device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0240] In one embodiment, a servo motor is provided, whose internal structure diagram can be shown as follows: Fig.15As shown. The servo motor includes a processor and a memory connected via a system bus. The processor of the servo motor is used to provide computing and control capabilities. The memory of the servo motor includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, a motor driving method is implemented.
[0241] Those skilled in the art will understand that Fig.15 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the servo motor to which the scheme of the present application is applied. The specific servo motor may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0242] In one embodiment, a servo motor is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the motor driving method in any of the above embodiments when executing the computer program.
[0243] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the motor driving method in any of the above embodiments are implemented.
[0244] In one embodiment, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the motor driving method in any of the above embodiments are implemented.
[0245] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0246] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0247] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A servo motor driving method, characterized in that: The method comprises: Acquire first position information of a rotor assembly of the servo motor at a current position and second position information of the rotor assembly after passing a reference position; Determine a target electrical angle of the rotor assembly at the current position according to the first position information, the second position information, and the position offset information between the reference position and the initial position of the rotor assembly; the initial position is the position of the rotor assembly corresponding to the initial electrical angle; The rotor assembly is driven to rotate according to the target electrical angle.
2. The method according to claim 1, characterized in that The servo motor includes an incremental encoder; the obtaining of first position information of a rotor assembly of the servo motor at a current position and second position information of the rotor assembly after a reference position includes: Acquire first position information of the rotor assembly of the servo motor at a current position through the incremental encoder; Preset state change information is acquired through the incremental encoder, and second position information of the rotor assembly passing through a reference position is determined according to the preset state change information.
3. The method according to claim 2, characterized in that The servo motor further includes a Hall sensor; the preset state change information includes first preset state change information and second preset state change information; the first preset state change information includes state change information of a pulse signal of the Hall sensor, and the second preset state change information includes state change information of a preset pulse signal of the incremental encoder; The step of acquiring preset state change information through the incremental encoder and determining second position information of the rotor assembly passing through a reference position according to the preset state change information comprises: If the preset state change information first acquired by the incremental encoder is the first preset state change information, determining the second position information of the rotor assembly passing through the reference position according to the first preset state change information; If the preset state change information first acquired by the incremental encoder is the second preset state change information, the second position information of the rotor assembly passing through the reference position is determined according to the second preset state change information.
4. The method according to claim 3, characterized in that The method further comprises: Acquire first position offset information corresponding to the first preset state change information, and use the first position offset information as position offset information between the reference position and the initial position of the rotor assembly; or, Second position offset information corresponding to the second preset state change information is acquired, and the second position offset information is used as position offset information between the reference position and the initial position of the rotor assembly.
5. The method according to claim 3, characterized in that: The method further comprises: driving the rotor assembly in the servo motor to perform multiple bidirectional movements, and determining initial position information of the rotor assembly at the initial position; during the multiple bidirectional movements, the rotor assembly passes through the initial position multiple times; The rotor assembly in the servo motor is driven to perform a preset unidirectional motion, and the third position information of the rotor assembly when a first preset state change occurs and the fourth position information of the rotor assembly when a second preset state change occurs are determined; the first preset state change includes multiple state changes of the pulse signal of the Hall sensor, and the second preset state change includes the state change of the preset pulse signal of the incremental encoder; during the preset unidirectional motion, the multiple state changes of the pulse signal of the Hall sensor and the state change of the preset pulse signal of the incremental encoder all occur once; The first position offset information corresponding to the first preset state change is calculated according to the third position information and the initial position information; and the second position offset information corresponding to the second preset state change is calculated according to the fourth position information and the initial position information.
6. The method according to claim 5, characterized in that calculating, according to the third position information and the initial position information, first position offset information corresponding to when the first preset state changes; And calculating, according to the fourth position information and the initial position information, second position offset information corresponding to when the second preset state changes, including: For each of the first preset state changes, calculating a difference between the third position information when the first preset state change occurs and the initial position information, to obtain first position offset information corresponding to the first preset state change; The difference between the fourth position information when the second preset state changes and the initial position information is calculated to obtain the second position offset information corresponding to the second preset state change.
7. The method according to claim 5 or 6, characterized in that: The step of driving the rotor assembly in the servo motor to perform a plurality of bidirectional movements and determining initial position information of the rotor assembly at the initial position includes: driving the rotor assembly in the servo motor to perform multiple bidirectional movements, and determining multiple candidate position information of the rotor assembly after passing through the initial position; An average value of the plurality of candidate position information is calculated, and the average value of the plurality of candidate position information is used as the initial position information of the rotor assembly at the initial position.
8. The method according to claim 7, characterized in that The method further comprises: For each of the candidate position information, calculate the position error between the candidate position information and the initial position information, and determine whether the candidate position information meets a first position error condition according to the position error and a preset error threshold; When each of the candidate position information satisfies the first position error condition, it is determined that the initial position information is calibrated successfully.
9. The method according to claim 8, characterized in that The bidirectional motion includes a first motion endpoint position and a second motion endpoint position; the method further includes: Driving the rotor assembly in the servo motor to perform multiple bidirectional movements, determining position information of the rotor assembly when passing through the first movement endpoint position, and position information of the rotor assembly when passing through the second movement endpoint position; Determining whether the position information of each first motion endpoint position and the position information of each second motion endpoint position meet a second position error condition according to the position information of each first motion endpoint position and the position information of each second motion endpoint position; Accordingly, when each of the candidate position information satisfies the first position error condition, determining that the initial position information is calibrated successfully includes: When each of the candidate position information satisfies the first position error condition, and the position information of each of the first motion endpoint positions and the position information of each of the second motion endpoint positions satisfies the second position error condition, it is determined that the initial position information calibration is successful.
10. A servo motor driving device, characterized in that: The device comprises: A first acquisition module, used for acquiring first position information of the rotor assembly of the servo motor at a current position and second position information of the rotor assembly after passing a reference position; A first determination module is used to determine a target electrical angle of the rotor assembly at the current position according to the first position information, the second position information, and position offset information between the reference position and the initial position of the rotor assembly; the initial position is a position corresponding to the rotor assembly at an initial electrical angle; A driving module is used to drive the rotor assembly to rotate according to the target electrical angle.
11. A servo motor, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.