Motor speed control method and apparatus, device and storage medium
By monitoring and calculating the motor speed difference in real time and using a PID controller to generate voltage control commands, the problem of motor performance degradation was solved, real-time closed-loop control of the motor was achieved, and the tactile feedback effect was improved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- AAC ACOUSTIC TECH (SHANGHAI) CO LTD
- Filing Date
- 2024-11-06
- Publication Date
- 2026-05-15
AI Technical Summary
In practical applications, motor performance degrades due to parameter perturbations and nonlinear distortion, affecting the tactile feedback effect.
By acquiring the current speed and preset desired speed of the target motor, the PID controller calculates the target drive voltage value and generates control commands to control the motor drive module to output the corresponding voltage, thereby achieving real-time closed-loop control of the motor speed.
Real-time monitoring and adjustment of motor speed ensures it always operates within a good performance range, improving haptic feedback and enhancing the user experience.
Smart Images

Figure CN2024130080_15052026_PF_FP_ABST
Abstract
Description
A method, apparatus, device, and storage medium for controlling motor speed. Technical Field
[0001] This application relates to the field of motor control technology, and in particular to a motor speed control method, device, equipment and storage medium. Background Technology
[0002] Linear resonant actuators (LRAs), also known as linear motors, are now widely used in a range of consumer electronics products, including smartphones, tablets, VR devices, and smart wearables. They provide haptic feedback, such as vibration cues and touch feedback, which enhances the user's interaction with the device. Therefore, linear motors are considered an important component in these consumer electronics products, playing a crucial role in improving the user experience.
[0003] However, in practical applications, motors may encounter problems such as low manufacturing precision, parameter perturbations due to the motor's inherent physical characteristics, and nonlinear distortion. These issues can affect the haptic feedback experience of the originally designed drive signal. Therefore, it is necessary to perform real-time control of the motor to ensure it always operates within its optimal performance range and improve the user experience. Technical issues
[0004] The main objective of this application is to provide a motor speed control method, device, equipment, and storage medium, which can at least solve the problems in the related art where motor performance deteriorates and haptic feedback is affected by motor parameter perturbations and nonlinear distortion. Technical solutions
[0005] To achieve the above objectives, a first aspect of this application provides a motor speed control method, the method comprising: acquiring the current speed of a target motor and a preset desired speed; calculating a target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed; generating a corresponding control command based on the target drive voltage value and transmitting it to a corresponding motor drive module; wherein the control command is used to instruct the motor drive module to output a corresponding drive voltage to the target motor to control the speed of the target motor.
[0006] A second aspect of this application provides a motor speed control device, comprising: an acquisition module for acquiring the current speed of a target motor and a preset desired speed; an error calculation module for calculating a target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed; and an instruction generation module for generating a corresponding control instruction based on the target drive voltage value and transmitting it to a corresponding motor drive module; wherein the control instruction is used to instruct the motor drive module to output a corresponding drive voltage to the target motor to control the speed of the target motor.
[0007] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is configured to execute a computer program stored in the memory, and when the processor executes the computer program, it implements the steps of the motor speed control method provided in the first aspect of this application.
[0008] The fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the motor speed control method provided in the first aspect of this application. Beneficial effects
[0009] As can be seen from the above, the motor speed control method, apparatus, device, and readable storage medium provided in this application obtain the current speed and preset desired speed of the target motor; calculate the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed; generate corresponding control commands based on the target drive voltage value and transmit them to the corresponding motor drive module; wherein, the control commands are used to instruct the motor drive module to output the corresponding drive voltage to the target motor to control the speed of the target motor. Through the implementation of this application, the current speed of the target motor is monitored in real time and the speed error is calculated in real time. By correcting the drive signal of the target motor, the speed of the target motor can reach the desired speed, realizing real-time closed-loop control of the target motor, ensuring that the target motor can always work within a good performance range, thereby effectively improving the haptic feedback effect and enhancing the user experience. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0012] Figure 2 is a schematic flowchart of a motor speed control method provided in an embodiment of this application;
[0013] Figure 3 is a schematic diagram of the input and output of a discrete PID controller provided in an embodiment of this application;
[0014] Figure 4 is a detailed flowchart of a motor speed control method provided in an embodiment of this application;
[0015] Figure 5 is a detailed flowchart of another motor speed control method provided in an embodiment of this application;
[0016] Figure 6 is a schematic diagram of a motor speed control device according to an embodiment of this application;
[0017] Figure 7 is a schematic diagram of the structure of another electronic device provided in an embodiment of this application. Embodiments of the present invention
[0018] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0020] To address the issues in related technologies where motor performance degrades and haptic feedback is affected by motor parameter perturbations and nonlinear distortion, the first embodiment of this application provides a motor speed control method applied to an electronic device. Figure 1 is a schematic diagram of the structure of an electronic device provided in this embodiment, which includes a target motor, a motor drive module, a speed acquisition module, and a main control module. Figure 2 is a basic flowchart of the motor speed control method provided in this embodiment, which includes the following steps:
[0021] Step 201: Obtain the current speed of the target motor and the preset desired speed.
[0022] Specifically, in this embodiment, multiple linear motors can be installed in the electronic device to provide tactile feedback at different locations. The linear motor currently providing tactile feedback is designated as the target motor. When multiple target motors exist, the speed of each target motor can be monitored in real time. Specifically, a speed acquisition module can acquire the current speed of the target motor in real time and transmit it to the main control module. Simultaneously, the main control module will also acquire the expected speed corresponding to the target motor. The expected speed of the target motor can be the same or different at different times. In this embodiment, the speed acquisition module can be a speed sensor, and a sensor with appropriate acquisition accuracy can be selected according to the actual application requirements. The main control module can be a device with certain computing capabilities, such as an MCU or DSP.
[0023] In some embodiments of this example, before obtaining the current speed and desired speed of the target motor, the method further includes: establishing a corresponding motor mathematical model based on the characteristic parameters of the target motor; inputting a preset desired voltage value into the motor mathematical model to obtain the desired speed.
[0024] Specifically, in this embodiment, a model can be created based on the physical characteristics of the target motor, describing its behavior and performance in mathematical terms. The motor's motion characteristics can be understood and predicted based on the motor mathematical module. The motor mathematical module can take various forms, such as transfer functions or state-space models. The motor's characteristic parameters can be electrical parameters (e.g., resistance, inductance, capacitance, etc., parameters related to drive current and voltage) or mechanical parameters (e.g., mass, inertia, damping, etc.). After the motor mathematical model is established, a suitable desired voltage signal is selected based on the actual application scenario and input into the motor mathematical model. The module can then calculate the desired speed information of the target motor.
[0025] In some other embodiments of this example, before obtaining the current speed of the target motor and the preset desired speed, the method further includes: acquiring the real-time speed of the target motor multiple times within a preset time period based on the preset speed acquisition module; and determining the current speed of the target motor based on the multiple real-time speeds.
[0026] Specifically, in this embodiment, in order to improve the accuracy of the target motor speed determination, the real-time speed of the target motor can be collected multiple times within a preset time period, such as 3 seconds, by a speed acquisition module (e.g., a speed sensor). The current speed of the target motor can be determined based on the multiple real-time speeds collected within this time period. The current speed of the target motor can be determined by averaging the multiple real-time speeds or by other statistical indicators. This can avoid the problem of low data reliability caused by system noise, sensor errors, etc. in a single measurement, thereby improving the credibility of the measurement results.
[0027] Step 202: Calculate the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed.
[0028] Specifically, in this embodiment, after obtaining the current speed of the target motor, the main control module will also calculate the speed difference between the current speed and the desired speed of the target motor, that is, the error between the current speed and the desired speed, and calculate the target drive voltage value required to drive the target motor to reach the desired speed based on the speed difference.
[0029] In some embodiments of this example, the target drive voltage value of the target motor is calculated based on the speed difference between the current speed and the desired speed, including: obtaining a first historical speed difference corresponding to a first historical time and a second historical speed difference corresponding to a second historical time; wherein the first historical time differs from the current time by a unit of time, and the second historical time differs from the first historical time by a unit of time; performing proportional-integral-differential calculations on the speed difference between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference to obtain an incremental voltage value; and summing the historical drive voltage value corresponding to the first historical time and the incremental voltage value to obtain the target drive voltage value of the target motor.
[0030] Specifically, in this embodiment, the target drive voltage value of the target motor can be calculated based on a PID controller, i.e., a proportional-integral-derivative controller. A PID controller is an automatic control algorithm that generates a control output based on proportional, integral, and derivative operations on the system feedback error to achieve stable system control. In this embodiment, the incremental voltage value Δu(k) corresponding to the current moment is obtained by performing proportional, integral, and derivative operations on the speed difference corresponding to the current moment and the historical speed differences corresponding to the two previous historical moments. The target drive voltage value u(k) corresponding to the current moment is obtained by adding this incremental voltage value Δu(k) to the target drive voltage value calculated at the previous historical moment (i.e., the historical drive voltage value u(k-1)). The two historical moments are the first historical moment, which is one unit time interval from the current moment, and the second historical moment, which is two units time interval from the current moment. The calculation method for the corresponding two historical speed differences is the same as that for the speed difference corresponding to the current moment. Taking the first historical speed difference as an example, the first historical speed difference is the difference between the actual speed at the first historical moment and the expected speed of the motor at the corresponding first historical moment. The expected speed of the motor at the corresponding first historical moment and the expected speed of the motor at the current moment can be the same or different.
[0031] Furthermore, in some embodiments of this example, proportional-integral-differential (PID) calculations are performed on the speed difference between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference to obtain the incremental voltage value. This includes: performing discrete PID calculations on the speed error between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference according to the discrete PID formula to obtain the incremental voltage value; wherein, the formula for discrete PID is: Δu(k)=k p (e(k)-e(k-1))+k i e(k)+k d (e(k)-2e(k-1)+e(k-2)), where Δu(k) is the incremental voltage value, and k p k is the proportionality coefficient. i k is the coefficient of the integral term. d Here, e(k) is the differential coefficient, e(k-1) is the first historical speed difference, and e(k-2) is the second historical speed difference.
[0032] Specifically, for a PID controller, a common output expression is: u(t) = k P *e(t)+k i *∫e(t)dt+k d *de(t) / dt, where k P k is the proportionality coefficient. i k is the coefficient of the integral term. d Here, z is the coefficient of the differential term, and e(t) is the real-time error. The PID controller achieves error control by amplifying the error through proportional-integral-derivative operations, enabling the actual output of the system to continuously track the desired output. In practical control systems, since processors can only handle discrete signals, continuous systems are often discretized. Similarly, for PID controllers, discretization is often used to control the system in practical applications. Therefore, this embodiment calculates the target drive voltage value of the target motor based on a discrete PID controller. The input and output of this discrete PID controller are shown in Figure 3, where z... -1 This is a discrete unit delay module. The proportional (P) action of the PID controller enables it to respond quickly and with limited error, the integral (I) action eliminates the system's deviation in steady state, allowing the system to track the setpoint more accurately, and the derivative (D) action predicts the system's future behavior, suppresses changes in error, and accelerates the system's response.
[0033] In some other embodiments of this example, before calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed, the method further includes: comparing the speed difference between the current speed and the desired speed with a preset error allowable range; if the speed difference does not meet the error allowable range, then calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed.
[0034] Specifically, before calculating the target drive voltage, it is possible to first determine the magnitude of the error between the current speed of the target motor and the desired speed. If the current speed of the target motor is within the allowable error range, it can be determined that the current motor speed can ensure that the motor is in a good performance range, and there is no need to correct its speed. Otherwise, it is necessary to calculate the target drive voltage value based on the speed difference between the current speed and the desired speed of the motor in order to correct the motor speed and ensure the stability of the motor performance.
[0035] In some other embodiments of this example, before calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed, the method further includes: obtaining the current output voltage value of the motor drive module; determining the matching relationship between the output voltage value and the current speed based on a preset motor drive speed index table; wherein the motor drive speed index table contains a mapping relationship between the drive voltage range and the motor speed range; if the output voltage value does not match the current speed, then the target drive voltage value of the target motor is calculated based on the speed difference between the current speed and the desired speed.
[0036] Specifically, in this embodiment, the motor speed can be determined based on the current output voltage value of the motor drive module to determine whether it meets the expected speed requirement. A simulation test of the excitation-speed relationship can be performed using the constructed motor mathematical model and the motor itself. A motor drive speed index table that closely reflects the actual working characteristics of the motor can be constructed, recording the correspondence between each drive voltage range and the motor speed range. If the current motor speed does not match the current output voltage value of the motor drive module, it is determined that the motor performance is affected by factors such as parameter perturbation or nonlinear distortion, and the motor speed needs to be controlled.
[0037] Step 203: Generate corresponding control commands based on the target drive voltage value and transmit them to the corresponding motor drive module.
[0038] Specifically, in this embodiment, after the main control module calculates the target drive voltage based on the PID controller, it generates a corresponding control command to instruct the motor drive module to output the corresponding drive voltage to the target motor, thereby controlling the speed of the target motor. The target drive voltage is a corrected drive voltage. After receiving the control command, the motor drive module generates the corresponding drive voltage, amplifies it, and outputs it to the target motor to control its speed to reach the desired speed.
[0039] Based on the technical solution of the embodiments of this application described above, the current speed and preset desired speed of the target motor are obtained; the target drive voltage value of the target motor is calculated based on the speed difference between the current speed and the desired speed; a corresponding control command is generated based on the target drive voltage value and transmitted to the corresponding motor drive module; wherein, the control command is used to instruct the motor drive module to output a corresponding drive voltage to the target motor to control the speed of the target motor. Through the implementation of this solution, the current speed of the target motor is monitored in real time and the speed error is calculated in real time. The drive signal of the target motor is corrected through voltage compensation so that the speed of the target motor can reach the desired speed, achieving real-time closed-loop control of the target motor. This ensures that the target motor always operates within a good performance range, thereby effectively improving the haptic feedback effect and enhancing the user experience.
[0040] The method shown in Figure 4 is a refined motor speed control method provided in an embodiment of this application. The motor speed control method includes:
[0041] Step 401: Establish the corresponding mathematical model of the motor based on the characteristic parameters of the target motor;
[0042] Step 402: Input the preset desired voltage value into the motor mathematical model to obtain the desired speed;
[0043] Step 403: Obtain the first historical velocity difference corresponding to the first historical moment and the second historical velocity difference corresponding to the second historical moment;
[0044] Step 404: Calculate the speed difference between the current speed and the desired speed of the target motor;
[0045] Step 405: Perform proportional-integral-differential calculations on the speed difference, the first historical speed difference, and the second historical speed difference to obtain the incremental voltage value;
[0046] Step 406: Sum the historical drive voltage value and incremental voltage value corresponding to the previous adjacent historical time to obtain the target drive voltage value of the target motor.
[0047] Step 407: Generate corresponding control commands based on the target drive voltage value and transmit them to the corresponding motor drive module.
[0048] Specifically, as shown in the flowchart of the motor speed control method in Figure 5, to achieve closed-loop tracking control of the motor speed, a model is first built based on the physical characteristics of the target motor. After the motor mathematical model is established, a suitable desired voltage signal is selected according to the actual application scenario and input into the motor mathematical model. The desired speed information of the target motor can be calculated through the module. Then, the current speed of the target motor is obtained through the speed acquisition module, and the speed difference between the current speed and the desired speed is calculated. Next, the target drive voltage value of the target motor is calculated based on the PID controller. Specifically, the incremental voltage value Δu(k) corresponding to the current moment is obtained by performing proportional, integral, and differential operations on the speed difference corresponding to the current moment and the historical speed differences corresponding to the two previous historical moments. By adding the incremental voltage value Δu(k) to the target drive voltage value calculated at the previous historical moment (i.e., the historical drive voltage value u(k-1)), the target drive voltage value u(k) corresponding to the current moment can be obtained. The two historical moments are the first historical moment, which is one unit interval from the current moment, and the second historical moment, which is two units interval from the current moment. The speed difference between the two historical moments is calculated in the same way as the speed difference at the current moment. Finally, after the main control module calculates the target drive voltage based on the PID controller, it will generate corresponding control commands to instruct the motor drive module to output the corresponding drive voltage to the target motor, thereby controlling the target motor speed to reach the desired speed. This ensures that the target motor always operates within a good performance range, effectively improving the haptic feedback effect and enhancing the user experience.
[0049] It should be understood that the sequence number of each step in this embodiment does not imply the order in which the steps are executed. The execution order of each step should be determined by its function and internal logic, and should not constitute a unique limitation on the implementation process of this application embodiment.
[0050] Figure 6 is a schematic diagram of a motor speed control device according to an embodiment of this application. This motor speed control device can be applied to the aforementioned motor speed control method. As shown in Figure 6, the motor speed control device mainly includes:
[0051] The acquisition module 601 is used to acquire the current speed of the target motor and the preset desired speed.
[0052] Error calculation module 602 is used to calculate the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed;
[0053] The instruction generation module 603 is used to generate corresponding control instructions based on the target drive voltage value and transmit them to the corresponding motor drive module; wherein, the control instructions are used to instruct the motor drive module to output the corresponding drive voltage to the target motor in order to control the speed of the target motor.
[0054] In some embodiments of this example, before the acquisition module performs the function of acquiring the current speed and desired speed of the target motor, it is also used to establish a corresponding motor mathematical model based on the characteristic parameters of the target motor; and input the preset desired voltage value into the motor mathematical model to obtain the desired speed.
[0055] In some other embodiments of this example, before the acquisition module performs the function of acquiring the current speed and the desired speed of the target motor, it is further used to acquire the current speed and the preset desired speed of the target motor, and then: acquire the real-time speed of the target motor multiple times within a preset time period based on the preset speed acquisition module; and determine the current speed of the target motor based on the multiple real-time speeds.
[0056] In some embodiments of this example, the error calculation module is specifically used to: obtain the first historical speed difference corresponding to the first historical time and the second historical speed difference corresponding to the second historical time; wherein the first historical time differs from the current time by a unit time, and the second historical time differs from the first historical time by a unit time; perform proportional-integral-differential calculation on the speed difference between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference to obtain the incremental voltage value; and sum the historical drive voltage value corresponding to the previous adjacent historical time and the incremental voltage value to obtain the target drive voltage value of the target motor.
[0057] Furthermore, in some embodiments of this example, when the error calculation module performs proportional-integral-differential (PID) calculations on the speed difference between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference to obtain the incremental voltage value, it is specifically used to: perform discrete PID calculations on the speed error between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference according to the discrete PID formula to obtain the incremental voltage value; wherein, the formula for discrete PID is: Δu(k)=k p (e(k)-e(k-1))+k i e(k)+k d (e(k)-2e(k-1)+e(k-2)), where Δu(k) is the incremental voltage value, and k p k is the proportionality coefficient. i k is the coefficient of the integral term. d Here, e(k) is the differential coefficient, e(k-1) is the first historical speed difference, and e(k-2) is the second historical speed difference.
[0058] In some other embodiments of this example, before performing the function of calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed, the error calculation module is further configured to: compare the speed difference between the current speed and the desired speed with a preset error allowable range; if the speed difference does not meet the error allowable range, then perform the function of calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed.
[0059] In some other embodiments of this example, before performing the function of calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed, the error calculation module is further configured to: obtain the current output voltage value of the motor drive module; determine the matching relationship between the output voltage value and the current speed based on a preset motor drive speed index table; wherein, the motor drive speed index table contains a mapping relationship between the drive voltage range and the motor speed range; if the output voltage value does not match the current speed, then the function of calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed is performed.
[0060] It should be noted that the motor speed control methods in the foregoing embodiments can all be implemented based on the motor speed control device provided in this embodiment. Those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working process of the motor speed control device described in this embodiment can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0061] Based on the technical solution of the above embodiments of this application, the current speed and preset desired speed of the target motor are obtained; the target drive voltage value of the target motor is calculated based on the speed difference between the current speed and the desired speed; a corresponding control command is generated based on the target drive voltage value and transmitted to the corresponding motor drive module; wherein, the control command is used to instruct the motor drive module to output a corresponding drive voltage to the target motor to control the speed of the target motor. Through the implementation of this solution, the current speed of the target motor is monitored in real time and the speed error is calculated in real time. The drive signal of the target motor is corrected through voltage compensation so that the speed of the target motor can reach the desired speed, achieving real-time closed-loop control of the target motor. This ensures that the target motor always operates within a good performance range, thereby effectively improving the haptic feedback effect and enhancing the user experience.
[0062] Figure 7 is a schematic diagram of another electronic device provided in an embodiment of this application. This electronic device can be used to implement the motor speed control method in the foregoing embodiment, and mainly includes:
[0063] The system includes a memory 701, a processor 702, and a computer program 703 stored on the memory 701 and executable on the processor 702. The memory 701 and the processor 702 are connected via communication. When the processor 702 executes the computer program 703, it implements the method described in Embodiment 1 or 2 above. The number of processors can be one or more.
[0064] The memory 701 can be a high-speed random access memory (RAM) or a non-volatile memory, such as a disk storage device. The memory 701 is used to store executable program code, and the processor 702 is coupled to the memory 701.
[0065] Furthermore, embodiments of this application also provide a computer-readable storage medium, which may be disposed in the aforementioned electronic device, and may be the memory in the embodiment shown in FIG7 above.
[0066] The computer-readable storage medium stores a computer program that, when executed by a processor, implements the motor speed control method described in the foregoing embodiments. Furthermore, the computer-readable storage medium can also be a USB flash drive, a portable hard drive, a read-only memory (ROM), RAM, a magnetic disk, or an optical disk, or any other medium capable of storing program code.
[0067] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0068] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0069] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0070] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0071] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0072] In the above embodiments, the descriptions of each embodiment have different focuses. Parts not described in detail in a certain embodiment can be referred to in the relevant descriptions of other embodiments. The above is a description of the motor speed control method, apparatus, device, and storage medium provided in this application. For those skilled in the art, based on the ideas of the embodiments of this application, there will be changes in specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A motor speed control method, characterized in that, include: Obtain the current speed of the target motor and the preset desired speed; Calculate the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed; The corresponding control command is generated based on the target drive voltage value and transmitted to the corresponding motor drive module; wherein, the control command is used to instruct the motor drive module to output the corresponding drive voltage to the target motor in order to control the speed of the target motor.
2. The motor speed control method according to claim 1, characterized in that, Before obtaining the current speed of the target motor and the preset desired speed, the method further includes: Establish a corresponding mathematical model of the target motor based on its characteristic parameters; The desired speed is obtained by inputting the preset desired voltage value into the motor mathematical model.
3. The motor speed control method according to claim 1, characterized in that, Before obtaining the current speed of the target motor and the preset desired speed, the method further includes: The real-time speed of the target motor is collected multiple times within a preset time period based on the preset speed acquisition module. The current speed of the target motor is determined based on multiple real-time speeds.
4. The motor speed control method according to claim 1, characterized in that, The step of calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed includes: Obtain the first historical velocity difference corresponding to the first historical moment and the second historical velocity difference corresponding to the second historical moment; wherein, the first historical moment differs from the current moment by a unit of time, and the second historical moment differs from the first historical moment by the unit of time; The speed difference between the current speed and the desired speed, the first The incremental voltage value is obtained by performing proportional-integral-differential calculations on the historical speed difference and the second historical speed difference; The target drive voltage value of the target motor is obtained by summing the historical drive voltage value corresponding to the first historical moment and the incremental voltage value.
5. The motor speed control method according to claim 4, characterized in that, The step of performing proportional-integral-differential calculations on the speed difference between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference to obtain the incremental voltage value includes: The incremental voltage value is obtained by performing discrete proportional-integral-differential (PI-DI) calculations on the speed error between the current speed and the desired speed, the first historical speed difference, and the second historical speed difference. The formula for the discrete proportional-integral-differential is: Δu(k)=k p (e(k)-e(k-1))+k i e(k)+k d (e(k)-2e(k-1)+e(k-2)), where Δu(k) is the incremental voltage value, and k p k is the proportionality coefficient. i k is the coefficient of the integral term. d Here, e(k) is the differential coefficient, e(k) is the speed error, e(k-1) is the first historical speed difference, and e(k-2) is the second historical speed difference.
6. The motor speed control method according to any one of claims 1 to 5, characterized in that, Before calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed, the method further includes: The speed difference between the current speed and the desired speed is compared with a preset error allowable range; If the speed difference does not meet the allowable error range, then the target drive voltage value of the target motor is calculated based on the speed difference between the current speed and the desired speed.
7. The motor speed control method according to any one of claims 1 to 5, characterized in that, Before calculating the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed, the method further includes: Obtain the current output voltage value of the motor drive module; The matching relationship between the output voltage value and the current speed is determined based on a preset motor drive speed index table; wherein, the motor drive speed index table contains a mapping relationship between the drive voltage range and the motor speed range; If the output voltage value does not match the current speed, then the target drive voltage value of the target motor is calculated based on the speed difference between the current speed and the desired speed.
8. A motor speed control device, characterized in that, include: The acquisition module is used to acquire the current speed of the target motor and the preset desired speed; The error calculation module is used to calculate the target drive voltage value of the target motor based on the speed difference between the current speed and the desired speed; The instruction generation module is used to generate corresponding control instructions based on the target drive voltage value and transmit them to the corresponding motor drive module; wherein, the control instructions are used to instruct the motor drive module to output a corresponding drive voltage to the target motor in order to control the speed of the target motor.
9. An electronic device, characterized in that, Includes memory and processor, of which: The processor is used to execute computer programs stored in the memory; When the processor executes the computer program, it implements the steps in the motor speed control method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the motor speed control method according to any one of claims 1 to 7.