Servo motor driving voltage control method, servo motor driving voltage control device, electronic equipment and storage medium

文档序号:1275258 发布日期:2020-08-25 浏览:9次 中文

阅读说明:本技术 伺服电机驱动电压控制方法、装置、电子设备及存储介质 (Servo motor driving voltage control method, servo motor driving voltage control device, electronic equipment and storage medium ) 是由 卓国熙 于 2020-05-26 设计创作,主要内容包括:本申请提供了一种伺服电机驱动电压控制方法、装置、电子设备及存储介质。该伺服电机驱动电压控制方法,包括以下步骤:获取用于调整伺服电机的转速的第一控制指令,所述第一控制指令携带有目标转速;将所述目标转速输入第一目标神经网络模型,以获取第一驱动电压值;根据所述第一驱动电压值对所述伺服电机进行驱动,并获取所述伺服电机的第一实际转速;根据所述第一驱动电压值以及所述第一实际转速对所述第一目标神经网络模型进行优化,以得到第二神经网络模型;将所述目标转速输入所述第二神经网络模型以获取第二驱动电压值;根据所述第二驱动电压值对所述伺服电机进行驱动。本申请可以提高转速的准确度。(The application provides a servo motor driving voltage control method and device, electronic equipment and a storage medium. The servo motor driving voltage control method comprises the following steps: acquiring a first control instruction for adjusting the rotating speed of a servo motor, wherein the first control instruction carries a target rotating speed; inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value; driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor; optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model; inputting the target rotating speed into the second neural network model to obtain a second driving voltage value; and driving the servo motor according to the second driving voltage value. The application can improve the accuracy of the rotating speed.)

1. A servo motor driving voltage control method is characterized by comprising the following steps:

acquiring a first control instruction for adjusting the rotating speed of a servo motor, wherein the first control instruction carries a target rotating speed;

inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value;

driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor;

optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model;

inputting the target rotating speed into the second neural network model to obtain a second driving voltage value;

and driving the servo motor according to the second driving voltage value.

2. The servo motor driving voltage control method according to claim 1, wherein the step of inputting the target rotational speed into the first target neural network model to obtain the first driving voltage value is preceded by the step of:

obtaining a plurality of sample data, wherein each sample data comprises a sample rotating speed and a corresponding sample driving voltage value;

and training a preset initial neural network model according to the plurality of sample data to obtain a first target neural network model.

3. The servo motor driving voltage control method according to claim 1, wherein the step of inputting the target rotational speed into the first target neural network model to obtain the first driving voltage value is preceded by the step of:

acquiring a plurality of historical data within a preset time period with the current time as an end point, wherein each historical data comprises a historical actual rotating speed value and a corresponding historical driving voltage value;

and training a preset initial neural network model according to the plurality of historical data to obtain a first target neural network model.

4. The servo motor driving voltage control method according to claim 1, wherein the optimizing the first target neural network model according to the first driving voltage value and the actual rotation speed to obtain a second neural network model comprises:

modifying each weight parameter of the first target neural network model according to the actual rotating speed and the first driving voltage value;

and acquiring a second neural network model according to the modified weight parameters.

5. The servo motor driving voltage control method according to claim 1, wherein the step of inputting the target rotational speed into a first target neural network model to obtain a first driving voltage value is preceded by the step of:

acquiring the interval range of the target rotating speed;

and selecting a corresponding first target neural network model from a plurality of first neural network models according to the interval range.

6. The servo motor driving voltage control method according to claim 1, further comprising, after the step of driving the servo motor according to the second driving voltage value:

acquiring a second actual rotating speed when the servo motor is driven by a second driving voltage value;

judging whether the difference value between the second actual rotating speed and the target rotating speed is smaller than a preset threshold value or not;

if the actual rotating speed is less than the preset threshold value, adjusting the first driving voltage value by adopting a gradual fine adjustment method so as to enable the actual rotating speed after fine adjustment to be equal to the target rotating speed;

and if the second actual rotating speed is larger than the preset threshold value, setting the second actual rotating speed as a first actual rotating speed, and returning to the step of optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model.

7. A servo motor drive voltage control apparatus, characterized by comprising:

the servo motor control device comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a first control instruction for adjusting the rotating speed of a servo motor, and the first control instruction carries a target rotating speed;

the second acquisition module is used for inputting the target rotating speed into the first target neural network model so as to acquire a first driving voltage value;

the third obtaining module is used for driving the servo motor according to the first driving voltage value and obtaining a first actual rotating speed of the servo motor;

the optimization module is used for optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model;

the fourth obtaining module is used for inputting the target rotating speed into the second neural network model so as to obtain a second driving voltage value;

and the driving module is used for driving the servo motor according to the second driving voltage value.

8. The servo motor drive voltage control device according to claim 7, further comprising:

the fifth acquisition module is used for acquiring a plurality of sample data, and each sample data comprises a sample rotating speed and a corresponding sample driving voltage value;

and the training module is used for training a preset initial neural network model according to the plurality of sample data to obtain a first target neural network model.

9. An electronic device comprising a processor and a memory, said memory storing computer readable instructions which, when executed by said processor, perform the steps of the method of any of claims 1-6.

10. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method according to any one of claims 1-6.

Technical Field

The present disclosure relates to the field of servo motor control technologies, and in particular, to a method and an apparatus for controlling a driving voltage of a servo motor, an electronic device, and a storage medium.

Background

Servo motors, that is, permanent magnet synchronous motors are widely used in various fields as power sources for power output, for example, in the fields of automobiles, intelligent robots, and transmission mechanisms.

At present, the common driver speed control command interfaces all adopt an analog quantity command interface, that is, an upper computer linearly controls the speed of a servo motor (for example, -3000 rpm) by sending an analog quantity signal, for example, sending an analog quantity signal with a voltage value of-10V to + 10V.

Disclosure of Invention

An object of the embodiments of the present application is to provide a method and an apparatus for controlling a driving voltage of a servo motor, an electronic device, and a storage medium, which can improve accuracy of a rotation speed.

In a first aspect, an embodiment of the present application provides a method for controlling a driving voltage of a servo motor, including the following steps:

acquiring a first control instruction for adjusting the rotating speed of a servo motor, wherein the first control instruction carries a target rotating speed;

inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value;

driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor;

optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model;

inputting the target rotating speed into the second neural network model to obtain a second driving voltage value;

and driving the servo motor according to the second driving voltage value.

Optionally, in the servo motor driving voltage control method according to the embodiment of the present application, before the step of inputting the target rotation speed into the first target neural network model to obtain the first driving voltage value, the method further includes:

obtaining a plurality of sample data, wherein each sample data comprises a sample rotating speed and a corresponding sample driving voltage value;

and training a preset initial neural network model according to the plurality of sample data to obtain a first target neural network model.

Optionally, in the servo motor driving voltage control method according to the embodiment of the present application, before the step of inputting the target rotation speed into the first target neural network model to obtain the first driving voltage value, the method further includes:

acquiring a plurality of historical data within a preset time period with the current time as an end point, wherein each historical data comprises a historical actual rotating speed value and a corresponding historical driving voltage value;

and training a preset initial neural network model according to the plurality of historical data to obtain a first target neural network model.

Optionally, in the servo motor driving voltage control method according to the embodiment of the present application, the optimizing the first target neural network model according to the first driving voltage value and the actual rotation speed to obtain a second neural network model includes:

modifying each weight parameter of the first target neural network model according to the actual rotating speed and the first driving voltage value;

and acquiring a second neural network model according to the modified weight parameters.

Optionally, in the servo motor driving voltage control method according to the embodiment of the present application, before the step of inputting the target rotation speed into the first target neural network model to obtain the first driving voltage value, the method includes:

acquiring the interval range of the target rotating speed;

and selecting a corresponding first target neural network model from a plurality of first neural network models according to the interval range.

Optionally, in the method for controlling driving voltage of a servo motor according to the embodiment of the present application, after the step of driving the servo motor according to the second driving voltage value, the method further includes:

acquiring a second actual rotating speed when the servo motor is driven by a second driving voltage value;

judging whether the difference value between the second actual rotating speed and the target rotating speed is smaller than a preset threshold value or not;

if the actual rotating speed is less than the preset threshold value, adjusting the first driving voltage value by adopting a gradual fine adjustment method so as to enable the actual rotating speed after fine adjustment to be equal to the target rotating speed;

and if the second actual rotating speed is larger than the preset threshold value, setting the second actual rotating speed as a first actual rotating speed, and returning to the step of optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model.

In a second aspect, an embodiment of the present application further provides a servo motor driving voltage control apparatus, including:

the servo motor control device comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a first control instruction for adjusting the rotating speed of a servo motor, and the first control instruction carries a target rotating speed;

the second acquisition module is used for inputting the target rotating speed into the first target neural network model so as to acquire a first driving voltage value;

the third obtaining module is used for driving the servo motor according to the first driving voltage value and obtaining a first actual rotating speed of the servo motor;

the optimization module is used for optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model;

the fourth obtaining module is used for inputting the target rotating speed into the second neural network model so as to obtain a second driving voltage value;

and the driving module is used for driving the servo motor according to the second driving voltage value.

Optionally, in the servo motor driving voltage control device according to an embodiment of the present application, the servo motor driving voltage control device further includes:

the fifth acquisition module is used for acquiring a plurality of sample data, and each sample data comprises a sample rotating speed and a corresponding sample driving voltage value;

and the training module is used for training a preset initial neural network model according to the plurality of sample data to obtain a first target neural network model.

In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method as provided in the first aspect are executed.

In a fourth aspect, embodiments of the present application provide a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps in the method as provided in the first aspect.

As can be seen from the above, the method and the device for controlling the driving voltage of the servo motor provided in the embodiment of the present application obtain a first control instruction for adjusting the rotation speed of the servo motor, where the first control instruction carries a target rotation speed; inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value; driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor; optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model; inputting the target rotating speed into the second neural network model to obtain a second driving voltage value; driving the servo motor according to the second driving voltage value; therefore, the control of the driving voltage is realized, and the beneficial effect of improving the accuracy of the rotating speed is achieved.

Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.

Fig. 1 is a flowchart of a servo motor driving voltage control method according to an embodiment of the present disclosure.

Fig. 2 is a schematic structural diagram of a servo motor driving voltage control apparatus according to an embodiment of the present disclosure.

Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.

Referring to fig. 1, fig. 1 is a flowchart illustrating a servo motor driving voltage control method according to some embodiments of the present disclosure, the servo motor driving voltage control method including the following steps:

s101, a first control instruction for adjusting the rotating speed of the servo motor is obtained, and the first control instruction carries a target rotating speed.

And S102, inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value.

S103, driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor.

S104, optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model.

And S105, inputting the target rotating speed into the second neural network model to obtain a second driving voltage value.

And S106, driving the servo motor according to the second driving voltage value.

In step S101, the target rotation speed is generated based on an instruction input by a user.

In step S102, the first driving voltage value is a driving voltage that needs to be output to the servo motor, so that the servo motor is driven to rotate by the first driving voltage value. The first target neural network model is obtained by training a preset initial neural network model based on a plurality of sample data. Therefore, in some embodiments, before the step S102, the following steps are further included: obtaining a plurality of sample data, wherein each sample data comprises a sample rotating speed and a corresponding sample driving voltage value; and training a preset initial neural network model according to the plurality of sample data to obtain a first target neural network model. And sequentially inputting a plurality of sample data into the initial neural network model until the cost function of the initial neural network model is smaller than a preset range.

It will be appreciated that in some embodiments, to improve the accuracy of the first drive voltage value calculation, different neural network models may be trained for different speed intervals. Specifically, in some embodiments, before step S102, the method further includes: acquiring the interval range of the target rotating speed; and selecting a corresponding first target neural network model from a plurality of first neural network models according to the interval range. For example, an interval may be set every 100 revolutions per second, and then training of the neural network model may be performed for each interval.

The plurality of first neural network models are obtained by training sample data located in the range of the corresponding interval, so that the first neural network models are more targeted, and the accuracy of calculation of the driving voltage of the servo motor is greatly improved.

It will be appreciated that in some embodiments, as the servo motor is continuously aging during use, for example, the stator is magnetically weakened, or the resistance is increased, etc., to improve accuracy, a plurality of historical data over a preset time period ending with the current time may be used to train the neural network model. Specifically, before executing the step S102, the following steps are further included: acquiring a plurality of historical data within a preset time period with the current time as an end point, wherein each historical data comprises a historical actual rotating speed value and a corresponding historical driving voltage value; and training a preset initial neural network model according to the plurality of historical data to obtain a first target neural network model.

In step S103, the external power module provides a driving voltage to the servo motor according to the calculated first driving voltage value, and obtains a first actual rotation speed of the servo motor driven by the first driving voltage value through a rotation speed sensor of the servo motor.

In step S104, the first neural network model is dynamically optimized by using the current first actual rotation speed and the corresponding first driving voltage value, so as to obtain a second neural network model with higher accuracy.

Specifically, the step S104 includes: modifying each weight parameter of the first target neural network model according to the actual rotating speed and the first driving voltage value; and acquiring a second neural network model according to the modified weight parameters.

In step S105, the second driving voltage value is calculated by using a second neural network model obtained through optimization, so that the actual rotation speed obtained when the driving is performed according to the second driving voltage value is closer to the target rotation speed.

It is understood that, in some embodiments, after the step S106, the following steps are further included:

s107, acquiring a second actual rotating speed when the servo motor is driven by a second driving voltage value;

s108, judging whether the difference value between the second actual rotating speed and the target rotating speed is smaller than a preset threshold value or not;

s109, if the actual rotating speed is smaller than the preset threshold value, adjusting the first driving voltage value by adopting a gradual fine adjustment method so as to enable the actual rotating speed after fine adjustment to be equal to the target rotating speed;

and S110, if the second actual rotating speed is larger than a preset threshold value, setting the second actual rotating speed as a first actual rotating speed, and returning to the step of optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model.

In step S108, the preset threshold may be set according to the target rotation speed, for example, if the target rotation speed is x, the preset threshold is set to 0.05 x. Of course, other settings may be used.

In step S109, if the difference is smaller than the preset threshold, it indicates that the second actual rotation speed is already close to the target rotation speed, and therefore, the driving voltage is finely adjusted by using a gradual fine adjustment method without continuously optimizing the second neural network model, and finally the purpose that the actual rotation speed is the same as the target rotation speed is achieved. For example, the driving voltage of the servo motor is finely adjusted by a smaller preset amplitude, then whether the actual rotating speed of the servo motor is equal to the target rotating speed is detected, and if not, the driving voltage is continuously finely adjusted by the same preset amplitude until the actual rotating speed of the servo motor is equal to the target rotating speed.

In step S110, if the second actual rotation speed is greater than the preset threshold, it indicates that the second neural network model needs to be optimized, and therefore, the step S104 is executed again, where the data adopted in the optimization is the second actual rotation speed and the first driving voltage value.

The method and the device have the advantages that the actual rotating speed can be adjusted to the target rotating speed more quickly by adopting a mode of combining a gradual fine adjustment method with the second neural network model, the efficiency can be improved, and the adjusting time can be shortened.

As can be seen from the above, in the servo motor driving voltage control method provided in the embodiment of the present application, a first control instruction for adjusting the rotation speed of the servo motor is obtained, where the first control instruction carries a target rotation speed; inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value; driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor; optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model; inputting the target rotating speed into the second neural network model to obtain a second driving voltage value; driving the servo motor according to the second driving voltage value; therefore, the control of the driving voltage is realized, and the beneficial effect of improving the accuracy of the rotating speed is achieved.

Referring to fig. 2, fig. 2 is a schematic structural diagram of a servo motor driving voltage control device according to some embodiments of the present disclosure. This servo motor drive voltage control device includes: a first obtaining module 201, a second obtaining module 202, a third obtaining module 203, an optimizing module 204, a fourth obtaining module 205, and a driving module 206.

The first obtaining module 201 is configured to obtain a first control instruction for adjusting a rotation speed of the servo motor, where the first control instruction carries a target rotation speed.

The second obtaining module 202 is configured to input the target rotation speed into a first target neural network model to obtain a first driving voltage value.

The third obtaining module 203 is configured to drive the servo motor according to the first driving voltage value, and obtain a first actual rotation speed of the servo motor.

The optimization module 204 is configured to optimize the first target neural network model according to the first driving voltage value and the first actual rotation speed to obtain a second neural network model.

The fourth obtaining module 205 is configured to input the target rotation speed into the second neural network model to obtain a second driving voltage value.

The driving module 206 is configured to drive the servo motor according to the second driving voltage value.

In some embodiments, the servo motor driving voltage control apparatus further includes: the fifth acquisition module is used for acquiring a plurality of sample data, and each sample data comprises a sample rotating speed and a corresponding sample driving voltage value; and the training module is used for training a preset initial neural network model according to the plurality of sample data to obtain a first target neural network model.

As can be seen from the above, the servo motor driving voltage control device provided in the embodiment of the present application obtains a first control instruction for adjusting the rotation speed of the servo motor, where the first control instruction carries a target rotation speed; inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value; driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor; optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model; inputting the target rotating speed into the second neural network model to obtain a second driving voltage value; driving the servo motor according to the second driving voltage value; therefore, the control of the driving voltage is realized, and the beneficial effect of improving the accuracy of the rotating speed is achieved.

Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the present disclosure provides an electronic device 3, including: the processor 301 and the memory 302, the processor 301 and the memory 302 being interconnected and communicating with each other via a communication bus 303 and/or other form of connection mechanism (not shown), the memory 302 storing a computer program executable by the processor 301, the computer program being executable by the processor 301 when the computing device is running to perform the method in any of the alternative implementations of the above embodiments when the processor 301 executes the computer program to perform the following functions: acquiring a first control instruction for adjusting the rotating speed of a servo motor, wherein the first control instruction carries a target rotating speed; inputting the target rotating speed into a first target neural network model to obtain a first driving voltage value; driving the servo motor according to the first driving voltage value, and acquiring a first actual rotating speed of the servo motor; optimizing the first target neural network model according to the first driving voltage value and the first actual rotating speed to obtain a second neural network model; inputting the target rotating speed into the second neural network model to obtain a second driving voltage value; driving the servo motor according to the second driving voltage value; therefore, the control of the driving voltage is realized, and the beneficial effect of improving the accuracy of the rotating speed is achieved.

The embodiment of the present application provides a storage medium, and when being executed by a processor, the computer program performs the method in any optional implementation manner of the above embodiment. The storage medium may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.

In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.

In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.

The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种三相无传感器无刷直流电机控制系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!