Stepping motor synchronous driving method, stepping motor synchronous driving device, terminal and storage medium

文档序号:1218462 发布日期:2020-09-04 浏览:30次 中文

阅读说明:本技术 步进电机同步驱动方法、装置、终端及存储介质 (Stepping motor synchronous driving method, stepping motor synchronous driving device, terminal and storage medium ) 是由 陈毅东 季传坤 孙清原 杨立保 李平 于 2020-05-25 设计创作,主要内容包括:本申请适用于电机控制技术领域,提供了一种步进电机同步驱动方法、装置、终端及存储介质,上述步进电机同步驱动方法包括:通过获取第一电机的第一转速信号和第二电机的第二转速信号;并根据第一转速信号确定第一脉冲信号,根据第二转速信号确定第二脉冲信号;然后根据第一脉冲信号和预设值确定第一目标频率补偿值,根据第二脉冲信号和预设值确定第二目标频率补偿值;再根据第一脉冲信号和第一目标频率补偿值确定第一目标脉冲信号,根据第二脉冲信号和第二目标频率补偿值确定第二目标脉冲信号;最终根据第一目标脉冲信号对第一电机进行驱动,根据第二目标脉冲信号对第二电机进行驱动,实现第一电机和第二电机同步驱动的精准控制。(The application is applicable to the technical field of motor control, and provides a stepping motor synchronous driving method, a stepping motor synchronous driving device, a stepping motor synchronous driving terminal and a storage medium, wherein the stepping motor synchronous driving method comprises the following steps: acquiring a first rotating speed signal of a first motor and a second rotating speed signal of a second motor; determining a first pulse signal according to the first rotating speed signal, and determining a second pulse signal according to the second rotating speed signal; then determining a first target frequency compensation value according to the first pulse signal and a preset value, and determining a second target frequency compensation value according to the second pulse signal and the preset value; determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value; and finally, driving the first motor according to the first target pulse signal, and driving the second motor according to the second target pulse signal, so as to realize the accurate control of the synchronous driving of the first motor and the second motor.)

1. A synchronous driving method of a stepping motor is characterized by comprising the following steps:

acquiring a first rotating speed signal of a first motor and a second rotating speed signal of a second motor;

determining a first pulse signal according to the first rotating speed signal, and determining a second pulse signal according to the second rotating speed signal;

determining a first target frequency compensation value and a second target frequency compensation value according to the first pulse signal, the second pulse signal and a preset value;

determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value;

and driving the first motor according to the first target pulse signal, and driving the second motor according to the second target pulse signal.

2. The stepping motor synchronous driving method according to claim 1, wherein the determining a first target frequency compensation value and a second target frequency compensation value according to the first pulse signal, the second pulse signal, and a preset value comprises:

calculating the absolute value of the difference value between the frequency value of the first pulse signal and the frequency value of the second pulse signal to obtain a frequency absolute difference value;

comparing the absolute frequency difference value with the preset value, and determining a frequency compensation value according to a comparison result;

and comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal, and determining the first target frequency compensation value and the second target frequency compensation value according to the comparison result and the frequency compensation value.

3. The stepping motor synchronous driving method according to claim 2, wherein the preset values include a first preset value and a second preset value, the first preset value being smaller than the second preset value; the comparing the absolute frequency difference value with the preset value and determining a frequency compensation value according to a comparison result includes:

determining zero as the frequency compensation value when the absolute difference value of the frequencies is smaller than the first preset value;

determining the first preset value as the frequency compensation value under the condition that the absolute difference of the frequencies is greater than or equal to the first preset value and less than or equal to the second preset value;

and determining the second preset value as the frequency compensation value when the absolute difference value of the frequencies is larger than the second preset value.

4. The stepping motor synchronous driving method according to claim 3, wherein the preset values further include a third preset value, the third preset value being greater than the second preset value; the comparing the absolute frequency difference value with the preset value and determining a frequency compensation value according to the comparison result further comprises:

under the condition that the absolute difference value of the frequencies is larger than the third preset value, generating a first brake signal and a second brake signal;

the first brake signal is used for controlling the first motor to brake, and the second brake signal is used for controlling the second motor to brake.

5. The stepping motor synchronous driving method according to claim 2, wherein the first target frequency compensation value and the second target frequency compensation value are opposite numbers; the comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal and determining the first target frequency compensation value and the second target frequency compensation value according to the comparison result and the frequency compensation value includes:

determining an absolute value of the frequency compensation value as the second target frequency compensation value in a case where the frequency value of the first pulse signal is greater than the frequency value of the second pulse signal;

determining an absolute value of the frequency compensation value as the first target frequency compensation value in a case where the frequency value of the first pulse signal is less than the frequency value of the second pulse signal.

6. The stepping motor synchronous driving method according to claim 1, wherein a frequency of the first target pulse signal is equal to a sum of the frequency of the first pulse signal and the first target frequency compensation value;

the frequency of the second target pulse signal is equal to the sum of the frequency of the second pulse signal and the second target frequency compensation value.

7. The stepping motor synchronous driving method according to claim 1, comprising:

and acquiring the first rotating speed signal and the second rotating speed signal through light sensing or encoder acquisition.

8. A synchronous drive device for a stepping motor, comprising:

the acquisition module is used for acquiring a first rotating speed signal of a first motor and a second rotating speed signal of a second motor;

the pulse signal determining module is used for determining a first pulse signal according to the first rotating speed signal and determining a second pulse signal according to the second rotating speed signal;

the target frequency compensation value determining module is used for determining a first target frequency compensation value and a second target frequency compensation value according to the first pulse signal, the second pulse signal and a preset value;

the target pulse signal determining module is used for determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value;

and the control module is used for driving the first motor according to the first target pulse signal and driving the second motor according to the second target pulse signal.

9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.

Technical Field

The application belongs to the technical field of motor control, and particularly relates to a synchronous driving method and device for a stepping motor, a terminal and a storage medium.

Background

The stepping motor is an open-loop control element for converting an electric pulse signal into angular displacement or linear displacement, the rotating speed and the stopping position of the stepping motor only depend on the frequency and the pulse number of the pulse signal, and the angular displacement of the stepping motor can be controlled by controlling the number of pulses, so that the aim of accurate positioning is fulfilled; meanwhile, the rotating speed and the acceleration of the stepping motor can be controlled by controlling the pulse frequency, so that the purpose of speed regulation is achieved.

In industrial servo control, a dual-motor synchronous driving mode of a shafting is widely applied, and the mode has two advantages compared with a single-motor driving mode: 1) larger torque can be output to drag heavy loads; 2) the volume size of the equipment can be reduced, and the utilization rate of the space is improved.

At present, the synchronous drive control strategies of the double motors mainly include: a) parallel control, the system is equivalent to open-loop control, when a certain motor is disturbed in the running process, synchronous deviation is generated among the motors, and the synchronous performance is poor; b) the speed master-slave control, the disturbance on the slave motor can not be fed back to the main motor, and when the load changes, the synchronization precision between the motors can not be ensured.

As can be seen from the dual-motor control strategy, the existing dual-motor control system has the problem of low synchronous driving precision.

Disclosure of Invention

The embodiment of the application provides a synchronous driving method, a synchronous driving device, a synchronous driving terminal and a synchronous driving storage medium for a stepping motor, and can solve the problem of low synchronous driving precision of double motors.

In a first aspect, an embodiment of the present application provides a synchronous driving method for a stepping motor, including:

acquiring a first rotating speed signal of a first motor and a second rotating speed signal of a second motor;

determining a first pulse signal according to the first rotating speed signal, and determining a second pulse signal according to the second rotating speed signal;

determining a first target frequency compensation value and a second target frequency compensation value according to the first pulse signal, the second pulse signal and a preset value;

determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value;

and driving the first motor according to the first target pulse signal, and driving the second motor according to the second target pulse signal.

In a possible implementation manner of the first aspect, the determining a first target frequency compensation value according to the first pulse signal and a preset value, and determining a second target frequency compensation value according to the second pulse signal and the preset value includes:

calculating the absolute value of the difference value between the frequency value of the first pulse signal and the frequency value of the second pulse signal to obtain a frequency absolute difference value;

comparing the absolute frequency difference value with the preset value, and determining a frequency compensation value according to a comparison result;

and comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal, and determining the first target frequency compensation value and the second target frequency compensation value according to the comparison result and the frequency compensation value.

In a possible implementation manner of the first aspect, the preset value includes a first preset value and a second preset value, and the first preset value is smaller than the second preset value; the comparing the absolute frequency difference value with the preset value and determining a frequency compensation value according to a comparison result includes:

determining zero as the frequency compensation value when the absolute difference value of the frequencies is smaller than the first preset value;

determining the first preset value as the frequency compensation value under the condition that the absolute difference of the frequencies is greater than or equal to the first preset value and less than or equal to the second preset value;

and determining the second preset value as the frequency compensation value when the absolute difference value of the frequencies is larger than the second preset value.

In a possible implementation manner of the first aspect, the preset values further include a third preset value, and the third preset value is greater than the second preset value; the comparing the absolute frequency difference value with the preset value and determining a frequency compensation value according to the comparison result further comprises:

under the condition that the absolute difference value of the frequencies is larger than the third preset value, generating a first brake signal and a second brake signal;

the first brake signal is used for controlling the first motor to brake, and the second brake signal is used for controlling the second motor to brake.

In a possible implementation manner of the first aspect, the first target frequency compensation value and the second target frequency compensation value are opposite numbers; the comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal and determining the first target frequency compensation value and the second target frequency compensation value according to the comparison result and the frequency compensation value includes:

determining an absolute value of the frequency compensation value as the second target frequency compensation value in a case where the frequency value of the first pulse signal is greater than the frequency value of the second pulse signal;

determining an absolute value of the frequency compensation value as the first target frequency compensation value in a case where the frequency value of the first pulse signal is less than the frequency value of the second pulse signal.

In one possible implementation manner of the first aspect, the frequency of the first target pulse signal is equal to the sum of the frequency of the first pulse signal and the first target frequency compensation value;

the frequency of the second target pulse signal is equal to the sum of the frequency of the second pulse signal and the second target frequency compensation value.

In one possible implementation manner of the first aspect, the method includes:

and acquiring the first rotating speed signal and the second rotating speed signal through light sensing or encoder acquisition.

In a second aspect, an embodiment of the present application provides a synchronous driving apparatus for a stepping motor, including:

the acquisition module is used for acquiring a first rotating speed signal of a first motor and a second rotating speed signal of a second motor;

the pulse signal determining module is used for determining a first pulse signal according to the first rotating speed signal and determining a second pulse signal according to the second rotating speed signal;

the target frequency compensation value determining module is used for determining a first target frequency compensation value according to the first pulse signal and a preset value and determining a second target frequency compensation value according to the second pulse signal and the preset value;

the target pulse signal determining module is used for determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value;

and the control module is used for driving the first motor according to the first target pulse signal and driving the second motor according to the second target pulse signal.

In a third aspect, an embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method of any one of the above first aspects when executing the computer program.

In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method of any one of the above first aspects.

In a fifth aspect, the present application provides a computer program product, which when run on a terminal device, causes the terminal device to execute the method of any one of the above first aspects.

It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.

Compared with the prior art, the embodiment of the application has the advantages that:

the method comprises the steps of obtaining a first rotating speed signal of a first motor and a second rotating speed signal of a second motor; determining a first pulse signal according to the first rotating speed signal, and determining a second pulse signal according to the second rotating speed signal; then determining a first target frequency compensation value according to the first pulse signal and a preset value, and determining a second target frequency compensation value according to the second pulse signal and the preset value; determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value; and finally, driving the first motor according to the first target pulse signal, and driving the second motor according to the second target pulse signal. When the first motor and the second motor are asynchronous, a first target frequency compensation value and a second target frequency compensation value are generated, a first target pulse signal is determined by the first pulse signal and the first target frequency compensation value, a second target pulse signal is determined by the second pulse signal and the second target frequency compensation value, then the first motor is driven according to the first target pulse signal, and the second motor is driven according to the second target pulse signal, so that the accurate control of the synchronous driving of the first motor and the second motor is realized.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.

Fig. 1 is a flowchart of a synchronous driving method for a stepping motor according to an embodiment of the present application;

fig. 2 is a flowchart of a synchronous driving method for a stepping motor according to an embodiment of the present application;

fig. 3 is a schematic structural diagram of a synchronous driving device of a stepping motor according to an embodiment of the present application;

fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present application.

Detailed Description

In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".

Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.

Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.

At present, the synchronous drive control strategies of the double motors mainly include: a) parallel control, the system is equivalent to open-loop control, when a certain motor is disturbed in the running process, synchronous deviation is generated among the motors, and the synchronous performance is poor; b) the speed master-slave control, the disturbance on the slave motor can not be fed back to the main motor, and when the load changes, the synchronization precision between the motors can not be ensured.

As can be seen from the dual-motor control strategy, the existing dual-motor control system has the problem of low synchronous driving precision.

Based on the above problem, the embodiment of the present application discloses a synchronous driving method for a stepping motor, which includes obtaining a first rotation speed signal of a first motor and a second rotation speed signal of a second motor; determining a first pulse signal according to the first rotating speed signal, and determining a second pulse signal according to the second rotating speed signal; then determining a first target frequency compensation value according to the first pulse signal and a preset value, and determining a second target frequency compensation value according to the second pulse signal and the preset value; determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value; and finally, driving the first motor according to the first target pulse signal, and driving the second motor according to the second target pulse signal. When the first motor and the second motor are asynchronous, a first target frequency compensation value and a second target frequency compensation value are generated, a first target pulse signal is determined by the first pulse signal and the first target frequency compensation value, a second target pulse signal is determined by the second pulse signal and the second target frequency compensation value, then the first motor is driven according to the first target pulse signal, and the second motor is driven according to the second target pulse signal, so that the accurate control of the synchronous driving of the first motor and the second motor is realized.

In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.

Fig. 1 shows a flowchart of a synchronous driving method for a stepping motor provided in an embodiment of the present application, and by way of example and not limitation, the method may include the following steps:

s101, a first rotating speed signal of a first motor and a second rotating speed signal of a second motor are obtained.

Specifically, the rotation speeds of the first motor and the second motor may be tested by a testing device to obtain a first rotation speed signal and a second rotation speed signal, for example, the first rotation speed signal and the second rotation speed signal are acquired by a light sensor or an encoder.

S102, determining a first pulse signal according to the first rotating speed signal, and determining a second pulse signal according to the second rotating speed signal.

Specifically, as can be seen from the operating principle of the stepping motor, the frequency of the pulse signal determines the rotational speed of the stepping motor. The rotation speed (first rotation speed signal) of the first motor is obtained in step S101, and the first pulse signal can be obtained by calculation in combination with the technical parameters of the first motor; the rotation speed (second rotation speed signal) of the second motor is obtained in step S101, and the second pulse signal can be calculated by combining the technical parameters of the second motor.

S103, determining a first target frequency compensation value and a second target frequency compensation value according to the first pulse signal, the second pulse signal and a preset value.

For example, as shown in fig. 2, step S103 may specifically include:

and S1031, calculating an absolute value of a difference value between the frequency value of the first pulse signal and the frequency value of the second pulse signal to obtain a frequency absolute difference value.

Specifically, the frequency value of the first pulse signal and the frequency value of the second pulse signal are subtracted, and then an absolute value is obtained, and the obtained absolute frequency difference value can represent an error range of the first pulse signal and the second pulse signal, wherein the larger the absolute frequency difference value is, the larger the error range of the first pulse signal and the second pulse signal is, the larger the difference between the corresponding rotating speed of the first motor and the corresponding rotating speed of the second motor is; the smaller the absolute difference of the frequencies is, the smaller the error range of the first pulse signal and the second pulse signal is, and the smaller the difference between the rotating speed of the first motor and the rotating speed of the second motor is.

S1032, comparing the frequency absolute difference value with a preset value, and determining a frequency compensation value according to the comparison result.

Specifically, the absolute difference of the frequencies may reflect the error range of the first pulse signal and the second pulse signal, and further reflect the error range of the first motor speed and the second motor speed. The larger the absolute difference of the frequencies is, the larger the error range of the first pulse signal and the second pulse signal is, the larger the difference between the corresponding rotating speed of the first motor and the rotating speed of the second motor is, and the larger the required frequency compensation value is at the moment; the smaller the absolute difference of the frequencies is, the smaller the error range between the first pulse signal and the second pulse signal is, and the smaller the difference between the corresponding rotating speed of the first motor and the rotating speed of the second motor is, the smaller the frequency compensation value is required at this time.

For example, step S1032 may specifically include:

and A1, in the case that the absolute difference value of the frequency is smaller than the first preset value, determining zero as the frequency compensation value.

Specifically, the absolute difference of the frequencies is smaller than the first preset value, and the error at this time is determined to be within the range of the accuracy requirement, and at this time, frequency compensation is not needed, so that zero is determined as the frequency compensation value.

It should be noted that the first preset value is set according to the precision requirement of synchronous driving of the stepping motor, and when the precision requirement of synchronous rotation of the motor is higher, the first preset value is designed to be smaller; when the requirement on the synchronous rotation precision of the motor is lower, the first preset value is designed to be larger.

And B1, determining the first preset value as the frequency compensation value when the absolute difference of the frequencies is greater than or equal to the first preset value and less than or equal to the second preset value.

Specifically, when the absolute difference of the frequencies is greater than or equal to a first preset value and less than or equal to a second preset value, the error range of the first pulse signal and the second pulse signal is large, frequency compensation needs to be performed on the first pulse signal and the second pulse signal, the first preset value is determined as a frequency compensation value, and after the frequency compensation, the error of the first pulse signal and the second pulse signal meets the requirement.

And C1, determining the second preset value as the frequency compensation value under the condition that the absolute difference of the frequency is larger than the second preset value.

Specifically, the absolute difference of the frequencies is greater than a second preset value, the error range of the first pulse signal and the second pulse signal is large at this time, frequency compensation needs to be performed on the first pulse signal and the second pulse signal, the second preset value is determined as a frequency compensation value at this time, and after the frequency compensation is performed, the error of the first pulse signal and the error of the second pulse signal meet the requirement.

In an embodiment of the application, step S1032 may further include:

and D1, generating a first brake signal and a second brake signal under the condition that the absolute difference of the frequencies is larger than a third preset value.

Specifically, when the absolute difference of the frequencies is greater than a third preset value, the error range of the first pulse signal and the error range of the second pulse signal are too large, the difference between the rotating speeds of the first motor and the second motor is too large, potential safety hazards can be caused to other equipment, and the first braking signal and the second braking signal are generated to brake the first motor and the second motor respectively so as to protect other equipment from being damaged.

S1033, comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal, and determining a first target frequency compensation value and a second target frequency compensation value according to the comparison result and the frequency compensation value.

Specifically, by comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal, the frequency magnitude relationship between the first pulse signal and the second pulse signal can be obtained, and then a first target frequency compensation value and a second target frequency compensation value are determined in combination with the frequency compensation value, wherein the first target frequency compensation value is used for compensating the first pulse signal, and the second target frequency compensation value is used for compensating the second pulse signal.

Illustratively, step S1033 may specifically include:

a2, in the case where the frequency value of the first pulse signal is greater than the frequency value of the second pulse signal, determining the absolute value of the frequency compensation value as a second target frequency compensation value.

Specifically, the frequency value of the first pulse signal is greater than the frequency value of the second pulse signal, which indicates that the rotation speed of the first motor is greater than the rotation speed of the second motor. At this time, the absolute value of the frequency compensation value is determined as a second target frequency compensation value, and the first target frequency compensation value and the second target frequency compensation value are opposite numbers, so that the first target frequency compensation value is a negative value, and the frequency of the first pulse signal can be reduced; the second target frequency compensation value is a positive value, and the frequency of the second pulse signal can be increased.

B2, in case that the frequency value of the first pulse signal is smaller than the frequency value of the second pulse signal, determining the absolute value of the frequency compensation value as the first target frequency compensation value.

Specifically, the frequency value of the first pulse signal is smaller than the frequency value of the second pulse signal, which indicates that the rotation speed of the first motor is smaller than the rotation speed of the second motor. At this time, the absolute value of the frequency compensation value is determined as a first target frequency compensation value, and since the first target frequency compensation value and the second target frequency compensation value are opposite numbers, the first target frequency compensation value is a positive value, and the frequency of the first pulse signal can be increased; the second target frequency compensation value is a negative value, and the frequency of the second pulse signal can be reduced.

And S104, determining a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determining a second target pulse signal according to the second pulse signal and the second target frequency compensation value.

Specifically, the frequency of the first target pulse signal is equal to the sum of the frequency of the first pulse signal and the first target frequency compensation value, and the frequency of the second target pulse signal is equal to the sum of the frequency of the second pulse signal and the second target frequency compensation value.

And S105, driving the first motor according to the first target pulse signal, and driving the second motor according to the second target pulse signal.

Specifically, the first target pulse signal and the second target pulse signal determined in step S104 are compensated signals, and the first motor is driven according to the first target pulse signal and the second motor is driven according to the second target pulse signal, so that accurate synchronous rotation of the first motor and the second motor can be ensured.

To clearly illustrate the principle of the synchronous driving method of the stepping motor, a specific embodiment is described as an example, wherein the frequency of the first pulse signal is n1The frequency of the second pulse signal is n2The first preset value is 50, and the second preset value is 100.

(1) When | n1-n2When | < 50, the frequency error of the first pulse signal and the second pulse signal meets the requirement, and compensation is not needed, and the frequency compensation value n is used3=0。

(2) When the absolute value of n is more than or equal to 501-n2When | is less than or equal to 100, the frequency compensation value n3=50;

When n is1<n2At this time, the first target frequency compensation value n4=n350, second target frequency compensation value n5=-n4-50; the frequency of the first target pulse signal is N1=n1+n4=n1+50, the frequency of the second target pulse signal is N2=n2+n5=n2-50;

When n is1>n2At this time, the first target frequency compensation value n4=-n3-50, second target frequency compensation value n5=-n450; the frequency of the first target pulse signal is N1=n1+n4=n1-50, the frequency of the second target pulse signal being N2=n2+n5=n2+50。

(3) When 100 < | n1-n2When l, the frequency compensation value n is now3=100;

When n is1<n2At this time, the first target frequency compensation value n4=n3100, second target frequency compensation value n5=-n4-100; the frequency of the first target pulse signal is N1=n1+n4=n1+100, the frequency of the second target pulse signal is N2=n2+n5=n2-100;

When n is1>n2At this time, the first target frequency compensation value n4=-n3-100, second target frequency compensation value n5=-n4100; the frequency of the first target pulse signal is N1=n1+n4=n1100, the frequency of the second target pulse signal is N2=n2+n5=n2+100。

And respectively compensating the first pulse signal and the second pulse signal, determining a first target pulse signal and a second target pulse signal, enabling the frequency of the first target pulse signal and the frequency error of the second target pulse signal to meet requirements, and ensuring that the synchronous driving precision of the first motor and the second motor meets the requirements.

It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

Fig. 3 shows a schematic structural diagram of a synchronous driving apparatus for a stepping motor according to an embodiment of the present application, where the synchronous driving apparatus for a stepping motor may include an obtaining module 31, a pulse signal determining module 32, a target frequency compensation value determining module 33, a target pulse signal determining module 34, and a control module 35;

the acquiring module 31 is configured to acquire a first rotation speed signal of a first motor and a second rotation speed signal of a second motor;

the pulse signal determining module 32 is configured to determine a first pulse signal according to the first rotation speed signal and determine a second pulse signal according to the second rotation speed signal;

a target frequency compensation value determining module 33, configured to determine a first target frequency compensation value according to the first pulse signal and a preset value, and determine a second target frequency compensation value according to the second pulse signal and the preset value;

a target pulse signal determination module 34, configured to determine a first target pulse signal according to the first pulse signal and the first target frequency compensation value, and determine a second target pulse signal according to the second pulse signal and the second target frequency compensation value;

and the control module 35 is configured to drive the first motor according to the first target pulse signal, and drive the second motor according to the second target pulse signal.

In one embodiment of the present application, the target frequency compensation value determining module 33 may include a calculating unit, a frequency compensation value determining unit, and a target frequency compensation value determining unit;

the calculating unit is used for calculating the absolute value of the difference value between the frequency value of the first pulse signal and the frequency value of the second pulse signal to obtain a frequency absolute difference value;

the frequency compensation value determining unit is used for comparing the frequency absolute difference value with the preset value and determining a frequency compensation value according to a comparison result;

and the target frequency compensation value determining unit is used for comparing the frequency value of the first pulse signal with the frequency value of the second pulse signal and determining the first target frequency compensation value and the second target frequency compensation value according to the comparison result and the frequency compensation value.

In an embodiment of the present application, the preset values include a first preset value and a second preset value, the first preset value is smaller than the second preset value, and the frequency compensation value determining unit may include a first frequency compensation value determining subunit, a second frequency compensation value determining subunit, and a third frequency compensation value determining subunit;

a first frequency compensation value determining subunit, configured to determine zero as the frequency compensation value when the absolute difference of the frequencies is smaller than the first preset value;

a second frequency compensation value determining subunit, configured to determine, when the absolute difference of the frequencies is greater than or equal to the first preset value and is less than or equal to the second preset value, the first preset value as the frequency compensation value;

and the third frequency compensation value determining subunit is configured to determine the second preset value as the frequency compensation value when the absolute frequency difference is greater than the second preset value.

In an embodiment of the present application, the preset values further include a third preset value, the third preset value is greater than the second preset value, and the frequency compensation value determining unit may further include a fourth frequency compensation value determining subunit;

the fourth frequency compensation value determining subunit is configured to generate a first brake signal and a second brake signal when the absolute difference of the frequencies is greater than the third preset value;

the first brake signal is used for controlling the first motor to brake, and the second brake signal is used for controlling the second motor to brake.

In an embodiment of the present application, the first target frequency compensation value and the second target frequency compensation value are opposite numbers, and the target frequency compensation value determining unit may include

A first target frequency compensation value determining subunit, configured to determine, as the second target frequency compensation value, an absolute value of the frequency compensation value when the frequency value of the first pulse signal is greater than the frequency value of the second pulse signal;

a second target frequency compensation value determining subunit configured to determine, as the first target frequency compensation value, an absolute value of the frequency compensation value in a case where the frequency value of the first pulse signal is smaller than the frequency value of the second pulse signal.

It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.

In addition, the stepping motor synchronous driving apparatus shown in fig. 3 may be a software unit, a hardware unit, or a combination of software and hardware unit built in the existing terminal device, may be integrated into the terminal device as an independent pendant, or may exist as an independent terminal device.

It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

Fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 4, the terminal device 4 of this embodiment may include: at least one processor 40 (only one processor 40 is shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 executes the computer program 42 to implement the steps of any of the above-mentioned method embodiments, for example, the steps S101 to S105 in the embodiment shown in fig. 1. Alternatively, the processor 40, when executing the computer program 42, implements the functions of the modules/units in the above-described device embodiments, such as the functions of the modules 31 to 35 shown in fig. 3.

Illustratively, the computer program 42 may be partitioned into one or more modules/units that are stored in the memory 41 and executed by the processor 40 to implement the present invention. The one or more modules/units may be a series of instruction segments of the computer program 42 capable of performing specific functions, which are used to describe the execution process of the computer program 42 in the terminal device 4.

The terminal device 4 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device 4 may include, but is not limited to, a processor 40, a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of the terminal device 4, and does not constitute a limitation of the terminal device 4, and may include more or less components than those shown, or combine some components, or different components, such as an input-output device, a network access device, and the like.

The Processor 40 may be a Central Processing Unit (CPU), and the Processor 40 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

The memory 41 may in some embodiments be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. In other embodiments, the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used for storing an operating system, an application program, a Boot Loader (Boot Loader), data, and other programs, such as program codes of the computer program 42. The memory 41 may also be used to temporarily store data that has been output or is to be output.

The present application further provides a computer-readable storage medium, where a computer program 42 is stored, and when the computer program 42 is executed by the processor 40, the steps in the above-mentioned method embodiments may be implemented.

The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.

The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. With this understanding, all or part of the processes in the methods of the embodiments described above can be implemented by the computer program 42 to instruct the relevant hardware, where the computer program 42 can be stored in a computer readable storage medium, and when the computer program 42 is executed by the processor 40, the steps of the methods of the embodiments described above can be implemented. Wherein the computer program 42 comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or apparatus capable of carrying computer program code to a terminal device, recording medium, computer Memory, Read-Only Memory (ROM), random-access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.

In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.

Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

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

The 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.

The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种三级式变频交流发电系统数字采样系统

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!