Mode switching method and device of servo motor, electronic equipment and storage medium
By calculating the predicted speed output torque in the servo motor and determining the switching timing based on its comparison relationship with the target torque, the problem of speed overshoot in the servo motor torque control mode is solved, and the stability and control accuracy of the system are improved.
Patent Information
- Application Number
- CN202411315434.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-10
AI Technical Summary
In the prior art, the servo motor has a rapid increase in speed due to the rapid increase in speed in the torque control mode, which can easily lead to overshoot speed, increasing the risk of system vibration and damage, and the traditional torque mode speed limiting method is insufficient.
When the servo motor is in torque control mode, the predicted speed output torque is calculated by obtaining the rotation speed and the preset speed limit value. If the predicted speed output torque is not lower than the target torque, switch to the speed control mode to determine Switch the timing to avoid speed overshoot.
It realizes accurate switching to the speed control mode in torque control mode, avoids the risk of damage caused by speed overshooting of the servo motor, and improves system stability and control accuracy.
Smart Images

Figure CN119298786A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of motor control technology, and in particular to a mode switching method, device, electronic device and storage medium for a servo motor. Background Art
[0002] In modern industrial production, servo motors have been widely used in various industries due to their simple control, high precision and high reliability. Different application scenarios require different servo motor control methods, and the torque control mode is also one of the more commonly used control methods in servo motor control. It is widely used in machine tool processing, textile, robotics and other industries.
[0003] The torque mode of the servo motor can achieve precise control of the load torque, but when the given torque is greater than the load torque, the motor speed will rise rapidly. If the speed is not limited and controlled in time, it may cause damage to the servo motor and even the entire servo control system. The current common practice is that when the speed reaches the set limit value, the control system starts to switch from torque mode to speed mode and perform closed-loop speed control. However, this method of switching when the speed reaches the limit value usually causes the speed to continue to rise for a period of time after switching, resulting in a large speed overshoot, increasing the risk of system vibration or even damage. Therefore, the traditional torque mode speed limiting method needs to be further optimized and improved. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a mode switching method, device, electronic device and storage medium for a servo motor to solve the problem in the prior art that the control mode of the servo motor is switched only according to the rotation speed, which easily causes speed overshoot and puts the servo motor at risk of damage.
[0005] According to a first aspect of an embodiment of the present application, a mode switching method for a servo motor is provided, the method comprising: obtaining a rotation speed of the servo motor when the servo motor is in a torque control mode; obtaining a preset first speed limit value, and calculating a predicted speed output torque based on the rotation speed and the first speed limit value, wherein the first speed limit value is a preset target speed of the servo motor in the torque control mode; when the predicted speed output torque is not lower than the preset target torque, adjusting the control mode of the servo motor to a speed control mode.
[0006] According to a second aspect of an embodiment of the present application, a mode switching device for a servo motor is provided, the device comprising: an acquisition module for acquiring the rotation speed of the servo motor when the servo motor is in a torque control mode; a torque module for acquiring a preset first speed limit value, and calculating a predicted speed output torque based on the rotation speed and the first speed limit value, wherein the first speed limit value is a preset target speed of the servo motor in the torque control mode; and a switching module for adjusting the control mode of the servo motor to a speed control mode when the predicted speed output torque is not lower than a preset target torque.
[0007] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0008] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0009] Compared with the prior art, the embodiments of the present application have the following beneficial effects: in the embodiments of the present application, when the servo motor is in the torque control mode, the rotation speed of the servo motor is obtained; a preset first speed limit value is obtained, and a predicted speed output torque is calculated according to the rotation speed and the first speed limit value, the first speed limit value being a preset target speed of the servo motor in the torque control mode; when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to the speed control mode, and the above method is used to predict the predicted speed output torque corresponding to the rotation speed of the servo motor in the speed control mode, and when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to the speed control mode, and the timing of switching from the torque control mode to the speed control mode is determined according to the comparison relationship between the predicted speed output torque and the target torque, thereby avoiding the problem in the related art that the control mode of the servo motor is switched only according to the rotation speed, which easily causes speed overshoot and leads to the risk of damage to the servo motor. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1It is a flow chart of a mode switching method of a servo motor provided in an embodiment of the present application;
[0012] Figure 2 is a flow chart of another mode switching method of a servo motor provided in an embodiment of the present application;
[0013] Figure 3 is a flow chart of another mode switching method of a servo motor provided in an embodiment of the present application;
[0014] Figure 4 It is a flow chart of another mode switching method of a servo motor provided in an embodiment of the present application;
[0015] Figure 5 is a flow chart of another mode switching method of a servo motor provided in an embodiment of the present application;
[0016] Figure 6 It is a flowchart of another optional servo motor mode switching method provided in an embodiment of the present application;
[0017] Figure 7 It is a basic schematic diagram of a servo motor controller provided in an embodiment of the present application;
[0018] Figure 8 It is a basic schematic diagram of an output change process of a pseudo speed control loop provided in an embodiment of the present application;
[0019] Fig. 9 is a structural schematic diagram of a mode switching device for a servo motor provided in an embodiment of the present application;
[0020] Fig.10 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0022] A mode switching method and device for a servo motor according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0023] Figure 1 A mode switching method of a servo motor provided in an embodiment of the present application is as follows: Figure 1 As shown, the method includes:
[0024] S101, when the servo motor is in a torque control mode, obtaining a rotation speed of the servo motor;
[0025] S102, obtaining a preset first speed limit value, and calculating a predicted speed output torque according to the rotation speed and the first speed limit value, wherein the first speed limit value is a preset target speed of the servo motor in a torque control mode;
[0026] S103: When the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to the speed control mode.
[0027] It can be understood that the above-mentioned servo motor mode switching method provided in this example is applied to the controller of the servo motor, in which the servo motor can be controlled by a speed control mode or a torque control mode. During the process of torque mode control of the servo motor, the controller can provide the servo motor with a stable output torque, so that the servo motor can output stably according to the output torque.
[0028] It can be understood that when the servo motor outputs stably according to the output torque, it will feed back the rotation speed of its own motor shaft to the controller. When the controller receives the rotation speed, it will obtain a preset first speed limit value. The first speed limit value is a preset target speed of the servo motor in the torque control mode. When the servo motor is in the torque control mode and the rotation speed of the servo motor is below the first speed limit value, the servo motor itself will not be damaged.
[0029] The first speed limit value is a value determined by relevant technicians according to the actual situation of the servo motor.
[0030] It can be understood that the rotation speed of the servo motor will increase with the increase of the output torque provided by the controller, that is, as the rotation speed of the servo motor increases, the torque of the servo motor also increases. In order to better and more accurately control the servo motor and avoid the servo motor failing to enter the speed control mode in time, resulting in the problem of rotation speed overshoot in the torque control mode, this example will predict the predicted speed output torque corresponding to the rotation speed of the servo motor in the speed control mode.
[0031] Specifically, this example calculates the predicted speed output torque based on the rotation speed and the first speed limit value; it can be understood that if the servo motor is in the torque control mode and the rotation speed is fed back in real time, this example will calculate the real-time predicted speed output torque based on the real-time determined rotation speed and the first speed limit value; if the servo motor is in the torque control mode and the rotation speed is fed back only when the rotation speed changes, this example will calculate the predicted speed output torque based on the rotation speed fed back by the servo motor and the first speed limit value when the rotation speed of the servo motor changes.
[0032] It can be understood that the predicted speed output torque obtained by the above calculation will be greater than or equal to the actual torque output by the servo motor when it rotates at this rotation speed in the speed control mode. How to calculate the above predicted speed output torque and achieve the above effect will be described in detail later and will not be repeated here.
[0033] In some examples, when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to the speed control mode, thereby determining the timing of switching from the torque control mode to the speed control mode based on the comparison relationship between the predicted speed output torque and the target torque; it can be understood that the above-mentioned target torque is the saturation limit value of the output torque of the servo motor in the speed control mode given by relevant personnel.
[0034] According to the technical solution provided in the embodiment of the present application, when the servo motor is in a torque control mode, the rotation speed of the servo motor is obtained; a preset first speed limit value is obtained, and a predicted speed output torque is calculated based on the rotation speed and the first speed limit value, the first speed limit value being a preset target speed of the servo motor in the torque control mode; when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to a speed control mode. By means of the above method, it is possible to predict the predicted speed output torque corresponding to the rotation speed of the servo motor in the speed control mode, and when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to a speed control mode. This method realizes the determination of the timing of switching from the torque control mode to the speed control mode based on the comparison relationship between the predicted speed output torque and the target torque, thereby avoiding the problem in the related art that the control mode of the servo motor is switched only based on the rotation speed, which easily causes speed overshoot and leads to the risk of damage to the servo motor.
[0035] In some embodiments, Figure 2 As shown, the predicted speed output torque is calculated according to the rotation speed and the first speed limit value, including:
[0036] S201, calculating a speed error based on the current rotation speed and the first speed limit value, and calculating a cumulative error based on the speed errors at all times;
[0037] S202, obtaining a first proportional gain and a first integral gain, and weighting the speed error at the current moment according to the first proportional gain, and weighting the cumulative error according to the first integral gain, and taking the sum of the weighted speed error and the weighted cumulative error as the predicted speed output torque.
[0038] In some examples, the speed error at the current moment is calculated based on the rotation speed at the current moment and the first speed limit value, including: taking the difference between the first speed limit value and the rotation speed as the speed error, specifically, assuming that the current moment is moment t, the speed error at moment t is e(t), then e(t) = first speed limit value - rotation speed at moment t.
[0039] In some examples, the cumulative error is calculated based on the speed errors at all times, including: integrating and accumulating the speed errors at all times to obtain the cumulative error. Specifically, the cumulative error at time t is as follows:
[0040] Subsequently, the first proportional gain and the first integral gain are obtained, and the speed error at the current moment is weighted according to the first proportional gain, the cumulative error is weighted according to the first integral gain, and the sum of the weighted speed error and the weighted cumulative error is used as the predicted speed output torque.
[0041] The details are as follows:
[0042]
[0043] Among them, K p is the first proportional gain, K i is the first integral gain, and u(t) is the predicted speed output torque corresponding to time t.
[0044] According to the technical solution provided in the embodiment of the present application, the speed error is calculated based on the rotation speed at the current moment and the first speed limit value, and the cumulative error is calculated based on the speed errors at all moments; the first proportional gain and the first integral gain are obtained, and the speed error at the current moment is weighted according to the first proportional gain, the cumulative error is weighted according to the first integral gain, and the sum of the weighted speed error and the weighted cumulative error is used as the predicted speed output torque, thereby achieving accurate predicted speed output torque based on the rotation speed.
[0045] In some embodiments, Figure 3 As shown, obtaining a first proportional gain and a first integral gain includes:
[0046] S301, obtaining a second proportional gain and a second integral gain corresponding to a speed control mode;
[0047] S302 , setting a first increase value and a second increase value, taking the sum of the second proportional gain and the first increase value as the first proportional gain, and taking the sum of the second integral gain and the second increase value as the first integral gain.
[0048] It can be understood that the second proportional gain and the second integral gain are used for the torque corresponding to the rotation speed of the servo motor when the servo motor is in the speed control mode, and the usage method is the same as the first proportional gain and the first integral gain, which will not be repeated here.
[0049] After obtaining the second proportional gain and the second integral gain corresponding to the speed control mode, in order to make the calculated predicted speed output torque greater than or equal to the actual torque output by the servo motor when it rotates at this rotation speed in the speed control mode, this example sets the first increase value and the second increase value, and takes the sum of the second proportional gain and the first increase value as the first proportional gain, and takes the sum of the second integral gain and the second increase value as the first integral gain; it can be understood that the above-mentioned first increase value and the second increase value are both natural numbers greater than zero, and the first increase value and the second increase value can be the same, or the first increase value and the second increase value can be different.
[0050] According to the technical solution provided in the embodiment of the present application, the second proportional gain and the second integral gain corresponding to the speed control mode are obtained; the first increase value and the second increase value are set, and the sum of the second proportional gain and the first increase value is used as the first proportional gain, and the sum of the second integral gain and the second increase value is used as the first integral gain, so that the first proportional gain is greater than or equal to the second proportional gain, and the first integral gain is greater than or equal to the second integral gain, so that the calculated predicted speed output torque will be greater than or equal to the actual torque output by the servo motor when it rotates at this rotation speed in the speed control mode.
[0051] In some embodiments, Figure 4 As shown, the control mode of the servo motor is switched to the speed control mode, including:
[0052] S401, when the predicted speed output torque is not lower than the preset target torque, stop accumulating the accumulated error, and use the accumulated error that stops accumulating as a fixed error;
[0053] S402, weighting the speed error at the current moment according to the first proportional gain, weighting the fixed error according to the first integral gain, and taking the sum of the weighted speed error and the weighted fixed error as a new predicted speed output torque;
[0054] S403: When the new predicted speed output torque is lower than the target torque, the control mode of the servo motor is switched to the speed control mode.
[0055] It can be understood that when the predicted speed output torque is not lower than the preset target torque, the predicted speed output torque reaches the saturation limit value. It can be seen that when the rotation speed is equal to the first speed limit value, e(t) is 0, and the actual value of the predicted speed output torque is In order to avoid the problem that the cumulative error corresponding to the predicted speed output torque continues to increase when the predicted speed output torque is not lower than the preset target torque, resulting in the predicted speed output torque being unable to exit the saturation limit value, this example will stop the accumulation of the cumulative error and use the accumulated error that stops accumulating as a fixed error; for example, when the predicted speed output torque at time t is not lower than the preset target torque, the As a fixed error, at the subsequent time t+1, time T+2 and time t+n, as the corresponding accumulated error.
[0056] The speed error at the current moment is weighted according to the first proportional gain, the fixed error is weighted according to the first integral gain, and the sum of the weighted speed error and the weighted fixed error is used as the new predicted speed output torque. It can be understood that this example uses the predicted speed output torque obtained based on the fixed error as the new predicted speed output torque.
[0057] It can be understood that as the rotation speed of the servo motor increases, the above-mentioned predicted speed output torque will exit the saturation limit value; specifically, when the predicted speed output torque is greater than the target torque, e(t) is a negative number. is a fixed value, the greater the rotation speed obtained, the smaller the corresponding calculated new predicted speed output torque will be. Therefore, after a period of time, the new predicted speed output torque will exit the saturation limit value. When the new predicted speed output torque is lower than the target torque, the control mode of the servo motor is switched to the speed control mode, thereby achieving the control of the servo motor's rotation speed to smoothly increase to the set first speed limit value.
[0058] According to the technical solution provided in the embodiment of the present application, when the predicted speed output torque is not lower than the preset target torque, the accumulation of cumulative errors is stopped, and the cumulative errors that have stopped accumulation are used as fixed errors; the speed error at the current moment is weighted according to the first proportional gain, the fixed error is weighted according to the first integral gain, and the sum of the weighted speed error and the weighted fixed error is used as the new predicted speed output torque; when the new predicted speed output torque is lower than the target torque, the control mode of the servo motor is switched to the speed control mode, wherein, by stopping the accumulation of the above-mentioned cumulative errors, it is avoided that when the predicted speed output torque is not lower than the preset target torque, the cumulative error corresponding to the predicted speed output torque continues to increase, resulting in the problem that the predicted speed output torque cannot exit the saturation limit value; when the new predicted speed output torque is lower than the target torque, the control mode of the servo motor is switched to the speed control mode, thereby achieving the control of the servo motor's rotation speed to smoothly increase to the set first speed limit value.
[0059] In some embodiments, Figure 5 As shown, the method also includes:
[0060] S501, obtaining a second speed limit value, where the second speed limit value is a preset initial speed of the servo motor in a speed control mode, and the second speed limit value is higher than the first speed limit value;
[0061] S502: Compare the rotation speed with the second speed limit value. If the rotation speed is not lower than the second speed limit value, switch the control mode of the servo motor to the speed control mode.
[0062] Specifically, in order to avoid the target torque being too large, the above-mentioned predicted speed output torque is always lower than the preset target torque, resulting in the servo motor being unable to enter the speed control mode when the rotation speed is very large, causing damage to the servo motor. This example also sets a second speed limit value, which is the pre-set initial speed of the servo motor in the speed control mode, and the second speed limit value is higher than the first speed limit value.
[0063] This example compares the rotation speed with the second speed limit value. If the rotation speed is not lower than the second speed limit value, the control mode of the servo motor is switched to the speed control mode, thereby achieving the effect of switching the control mode of the servo motor in multiple ways.
[0064] According to the technical solution provided in the embodiment of the present application, a second speed limit value is obtained, the second speed limit value is a preset initial speed of the servo motor in the speed control mode, and the second speed limit value is higher than the first speed limit value; the rotation speed is compared with the second speed limit value, and if the rotation speed is not lower than the second speed limit value, the control mode of the servo motor is switched to the speed control mode, thereby achieving the effect of switching the control mode of the servo motor in a variety of ways, avoiding excessive target torque. At this time, the above-mentioned predicted speed output torque is always lower than the preset target torque, resulting in the servo motor being unable to enter the speed control mode when the rotation speed is very large, causing damage to the servo motor.
[0065] In some examples, such as Figure 6 As shown, after the control mode of the servo motor is switched to the speed control mode, the method further includes:
[0066] S601, obtaining a speed output torque corresponding to a rotation speed in a speed control mode;
[0067] S602: Taking the minimum torque between the speed output torque and the target torque as the output torque, and performing torque control on the servo motor according to the determined output torque.
[0068] It can be understood that in order to avoid the problem of excessive output torque to the servo motor in the speed control mode, which may cause damage to the servo motor, this example will obtain the speed output torque corresponding to the rotation speed in the speed control mode; specifically, the speed output torque is calculated by the second proportional gain, the second integral gain and the rotation speed.
[0069] After obtaining the speed output torque, the minimum torque between the speed output torque and the target torque is used as the output torque, and the servo motor is torque controlled according to the determined output torque, so that timely adjustment and response can be made when the given torque changes during operation.
[0070] In order to better understand the above method, this embodiment provides a more specific example for illustration. Figure 7 As shown, the controller of the servo motor includes a torque control module, a pseudo-speed loop monitoring module, a switching condition judgment module and a speed loop control module. The switching condition judgment module is used to judge whether the predicted speed output torque output by the pseudo-speed loop monitoring module is desaturated, or whether the speed of the servo motor reaches the second speed limit value.
[0071] The torque control module is used to perform torque mode control on the servo motor and provide a stable output torque to the servo motor; the pseudo-speed loop monitoring module is used to build a pseudo-speed control loop when the torque control module performs torque mode control on the servo motor. The pseudo-speed control loop takes the first speed limit value as a given object, and the actual feedback speed value of the servo motor is the rotation speed, and obtains the corresponding predicted speed output torque through PI control. Since the speed loop is not a speed loop control under the speed control mode, it is called a pseudo-speed control loop. The pseudo-speed control loop takes the given target torque as the saturation limit value of its output, and calculates the predicted speed output torque through the first proportional gain and the first integral gain corresponding to the pseudo-speed control loop, and sets the first proportional gain and the first integral gain to be greater than or equal to the second proportional gain and the second integral gain of the real speed loop. During operation, the predicted speed output torque output by the pseudo-speed control loop is used to determine the timing of switching from the torque control mode to the speed control mode.
[0072] Specifically, when the servo motor starts to run in the torque control mode, due to the low feedback rotation speed, the speed setting value and feedback value of the pseudo-speed control loop differ greatly. Therefore, the output of the pseudo-speed control loop will quickly reach the output saturation limit value. After reaching the saturation limit value, the cumulative integral part of the pseudo-speed control loop will no longer accumulate. As the rotation speed of the servo motor increases, after a period of time, the predicted speed output torque of the output of the pseudo-speed control loop will exit the saturation limit value (the output change process of the pseudo-speed control loop is shown in FIG. Figure 8 At this time, switching the torque control mode to the speed control mode can achieve a smooth increase in the feedback speed to the set speed limit value with almost no overshoot.
[0073] Among them, in addition to the pseudo-speed control loop desaturation limit value mentioned above, there may be a situation where the target torque is large but the set speed limit value is very small. At this time, the output of the pseudo-speed loop may not reach saturation, but when it is monitored that the feedback rotation speed reaches the set second speed limit value, the torque control mode must be switched to the speed control mode.
[0074] In addition, the speed loop control module performs dual closed-loop control of speed and current, which can stabilize the rotation speed of the servo motor feedback near the set second speed limit value and output the corresponding torque. During speed closed-loop control, the output torque of the speed loop must still be compared with the given target torque and the smaller one is output, so that timely adjustment and response can be made when the given torque changes during operation.
[0075] The mode switching method of the servo motor provided by the method can realize the smooth increase and control of the actual feedback rotation speed when the torque control mode is switched to the speed control mode, without large overshoot, and greatly improve the stability of the system in which the servo motor is located. And the mode switching method of the servo motor provided by the method can be achieved by adjusting the gain K in the PI controller corresponding to the pseudo speed control loop p and integral K i The value of maintains the stable torque output before switching while achieving fine-tuning of the switching moment to achieve a better switching effect.
[0076] According to the technical solution provided in the embodiment of the present application, the speed output torque corresponding to the rotation speed in the speed control mode is obtained; the minimum torque between the speed output torque and the target torque is used as the output torque, and the servo motor is torque controlled according to the determined output torque, so as to facilitate timely adjustment and response when the given torque changes during operation, and avoid the problem of excessive output torque output to the servo motor in the speed control mode, which may cause damage to the servo motor.
[0077] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0078] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0079] This embodiment also provides a mode switching device for a servo motor, such as Fig. 9 As shown, the device comprises:
[0080] An acquisition module 901 is used to acquire the rotation speed of the servo motor when the servo motor is in a torque control mode;
[0081] The torque module 902 is used to obtain a preset first speed limit value, and calculate the predicted speed output torque according to the rotation speed and the first speed limit value, where the first speed limit value is a preset target speed of the servo motor in the torque control mode;
[0082] The switching module 903 is used to adjust the control mode of the servo motor to the speed control mode when the predicted speed output torque is not lower than the preset target torque.
[0083] In some examples, the torque module 902 is also used to calculate the speed error based on the rotation speed at the current moment and the first speed limit value, and calculate the cumulative error based on the speed errors at all moments; obtain the first proportional gain and the first integral gain, and weight the speed error at the current moment according to the first proportional gain, weight the cumulative error according to the first integral gain, and use the sum of the weighted speed error and the weighted cumulative error as the predicted speed output torque.
[0084] In some examples, the torque module 902 is also used to obtain a second proportional gain and a second integral gain corresponding to the speed control mode; set a first increase value and a second increase value, and use the sum of the second proportional gain and the first increase value as the first proportional gain, and use the sum of the second integral gain and the second increase value as the first integral gain.
[0085] In some examples, the switching module 903 is also used to stop the accumulation of cumulative errors when the predicted speed output torque is not lower than the preset target torque, and use the accumulated errors that have stopped accumulating as fixed errors; weight the speed error at the current moment according to the first proportional gain, weight the fixed error according to the first integral gain, and use the sum of the weighted speed error and the weighted fixed error as the new predicted speed output torque; when the new predicted speed output torque is lower than the target torque, switch the control mode of the servo motor to the speed control mode.
[0086] In some examples, the switching module 903 is also used to obtain a second speed limit value, which is a preset initial speed of the servo motor in the speed control mode, and the second speed limit value is higher than the first speed limit value; the rotation speed is compared with the second speed limit value, and if the rotation speed is not lower than the second speed limit value, the control mode of the servo motor is switched to the speed control mode.
[0087] In some examples, the switching module 903 is also used to obtain the speed output torque corresponding to the rotation speed in the speed control mode; the minimum torque between the speed output torque and the target torque is used as the output torque, and the servo motor is torque controlled according to the determined output torque.
[0088] According to the technical solution provided in the embodiment of the present application, the mode switching device of the servo motor provided in the embodiment obtains the rotation speed of the servo motor when the servo motor is in the torque control mode; obtains a preset first speed limit value, and calculates the predicted speed output torque according to the rotation speed and the first speed limit value, the first speed limit value being a preset target speed of the servo motor in the torque control mode; when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to the speed control mode, and the above method is used to predict the predicted speed output torque corresponding to the rotation speed of the servo motor in the speed control mode, and when the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is switched to the speed control mode, and the timing of switching from the torque control mode to the speed control mode is determined according to the comparison relationship between the predicted speed output torque and the target torque, thereby avoiding the problem in the related art that the control mode of the servo motor is switched only according to the rotation speed, which easily causes speed overshoot and leads to the risk of damage to the servo motor.
[0089] Fig.10 Schematic diagram of an electronic device 10 provided in an embodiment of the present application. Fig.10 As shown, the electronic device 10 of this embodiment includes: a processor 1001, a memory 1002, and a computer program 1003 stored in the memory 1002 and executable on the processor 1001. When the processor 1001 executes the computer program 1003, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1001 executes the computer program 1003, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0090] The electronic device 10 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 10 may include, but is not limited to, a processor 1001 and a memory 1002. Those skilled in the art will appreciate that Fig.10 The electronic device 10 is merely an example and does not limit the electronic device 10 . The electronic device 10 may include more or fewer components than shown in the figure, or different components.
[0091] The processor 1001 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0092] The memory 1002 may be an internal storage unit of the electronic device 10, for example, a hard disk or memory of the electronic device 10. The memory 1002 may also be an external storage device of the electronic device 10, for example, a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 10. The memory 1002 may also include both an internal storage unit of the electronic device 10 and an external storage device. The memory 1002 is used to store computer programs and other programs and data required by the electronic device.
[0093] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0094] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of regional requirements and patent practice. For example, in some areas, according to regional requirements and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0095] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A mode switching method for a servo motor, characterized in that: The method comprises: When the servo motor is in a torque control mode, obtaining a rotation speed of the servo motor; Obtain a preset first speed limit value, and calculate a predicted speed output torque according to the rotation speed and the first speed limit value, wherein the first speed limit value is a preset target speed of the servo motor in the torque control mode; When the predicted speed output torque is not lower than the preset target torque, the control mode of the servo motor is adjusted to a speed control mode.
2. The method according to claim 1, characterized in that Calculating the predicted speed output torque according to the rotation speed and the first speed limit value includes: Calculating a speed error according to the rotation speed at the current moment and the first speed limit value, and calculating a cumulative error according to the speed errors at all moments; Obtain a first proportional gain and a first integral gain, and weight the speed error at the current moment according to the first proportional gain, weight the accumulated error according to the first integral gain, and use the sum of the weighted speed error and the weighted accumulated error as the predicted speed output torque.
3. The method according to claim 2, characterized in that Obtaining a first proportional gain and a first integral gain includes: Acquire a second proportional gain and a second integral gain corresponding to the speed control mode; A first increase value and a second increase value are set, a sum of the second proportional gain and the first increase value is used as the first proportional gain, and a sum of the second integral gain and the second increase value is used as the first integral gain.
4. The method according to claim 2, characterized in that: Switching the control mode of the servo motor to a speed control mode comprises: When the predicted speed output torque is not lower than the preset target torque, the accumulation of the accumulated error is stopped, and the accumulated error whose accumulation is stopped is used as a fixed error; weighting the speed error at the current moment according to the first proportional gain, weighting the fixed error according to the first integral gain, and taking the sum of the weighted speed error and the weighted fixed error as a new predicted speed output torque; When the new predicted speed output torque is lower than the target torque, the control mode of the servo motor is switched to the speed control mode.
5. The method according to claim 1, characterized in that The method further comprises: Acquire a second speed limit value, where the second speed limit value is a preset initial speed of the servo motor in the speed control mode, and the second speed limit value is higher than the first speed limit value; The rotation speed is compared with the second speed limit value, and if the rotation speed is not lower than the second speed limit value, the control mode of the servo motor is switched to the speed control mode.
6. The method according to claim 1, characterized in that After switching the control mode of the servo motor to the speed control mode, the method further includes: Obtaining the speed output torque corresponding to the rotation speed in the speed control mode; The minimum torque between the speed output torque and the target torque is used as the output torque, and the servo motor is torque controlled according to the determined output torque.
7. A mode switching device for a servo motor, characterized in that: The device comprises: An acquisition module, used for acquiring the rotation speed of the servo motor when the servo motor is in a torque control mode; A torque module, configured to obtain a preset first speed limit value, and calculate a predicted speed output torque according to the rotation speed and the first speed limit value, wherein the first speed limit value is a preset target speed of the servo motor in the torque control mode; The switching module is used to adjust the control mode of the servo motor to a speed control mode when the predicted speed output torque is not lower than a preset target torque.
8. The device according to claim 7, characterized in that The torque module is also used to calculate the speed error based on the rotation speed at the current moment and the first speed limit value, and calculate the cumulative error based on the speed errors at all moments; obtain the first proportional gain and the first integral gain, and weight the speed error at the current moment according to the first proportional gain, weight the cumulative error according to the first integral gain, and use the sum of the weighted speed error and the weighted cumulative error as the predicted speed output torque.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium storing 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 6 are implemented.